FFmpeg
Loading...
Searching...
No Matches
cbs_internal.h File Reference
#include <stddef.h>
#include <stdint.h>
#include "config.h"
#include "libavutil/log.h"
#include "cbs.h"
#include "codec_id.h"
#include "get_bits.h"
#include "put_bits.h"
#include "libavutil/refstruct.h"

Go to the source code of this file.

Data Structures

struct  CodedBitstreamUnitTypeDescriptor
 
struct  CodedBitstreamType
 

Macros

#define CBS_READ   1
 
#define CBS_WRITE   1
 
#define CBS_TRACE   1
 
#define CBS_APV   CONFIG_CBS_APV
 
#define CBS_AV1   CONFIG_CBS_AV1
 
#define CBS_H264   CONFIG_CBS_H264
 
#define CBS_H265   CONFIG_CBS_H265
 
#define CBS_H266   CONFIG_CBS_H266
 
#define CBS_LCEVC   CONFIG_CBS_LCEVC
 
#define CBS_JPEG   CONFIG_CBS_JPEG
 
#define CBS_MPEG2   CONFIG_CBS_MPEG2
 
#define CBS_VP8   CONFIG_CBS_VP8
 
#define CBS_VP9   CONFIG_CBS_VP9
 
#define MAX_UINT_BITS(length)
 
#define MAX_INT_BITS(length)
 
#define MIN_INT_BITS(length)
 
#define CBS_TRACE_READ_START()
 
#define CBS_TRACE_READ_END()
 
#define CBS_TRACE_READ_END_NO_SUBSCRIPTS()
 
#define CBS_TRACE_READ_END_VALUE_ONLY()
 
#define CBS_TRACE_WRITE_START()
 
#define CBS_TRACE_WRITE_END()
 
#define CBS_TRACE_WRITE_END_NO_SUBSCRIPTS()
 
#define CBS_TRACE_WRITE_END_VALUE_ONLY()
 
#define TYPE_LIST(...)
 
#define CBS_UNIT_TYPE_POD(type_, structure)
 
#define CBS_UNIT_RANGE_POD(range_start, range_end, structure)
 
#define CBS_UNIT_TYPES_INTERNAL_REF(types, structure, ref_field)
 
#define CBS_UNIT_TYPE_INTERNAL_REF(type, structure, ref_field)
 
#define CBS_UNIT_RANGE_INTERNAL_REF(range_start, range_end, structure, ref_field)
 
#define CBS_UNIT_TYPES_COMPLEX(types, structure, free_func)
 
#define CBS_UNIT_TYPE_COMPLEX(type, structure, free_func)
 
#define CBS_UNIT_TYPE_END_OF_LIST   { .nb_unit_types = 0 }
 

Enumerations

enum  CBSContentType { CBS_CONTENT_TYPE_INTERNAL_REFS , CBS_CONTENT_TYPE_COMPLEX }
 
enum  { CBS_MAX_LIST_UNIT_TYPES = 3 , CBS_MAX_REF_OFFSETS = 2 , CBS_UNIT_TYPE_RANGE = -1 }
 

Functions

void CBS_FUNC trace_header (CodedBitstreamContext *ctx, const char *name)
 
int CBS_FUNC read_unsigned (CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, uint32_t *write_to, uint32_t range_min, uint32_t range_max)
 
int CBS_FUNC read_simple_unsigned (CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, uint32_t *write_to)
 
int CBS_FUNC write_unsigned (CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, uint32_t value, uint32_t range_min, uint32_t range_max)
 
int CBS_FUNC write_simple_unsigned (CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, uint32_t value)
 
int CBS_FUNC read_signed (CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, int32_t *write_to, int32_t range_min, int32_t range_max)
 
int CBS_FUNC write_signed (CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, int32_t value, int32_t range_min, int32_t range_max)
 
const CodedBitstreamType CBS_FUNC (type_apv)
 
const CodedBitstreamType CBS_FUNC (type_av1)
 
const CodedBitstreamType CBS_FUNC (type_h264)
 
const CodedBitstreamType CBS_FUNC (type_h265)
 
