FFmpeg
Data Structures | Macros | Functions | Variables
cbs_vp8.c File Reference
#include "libavutil/avassert.h"
#include "cbs.h"
#include "cbs_internal.h"
#include "cbs_vp8.h"
#include <stdbool.h>
#include "cbs_vp8_syntax_template.c"

Go to the source code of this file.

Data Structures

struct  CBSVP8BoolDecoder
 

Macros

#define DEFAULT_PROB   0x80
 
#define HEADER(name)
 
#define CHECK(call)
 
#define FUNC_NAME(rw, codec, name)   cbs_##codec##_##rw##_##name
 
#define FUNC_VP8(rw, name)   FUNC_NAME(rw, vp8, name)
 
#define FUNC(name)   FUNC_VP8(READWRITE, name)
 
#define SUBSCRIPTS(subs, ...)   (subs > 0 ? ((int[subs + 1]){subs, __VA_ARGS__}) : NULL)
 
#define f(width, name)   xf(width, name, 0, )
 
#define bc_f(width, name)   bc_unsigned_subs(width, DEFAULT_PROB, true, name, 0, )
 
#define bc_s(width, name)   bc_signed_subs(width, DEFAULT_PROB, name, 0, )
 
#define bc_fs(width, name, subs, ...)   bc_unsigned_subs(width, DEFAULT_PROB, true, name, subs, __VA_ARGS__)
 
#define bc_ss(width, name, subs, ...)   bc_signed_subs(width, DEFAULT_PROB, name, subs, __VA_ARGS__)
 
#define bc_b(name)   bc_unsigned_subs(1, DEFAULT_PROB, false, name, 0, )
 
#define bc_b_prob(prob, name)   bc_unsigned_subs(1, prob, false, name, 0, )
 
#define READ
 
#define READWRITE   read
 
#define RWContext   GetBitContext
 
#define CBSVP8BoolCodingRW   CBSVP8BoolDecoder
 
#define xf(width, name, subs, ...)
 
#define fixed(width, name, value)
 
#define bc_unsigned_subs(width, prob, enable_trace, name, subs, ...)
 
#define bc_signed_subs(width, prob, name, subs, ...)
 

Functions

static int cbs_vp8_bool_decoder_init (CBSVP8BoolDecoder *decoder, GetBitContext *gbc)
 
static bool cbs_vp8_bool_decoder_fill_value (CBSVP8BoolDecoder *decoder)
 
static int cbs_vp8_bool_decoder_read_bool (CBSVP8BoolDecoder *decoder, const uint8_t prob, uint8_t *output)
 
static int cbs_vp8_bool_decoder_read_literal (CBSVP8BoolDecoder *decoder, const uint8_t prob, uint32_t num_bits, uint32_t *output)
 
static int cbs_vp8_bool_decoder_read_unsigned (CodedBitstreamContext *ctx, CBSVP8BoolDecoder *bool_decoder, int width, uint8_t prob, const char *name, const int *subscripts, uint32_t *write_to, bool trace_enable)
 
static int cbs_vp8_bool_decoder_read_signed (CodedBitstreamContext *ctx, CBSVP8BoolDecoder *bool_decoder, int width, uint8_t prob, const char *name, const int *subscripts, int32_t *write_to)
 
static int cbs_vp8_read_unsigned_le (CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, uint32_t *write_to, uint32_t range_min, uint32_t range_max)
 
static int cbs_vp8_split_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
 
static int cbs_vp8_read_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
 
static int cbs_vp8_write_unit (CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
 
static int cbs_vp8_assemble_fragment (CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
 

Variables

const uint8_t ff_vp8_token_update_probs [4][8][3][11]
 
static const CodedBitstreamUnitTypeDescriptor cbs_vp8_unit_types []
 
const CodedBitstreamType ff_cbs_type_vp8
 

Macro Definition Documentation

◆ DEFAULT_PROB

#define DEFAULT_PROB   0x80

Definition at line 27 of file cbs_vp8.c.

◆ HEADER

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

Definition at line 217 of file cbs_vp8.c.

◆ CHECK

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

Definition at line 222 of file cbs_vp8.c.

◆ FUNC_NAME

#define FUNC_NAME (   rw,
  codec,
  name 
)    cbs_##codec##_##rw##_##name

Definition at line 229 of file cbs_vp8.c.

◆ FUNC_VP8

#define FUNC_VP8 (   rw,
  name 
)    FUNC_NAME(rw, vp8, name)

Definition at line 230 of file cbs_vp8.c.

◆ FUNC

#define FUNC (   name)    FUNC_VP8(READWRITE, name)

Definition at line 231 of file cbs_vp8.c.

◆ SUBSCRIPTS

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

