FFmpeg
Loading...
Searching...
No Matches
vvc_parser.c File Reference
#include "libavutil/mem.h"
#include "cbs.h"
#include "cbs_h266.h"
#include "parser.h"
#include "parser_internal.h"

Go to the source code of this file.

Data Structures

struct  PuInfo
 
struct  AuDetector
 
struct  VVCParserContext
 

Macros

#define START_CODE   0x000001
 start_code_prefix_one_3bytes
 
#define IS_IDR(nut)
 
#define IS_H266_SLICE(nut)
 

Functions

static int get_format (const H266RawSPS *sps)
 
static int find_frame_end (AVCodecParserContext *s, const uint8_t *buf, int buf_size)
 Find the end of the current frame in the bitstream.
 
static int get_pict_type (const CodedBitstreamFragment *pu)
 
static void set_parser_ctx (AVCodecParserContext *s, AVCodecContext *avctx, const PuInfo *pu)
 
static void get_slice_poc (VVCParserContext *s, int *poc, const H266RawSPS *sps, const H266RawPictureHeader *ph, const H266RawSliceHeader *slice, void *log_ctx)
 
static void au_detector_init (AuDetector *d)
 
static int is_au_start (VVCParserContext *s, const PuInfo *pu, void *log_ctx)
 
static int get_pu_info (PuInfo *info, const CodedBitstreamH266Context *h266, const CodedBitstreamFragment *pu, void *logctx)
 
static int append_au (AVPacket *pkt, const uint8_t *buf, int buf_size)
 
static int parse_nal_units (AVCodecParserContext *s, const uint8_t *buf, int buf_size, AVCodecContext *avctx)
 Parse NAL units of found picture and decode some basic information.
 
static int combine_au (AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **buf, int *buf_size)
 Combine PU to AU.
 
