FFmpeg
cbs_h2645.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include "libavutil/attributes.h"
20 #include "libavutil/avassert.h"
21 #include "libavutil/mem.h"
22 
23 #include "bytestream.h"
24 #include "cbs.h"
25 #include "cbs_internal.h"
26 #include "cbs_h2645.h"
27 #include "h264.h"
28 #include "h2645_parse.h"
29 #include "vvc.h"
30 
31 #include "hevc/hevc.h"
32 
33 int ff_cbs_h2645_payload_extension_present(GetBitContext *gbc, uint32_t payload_size,
34  int cur_pos)
35 {
36  int bits_left = payload_size * 8 - cur_pos;
37  return (bits_left > 0 &&
38  (bits_left > 7 || show_bits(gbc, bits_left) & MAX_UINT_BITS(bits_left - 1)));
39 }
40 
42  const char *name, const int *subscripts,
43  uint32_t *write_to,
44  uint32_t range_min, uint32_t range_max)
45 {
46  uint32_t leading_bits, value;
47  int max_length, leading_zeroes;
48 
50 
51  max_length = FFMIN(get_bits_left(gbc), 32);
52 
53  leading_bits = max_length ? show_bits_long(gbc, max_length) : 0;
54  if (leading_bits == 0) {
55  if (max_length >= 32) {
56  av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid ue-golomb code at "
57  "%s: more than 31 zeroes.\n", name);
58  return AVERROR_INVALIDDATA;
59  } else {
60  av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid ue-golomb code at "
61  "%s: bitstream ended.\n", name);
62  return AVERROR_INVALIDDATA;
63  }
64  }
65 
66  leading_zeroes = max_length - 1 - av_log2(leading_bits);
67  skip_bits_long(gbc, leading_zeroes);
68 
69  if (get_bits_left(gbc) < leading_zeroes + 1) {
70  av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid ue-golomb code at "
71  "%s: bitstream ended.\n", name);
72  return AVERROR_INVALIDDATA;
73  }
74 
75  value = get_bits_long(gbc, leading_zeroes + 1) - 1;
76 
78 
79  if (value < range_min || value > range_max) {
80  av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: "
81  "%"PRIu32", but must be in [%"PRIu32",%"PRIu32"].\n",
82  name, value, range_min, range_max);
83  return AVERROR_INVALIDDATA;
84  }
85 
86  *write_to = value;
87  return 0;
88 }
89 
91  const char *name, const int *subscripts,
92  int32_t *write_to,
93  int32_t range_min, int32_t range_max)
94 {
95  uint32_t leading_bits, unsigned_value;
96  int max_length, leading_zeroes;
97  int32_t value;
98 
100 
101  max_length = FFMIN(get_bits_left(gbc), 32);
102 
103  leading_bits = max_length ? show_bits_long(gbc, max_length) : 0;
104  if (leading_bits == 0) {
105  if (max_length >= 32) {
106  av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid se-golomb code at "
107  "%s: more than 31 zeroes.\n", name);
108  return AVERROR_INVALIDDATA;
109  } else {
110  av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid se-golomb code at "
111  "%s: bitstream ended.\n", name);
112  return AVERROR_INVALIDDATA;
113  }
114  }
115 
116  leading_zeroes = max_length - 1 - av_log2(leading_bits);
117  skip_bits_long(gbc, leading_zeroes);
118 
119  if (get_bits_left(gbc) < leading_zeroes + 1) {
120  av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid se-golomb code at "
121  "%s: bitstream ended.\n", name);
122  return AVERROR_INVALIDDATA;
123  }
124 
125  unsigned_value = get_bits_long(gbc, leading_zeroes + 1);
126 
127  if (unsigned_value & 1)
128  value = -(int32_t)(unsigned_value / 2);
129  else
130  value = unsigned_value / 2;
131 
133 
134  if (value < range_min || value > range_max) {
135  av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: "
136  "%"PRId32", but must be in [%"PRId32",%"PRId32"].\n",
137  name, value, range_min, range_max);
138  return AVERROR_INVALIDDATA;
139  }
140 
141  *write_to = value;
142  return 0;
143 }
144 
146  const char *name, const int *subscripts,
147  uint32_t value,
148  uint32_t range_min, uint32_t range_max)
149 {
150  int len;
151 
153 
154  if (value < range_min || value > range_max) {
155  av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: "
156  "%"PRIu32", but must be in [%"PRIu32",%"PRIu32"].\n",
157  name, value, range_min, range_max);
158  return AVERROR_INVALIDDATA;
159  }
160  av_assert0(value != UINT32_MAX);
161 
162  len = av_log2(value + 1);
163  if (put_bits_left(pbc) < 2 * len + 1)
164  return AVERROR(ENOSPC);
165 
166  put_bits(pbc, len, 0);
167  if (len + 1 < 32)
168  put_bits(pbc, len + 1, value + 1);
169  else
170  put_bits32(pbc, value + 1);
171 
173 
174  return 0;
175 }
176 
178  const char *name, const int *subscripts,
179  int32_t value,
180  int32_t range_min, int32_t range_max)
181 {
182  int len;
183  uint32_t uvalue;
184 
186 
187  if (value < range_min || value > range_max) {
188  av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: "
189  "%"PRId32", but must be in [%"PRId32",%"PRId32"].\n",
190  name, value, range_min, range_max);
191  return AVERROR_INVALIDDATA;
192  }
193  av_assert0(value != INT32_MIN);
194 
195  if (value == 0)
196  uvalue = 0;
197  else if (value > 0)
198  uvalue = 2 * (uint32_t)value - 1;
199  else
200  uvalue = 2 * (uint32_t)-value;
201 
202  len = av_log2(uvalue + 1);
203  if (put_bits_left(pbc) < 2 * len + 1)
204  return AVERROR(ENOSPC);
205 
206  put_bits(pbc, len, 0);
207  if (len + 1 < 32)
208  put_bits(pbc, len + 1, uvalue + 1);
209  else
210  put_bits32(pbc, uvalue + 1);
211 
213 
214  return 0;
215 }
216 
218 {
219  int bits_left = get_bits_left(gbc);
220  if (bits_left > 8)
221  return 1;
222  if (bits_left == 0)
223  return 0;
224  if (show_bits(gbc, bits_left) & MAX_UINT_BITS(bits_left - 1))
225  return 1;
226  return 0;
227 }
228 
231  const H2645Packet *packet)
232 {
233  int err, i;
234 
235  for (i = 0; i < packet->nb_nals; i++) {
236  const H2645NAL *nal = &packet->nals[i];
237  AVBufferRef *ref;
238  size_t size = nal->size;
239  enum AVCodecID codec_id = ctx->codec->codec_id;
240 
241  if (codec_id == AV_CODEC_ID_HEVC && nal->nuh_layer_id > 0 &&
242  (nal->type < HEVC_NAL_VPS || nal->type > HEVC_NAL_PPS))
243  continue;
244 
245  // Remove trailing zeroes.
246  while (size > 0 && nal->data[size - 1] == 0)
247  --size;
248  if (size == 0) {
249  av_log(ctx->log_ctx, AV_LOG_VERBOSE, "Discarding empty 0 NAL unit\n");
250  continue;
251  }
252 
253  ref = (nal->data == nal->raw_data) ? frag->data_ref
254  : packet->rbsp.rbsp_buffer_ref;
255 
256  err = ff_cbs_append_unit_data(frag, nal->type,
257  (uint8_t*)nal->data, size, ref);
258  if (err < 0)
259  return err;
260  }
261 
262  return 0;
263 }
264 
266  PutBitContext *pbc, const uint8_t *data,
267  size_t data_size, int data_bit_start)
268 {
269  size_t rest = data_size - (data_bit_start + 7) / 8;
270  const uint8_t *pos = data + data_bit_start / 8;
271 
272  av_assert0(data_bit_start >= 0 &&
273  data_size > data_bit_start / 8);
274 
275  if (data_size * 8 + 8 > put_bits_left(pbc))
276  return AVERROR(ENOSPC);
277 
278  if (!rest)
279  goto rbsp_stop_one_bit;
280 
281  // First copy the remaining bits of the first byte
282  // The above check ensures that we do not accidentally
283  // copy beyond the rbsp_stop_one_bit.
284  if (data_bit_start % 8)
285  put_bits(pbc, 8 - data_bit_start % 8,
286  *pos++ & MAX_UINT_BITS(8 - data_bit_start % 8));
287 
288  if (put_bits_count(pbc) % 8 == 0) {
289  // If the writer is aligned at this point,
290  // memcpy can be used to improve performance.
291  // This happens normally for CABAC.
292  flush_put_bits(pbc);
293  memcpy(put_bits_ptr(pbc), pos, rest);
294  skip_put_bytes(pbc, rest);
295  } else {
296  // If not, we have to copy manually.
297  // rbsp_stop_one_bit forces us to special-case
298  // the last byte.
299  uint8_t temp;
300  int i;
301 
302  for (; rest > 4; rest -= 4, pos += 4)
303  put_bits32(pbc, AV_RB32(pos));
304 
305  for (; rest > 1; rest--, pos++)
306  put_bits(pbc, 8, *pos);
307 
308  rbsp_stop_one_bit:
309  temp = rest ? *pos : *pos & MAX_UINT_BITS(8 - data_bit_start % 8);
310 
311  av_assert0(temp);
312  i = ff_ctz(*pos);
313  temp = temp >> i;
314  i = rest ? (8 - i) : (8 - i - data_bit_start % 8);
315  put_bits(pbc, i, temp);
316  if (put_bits_count(pbc) % 8)
317  put_bits(pbc, 8 - put_bits_count(pbc) % 8, 0);
318  }
319 
320  return 0;
321 }
322 
325  int nal_unit_index)
326 {
327  // Section B.1.2 in H.264, section B.2.2 in H.265, H.266.
328  if (nal_unit_index == 0) {
329  // Assume that this is the first NAL unit in an access unit.
330  return 1;
331  }
332  if (codec_id == AV_CODEC_ID_H264)
333  return type == H264_NAL_SPS || type == H264_NAL_PPS;
334  if (codec_id == AV_CODEC_ID_HEVC)
335  return type == HEVC_NAL_VPS || type == HEVC_NAL_SPS || type == HEVC_NAL_PPS;
336  if (codec_id == AV_CODEC_ID_VVC)
337  return type >= VVC_OPI_NUT && type <= VVC_SUFFIX_APS_NUT;
338  return 0;
339 }
340 
343 {
344  uint8_t *data;
345  size_t max_size, dp, sp;
346  int err, i, zero_run;
347 
348  for (i = 0; i < frag->nb_units; i++) {
349  // Data should already all have been written when we get here.
350  av_assert0(frag->units[i].data);
351  }
352 
353  max_size = 0;
354  for (i = 0; i < frag->nb_units; i++) {
355  // Start code + content with worst-case emulation prevention.
356  max_size += 4 + frag->units[i].data_size * 3 / 2;
357  }
358 
360  if (!data)
361  return AVERROR(ENOMEM);
362 
363  dp = 0;
364  for (i = 0; i < frag->nb_units; i++) {
365  CodedBitstreamUnit *unit = &frag->units[i];
366 
367  if (unit->data_bit_padding > 0) {
368  if (i < frag->nb_units - 1)
369  av_log(ctx->log_ctx, AV_LOG_WARNING, "Probably invalid "
370  "unaligned padding on non-final NAL unit.\n");
371  else
372  frag->data_bit_padding = unit->data_bit_padding;
373  }
374 
375  if (ff_cbs_h2645_unit_requires_zero_byte(ctx->codec->codec_id, unit->type, i)) {
376  // zero_byte
377  data[dp++] = 0;
378  }
379  // start_code_prefix_one_3bytes
380  data[dp++] = 0;
381  data[dp++] = 0;
382  data[dp++] = 1;
383 
384  zero_run = 0;
385  for (sp = 0; sp < unit->data_size; sp++) {
386  if (zero_run < 2) {
387  if (unit->data[sp] == 0)
388  ++zero_run;
389  else
390  zero_run = 0;
391  } else {
392  if ((unit->data[sp] & ~3) == 0) {
393  // emulation_prevention_three_byte
394  data[dp++] = 3;
395  }
396  zero_run = unit->data[sp] == 0;
397  }
398  data[dp++] = unit->data[sp];
399  }
400  }
401 
402  av_assert0(dp <= max_size);
404  if (err)
405  return err;
406  memset(data + dp, 0, AV_INPUT_BUFFER_PADDING_SIZE);
407 
409  NULL, NULL, 0);
410  if (!frag->data_ref) {
411  av_freep(&data);
412  return AVERROR(ENOMEM);
413  }
414 
415  frag->data = data;
416  frag->data_size = dp;
417 
418  return 0;
419 }
H264_NAL_PPS
@ H264_NAL_PPS
Definition: h264.h:42
cbs.h
skip_bits_long
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
Definition: get_bits.h:280
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:216
name
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
Definition: writing_filters.txt:88
show_bits_long
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
Definition: get_bits.h:498
h2645_parse.h
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:694
AVERROR
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
ff_ctz
#define ff_ctz
Definition: intmath.h:105
ff_cbs_read_ue_golomb
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)
Definition: cbs_h2645.c:41
get_bits_long
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
Definition: get_bits.h:424
ff_cbs_h2645_read_more_rbsp_data
int ff_cbs_h2645_read_more_rbsp_data(GetBitContext *gbc)
Definition: cbs_h2645.c:217
put_bits
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Definition: j2kenc.c:154
CodedBitstreamContext
Context structure for coded bitstream operations.
Definition: cbs.h:226
data
const char data[16]
Definition: mxf.c:149
ff_cbs_h2645_fragment_add_nals
int ff_cbs_h2645_fragment_add_nals(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const H2645Packet *packet)
Definition: cbs_h2645.c:229
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:226
CodedBitstreamUnit::type
CodedBitstreamUnitType type
Codec-specific type of this unit.
Definition: cbs.h:81
put_bits32
static av_unused void put_bits32(PutBitContext *s, uint32_t value)
Write exactly 32 bits into a bitstream.
Definition: put_bits.h:301
H2645Packet::nb_nals
int nb_nals
Definition: h2645_parse.h:85
CodedBitstreamUnit
Coded bitstream unit structure.
Definition: cbs.h:77
ff_cbs_h2645_assemble_fragment
int ff_cbs_h2645_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Definition: cbs_h2645.c:341
GetBitContext
Definition: get_bits.h:109
put_bits_left
static int put_bits_left(PutBitContext *s)
Definition: put_bits.h:135
H2645Packet::rbsp
H2645RBSP rbsp
Definition: h2645_parse.h:84
type
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
Definition: writing_filters.txt:86
CodedBitstreamUnit::data
uint8_t * data
Pointer to the directly-parsable bitstream form of this unit.
Definition: cbs.h:88
CodedBitstreamFragment::units
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units_allocated.
Definition: cbs.h:175
ff_cbs_h2645_unit_requires_zero_byte
int ff_cbs_h2645_unit_requires_zero_byte(enum AVCodecID codec_id, CodedBitstreamUnitType type, int nal_unit_index)
Definition: cbs_h2645.c:323
avassert.h
ff_cbs_write_ue_golomb
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)
Definition: cbs_h2645.c:145
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
CodedBitstreamFragment
Coded bitstream fragment structure, combining one or more units.
Definition: cbs.h:129
CodedBitstreamFragment::data_size
size_t data_size
The number of bytes in the bitstream.
Definition: cbs.h:142
HEVC_NAL_VPS
@ HEVC_NAL_VPS
Definition: hevc.h:61
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:42
CodedBitstreamUnitType
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
Definition: cbs.h:54
ctx
static AVFormatContext * ctx
Definition: movenc.c:49
hevc.h
cbs_internal.h
codec_id
enum AVCodecID codec_id
Definition: vaapi_decode.c:410
CodedBitstreamFragment::data_bit_padding
size_t data_bit_padding
The number of bits which should be ignored in the final byte.
Definition: cbs.h:146
MAX_UINT_BITS
#define MAX_UINT_BITS(length)
Definition: cbs_internal.h:238
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
PutBitContext
Definition: put_bits.h:50
CBS_TRACE_WRITE_END
#define CBS_TRACE_WRITE_END()
Definition: cbs_internal.h:297
NULL
#define NULL
Definition: coverity.c:32
bits_left
#define bits_left
Definition: bitstream.h:116
ff_cbs_read_se_golomb
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)
Definition: cbs_h2645.c:90
CodedBitstreamUnit::data_size
size_t data_size
The number of bytes in the bitstream (including any padding bits in the final byte).
Definition: cbs.h:93
av_buffer_create
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.
Definition: buffer.c:55
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: codec_id.h:49
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
HEVC_NAL_SPS
@ HEVC_NAL_SPS
Definition: hevc.h:62
size
int size
Definition: twinvq_data.h:10344
CodedBitstreamFragment::data
uint8_t * data
Pointer to the bitstream form of this fragment.
Definition: cbs.h:135
av_reallocp
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
Definition: mem.c:188
CodedBitstreamUnit::data_bit_padding
size_t data_bit_padding
The number of bits which should be ignored in the final byte.
Definition: cbs.h:99
ff_cbs_write_se_golomb
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)
Definition: cbs_h2645.c:177
AV_RB32
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
Definition: bytestream.h:96
H2645NAL
Definition: h2645_parse.h:34
HEVC_NAL_PPS
@ HEVC_NAL_PPS
Definition: hevc.h:63
AV_CODEC_ID_VVC
@ AV_CODEC_ID_VVC
Definition: codec_id.h:252
attributes.h
vvc.h
H2645Packet::nals
H2645NAL * nals
Definition: h2645_parse.h:83
put_bits_count
static int put_bits_count(PutBitContext *s)
Definition: put_bits.h:90
nal
static int FUNC() nal(CodedBitstreamContext *ctx, RWContext *rw, LCEVCRawNAL *current, int nal_unit_type)
Definition: cbs_lcevc_syntax_template.c:655
show_bits
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
Definition: get_bits.h:373
cbs_h2645.h
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: codec_id.h:228
value
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
Definition: writing_filters.txt:86
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
H2645RBSP::rbsp_buffer_ref
AVBufferRef * rbsp_buffer_ref
Definition: h2645_parse.h:76
len
int len
Definition: vorbis_enc_data.h:426
pos
unsigned int pos
Definition: spdifenc.c:414
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
ff_cbs_h2645_write_slice_data
int ff_cbs_h2645_write_slice_data(CodedBitstreamContext *ctx, PutBitContext *pbc, const uint8_t *data, size_t data_size, int data_bit_start)
Definition: cbs_h2645.c:265
H264_NAL_SPS
@ H264_NAL_SPS
Definition: h264.h:41
put_bits_ptr
static uint8_t * put_bits_ptr(PutBitContext *s)
Return the pointer to the byte where the bitstream writer will put the next bit.
Definition: put_bits.h:402
VVC_SUFFIX_APS_NUT
@ VVC_SUFFIX_APS_NUT
Definition: vvc.h:47
skip_put_bytes
static void skip_put_bytes(PutBitContext *s, int n)
Skip the given number of bytes.
Definition: put_bits.h:411
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:117
temp
else temp
Definition: vf_mcdeint.c:271
VVC_OPI_NUT
@ VVC_OPI_NUT
Definition: vvc.h:41
mem.h
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
flush_put_bits
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
Definition: put_bits.h:153
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
int32_t
int32_t
Definition: audioconvert.c:56
bytestream.h
h264.h
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
CodedBitstreamFragment::data_ref
AVBufferRef * data_ref
A reference to the buffer containing data.
Definition: cbs.h:152
ff_cbs_h2645_payload_extension_present
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,...
Definition: cbs_h2645.c:33
CBS_TRACE_READ_START
#define CBS_TRACE_READ_START()
Definition: cbs_internal.h:251
H2645Packet
Definition: h2645_parse.h:82
av_log2
int av_log2(unsigned v)
Definition: intmath.c:26
CodedBitstreamFragment::nb_units
int nb_units
Number of units in this fragment.
Definition: cbs.h:160
av_realloc
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
Definition: mem.c:155
CBS_TRACE_READ_END
#define CBS_TRACE_READ_END()
Definition: cbs_internal.h:259
CBS_TRACE_WRITE_START
#define CBS_TRACE_WRITE_START()
Definition: cbs_internal.h:289