Definition at line 233 of file cbs_vp8.c.

◆ f

#define f (   width,
  name 
)    xf(width, name, 0, )

Definition at line 236 of file cbs_vp8.c.

◆ bc_f

#define bc_f (   width,
  name 
)    bc_unsigned_subs(width, DEFAULT_PROB, true, name, 0, )

Definition at line 239 of file cbs_vp8.c.

◆ bc_s

#define bc_s (   width,
  name 
)    bc_signed_subs(width, DEFAULT_PROB, name, 0, )

Definition at line 240 of file cbs_vp8.c.

◆ bc_fs

#define bc_fs (   width,
  name,
  subs,
  ... 
)    bc_unsigned_subs(width, DEFAULT_PROB, true, name, subs, __VA_ARGS__)

Definition at line 241 of file cbs_vp8.c.

◆ bc_ss

#define bc_ss (   width,
  name,
  subs,
  ... 
)    bc_signed_subs(width, DEFAULT_PROB, name, subs, __VA_ARGS__)

Definition at line 243 of file cbs_vp8.c.

◆ bc_b

#define bc_b (   name)    bc_unsigned_subs(1, DEFAULT_PROB, false, name, 0, )

Definition at line 247 of file cbs_vp8.c.

◆ bc_b_prob

#define bc_b_prob (   prob,
  name 
)    bc_unsigned_subs(1, prob, false, name, 0, )

Definition at line 248 of file cbs_vp8.c.

◆ READ

#define READ

Definition at line 250 of file cbs_vp8.c.

◆ READWRITE

#define READWRITE   read

Definition at line 251 of file cbs_vp8.c.

◆ RWContext

#define RWContext   GetBitContext

Definition at line 252 of file cbs_vp8.c.

◆ CBSVP8BoolCodingRW

#define CBSVP8BoolCodingRW   CBSVP8BoolDecoder

Definition at line 253 of file cbs_vp8.c.

◆ xf

#define xf (   width,
  name,
  subs,
  ... 
)
Value:
do { \
uint32_t value; \
SUBSCRIPTS(subs, __VA_ARGS__), &value, \
current->name = value; \
} while (0)

Definition at line 255 of file cbs_vp8.c.

◆ fixed

#define fixed (   width,
  name,
  value 
)
Value:
do { \
uint32_t fixed_value; \
CHECK(cbs_vp8_read_unsigned_le(ctx, rw, width, #name, 0, &fixed_value, \
value, value)); \
} while (0)

Definition at line 264 of file cbs_vp8.c.

◆ bc_unsigned_subs

#define bc_unsigned_subs (   width,
  prob,
  enable_trace,
  name,
  subs,
  ... 
)
Value:
do { \
uint32_t value; \
ctx, bool_coding_rw, width, prob, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), &value, enable_trace)); \
current->name = value; \
} while (0)

Definition at line 271 of file cbs_vp8.c.

◆ bc_signed_subs

#define bc_signed_subs (   width,
  prob,
  name,
  subs,
  ... 
)
Value:
do { \
int32_t value; \
ctx, bool_coding_rw, width, prob, #name, \
SUBSCRIPTS(subs, __VA_ARGS__), &value)); \
current->name = value; \
} while (0)

Definition at line 280 of file cbs_vp8.c.

Function Documentation

◆ cbs_vp8_bool_decoder_init()

static int cbs_vp8_bool_decoder_init ( CBSVP8BoolDecoder decoder,
GetBitContext gbc 
)
static

Definition at line 43 of file cbs_vp8.c.

Referenced by cbs_vp8_read_unit().

◆ cbs_vp8_bool_decoder_fill_value()

static bool cbs_vp8_bool_decoder_fill_value ( CBSVP8BoolDecoder decoder)
static

Definition at line 57 of file cbs_vp8.c.

Referenced by cbs_vp8_bool_decoder_read_bool().

◆ cbs_vp8_bool_decoder_read_bool()

static int cbs_vp8_bool_decoder_read_bool ( CBSVP8BoolDecoder decoder,
const uint8_t  prob,
uint8_t *  output 
)
static

◆ cbs_vp8_bool_decoder_read_literal()

static int cbs_vp8_bool_decoder_read_literal ( CBSVP8BoolDecoder decoder,
const uint8_t  prob,
uint32_t  num_bits,
uint32_t *  output 
)
static

◆ cbs_vp8_bool_decoder_read_unsigned()

static int cbs_vp8_bool_decoder_read_unsigned ( CodedBitstreamContext ctx,
CBSVP8BoolDecoder bool_decoder,
int  width,
uint8_t  prob,
const char *  name,
const int subscripts,
uint32_t *  write_to,
bool  trace_enable 
)
static