const CodedBitstreamType CBS_FUNC (type_h266)
 
const CodedBitstreamType CBS_FUNC (type_lcevc)
 
const CodedBitstreamType CBS_FUNC (type_jpeg)
 
const CodedBitstreamType CBS_FUNC (type_mpeg2)
 
const CodedBitstreamType CBS_FUNC (type_vp8)
 
const CodedBitstreamType CBS_FUNC (type_vp9)
 

Macro Definition Documentation

◆ CBS_READ

#define CBS_READ   1

Definition at line 36 of file cbs_internal.h.

◆ CBS_WRITE

#define CBS_WRITE   1

Definition at line 39 of file cbs_internal.h.

◆ CBS_TRACE

#define CBS_TRACE   1

Definition at line 42 of file cbs_internal.h.

◆ CBS_APV

#define CBS_APV   CONFIG_CBS_APV

Definition at line 46 of file cbs_internal.h.

◆ CBS_AV1

#define CBS_AV1   CONFIG_CBS_AV1

Definition at line 49 of file cbs_internal.h.

◆ CBS_H264

#define CBS_H264   CONFIG_CBS_H264

Definition at line 52 of file cbs_internal.h.

◆ CBS_H265

#define CBS_H265   CONFIG_CBS_H265

Definition at line 55 of file cbs_internal.h.

◆ CBS_H266

#define CBS_H266   CONFIG_CBS_H266

Definition at line 58 of file cbs_internal.h.

◆ CBS_LCEVC

#define CBS_LCEVC   CONFIG_CBS_LCEVC

Definition at line 61 of file cbs_internal.h.

◆ CBS_JPEG

#define CBS_JPEG   CONFIG_CBS_JPEG

Definition at line 64 of file cbs_internal.h.

◆ CBS_MPEG2

#define CBS_MPEG2   CONFIG_CBS_MPEG2

Definition at line 67 of file cbs_internal.h.

◆ CBS_VP8

#define CBS_VP8   CONFIG_CBS_VP8

Definition at line 70 of file cbs_internal.h.

◆ CBS_VP9

#define CBS_VP9   CONFIG_CBS_VP9

Definition at line 73 of file cbs_internal.h.

◆ MAX_UINT_BITS

◆ MAX_INT_BITS

#define MAX_INT_BITS ( length)
Value:
((INT64_C(1) << ((length) - 1)) - 1)

Definition at line 242 of file cbs_internal.h.

Referenced by frame().

◆ MIN_INT_BITS

#define MIN_INT_BITS ( length)
Value:
(-(INT64_C(1) << ((length) - 1)))

Definition at line 246 of file cbs_internal.h.

◆ CBS_TRACE_READ_START

◆ CBS_TRACE_READ_END

◆ CBS_TRACE_READ_END_NO_SUBSCRIPTS

#define CBS_TRACE_READ_END_NO_SUBSCRIPTS ( )
Value:
do { } while (0)

Definition at line 333 of file cbs_internal.h.

Referenced by cbs_read_multi_byte(), and cbs_vp9_read_increment().

◆ CBS_TRACE_READ_END_VALUE_ONLY

#define CBS_TRACE_READ_END_VALUE_ONLY ( )
Value:
do { } while (0)

Definition at line 334 of file cbs_internal.h.

◆ CBS_TRACE_WRITE_START

#define CBS_TRACE_WRITE_START ( )

◆ CBS_TRACE_WRITE_END

#define CBS_TRACE_WRITE_END ( )
Value:
do { } while (0)

Definition at line 336 of file cbs_internal.h.

Referenced by cbs_vp9_write_le(), cbs_vp9_write_s(), ff_cbs_write_se_golomb(), and ff_cbs_write_ue_golomb().

◆ CBS_TRACE_WRITE_END_NO_SUBSCRIPTS

#define CBS_TRACE_WRITE_END_NO_SUBSCRIPTS ( )
Value:
do { } while (0)

Definition at line 337 of file cbs_internal.h.

Referenced by cbs_vp9_write_increment(), and cbs_write_multi_byte().

