FFmpeg
Macros | Functions | Variables
cbs_apv.c File Reference
#include "libavutil/mem.h"
#include "cbs.h"
#include "cbs_internal.h"
#include "cbs_apv.h"
#include "cbs_apv_syntax_template.c"

Go to the source code of this file.

Macros

#define HEADER(name)
 
#define CHECK(call)
 
#define SUBSCRIPTS(subs, ...)   (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)
 
#define u(width, name, range_min, range_max)   xu(width, name, current->name, range_min, range_max, 0, )
 
#define ub(width, name)   xu(width, name, current->name, 0, MAX_UINT_BITS(width), 0, )
 
#define us(width, name, range_min, range_max, subs, ...)   xu(width, name, current->name, range_min, range_max, subs, __VA_ARGS__)
 
#define ubs(width, name, subs, ...)   xu(width, name, current->name, 0, MAX_UINT_BITS(width), subs, __VA_ARGS__)
 
#define fixed(width, name, value)
 
#define READ
 
#define READWRITE   read
 
#define RWContext   GetBitContext
 
#define FUNC(name)   cbs_apv_read_ ## name
 
#define xu(width, name, var, range_min, range_max, subs, ...)
 
#define infer(name, value)
 
#define byte_alignment(rw)   (get_bits_count(rw) % 8)
 
#define WRITE
 
#define READWRITE   write
 
#define RWContext   PutBitContext
 
#define FUNC(name)   cbs_apv_write_ ## name
 
#define xu(width, name, var, range_min, range_max, subs, ...)
 
#define infer(name, value)
 
#define byte_alignment(rw)   (put_bits_count(rw) % 8)
 

Functions

static int cbs_apv_get_num_comp (const APVRawFrameHeader *fh)
 
static void cbs_apv_derive_tile_info (APVDerivedTileInfo *ti, const APVRawFrameHeader *fh)
 
static int cbs_apv_split_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
 
static int cbs_apv_read_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
 
static int cbs_apv_write_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_apv_assemble_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
 
static void cbs_apv_free_metadata (AVRefStructOpaque unused, void *content)
 

Variables

static const CodedBitstreamUnitTypeDescriptor cbs_apv_unit_types []
 
const CodedBitstreamType ff_cbs_type_apv
 

Macro Definition Documentation

◆ HEADER

#define HEADER (   name)
Value:
do { \
ff_cbs_trace_header(ctx, name); \
} while (0)

Definition at line 70 of file cbs_apv.c.

◆ CHECK

#define CHECK (   call)
Value:
do { \
err = (call); \
if (err < 0) \
return err; \
} while (0)

Definition at line 74 of file cbs_apv.c.

◆ SUBSCRIPTS

#define SUBSCRIPTS (   subs,
  ... 
)    (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)

Definition at line 80 of file cbs_apv.c.

◆ u

#define u (   width,
  name,
  range_min,
  range_max 
)    xu(width, name, current->name, range_min, range_max, 0, )

Definition at line 83 of file cbs_apv.c.

◆ ub

#define ub (   width,
  name 
)    xu(width, name, current->name, 0, MAX_UINT_BITS(width), 0, )

Definition at line 85 of file cbs_apv.c.

◆ us

#define us (   width,
  name,
  range_min,
  range_max,
  subs,
  ... 
)    xu(width, name, current->name, range_min, range_max, subs, __VA_ARGS__)

Definition at line 87 of file cbs_apv.c.

◆ ubs

#define ubs (   width,
  name,
  subs,
  ... 
)    xu(width, name, current->name, 0, MAX_UINT_BITS(width), subs, __VA_ARGS__)

Definition at line 89 of file cbs_apv.c.

◆ fixed

#define fixed (   width,
  name,
  value 
)
Value:
do { \
av_unused uint32_t fixed_value = value; \
xu(width, name, fixed_value, value, value, 0, ); \
} while (0)