Definition at line 125 of file cbs_vp8.c.

◆ cbs_vp8_bool_decoder_read_signed()

static int cbs_vp8_bool_decoder_read_signed ( CodedBitstreamContext ctx,
CBSVP8BoolDecoder bool_decoder,
int  width,
uint8_t  prob,
const char *  name,
const int subscripts,
int32_t write_to 
)
static

Definition at line 151 of file cbs_vp8.c.

◆ cbs_vp8_read_unsigned_le()

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

Definition at line 184 of file cbs_vp8.c.

◆ cbs_vp8_split_fragment()

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

Definition at line 291 of file cbs_vp8.c.

◆ cbs_vp8_read_unit()

static int cbs_vp8_read_unit ( CodedBitstreamContext ctx,
CodedBitstreamUnit unit 
)
static

Definition at line 307 of file cbs_vp8.c.

◆ cbs_vp8_write_unit()

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

Definition at line 357 of file cbs_vp8.c.

◆ cbs_vp8_assemble_fragment()

static int cbs_vp8_assemble_fragment ( CodedBitstreamContext ctx,
CodedBitstreamFragment frag 
)
static

Definition at line 363 of file cbs_vp8.c.

Variable Documentation

◆ ff_vp8_token_update_probs

const uint8_t ff_vp8_token_update_probs[4][8][3][11]

Definition at line 43 of file vp8data.c.

Referenced by update_token_probs(), and vp78_update_probability_tables().

◆ cbs_vp8_unit_types

const CodedBitstreamUnitTypeDescriptor cbs_vp8_unit_types[]
static
Initial value:

Definition at line 369 of file cbs_vp8.c.

◆ ff_cbs_type_vp8

const CodedBitstreamType ff_cbs_type_vp8
Initial value:
= {
.codec_id = AV_CODEC_ID_VP8,
.priv_data_size = 0,
.unit_types = cbs_vp8_unit_types,
.split_fragment = &cbs_vp8_split_fragment,
.read_unit = &cbs_vp8_read_unit,
.write_unit = &cbs_vp8_write_unit,
.assemble_fragment = &cbs_vp8_assemble_fragment,
}

Definition at line 374 of file cbs_vp8.c.

cbs_vp8_bool_decoder_read_unsigned
static int cbs_vp8_bool_decoder_read_unsigned(CodedBitstreamContext *ctx, CBSVP8BoolDecoder *bool_decoder, int width, uint8_t prob, const char *name, const int *subscripts, uint32_t *write_to, bool trace_enable)
Definition: cbs_vp8.c:125
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
data
const char data[16]
Definition: mxf.c:148
cbs_vp8_bool_decoder_read_signed
static int cbs_vp8_bool_decoder_read_signed(CodedBitstreamContext *ctx, CBSVP8BoolDecoder *bool_decoder, int width, uint8_t prob, const char *name, const int *subscripts, int32_t *write_to)
Definition: cbs_vp8.c:151
CBS_UNIT_TYPE_INTERNAL_REF
#define CBS_UNIT_TYPE_INTERNAL_REF(type, structure, ref_field)
Definition: cbs_internal.h:312
width
#define width
ctx
AVFormatContext * ctx
Definition: movenc.c:48
MAX_UINT_BITS
#define MAX_UINT_BITS(length)
Definition: cbs_internal.h:196
cbs_vp8_assemble_fragment
static int cbs_vp8_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Definition: cbs_vp8.c:363
cbs_vp8_unit_types
static const CodedBitstreamUnitTypeDescriptor cbs_vp8_unit_types[]
Definition: cbs_vp8.c:369
VP8RawFrame
Definition: cbs_vp8.h:125
SUBSCRIPTS
#define SUBSCRIPTS(subs,...)
Definition: cbs_vp8.c:233
cbs_vp8_read_unsigned_le
static int cbs_vp8_read_unsigned_le(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, uint32_t *write_to, uint32_t range_min, uint32_t range_max)
Definition: cbs_vp8.c:184
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_vp8_read_unit
static int cbs_vp8_read_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Definition: cbs_vp8.c:307
CBS_UNIT_TYPE_END_OF_LIST
#define CBS_UNIT_TYPE_END_OF_LIST
Definition: cbs_internal.h:335
prob
#define prob(name, subs,...)
Definition: cbs_vp9.c:325
cbs_vp8_write_unit
static int cbs_vp8_write_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
Definition: cbs_vp8.c:357
cbs_vp8_split_fragment
static int cbs_vp8_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
Definition: cbs_vp8.c:291
AV_CODEC_ID_VP8
@ AV_CODEC_ID_VP8
Definition: codec_id.h:192