FFmpeg
Data Structures | Macros | Functions | Variables
vvc_parser.c File Reference
#include "cbs.h"
#include "cbs_h266.h"
#include "parser.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 More...
 
#define IS_IDR(nut)   (nut == VVC_IDR_W_RADL || nut == VVC_IDR_N_LP)
 
#define IS_H266_SLICE(nut)   (nut <= VVC_RASL_NUT || (nut >= VVC_IDR_W_RADL && nut <= VVC_GDR_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. More...
 
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. More...
 
static int combine_au (AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **buf, int *buf_size)
 Combine PU to AU. More...
 
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 AVCodecParser ff_vvc_parser
 

Macro Definition Documentation

◆ START_CODE

#define START_CODE   0x000001

start_code_prefix_one_3bytes

Definition at line 27 of file vvc_parser.c.

◆ IS_IDR

#define IS_IDR (   nut)    (nut == VVC_IDR_W_RADL || nut == VVC_IDR_N_LP)

Definition at line 28 of file vvc_parser.c.

◆ IS_H266_SLICE

#define IS_H266_SLICE (   nut)    (nut <= VVC_RASL_NUT || (nut >= VVC_IDR_W_RADL && nut <= VVC_GDR_NUT))

Definition at line 29 of file vvc_parser.c.

Function Documentation

◆ get_format()

static int get_format ( const H266RawSPS sps)
static

Definition at line 69 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 84 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 128 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 147 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 205 of file vvc_parser.c.

Referenced by is_au_start().

◆ au_detector_init()

static void au_detector_init ( AuDetector d)
static

Definition at line 240 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 247 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 272 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 325 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 345 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 393 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 415 of file vvc_parser.c.

◆ vvc_parser_init()

static av_cold int vvc_parser_init ( AVCodecParserContext s)
static

Definition at line 483 of file vvc_parser.c.

◆ vvc_parser_close()

static av_cold void vvc_parser_close ( AVCodecParserContext s)
static

Definition at line 499 of file vvc_parser.c.

Variable Documentation

◆ pix_fmts_8bit

enum AVPixelFormat pix_fmts_8bit[]
static
Initial value:

Definition at line 59 of file vvc_parser.c.

Referenced by get_format().

◆ pix_fmts_10bit

enum AVPixelFormat pix_fmts_10bit[]
static
Initial value:

Definition at line 64 of file vvc_parser.c.

Referenced by get_format().

◆ decompose_unit_types

const CodedBitstreamUnitType decompose_unit_types[]
static

◆ ff_vvc_parser

const AVCodecParser ff_vvc_parser
Initial value:
= {
.codec_ids = { AV_CODEC_ID_VVC },
.priv_data_size = sizeof(VVCParserContext),
.parser_init = vvc_parser_init,
.parser_close = vvc_parser_close,
.parser_parse = vvc_parser_parse,
}

Definition at line 511 of file vvc_parser.c.

VVC_RADL_NUT
@ VVC_RADL_NUT
Definition: vvc.h:31
VVC_RASL_NUT
@ VVC_RASL_NUT
Definition: vvc.h:32
VVC_GDR_NUT
@ VVC_GDR_NUT
Definition: vvc.h:39
VVC_STSA_NUT
@ VVC_STSA_NUT
Definition: vvc.h:30
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:478
VVC_AUD_NUT
@ VVC_AUD_NUT
Definition: vvc.h:49
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)
Definition: vvc_parser.c:415
VVC_IDR_W_RADL
@ VVC_IDR_W_RADL
Definition: vvc.h:36
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:481
AV_PIX_FMT_YUV420P
@ 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_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:459
VVCParserContext
Definition: vvc_parser.c:45
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:479
VVC_PH_NUT
@ VVC_PH_NUT
Definition: vvc.h:48
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
VVC_VPS_NUT
@ VVC_VPS_NUT
Definition: vvc.h:43
AV_CODEC_ID_VVC
@ AV_CODEC_ID_VVC
Definition: codec_id.h:250
VVC_TRAIL_NUT
@ VVC_TRAIL_NUT
Definition: vvc.h:29
VVC_SPS_NUT
@ VVC_SPS_NUT
Definition: vvc.h:44
VVC_IDR_N_LP
@ VVC_IDR_N_LP
Definition: vvc.h:37
vvc_parser_init
static av_cold int vvc_parser_init(AVCodecParserContext *s)
Definition: vvc_parser.c:483
VVC_PPS_NUT
@ VVC_PPS_NUT
Definition: vvc.h:45
vvc_parser_close
static av_cold void vvc_parser_close(AVCodecParserContext *s)
Definition: vvc_parser.c:499
VVC_CRA_NUT
@ VVC_CRA_NUT
Definition: vvc.h:38
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77