Definition at line 92 of file cbs_apv.c.

◆ READ

#define READ

Definition at line 98 of file cbs_apv.c.

◆ READWRITE [1/2]

#define READWRITE   read

Definition at line 128 of file cbs_apv.c.

◆ RWContext [1/2]

#define RWContext   GetBitContext

Definition at line 129 of file cbs_apv.c.

◆ FUNC [1/2]

#define FUNC (   name)    cbs_apv_read_ ## name

Definition at line 130 of file cbs_apv.c.

◆ xu [1/2]

#define xu (   width,
  name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
uint32_t value; \
CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
&value, range_min, range_max)); \
var = value; \
} while (0)

Definition at line 132 of file cbs_apv.c.

◆ infer [1/2]

#define infer (   name,
  value 
)
Value:
do { \
current->name = value; \
} while (0)

Definition at line 139 of file cbs_apv.c.

◆ byte_alignment [1/2]

#define byte_alignment (   rw)    (get_bits_count(rw) % 8)

Definition at line 149 of file cbs_apv.c.

◆ WRITE

#define WRITE

Definition at line 127 of file cbs_apv.c.

◆ READWRITE [2/2]

#define READWRITE   write

Definition at line 128 of file cbs_apv.c.

◆ RWContext [2/2]

#define RWContext   PutBitContext

Definition at line 129 of file cbs_apv.c.

◆ FUNC [2/2]

#define FUNC (   name)    cbs_apv_write_ ## name

Definition at line 130 of file cbs_apv.c.

◆ xu [2/2]

#define xu (   width,
  name,
  var,
  range_min,
  range_max,
  subs,
  ... 
)
Value:
do { \
uint32_t value = var; \
CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), \
value, range_min, range_max)); \
} while (0)

Definition at line 132 of file cbs_apv.c.

◆ infer [2/2]

#define infer (   name,
  value 
)
Value:
do { \
if (current->name != (value)) { \
av_log(ctx->log_ctx, AV_LOG_ERROR, \
"%s does not match inferred value: " \
"%"PRId64", but should be %"PRId64".\n", \
#name, (int64_t)current->name, (int64_t)(value)); \
} \
} while (0)

Definition at line 139 of file cbs_apv.c.

◆ byte_alignment [2/2]

#define byte_alignment (   rw)    (put_bits_count(rw) % 8)

Definition at line 149 of file cbs_apv.c.

Function Documentation

◆ cbs_apv_get_num_comp()

static int cbs_apv_get_num_comp ( const APVRawFrameHeader fh)
static

Definition at line 25 of file cbs_apv.c.

Referenced by frame_header().

◆ cbs_apv_derive_tile_info()

static void cbs_apv_derive_tile_info ( APVDerivedTileInfo ti,
const APVRawFrameHeader fh 
)
static

Definition at line 40 of file cbs_apv.c.

Referenced by tile_info().

◆ cbs_apv_split_fragment()

static int cbs_apv_split_fragment ( CodedBitstreamContext ctx,
CodedBitstreamFragment frag,
int  header 
)
static

Definition at line 162 of file cbs_apv.c.

◆ cbs_apv_read_unit()

static int cbs_apv_read_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit 
)
static

Definition at line 252 of file cbs_apv.c.

◆ cbs_apv_write_unit()

static int cbs_apv_write_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit,
PutBitContext pbc 
)
static

Definition at line 315 of file cbs_apv.c.

◆ cbs_apv_assemble_fragment()

static int cbs_apv_assemble_fragment ( CodedBitstreamContext ctx,
CodedBitstreamFragment frag 
)
static

Definition at line 363 of file cbs_apv.c.

◆ cbs_apv_free_metadata()

static void cbs_apv_free_metadata ( AVRefStructOpaque  unused,
void *  content 
)
static

Definition at line 394 of file cbs_apv.c.

Variable Documentation

◆ cbs_apv_unit_types

