FFmpeg
Macros | Functions | Variables
h2645_parse.c File Reference
#include <string.h>
#include "config.h"
#include "libavutil/intmath.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "bytestream.h"
#include "hevc.h"
#include "h264.h"
#include "h2645_parse.h"
#include "vvc.h"

Go to the source code of this file.

Macros

#define STARTCODE_TEST
 

Functions

int ff_h2645_extract_rbsp (const uint8_t *src, int length, H2645RBSP *rbsp, H2645NAL *nal, int small_padding)
 Extract the raw (unescaped) bitstream. More...
 
static const char * vvc_nal_unit_name (int nal_type)
 
static const char * hevc_nal_unit_name (int nal_type)
 
static const char * h264_nal_unit_name (int nal_type)
 
static int get_bit_length (H2645NAL *nal, int min_size, int skip_trailing_zeros)
 
static int vvc_parse_nal_header (H2645NAL *nal, void *logctx)
 
static int hevc_parse_nal_header (H2645NAL *nal, void *logctx)
 
static int h264_parse_nal_header (H2645NAL *nal, void *logctx)
 
static int find_next_start_code (const uint8_t *buf, const uint8_t *next_avc)
 
static void alloc_rbsp_buffer (H2645RBSP *rbsp, unsigned int size, int use_ref)
 
int ff_h2645_packet_split (H2645Packet *pkt, const uint8_t *buf, int length, void *logctx, int is_nalff, int nal_length_size, enum AVCodecID codec_id, int small_padding, int use_ref)
 Split an input packet into NAL units. More...
 
void ff_h2645_packet_uninit (H2645Packet *pkt)
 Free all the allocated memory in the packet. More...
 

Variables

static const char *const vvc_nal_type_name [32]
 
static const char *const hevc_nal_type_name [64]
 
static const char *const h264_nal_type_name [32]
 

Macro Definition Documentation

◆ STARTCODE_TEST

#define STARTCODE_TEST
Value:
if (i + 2 < length && src[i + 1] == 0 && \
(src[i + 2] == 3 || src[i + 2] == 1)) { \
if (src[i + 2] == 1) { \
/* startcode, so we must be past the end */ \
length = i; \
} \
break; \
}

Function Documentation

◆ ff_h2645_extract_rbsp()

int ff_h2645_extract_rbsp ( const uint8_t *  src,
int  length,
H2645RBSP rbsp,
H2645NAL nal,
int  small_padding 
)

Extract the raw (unescaped) bitstream.

Definition at line 35 of file h2645_parse.c.

Referenced by ff_h2645_packet_split(), generate_fake_vps(), and parse_nal_units().

◆ vvc_nal_unit_name()

static const char* vvc_nal_unit_name ( int  nal_type)
static

Definition at line 185 of file h2645_parse.c.

Referenced by vvc_parse_nal_header().

◆ hevc_nal_unit_name()

static const char* hevc_nal_unit_name ( int  nal_type)
static

Definition at line 258 of file h2645_parse.c.

Referenced by hevc_parse_nal_header().

◆ h264_nal_unit_name()

static const char* h264_nal_unit_name ( int  nal_type)
static

Definition at line 299 of file h2645_parse.c.

Referenced by h264_parse_nal_header().

◆ get_bit_length()

static int get_bit_length ( H2645NAL nal,
int  min_size,
int  skip_trailing_zeros 
)
static

Definition at line 305 of file h2645_parse.c.

Referenced by ff_h2645_packet_split().

◆ vvc_parse_nal_header()

static int vvc_parse_nal_header ( H2645NAL nal,
void *  logctx 
)
static
Returns
AVERROR_INVALIDDATA if the packet is not a valid NAL unit, 0 otherwise

Definition at line 339 of file h2645_parse.c.

Referenced by ff_h2645_packet_split().

◆ hevc_parse_nal_header()

static int hevc_parse_nal_header ( H2645NAL nal,
void *  logctx 
)
static

Definition at line 364 of file h2645_parse.c.

Referenced by ff_h2645_packet_split().

◆ h264_parse_nal_header()

static int h264_parse_nal_header ( H2645NAL nal,
void *  logctx 
)
static

Definition at line 385 of file h2645_parse.c.

Referenced by ff_h2645_packet_split().

◆ find_next_start_code()

static int find_next_start_code ( const uint8_t *  buf,
const uint8_t *  next_avc 
)
static

Definition at line 402 of file h2645_parse.c.

Referenced by ff_h2645_packet_split().

◆ alloc_rbsp_buffer()

static void alloc_rbsp_buffer ( H2645RBSP rbsp,
unsigned int  size,
int  use_ref 
)
static

Definition at line 417 of file h2645_parse.c.

Referenced by ff_h2645_packet_split().

◆ ff_h2645_packet_split()

int ff_h2645_packet_split ( H2645Packet pkt,
const uint8_t *  buf,
int  length,
void *  logctx,
int  is_nalff,
int  nal_length_size,
enum AVCodecID  codec_id,
int  small_padding,
int  use_ref 
)

Split an input packet into NAL units.

If data == raw_data holds true for a NAL unit of the returned pkt, then said NAL unit does not contain any emulation_prevention_three_byte and the data is contained in the input buffer pointed to by buf. Otherwise, the unescaped data is part of the rbsp_buffer described by the packet's H2645RBSP.

If the packet's rbsp_buffer_ref is not NULL, the underlying AVBuffer must own rbsp_buffer. If not and rbsp_buffer is not NULL, use_ref must be 0. If use_ref is set, rbsp_buffer will be reference-counted and owned by the underlying AVBuffer of rbsp_buffer_ref.

Definition at line 464 of file h2645_parse.c.

Referenced by cbs_h2645_split_fragment(), decode_extradata_ps(), decode_nal_units(), extract_extradata_h2645(), hevc_decode_nal_units(), and parse_nal_units().

◆ ff_h2645_packet_uninit()

void ff_h2645_packet_uninit ( H2645Packet pkt)

Variable Documentation

◆ vvc_nal_type_name

const char* const vvc_nal_type_name[32]
static

Definition at line 150 of file h2645_parse.c.

Referenced by vvc_nal_unit_name().

◆ hevc_nal_type_name

const char* const hevc_nal_type_name[64]
static

Definition at line 191 of file h2645_parse.c.

Referenced by hevc_nal_unit_name().

◆ h264_nal_type_name

const char* const h264_nal_type_name[32]
static

Definition at line 264 of file h2645_parse.c.

Referenced by h264_nal_unit_name().

i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418