Go to the documentation of this file.
   28                           const int *subscripts, 
int32_t *write_to)
 
   38                "%s: bitstream ended.\n", 
name);
 
   76                                   uint32_t range_min, uint32_t range_max,
 
   77                                   const char *
name, uint32_t *write_to)
 
   83     av_assert0(range_min <= range_max && range_max - range_min < 32);
 
   88                    "%s: bitstream ended.\n", 
name);
 
  104                                    uint32_t range_min, uint32_t range_max,
 
  111     av_assert0(range_min <= range_max && range_max - range_min < 8);
 
  112     if (value < range_min || value > range_max) {
 
  114                "%"PRIu32
", but must be in [%"PRIu32
",%"PRIu32
"].\n",
 
  119     if (
value == range_max)
 
  120         len = range_max - range_min;
 
  136                            const int *subscripts, uint32_t *write_to)
 
  147                "%s: bitstream ended.\n", 
name);
 
  163                             const int *subscripts, uint32_t 
value)
 
  182 #define HEADER(name) do { \ 
  183         ff_cbs_trace_header(ctx, name); \ 
  186 #define CHECK(call) do { \ 
  192 #define FUNC_NAME(rw, codec, name) cbs_ ## codec ## _ ## rw ## _ ## name 
  193 #define FUNC_VP9(rw, name) FUNC_NAME(rw, vp9, name) 
  194 #define FUNC(name) FUNC_VP9(READWRITE, name) 
  196 #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL) 
  198 #define s(width, name) \ 
  199         xs(width, name, current->name, 0, ) 
  200 #define fs(width, name, subs, ...) \ 
  201         xf(width, name, current->name, subs, __VA_ARGS__) 
  202 #define ss(width, name, subs, ...) \ 
  203         xs(width, name, current->name, subs, __VA_ARGS__) 
  206 #define READWRITE read 
  207 #define RWContext GetBitContext 
  209 #define f(width, name) do { \ 
  211         CHECK(ff_cbs_read_simple_unsigned(ctx, rw, width, #name, \ 
  213         current->name = value; \ 
  215 #define xf(width, name, var, subs, ...) do { \ 
  217         CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ 
  218                                    SUBSCRIPTS(subs, __VA_ARGS__), \ 
  219                                    &value, 0, (1 << width) - 1)); \ 
  222 #define xs(width, name, var, subs, ...) do { \ 
  224         CHECK(cbs_vp9_read_s(ctx, rw, width, #name, \ 
  225                              SUBSCRIPTS(subs, __VA_ARGS__), &value)); \ 
  230 #define increment(name, min, max) do { \ 
  232         CHECK(cbs_vp9_read_increment(ctx, rw, min, max, #name, &value)); \ 
  233         current->name = value; \ 
  236 #define fle(width, name, subs, ...) do { \ 
  237         CHECK(cbs_vp9_read_le(ctx, rw, width, #name, \ 
  238                               SUBSCRIPTS(subs, __VA_ARGS__), ¤t->name)); \ 
  241 #define delta_q(name) do { \ 
  242         uint8_t delta_coded; \ 
  244         xf(1, name.delta_coded, delta_coded, 0, ); \ 
  246             xs(4, name.delta_q, delta_q, 0, ); \ 
  249         current->name = delta_q; \ 
  252 #define prob(name, subs, ...) do { \ 
  253         uint8_t prob_coded; \ 
  255         xf(1, name.prob_coded, prob_coded, subs, __VA_ARGS__); \ 
  257             xf(8, name.prob, prob, subs, __VA_ARGS__); \ 
  260         current->name = prob; \ 
  263 #define fixed(width, name, value) do { \ 
  264         av_unused uint32_t fixed_value; \ 
  265         CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ 
  266                                    0, &fixed_value, value, value)); \ 
  269 #define infer(name, value) do { \ 
  270         current->name = value; \ 
  273 #define byte_alignment(rw) (get_bits_count(rw) % 8) 
  289 #undef byte_alignment 
  293 #define READWRITE write 
  294 #define RWContext PutBitContext 
  296 #define f(width, name) do { \ 
  297         CHECK(ff_cbs_write_simple_unsigned(ctx, rw, width, #name, \ 
  300 #define xf(width, name, var, subs, ...) do { \ 
  301         CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \ 
  302                                     SUBSCRIPTS(subs, __VA_ARGS__), \ 
  303                                     var, 0, (1 << width) - 1)); \ 
  305 #define xs(width, name, var, subs, ...) do { \ 
  306         CHECK(cbs_vp9_write_s(ctx, rw, width, #name, \ 
  307                               SUBSCRIPTS(subs, __VA_ARGS__), var)); \ 
  310 #define increment(name, min, max) do { \ 
  311         CHECK(cbs_vp9_write_increment(ctx, rw, min, max, #name, current->name)); \ 
  314 #define fle(width, name, subs, ...) do { \ 
  315         CHECK(cbs_vp9_write_le(ctx, rw, width, #name, \ 
  316                                SUBSCRIPTS(subs, __VA_ARGS__), current->name)); \ 
  319 #define delta_q(name) do { \ 
  320         xf(1, name.delta_coded, !!current->name, 0, ); \ 
  322             xs(4, name.delta_q, current->name, 0, ); \ 
  325 #define prob(name, subs, ...) do { \ 
  326         xf(1, name.prob_coded, current->name != 255, subs, __VA_ARGS__); \ 
  327         if (current->name != 255) \ 
  328             xf(8, name.prob, current->name, subs, __VA_ARGS__); \ 
  331 #define fixed(width, name, value) do { \ 
  332         CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \ 
  333                                     0, value, value, value)); \ 
  336 #define infer(name, value) do { \ 
  337         if (current->name != (value)) { \ 
  338             av_log(ctx->log_ctx, AV_LOG_WARNING, "Warning: " \ 
  339                    "%s does not match inferred value: " \ 
  340                    "%"PRId64", but should be %"PRId64".\n", \ 
  341                    #name, (int64_t)current->name, (int64_t)(value)); \ 
  345 #define byte_alignment(rw) (put_bits_count(rw) % 8) 
  361 #undef byte_alignment 
  368     uint8_t superframe_header;
 
  377     if ((superframe_header & 0xe0) == 0xc0) {
 
  380         size_t index_size, 
pos;
 
  383         index_size = 2 + (((superframe_header & 0x18) >> 3) + 1) *
 
  384                           ((superframe_header & 0x07) + 1);
 
  394         err = cbs_vp9_read_superframe_index(
ctx, &gbc, &sfi);
 
  402                        "in superframe: %"PRIu32
" bytes.\n",
 
  451     err = cbs_vp9_read_frame(
ctx, &gbc, 
frame);
 
  464         if (!
frame->data_ref)
 
  481     err = cbs_vp9_write_frame(
ctx, pbc, 
frame);
 
  529                    "make superframe: %d.\n", frag->
nb_units);
 
  535             if (max < frag->units[
i].data_size)
 
  571         err = cbs_vp9_write_superframe_index(
ctx, &pbc, &sfi);
 
  574                    "superframe index.\n");
 
  594     memset(vp9->
ref, 0, 
sizeof(vp9->
ref));
 
  
#define AV_LOG_WARNING
Something somehow does not look correct.
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.
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static int get_bits_count(const GetBitContext *s)
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
static int cbs_vp9_write_increment(CodedBitstreamContext *ctx, PutBitContext *pbc, uint32_t range_min, uint32_t range_max, const char *name, uint32_t value)
Context structure for coded bitstream operations.
static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
uint32_t frame_sizes[VP9_MAX_FRAMES_IN_SUPERFRAME]
static void cbs_vp9_flush(CodedBitstreamContext *ctx)
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
VP9ReferenceFrameState ref[VP9_NUM_REF_FRAMES]
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, uint32_t value)
Coded bitstream unit structure.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define CBS_UNIT_TYPE_INTERNAL_REF(type, structure, ref_field)
static int cbs_vp9_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
static int put_bits_left(PutBitContext *s)
uint8_t * data
Pointer to the directly-parsable bitstream form of this unit.
static int cbs_vp9_read_s(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, int32_t *write_to)
static const CodedBitstreamUnitTypeDescriptor cbs_vp9_unit_types[]
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units_allocated.
const CodedBitstreamType ff_cbs_type_vp9
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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.
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.
uint8_t frames_in_superframe_minus_1
#define CBS_TRACE_WRITE_END()
static int cbs_vp9_read_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
#define CBS_TRACE_READ_END_NO_SUBSCRIPTS()
static unsigned int get_bits1(GetBitContext *s)
size_t data_size
The number of bytes in the bitstream (including any padding bits in the final byte).
void(* flush)(AVBSFContext *ctx)
static int cbs_vp9_write_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
uint8_t bytes_per_framesize_minus_1
static int cbs_vp9_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc, uint32_t range_min, uint32_t range_max, const char *name, uint32_t *write_to)
uint8_t * data
Pointer to the bitstream form of this fragment.
static const uint8_t header[24]
AVBufferRef * av_buffer_alloc(size_t size)
Allocate an AVBuffer of the given size using av_malloc().
#define CBS_TRACE_WRITE_END_NO_SUBSCRIPTS()
AVBufferRef * data_ref
A reference to the buffer containing data.
#define i(width, name, range_min, range_max)
static int put_bits_count(PutBitContext *s)
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
#define CBS_UNIT_TYPE_END_OF_LIST
static int cbs_vp9_read_le(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, uint32_t *write_to)
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
int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Allocate a new internal content buffer matching the type of the unit.
#define AV_INPUT_BUFFER_PADDING_SIZE
static uint8_t * put_bits_ptr(PutBitContext *s)
Return the pointer to the byte where the bitstream writer will put the next bit.
uint8_t superframe_marker
static void skip_put_bytes(PutBitContext *s, int n)
Skip the given number of bytes.
static int ref[MAX_W *MAX_W]
A reference to a data buffer.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int cbs_vp9_write_s(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, int32_t value)
AVBufferRef * data_ref
A reference to the buffer containing data.
#define CBS_TRACE_READ_START()
void * priv_data
Format private data.
int nb_units
Number of units in this fragment.
#define CBS_TRACE_READ_END()
#define CBS_TRACE_WRITE_START()