Go to the documentation of this file.
27 #define DEFAULT_PROB 0x80
112 for (; num_bits > 0; --num_bits) {
113 uint8_t bit_output = 0;
115 &bit_output)) != 0) {
127 uint8_t
prob,
const char *
name,
const int *subscripts, uint32_t *write_to,
153 uint8_t
prob,
const char *
name,
const int *subscripts,
int32_t *write_to)
186 const char *
name,
const int *subscripts,
187 uint32_t *write_to, uint32_t range_min,
205 if (value < range_min || value > range_max) {
208 "%" PRIu32
", but must be in [%" PRIu32
",%" PRIu32
"].\n",
217 #define HEADER(name) \
219 ff_cbs_trace_header(ctx, name); \
222 #define CHECK(call) \
229 #define FUNC_NAME(rw, codec, name) cbs_##codec##_##rw##_##name
230 #define FUNC_VP8(rw, name) FUNC_NAME(rw, vp8, name)
231 #define FUNC(name) FUNC_VP8(READWRITE, name)
233 #define SUBSCRIPTS(subs, ...) \
234 (subs > 0 ? ((int[subs + 1]){subs, __VA_ARGS__}) : NULL)
236 #define f(width, name) xf(width, name, 0, )
239 #define bc_f(width, name) bc_unsigned_subs(width, DEFAULT_PROB, true, name, 0, )
240 #define bc_s(width, name) bc_signed_subs(width, DEFAULT_PROB, name, 0, )
241 #define bc_fs(width, name, subs, ...) \
242 bc_unsigned_subs(width, DEFAULT_PROB, true, name, subs, __VA_ARGS__)
243 #define bc_ss(width, name, subs, ...) \
244 bc_signed_subs(width, DEFAULT_PROB, name, subs, __VA_ARGS__)
247 #define bc_b(name) bc_unsigned_subs(1, DEFAULT_PROB, false, name, 0, )
248 #define bc_b_prob(prob, name) bc_unsigned_subs(1, prob, false, name, 0, )
251 #define READWRITE read
252 #define RWContext GetBitContext
253 #define CBSVP8BoolCodingRW CBSVP8BoolDecoder
255 #define xf(width, name, subs, ...) \
258 CHECK(cbs_vp8_read_unsigned_le(ctx, rw, width, #name, \
259 SUBSCRIPTS(subs, __VA_ARGS__), &value, \
260 0, MAX_UINT_BITS(width))); \
261 current->name = value; \
264 #define fixed(width, name, value) \
266 uint32_t fixed_value; \
267 CHECK(cbs_vp8_read_unsigned_le(ctx, rw, width, #name, 0, &fixed_value, \
271 #define bc_unsigned_subs(width, prob, enable_trace, name, subs, ...) \
274 CHECK(cbs_vp8_bool_decoder_read_unsigned( \
275 ctx, bool_coding_rw, width, prob, #name, \
276 SUBSCRIPTS(subs, __VA_ARGS__), &value, enable_trace)); \
277 current->name = value; \
280 #define bc_signed_subs(width, prob, name, subs, ...) \
283 CHECK(cbs_vp8_bool_decoder_read_signed( \
284 ctx, bool_coding_rw, width, prob, #name, \
285 SUBSCRIPTS(subs, __VA_ARGS__), &value)); \
286 current->name = value; \
325 err = cbs_vp8_read_uncompressed_header(
ctx, &gbc,
frame);
337 err = cbs_vp8_read_compressed_header(
ctx, &bool_decoder,
frame);
348 if (!
frame->data_ref)
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)
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
static int get_bits_left(GetBitContext *gb)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
void * content
Pointer to the decomposed form of this unit.
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
static int get_bits_count(const GetBitContext *s)
const uint8_t ff_vp8_token_update_probs[4][8][3][11]
Context structure for coded bitstream operations.
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
static int cbs_vp8_bool_decoder_read_bool(CBSVP8BoolDecoder *decoder, const uint8_t prob, uint8_t *output)
Coded bitstream unit structure.
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 unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static const chunk_decoder decoder[8]
#define CBS_UNIT_TYPE_INTERNAL_REF(type, structure, ref_field)
uint8_t * data
Pointer to the directly-parsable bitstream form of this unit.
static int cbs_vp8_bool_decoder_init(CBSVP8BoolDecoder *decoder, GetBitContext *gbc)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const CodedBitstreamType ff_cbs_type_vp8
Coded bitstream fragment structure, combining one or more units.
size_t data_size
The number of bytes in the bitstream.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static unsigned int get_bits_le(GetBitContext *s, int n)
int ff_cbs_append_unit_data(CodedBitstreamFragment *frag, CodedBitstreamUnitType type, uint8_t *data, size_t data_size, AVBufferRef *data_buf)
Add a new unit to a fragment with the given data bitstream.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static int cbs_vp8_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
size_t data_size
The number of bytes in the bitstream (including any padding bits in the final byte).
static const CodedBitstreamUnitTypeDescriptor cbs_vp8_unit_types[]
uint8_t * data
Pointer to the bitstream form of this fragment.
static const uint8_t header[24]
static char * split(char *message, char delim)
AVBufferRef * data_ref
A reference to the buffer containing data.
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)
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
static int cbs_vp8_read_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
#define CBS_UNIT_TYPE_END_OF_LIST
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
#define prob(name, subs,...)
int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Allocate a new internal content buffer matching the type of the unit.
static int cbs_vp8_write_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
static int cbs_vp8_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
static int cbs_vp8_bool_decoder_read_literal(CBSVP8BoolDecoder *decoder, const uint8_t prob, uint32_t num_bits, uint32_t *output)
static int init_get_bits8_le(GetBitContext *s, const uint8_t *buffer, int byte_size)
static bool cbs_vp8_bool_decoder_fill_value(CBSVP8BoolDecoder *decoder)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
AVBufferRef * data_ref
A reference to the buffer containing data.
#define CBS_TRACE_READ_START()
#define CBS_TRACE_READ_END()