const CodedBitstreamUnitTypeDescriptor cbs_apv_unit_types[]
static
Initial value:
= {
{
.nb_unit_types = CBS_UNIT_TYPE_RANGE,
.unit_type.range = {
},
.content_size = sizeof(APVRawFrame),
.type.ref = {
.nb_offsets = 1,
.offsets = { 0x42 -
sizeof(void*) },
},
},
}

Definition at line 419 of file cbs_apv.c.

◆ ff_cbs_type_apv

const CodedBitstreamType ff_cbs_type_apv
Initial value:
= {
.codec_id = AV_CODEC_ID_APV,
.priv_data_size = sizeof(CodedBitstreamAPVContext),
.unit_types = cbs_apv_unit_types,
.split_fragment = &cbs_apv_split_fragment,
.read_unit = &cbs_apv_read_unit,
.write_unit = &cbs_apv_write_unit,
.assemble_fragment = &cbs_apv_assemble_fragment,
}

Definition at line 444 of file cbs_apv.c.

CBS_UNIT_TYPE_RANGE
@ CBS_UNIT_TYPE_RANGE
Definition: cbs_internal.h:92
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
CBS_UNIT_TYPE_COMPLEX
#define CBS_UNIT_TYPE_COMPLEX(type, structure, free_func)
Definition: cbs_internal.h:383
cbs_apv_write_unit
static int cbs_apv_write_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
Definition: cbs_apv.c:315
int64_t
long long int64_t
Definition: coverity.c:34
APV_PBU_METADATA
@ APV_PBU_METADATA
Definition: apv.h:33
APVRawAUInfo
Definition: cbs_apv.h:111
cbs_apv_unit_types
static const CodedBitstreamUnitTypeDescriptor cbs_apv_unit_types[]
Definition: cbs_apv.c:419
cbs_apv_free_metadata
static void cbs_apv_free_metadata(AVRefStructOpaque unused, void *content)
Definition: cbs_apv.c:394
CBS_CONTENT_TYPE_INTERNAL_REFS
@ CBS_CONTENT_TYPE_INTERNAL_REFS
Definition: cbs_internal.h:77
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
SUBSCRIPTS
#define SUBSCRIPTS(subs,...)
Definition: cbs_apv.c:80
ctx
AVFormatContext * ctx
Definition: movenc.c:49
APVRawMetadata
Definition: cbs_apv.h:178
APV_PBU_ACCESS_UNIT_INFORMATION
@ APV_PBU_ACCESS_UNIT_INFORMATION
Definition: apv.h:32
APVRawFrame
Definition: cbs_apv.h:101
CodedBitstreamAPVContext
Definition: cbs_apv.h:200
cbs_apv_read_unit
static int cbs_apv_read_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Definition: cbs_apv.c:252
CBS_UNIT_TYPE_POD
#define CBS_UNIT_TYPE_POD(type_, structure)
Definition: cbs_internal.h:339
cbs_apv_split_fragment
static int cbs_apv_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
Definition: cbs_apv.c:162
value
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
Definition: writing_filters.txt:86
CBS_UNIT_TYPE_END_OF_LIST
#define CBS_UNIT_TYPE_END_OF_LIST
Definition: cbs_internal.h:386
AV_CODEC_ID_APV
@ AV_CODEC_ID_APV
Definition: codec_id.h:332
APV_PBU_PRIMARY_FRAME
@ APV_PBU_PRIMARY_FRAME
Definition: apv.h:27
APV_PBU_FILLER
@ APV_PBU_FILLER
Definition: apv.h:34
cbs_apv_assemble_fragment
static int cbs_apv_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Definition: cbs_apv.c:363
APV_PBU_ALPHA_FRAME
@ APV_PBU_ALPHA_FRAME
Definition: apv.h:31
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
width
#define width
Definition: dsp.h:85
APVRawFiller
Definition: cbs_apv.h:39