static int vvc_parser_parse (AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
 
static av_cold int vvc_parser_init (AVCodecParserContext *s)
 
static av_cold void vvc_parser_close (AVCodecParserContext *s)
 

Variables

static enum AVPixelFormat pix_fmts_8bit []
 
static enum AVPixelFormat pix_fmts_10bit []
 
static const CodedBitstreamUnitType decompose_unit_types []
 
const FFCodecParser ff_vvc_parser
 

Macro Definition Documentation

◆ START_CODE

#define START_CODE   0x000001

start_code_prefix_one_3bytes

Definition at line 29 of file vvc_parser.c.

◆ IS_IDR

#define IS_IDR ( nut)
Value:
(nut == VVC_IDR_W_RADL || nut == VVC_IDR_N_LP)
@ VVC_IDR_N_LP
Definition vvc.h:37
@ VVC_IDR_W_RADL
Definition vvc.h:36

Definition at line 30 of file vvc_parser.c.

Referenced by get_slice_poc().

◆ IS_H266_SLICE

#define IS_H266_SLICE ( nut)
Value:
(nut <= VVC_RASL_NUT || (nut >= VVC_IDR_W_RADL && nut <= VVC_GDR_NUT))
@ VVC_RASL_NUT
Definition vvc.h:32
@ VVC_GDR_NUT
Definition vvc.h:39

Definition at line 31 of file vvc_parser.c.

Referenced by find_frame_end(), get_pict_type(), and get_pu_info().

Function Documentation

◆ get_format()

static int get_format ( const H266RawSPS * sps)
static

Definition at line 71 of file vvc_parser.c.

Referenced by set_parser_ctx().

◆ find_frame_end()

static int find_frame_end ( AVCodecParserContext * s,
const uint8_t * buf,
int buf_size )
static

Find the end of the current frame in the bitstream.

Returns
the position of the first byte of the next frame, or END_NOT_FOUND

Definition at line 86 of file vvc_parser.c.

Referenced by vvc_parser_parse().

◆ get_pict_type()

static int get_pict_type ( const CodedBitstreamFragment * pu)
static

Definition at line 130 of file vvc_parser.c.

Referenced by get_pu_info().

◆ set_parser_ctx()

static void set_parser_ctx ( AVCodecParserContext * s,
AVCodecContext * avctx,
const PuInfo * pu )
static

Definition at line 149 of file vvc_parser.c.

Referenced by parse_nal_units().

◆ get_slice_poc()

static void get_slice_poc ( VVCParserContext * s,
int * poc,
const H266RawSPS * sps,
const H266RawPictureHeader * ph,
const H266RawSliceHeader * slice,
void * log_ctx )
static

Definition at line 203 of file vvc_parser.c.

Referenced by is_au_start().

◆ au_detector_init()

static void au_detector_init ( AuDetector * d)
static

Definition at line 238 of file vvc_parser.c.

Referenced by vvc_parser_init().

◆ is_au_start()

static int is_au_start ( VVCParserContext * s,
const PuInfo * pu,
void * log_ctx )
static

Definition at line 245 of file vvc_parser.c.

Referenced by parse_nal_units().

◆ get_pu_info()

static int get_pu_info ( PuInfo * info,
const CodedBitstreamH266Context * h266,
const CodedBitstreamFragment * pu,
void * logctx )
static

Definition at line 270 of file vvc_parser.c.

Referenced by parse_nal_units().

◆ append_au()

static int append_au ( AVPacket * pkt,
const uint8_t * buf,
int buf_size )
static

Definition at line 323 of file vvc_parser.c.

Referenced by parse_nal_units().

◆ parse_nal_units()

static int parse_nal_units ( AVCodecParserContext * s,
const uint8_t * buf,
int buf_size,
AVCodecContext * avctx )
static

Parse NAL units of found picture and decode some basic information.

Parameters
sparser context.
avctxcodec context.
bufbuffer with field/frame data.
buf_sizesize of the buffer.
Returns
< 0 for error, == 0 for a complete au, > 0 is not a completed au.

Definition at line 343 of file vvc_parser.c.

Referenced by combine_au().

◆ combine_au()

static int combine_au ( AVCodecParserContext * s,
AVCodecContext * avctx,
const uint8_t ** buf,
int * buf_size )
static

Combine PU to AU.

Parameters
sparser context.
avctxcodec context.
bufbuffer to a PU.
buf_sizesize of the buffer.
Returns
< 0 for error, == 0 a complete au, > 0 not a completed au.

Definition at line 391 of file vvc_parser.c.

Referenced by vvc_parser_parse().

◆ vvc_parser_parse()

static int vvc_parser_parse ( AVCodecParserContext * s,
AVCodecContext * avctx,
const uint8_t ** poutbuf,
int * poutbuf_size,
const uint8_t * buf,
int buf_size )
static

Definition at line 413 of file vvc_parser.c.

◆ vvc_parser_init()

static av_cold int vvc_parser_init ( AVCodecParserContext * s)
static

Definition at line 481 of file vvc_parser.c.

◆ vvc_parser_close()

static av_cold void vvc_parser_close ( AVCodecParserContext * s)
static

Definition at line 497 of file vvc_parser.c.

Variable Documentation

◆ pix_fmts_8bit

enum AVPixelFormat pix_fmts_8bit[]
static
Initial value:
= {
}
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition pixfmt.h:77
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition pixfmt.h:81
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition pixfmt.h:78

Definition at line 61 of file vvc_parser.c.

◆ pix_fmts_10bit

enum AVPixelFormat pix_fmts_10bit[]
static
Initial value:
= {
}
#define AV_PIX_FMT_YUV420P10
Definition pixfmt.h:545
#define AV_PIX_FMT_YUV422P10
Definition pixfmt.h:546
#define AV_PIX_FMT_GRAY10
Definition pixfmt.h:525
#define AV_PIX_FMT_YUV444P10
Definition pixfmt.h:548

Definition at line 66 of file vvc_parser.c.

◆ decompose_unit_types

const CodedBitstreamUnitType decompose_unit_types[]
static
Initial value:
= {
}
@ VVC_SPS_NUT
Definition vvc.h:44
@ VVC_CRA_NUT
Definition vvc.h:38
@ VVC_TRAIL_NUT
Definition vvc.h:29
@ VVC_RADL_NUT
Definition vvc.h:31
@ VVC_PH_NUT
Definition vvc.h:48
@ VVC_VPS_NUT
Definition vvc.h:43
@ VVC_STSA_NUT
Definition vvc.h:30
@ VVC_AUD_NUT
Definition vvc.h:49
@ VVC_PPS_NUT
Definition vvc.h:45

Definition at line 465 of file vvc_parser.c.

◆ ff_vvc_parser

const FFCodecParser ff_vvc_parser
Initial value:
= {
.priv_data_size = sizeof(VVCParserContext),
}
static int parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
Definition apv_parser.c:92
static av_cold void close(AVCodecParserContext *s)
Definition apv_parser.c:197
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
@ AV_CODEC_ID_VVC
Definition codec_id.h:247
#define PARSER_CODEC_LIST(...)
static av_cold void vvc_parser_close(AVCodecParserContext *s)
Definition vvc_parser.c:497
static av_cold int vvc_parser_init(AVCodecParserContext *s)
Definition vvc_parser.c:481
static int vvc_parser_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
Definition vvc_parser.c:413

Definition at line 509 of file vvc_parser.c.