Go to the documentation of this file.
36 int bits_left = payload_size * 8 - cur_pos;
42 const char *
name,
const int *subscripts,
44 uint32_t range_min, uint32_t range_max)
46 uint32_t leading_bits,
value;
47 int max_length, leading_zeroes;
54 if (leading_bits == 0) {
55 if (max_length >= 32) {
57 "%s: more than 31 zeroes.\n",
name);
61 "%s: bitstream ended.\n",
name);
66 leading_zeroes = max_length - 1 -
av_log2(leading_bits);
71 "%s: bitstream ended.\n",
name);
79 if (value < range_min || value > range_max) {
81 "%"PRIu32
", but must be in [%"PRIu32
",%"PRIu32
"].\n",
91 const char *
name,
const int *subscripts,
95 uint32_t leading_bits, unsigned_value;
96 int max_length, leading_zeroes;
104 if (leading_bits == 0) {
105 if (max_length >= 32) {
107 "%s: more than 31 zeroes.\n",
name);
111 "%s: bitstream ended.\n",
name);
116 leading_zeroes = max_length - 1 -
av_log2(leading_bits);
121 "%s: bitstream ended.\n",
name);
127 if (unsigned_value & 1)
130 value = unsigned_value / 2;
134 if (value < range_min || value > range_max) {
136 "%"PRId32
", but must be in [%"PRId32
",%"PRId32
"].\n",
146 const char *
name,
const int *subscripts,
148 uint32_t range_min, uint32_t range_max)
154 if (value < range_min || value > range_max) {
156 "%"PRIu32
", but must be in [%"PRIu32
",%"PRIu32
"].\n",
178 const char *
name,
const int *subscripts,
187 if (value < range_min || value > range_max) {
189 "%"PRId32
", but must be in [%"PRId32
",%"PRId32
"].\n",
198 uvalue = 2 * (uint32_t)
value - 1;
200 uvalue = 2 * (uint32_t)-
value;
256 err = ff_cbs_append_unit_data(frag,
nal->type,
267 size_t data_size,
int data_bit_start)
269 size_t rest = data_size - (data_bit_start + 7) / 8;
270 const uint8_t *
pos =
data + data_bit_start / 8;
273 data_size > data_bit_start / 8);
279 goto rbsp_stop_one_bit;
284 if (data_bit_start % 8)
285 put_bits(pbc, 8 - data_bit_start % 8,
302 for (; rest > 4; rest -= 4,
pos += 4)
305 for (; rest > 1; rest--,
pos++)
314 i = rest ? (8 -
i) : (8 -
i - data_bit_start % 8);
328 if (nal_unit_index == 0) {
345 size_t max_size, dp, sp;
346 int err,
i, zero_run;
368 if (i < frag->nb_units - 1)
370 "unaligned padding on non-final NAL unit.\n");
385 for (sp = 0; sp < unit->
data_size; sp++) {
387 if (unit->
data[sp] == 0)
392 if ((unit->
data[sp] & ~3) == 0) {
396 zero_run = unit->
data[sp] == 0;
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
#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 unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
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
int ff_cbs_read_ue_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc, const char *name, const int *subscripts, uint32_t *write_to, uint32_t range_min, uint32_t range_max)
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
int ff_cbs_h2645_read_more_rbsp_data(GetBitContext *gbc)
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Context structure for coded bitstream operations.
int ff_cbs_h2645_fragment_add_nals(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const H2645Packet *packet)
#define AV_LOG_VERBOSE
Detailed information.
CodedBitstreamUnitType type
Codec-specific type of this unit.
static av_unused void put_bits32(PutBitContext *s, uint32_t value)
Write exactly 32 bits into a bitstream.
Coded bitstream unit structure.
int ff_cbs_h2645_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
static int put_bits_left(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 type
uint8_t * data
Pointer to the directly-parsable bitstream form of this unit.
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units_allocated.
int ff_cbs_h2645_unit_requires_zero_byte(enum AVCodecID codec_id, CodedBitstreamUnitType type, int nal_unit_index)
int ff_cbs_write_ue_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, const char *name, const int *subscripts, uint32_t value, uint32_t range_min, uint32_t range_max)
#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.
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
static AVFormatContext * ctx
size_t data_bit_padding
The number of bits which should be ignored in the final byte.
#define MAX_UINT_BITS(length)
#define CBS_TRACE_WRITE_END()
int ff_cbs_read_se_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc, const char *name, const int *subscripts, int32_t *write_to, int32_t range_min, int32_t range_max)
size_t data_size
The number of bytes in the bitstream (including any padding bits in the final byte).
AVBufferRef * av_buffer_create(uint8_t *data, size_t size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
AVCodecID
Identify the syntax and semantics of the bitstream.
#define i(width, name, range_min, range_max)
uint8_t * data
Pointer to the bitstream form of this fragment.
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
size_t data_bit_padding
The number of bits which should be ignored in the final byte.
int ff_cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc, const char *name, const int *subscripts, int32_t value, int32_t range_min, int32_t range_max)
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
static int put_bits_count(PutBitContext *s)
static int FUNC() nal(CodedBitstreamContext *ctx, RWContext *rw, LCEVCRawNAL *current, int nal_unit_type)
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
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
AVBufferRef * rbsp_buffer_ref
#define AV_INPUT_BUFFER_PADDING_SIZE
int ff_cbs_h2645_write_slice_data(CodedBitstreamContext *ctx, PutBitContext *pbc, const uint8_t *data, size_t data_size, int data_bit_start)
static uint8_t * put_bits_ptr(PutBitContext *s)
Return the pointer to the byte where the bitstream writer will put the next bit.
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.
AVBufferRef * data_ref
A reference to the buffer containing data.
int ff_cbs_h2645_payload_extension_present(GetBitContext *gbc, uint32_t payload_size, int cur_pos)
payload_extension_present() - true if we are before the last 1-bit in the payload structure,...
#define CBS_TRACE_READ_START()
int nb_units
Number of units in this fragment.
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
#define CBS_TRACE_READ_END()
#define CBS_TRACE_WRITE_START()