FFmpeg
Data Structures | Enumerations | Functions
vvc.c File Reference
#include "libavcodec/get_bits.h"
#include "libavcodec/put_bits.h"
#include "libavcodec/golomb.h"
#include "libavcodec/vvc.h"
#include "libavutil/avassert.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "avc.h"
#include "avio.h"
#include "avio_internal.h"
#include "nal.h"
#include "vvc.h"

Go to the source code of this file.

Data Structures

struct  VVCCNALUnitArray
 
struct  VVCPTLRecord
 
struct  VVCDecoderConfigurationRecord
 

Enumerations

enum  {
  OPI_INDEX, VPS_INDEX, SPS_INDEX, PPS_INDEX,
  SEI_PREFIX_INDEX, SEI_SUFFIX_INDEX, NB_ARRAYS
}
 

Functions

static void vvcc_update_ptl (VVCDecoderConfigurationRecord *vvcc, VVCPTLRecord *ptl)
 
static void vvcc_parse_ptl (GetBitContext *gb, VVCDecoderConfigurationRecord *vvcc, unsigned int profileTierPresentFlag, unsigned int max_sub_layers_minus1)
 
static int vvcc_parse_vps (GetBitContext *gb, VVCDecoderConfigurationRecord *vvcc)
 
static int vvcc_parse_sps (GetBitContext *gb, VVCDecoderConfigurationRecord *vvcc)
 
static int vvcc_parse_pps (GetBitContext *gb, VVCDecoderConfigurationRecord *vvcc)
 
static void nal_unit_parse_header (GetBitContext *gb, uint8_t *nal_type)
 
static int vvcc_array_add_nal_unit (uint8_t *nal_buf, uint32_t nal_size, uint8_t nal_type, int ps_array_completeness, VVCCNALUnitArray *array)
 
static int vvcc_add_nal_unit (uint8_t *nal_buf, uint32_t nal_size, int ps_array_completeness, VVCDecoderConfigurationRecord *vvcc, unsigned array_idx)
 
static void vvcc_init (VVCDecoderConfigurationRecord *vvcc)
 
static void vvcc_close (VVCDecoderConfigurationRecord *vvcc)
 
static int vvcc_write (AVIOContext *pb, VVCDecoderConfigurationRecord *vvcc)
 
int ff_vvc_annexb2mp4 (AVIOContext *pb, const uint8_t *buf_in, int size, int filter_ps, int *ps_count)
 Writes Annex B formatted H.266/VVC NAL units to the provided AVIOContext. More...
 
int ff_vvc_annexb2mp4_buf (const uint8_t *buf_in, uint8_t **buf_out, int *size, int filter_ps, int *ps_count)
 Writes Annex B formatted H.266/VVC NAL units to a data buffer. More...
 
int ff_isom_write_vvcc (AVIOContext *pb, const uint8_t *data, int size, int ps_array_completeness)
 Writes H.266/VVC extradata (parameter sets, declarative SEI NAL units) to the provided AVIOContext. More...
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
OPI_INDEX 
VPS_INDEX 
SPS_INDEX 
PPS_INDEX 
SEI_PREFIX_INDEX 
SEI_SUFFIX_INDEX 
NB_ARRAYS 

Definition at line 36 of file vvc.c.

Function Documentation

◆ vvcc_update_ptl()

static void vvcc_update_ptl ( VVCDecoderConfigurationRecord vvcc,
VVCPTLRecord ptl 
)
static

Definition at line 84 of file vvc.c.

Referenced by vvcc_parse_ptl().

◆ vvcc_parse_ptl()

static void vvcc_parse_ptl ( GetBitContext gb,
VVCDecoderConfigurationRecord vvcc,
unsigned int  profileTierPresentFlag,
unsigned int  max_sub_layers_minus1 
)
static

Definition at line 178 of file vvc.c.

Referenced by vvcc_parse_sps(), and vvcc_parse_vps().

◆ vvcc_parse_vps()

static int vvcc_parse_vps ( GetBitContext gb,
VVCDecoderConfigurationRecord vvcc 
)
static

Definition at line 229 of file vvc.c.

Referenced by vvcc_add_nal_unit().

◆ vvcc_parse_sps()

static int vvcc_parse_sps ( GetBitContext gb,
VVCDecoderConfigurationRecord vvcc 
)
static

Definition at line 329 of file vvc.c.

Referenced by vvcc_add_nal_unit().

◆ vvcc_parse_pps()

static int vvcc_parse_pps ( GetBitContext gb,
VVCDecoderConfigurationRecord vvcc 
)
static

Definition at line 419 of file vvc.c.

Referenced by vvcc_add_nal_unit().

◆ nal_unit_parse_header()

static void nal_unit_parse_header ( GetBitContext gb,
uint8_t *  nal_type 
)
static

