Go to the documentation of this file.
48 for (
i = 0; start_mb < frame_width_in_mbs;
i++) {
57 for (
i = 0; start_mb < frame_height_in_mbs;
i++) {
70 #define HEADER(name) do { \
71 ff_cbs_trace_header(ctx, name); \
74 #define CHECK(call) do { \
80 #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)
83 #define u(width, name, range_min, range_max) \
84 xu(width, name, current->name, range_min, range_max, 0, )
85 #define ub(width, name) \
86 xu(width, name, current->name, 0, MAX_UINT_BITS(width), 0, )
87 #define us(width, name, range_min, range_max, subs, ...) \
88 xu(width, name, current->name, range_min, range_max, subs, __VA_ARGS__)
89 #define ubs(width, name, subs, ...) \
90 xu(width, name, current->name, 0, MAX_UINT_BITS(width), subs, __VA_ARGS__)
92 #define fixed(width, name, value) do { \
93 av_unused uint32_t fixed_value = value; \
94 xu(width, name, fixed_value, value, value, 0, ); \
99 #define READWRITE read
100 #define RWContext GetBitContext
101 #define FUNC(name) cbs_apv_read_ ## name
103 #define xu(width, name, var, range_min, range_max, subs, ...) do { \
105 CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \
106 SUBSCRIPTS(subs, __VA_ARGS__), \
107 &value, range_min, range_max)); \
111 #define infer(name, value) do { \
112 current->name = value; \
115 #define byte_alignment(rw) (get_bits_count(rw) % 8)
125 #undef byte_alignment
128 #define READWRITE write
129 #define RWContext PutBitContext
130 #define FUNC(name) cbs_apv_write_ ## name
132 #define xu(width, name, var, range_min, range_max, subs, ...) do { \
133 uint32_t value = var; \
134 CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \
135 SUBSCRIPTS(subs, __VA_ARGS__), \
136 value, range_min, range_max)); \
139 #define infer(name, value) do { \
140 if (current->name != (value)) { \
141 av_log(ctx->log_ctx, AV_LOG_ERROR, \
142 "%s does not match inferred value: " \
143 "%"PRId64", but should be %"PRId64".\n", \
144 #name, (int64_t)current->name, (int64_t)(value)); \
145 return AVERROR_INVALIDDATA; \
149 #define byte_alignment(rw) (put_bits_count(rw) % 8)
159 #undef byte_alignment
182 trace =
ctx->trace_enable;
183 ctx->trace_enable = 0;
188 "Invalid APV access unit: bad signature %08x.\n",
212 "pbu_size too small (%"PRIu32
" bytes).\n",
221 if (pbu_size >
size) {
223 "pbu_size too large (%"PRIu32
" bytes).\n",
237 err = ff_cbs_append_unit_data(frag,
pbu_header.pbu_type,
248 ctx->trace_enable = trace;
262 err = ff_cbs_alloc_unit_content(
ctx, unit);
266 switch (unit->
type) {
275 err = cbs_apv_read_frame(
ctx, &gbc,
frame);
283 if (!
frame->tile_data_ref)
289 err = cbs_apv_read_au_info(
ctx, &gbc, unit->
content);
296 err = cbs_apv_read_metadata(
ctx, &gbc, unit->
content);
303 err = cbs_apv_read_filler(
ctx, &gbc, unit->
content);
321 switch (unit->
type) {
330 err = cbs_apv_write_frame(
ctx, pbc,
frame);
337 err = cbs_apv_write_au_info(
ctx, pbc, unit->
content);
344 err = cbs_apv_write_metadata(
ctx, pbc, unit->
content);
351 err = cbs_apv_write_filler(
ctx, pbc, unit->
content);
399 for (
int i = 0;
i <
md->metadata_count;
i++) {
430 .offsets = { offsetof(
APVRawFrame, tile_data_ref) -
#define CBS_UNIT_TYPE_COMPLEX(type, structure, free_func)
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
static int cbs_apv_write_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
uint8_t * data
The data buffer.
RefStruct is an API for creating reference-counted objects with minimal overhead.
void * content
Pointer to the decomposed form of this unit.
Context structure for coded bitstream operations.
static const CodedBitstreamUnitTypeDescriptor cbs_apv_unit_types[]
CodedBitstreamUnitType type
Codec-specific type of this unit.
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
uint32_t tile_width_in_mbs
static void cbs_apv_free_metadata(AVRefStructOpaque unused, void *content)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Coded bitstream unit structure.
@ CBS_CONTENT_TYPE_INTERNAL_REFS
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
uint8_t * data
Pointer to the directly-parsable bitstream form of this unit.
static const char signature[]
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units_allocated.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ APV_PBU_NON_PRIMARY_FRAME
Coded bitstream fragment structure, combining one or more units.
size_t data_size
The number of bytes in the bitstream.
const CodedBitstreamType ff_cbs_type_apv
#define av_assert0(cond)
assert() equivalent, that is always enabled.
uint32_t tile_height_in_mbs
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
static void cbs_apv_derive_tile_info(APVDerivedTileInfo *ti, const APVRawFrameHeader *fh)
@ APV_PBU_ACCESS_UNIT_INFORMATION
size_t data_size
The number of bytes in the bitstream (including any padding bits in the final byte).
static int cbs_apv_get_num_comp(const APVRawFrameHeader *fh)
static int FUNC() pbu_header(CodedBitstreamContext *ctx, RWContext *rw, APVRawPBUHeader *current)
uint8_t * data
Pointer to the bitstream form of this fragment.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
uint8_t chroma_format_idc
static const uint8_t header[24]
static int cbs_apv_read_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
#define CBS_UNIT_TYPE_POD(type_, structure)
AVBufferRef * av_buffer_alloc(size_t size)
Allocate an AVBuffer of the given size using av_malloc().
@ APV_METADATA_USER_DEFINED
uint16_t row_starts[APV_MAX_TILE_ROWS+1]
AVBufferRef * data_ref
A reference to the buffer containing data.
#define i(width, name, range_min, range_max)
static int cbs_apv_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
#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 AV_INPUT_BUFFER_PADDING_SIZE
uint16_t col_starts[APV_MAX_TILE_COLS+1]
static int cbs_apv_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
AVBufferRef * data_ref
A reference to the buffer containing data.
int nb_units
Number of units in this fragment.