◆ CBS_TRACE_WRITE_END_VALUE_ONLY

#define CBS_TRACE_WRITE_END_VALUE_ONLY ( )
Value:
do { } while (0)

Definition at line 338 of file cbs_internal.h.

◆ TYPE_LIST

#define TYPE_LIST ( ...)
Value:
{ __VA_ARGS__ }

Definition at line 341 of file cbs_internal.h.

◆ CBS_UNIT_TYPE_POD

#define CBS_UNIT_TYPE_POD ( type_,
structure )
Value:
{ \
.nb_unit_types = 1, \
.unit_type.list = { type_ }, \
.content_type = CBS_CONTENT_TYPE_INTERNAL_REFS, \
.content_size = sizeof(structure), \
.type.ref = { .nb_offsets = 0 }, \
}
@ CBS_CONTENT_TYPE_INTERNAL_REFS
cl_device_type type

Definition at line 342 of file cbs_internal.h.

◆ CBS_UNIT_RANGE_POD

#define CBS_UNIT_RANGE_POD ( range_start,
range_end,
structure )
Value:
{ \
.nb_unit_types = CBS_UNIT_TYPE_RANGE, \
.unit_type.range.start = range_start, \
.unit_type.range.end = range_end, \
.content_type = CBS_CONTENT_TYPE_INTERNAL_REFS, \
.content_size = sizeof(structure), \
.type.ref = { .nb_offsets = 0 }, \
}
@ CBS_UNIT_TYPE_RANGE

Definition at line 349 of file cbs_internal.h.

◆ CBS_UNIT_TYPES_INTERNAL_REF

#define CBS_UNIT_TYPES_INTERNAL_REF ( types,
structure,
ref_field )
Value:
{ \
.nb_unit_types = FF_ARRAY_ELEMS((CodedBitstreamUnitType[])TYPE_LIST types), \
.unit_type.list = TYPE_LIST types, \
.content_type = CBS_CONTENT_TYPE_INTERNAL_REFS, \
.content_size = sizeof(structure), \
.type.ref = { .nb_offsets = 1, \
.offsets = { offsetof(structure, ref_field) } }, \
}
#define TYPE_LIST(...)
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
Definition cbs.h:66
#define FF_ARRAY_ELEMS(a)

Definition at line 358 of file cbs_internal.h.

◆ CBS_UNIT_TYPE_INTERNAL_REF

#define CBS_UNIT_TYPE_INTERNAL_REF ( type,
structure,
ref_field )
Value:
CBS_UNIT_TYPES_INTERNAL_REF((type), structure, ref_field)
#define CBS_UNIT_TYPES_INTERNAL_REF(types, structure, ref_field)

Definition at line 366 of file cbs_internal.h.

◆ CBS_UNIT_RANGE_INTERNAL_REF

#define CBS_UNIT_RANGE_INTERNAL_REF ( range_start,
range_end,
structure,
ref_field )
Value:
{ \
.nb_unit_types = CBS_UNIT_TYPE_RANGE, \
.unit_type.range.start = range_start, \
.unit_type.range.end = range_end, \
.content_type = CBS_CONTENT_TYPE_INTERNAL_REFS, \
.content_size = sizeof(structure), \
.type.ref = { .nb_offsets = 1, \
.offsets = { offsetof(structure, ref_field) } }, \
}

Definition at line 369 of file cbs_internal.h.

◆ CBS_UNIT_TYPES_COMPLEX

#define CBS_UNIT_TYPES_COMPLEX ( types,
structure,
free_func )
Value:
{ \
.nb_unit_types = FF_ARRAY_ELEMS((CodedBitstreamUnitType[])TYPE_LIST types), \
.unit_type.list = TYPE_LIST types, \
.content_type = CBS_CONTENT_TYPE_COMPLEX, \
.content_size = sizeof(structure), \
.type.complex = { .content_free = free_func }, \
}
@ CBS_CONTENT_TYPE_COMPLEX

Definition at line 379 of file cbs_internal.h.

◆ CBS_UNIT_TYPE_COMPLEX