Definition at line 428 of file vvc.c.

Referenced by vvcc_add_nal_unit().

◆ vvcc_array_add_nal_unit()

static int vvcc_array_add_nal_unit ( uint8_t *  nal_buf,
uint32_t  nal_size,
uint8_t  nal_type,
int  ps_array_completeness,
VVCCNALUnitArray array 
)
static

Definition at line 444 of file vvc.c.

Referenced by vvcc_add_nal_unit().

◆ vvcc_add_nal_unit()

static int vvcc_add_nal_unit ( uint8_t *  nal_buf,
uint32_t  nal_size,
int  ps_array_completeness,
VVCDecoderConfigurationRecord vvcc,
unsigned  array_idx 
)
static

Definition at line 495 of file vvc.c.

Referenced by ff_isom_write_vvcc().

◆ vvcc_init()

static void vvcc_init ( VVCDecoderConfigurationRecord vvcc)
static

Definition at line 548 of file vvc.c.

Referenced by ff_isom_write_vvcc().

◆ vvcc_close()

static void vvcc_close ( VVCDecoderConfigurationRecord vvcc)
static

Definition at line 556 of file vvc.c.

Referenced by ff_isom_write_vvcc().

◆ vvcc_write()

static int vvcc_write ( AVIOContext pb,
VVCDecoderConfigurationRecord vvcc 
)
static

Definition at line 569 of file vvc.c.

Referenced by ff_isom_write_vvcc().

◆ ff_vvc_annexb2mp4()

int ff_vvc_annexb2mp4 ( AVIOContext pb,
const uint8_t *  buf_in,
int  size,
int  filter_ps,
int *  ps_count 
)

Writes Annex B formatted H.266/VVC NAL units to the provided AVIOContext.

The NAL units are converted to an MP4-compatible format (start code prefixes are replaced by 4-byte size fields, as per ISO/IEC 14496-15).

If filter_ps is non-zero, any VVC parameter sets found in the input will be discarded, and *ps_count will be set to the number of discarded PS NAL units.

Parameters
pbaddress of the AVIOContext where the data shall be written
buf_inaddress of the buffer holding the input data
sizesize (in bytes) of the input buffer
filter_pswhether to write parameter set NAL units to the output (0) or to discard them (non-zero)
ps_countaddress of the variable where the number of discarded parameter set NAL units shall be written, may be NULL
Returns
the amount (in bytes) of data written in case of success, a negative value corresponding to an AVERROR code in case of failure

Definition at line 810 of file vvc.c.

Referenced by ff_mov_write_packet(), and ff_vvc_annexb2mp4_buf().

◆ ff_vvc_annexb2mp4_buf()

int ff_vvc_annexb2mp4_buf ( const uint8_t *  buf_in,
uint8_t **  buf_out,
int *  size,
int  filter_ps,
int *  ps_count 
)

Writes Annex B formatted H.266/VVC NAL units to a data buffer.

The NAL units are converted to an MP4-compatible format (start code prefixes are replaced by 4-byte size fields, as per ISO/IEC 14496-15).

If filter_ps is non-zero, any VVC parameter sets found in the input will be discarded, and *ps_count will be set to the number of discarded PS NAL units.

On success, *size holds the size (in bytes) of the output data buffer.

Parameters
buf_inaddress of the buffer holding the input data
sizeaddress of the variable holding the size (in bytes) of the input buffer (on input) and of the output buffer (on success)
buf_outon success, address of the variable holding the address of the output buffer
filter_pswhether to write parameter set NAL units to the output (0) or to discard them (non-zero)
ps_countaddress of the variable where the number of discarded parameter set NAL units shall be written, may be NULL
Returns
0 in case of success, a negative value corresponding to an AVERROR code in case of failure
Note
*buf_out will be treated as uninitialized on input and won't be freed.

Definition at line 858 of file vvc.c.

Referenced by ff_mov_write_packet().

◆ ff_isom_write_vvcc()

int ff_isom_write_vvcc ( AVIOContext pb,
const uint8_t *  data,
int  size,
int  ps_array_completeness 
)

Writes H.266/VVC extradata (parameter sets, declarative SEI NAL units) to the provided AVIOContext.

If the extradata is Annex B format, it gets converted to vvcC format before writing.

Parameters
pbaddress of the AVIOContext where the vvcC shall be written
dataaddress of the buffer holding the data needed to write the vvcC
sizesize (in bytes) of the data buffer
ps_array_completenesswhether all parameter sets are in the vvcC (1) or there may be additional parameter sets in the bitstream (0)
Returns
>=0 in case of success, a negative value corresponding to an AVERROR code in case of failure

Definition at line 879 of file vvc.c.

Referenced by mov_write_vvcc_tag().