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 CBS_FUNC(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, ); \
100 #define READWRITE read
101 #define RWContext GetBitContext
102 #define FUNC(name) cbs_apv_read_ ## name
104 #define xu(width, name, var, range_min, range_max, subs, ...) do { \
106 CHECK(CBS_FUNC(read_unsigned)(ctx, rw, width, #name, \
107 SUBSCRIPTS(subs, __VA_ARGS__), \
108 &value, range_min, range_max)); \
112 #define infer(name, value) do { \
113 current->name = value; \
116 #define byte_alignment(rw) (get_bits_count(rw) % 8)
126 #undef byte_alignment
131 #define READWRITE write
132 #define RWContext PutBitContext
133 #define FUNC(name) cbs_apv_write_ ## name
135 #define xu(width, name, var, range_min, range_max, subs, ...) do { \
136 uint32_t value = var; \
137 CHECK(CBS_FUNC(write_unsigned)(ctx, rw, width, #name, \
138 SUBSCRIPTS(subs, __VA_ARGS__), \
139 value, range_min, range_max)); \
142 #define infer(name, value) do { \
143 if (current->name != (value)) { \
144 av_log(ctx->log_ctx, AV_LOG_ERROR, \
145 "%s does not match inferred value: " \
146 "%"PRId64", but should be %"PRId64".\n", \
147 #name, (int64_t)current->name, (int64_t)(value)); \
148 return AVERROR_INVALIDDATA; \
152 #define byte_alignment(rw) (put_bits_count(rw) % 8)
162 #undef byte_alignment
187 trace =
ctx->trace_enable;
188 ctx->trace_enable = 0;
193 "Invalid APV access unit: bad signature %08x.\n",
217 "pbu_size too small (%"PRIu32
" bytes).\n",
226 if (pbu_size >
size) {
228 "pbu_size too large (%"PRIu32
" bytes).\n",
253 ctx->trace_enable = trace;
275 switch (unit->
type) {
284 err = cbs_apv_read_frame(
ctx, &gbc,
frame);
292 if (!
frame->tile_data_ref)
298 err = cbs_apv_read_au_info(
ctx, &gbc, unit->
content);
305 err = cbs_apv_read_metadata(
ctx, &gbc, unit->
content);
312 err = cbs_apv_read_filler(
ctx, &gbc, unit->
content);
334 switch (unit->
type) {
343 err = cbs_apv_write_frame(
ctx, pbc,
frame);
350 err = cbs_apv_write_au_info(
ctx, pbc, unit->
content);
357 err = cbs_apv_write_metadata(
ctx, pbc, unit->
content);
364 err = cbs_apv_write_filler(
ctx, pbc, unit->
content);
419 for (
int i = 0;
i <
md->metadata_count;
i++) {
450 .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
@ APV_PBU_NON_PRIMARY_FRAME
uint8_t * data
The data buffer.
static int cbs_apv_read_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
RefStruct is an API for creating reference-counted objects with minimal overhead.
void * content
Pointer to the decomposed form of this unit.
int CBS_FUNC() 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.
static void cbs_apv_free_metadata(AVRefStructOpaque unused, void *content)
Context structure for coded bitstream operations.
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 int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Coded bitstream unit structure.
const CodedBitstreamType CBS_FUNC(type_apv)
@ 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
int CBS_FUNC() alloc_unit_content(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Allocate a new internal content buffer matching the type of the unit.
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.
Coded bitstream fragment structure, combining one or more units.
@ APV_PBU_ACCESS_UNIT_INFORMATION
size_t data_size
The number of bytes in the bitstream.
static const CodedBitstreamUnitTypeDescriptor cbs_apv_unit_types[]
#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)
size_t data_size
The number of bytes in the bitstream (including any padding bits in the final byte).
static int cbs_apv_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
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]
#define CBS_UNIT_TYPE_POD(type_, structure)
AVBufferRef * av_buffer_alloc(size_t size)
Allocate an AVBuffer of the given size using av_malloc().
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_get_num_comp(const APVRawFrameHeader *fh)
static int cbs_apv_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
#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]
@ APV_METADATA_USER_DEFINED
#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.
static int cbs_apv_write_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)