#define CBS_UNIT_TYPE_COMPLEX ( type,
structure,
free_func )
Value:
CBS_UNIT_TYPES_COMPLEX((type), structure, free_func)
#define CBS_UNIT_TYPES_COMPLEX(types, structure, free_func)

Definition at line 386 of file cbs_internal.h.

◆ CBS_UNIT_TYPE_END_OF_LIST

#define CBS_UNIT_TYPE_END_OF_LIST   { .nb_unit_types = 0 }

Definition at line 389 of file cbs_internal.h.

Enumeration Type Documentation

◆ CBSContentType

Enumerator
CBS_CONTENT_TYPE_INTERNAL_REFS 
CBS_CONTENT_TYPE_COMPLEX 

Definition at line 76 of file cbs_internal.h.

◆ anonymous enum

anonymous enum
Enumerator
CBS_MAX_LIST_UNIT_TYPES 
CBS_MAX_REF_OFFSETS 
CBS_UNIT_TYPE_RANGE 

Definition at line 86 of file cbs_internal.h.

Function Documentation

◆ trace_header()

void CBS_FUNC trace_header ( CodedBitstreamContext * ctx,
const char * name )

Definition at line 481 of file cbs.c.

Referenced by trace_header().

◆ read_unsigned()

int CBS_FUNC read_unsigned ( CodedBitstreamContext * ctx,
GetBitContext * gbc,
int width,
const char * name,
const int * subscripts,
uint32_t * write_to,
uint32_t range_min,
uint32_t range_max )

Referenced by read_unsigned().

◆ read_simple_unsigned()

int CBS_FUNC read_simple_unsigned ( CodedBitstreamContext * ctx,
GetBitContext * gbc,
int width,
const char * name,
uint32_t * write_to )

Referenced by read_simple_unsigned().

◆ write_unsigned()

int CBS_FUNC write_unsigned ( CodedBitstreamContext * ctx,
PutBitContext * pbc,
int width,
const char * name,
const int * subscripts,
uint32_t value,
uint32_t range_min,
uint32_t range_max )

Referenced by write_unsigned().

◆ write_simple_unsigned()

int CBS_FUNC write_simple_unsigned ( CodedBitstreamContext * ctx,
PutBitContext * pbc,
int width,
const char * name,
uint32_t value )

Referenced by write_simple_unsigned().

◆ read_signed()

int CBS_FUNC read_signed ( CodedBitstreamContext * ctx,
GetBitContext * gbc,
int width,
const char * name,
const int * subscripts,
int32_t * write_to,
int32_t range_min,
int32_t range_max )

◆ write_signed()

int CBS_FUNC write_signed ( CodedBitstreamContext * ctx,
PutBitContext * pbc,
int width,
const char * name,
const int * subscripts,
int32_t value,
int32_t range_min,
int32_t range_max )

Referenced by write_signed().

◆ CBS_FUNC() [1/10]

const CodedBitstreamType CBS_FUNC ( type_apv )
extern

◆ CBS_FUNC() [2/10]

const CodedBitstreamType CBS_FUNC ( type_av1 )
extern

◆ CBS_FUNC() [3/10]

const CodedBitstreamType CBS_FUNC ( type_h264 )
extern

◆ CBS_FUNC() [4/10]

const CodedBitstreamType CBS_FUNC ( type_h265 )
extern

◆ CBS_FUNC() [5/10]

const CodedBitstreamType CBS_FUNC ( type_h266 )
extern

◆ CBS_FUNC() [6/10]

const CodedBitstreamType CBS_FUNC ( type_lcevc )
extern

◆ CBS_FUNC() [7/10]

const CodedBitstreamType CBS_FUNC ( type_jpeg )
extern

◆ CBS_FUNC() [8/10]

const CodedBitstreamType CBS_FUNC ( type_mpeg2 )
extern

◆ CBS_FUNC() [9/10]

const CodedBitstreamType CBS_FUNC ( type_vp8 )
extern

◆ CBS_FUNC() [10/10]

const CodedBitstreamType CBS_FUNC ( type_vp9 )
extern