FFmpeg
cbs_jpeg.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 "cbs.h"
20 #include "cbs_internal.h"
21 #include "cbs_jpeg.h"
22 
23 
24 #define HEADER(name) do { \
25  ff_cbs_trace_header(ctx, name); \
26  } while (0)
27 
28 #define CHECK(call) do { \
29  err = (call); \
30  if (err < 0) \
31  return err; \
32  } while (0)
33 
34 #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL)
35 
36 #define u(width, name, range_min, range_max) \
37  xu(width, name, range_min, range_max, 0, )
38 #define us(width, name, sub, range_min, range_max) \
39  xu(width, name, range_min, range_max, 1, sub)
40 
41 
42 #define READ
43 #define READWRITE read
44 #define RWContext GetBitContext
45 #define FUNC(name) cbs_jpeg_read_ ## name
46 
47 #define xu(width, name, range_min, range_max, subs, ...) do { \
48  uint32_t value; \
49  CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \
50  SUBSCRIPTS(subs, __VA_ARGS__), \
51  &value, range_min, range_max)); \
52  current->name = value; \
53  } while (0)
54 
56 
57 #undef READ
58 #undef READWRITE
59 #undef RWContext
60 #undef FUNC
61 #undef xu
62 
63 #define WRITE
64 #define READWRITE write
65 #define RWContext PutBitContext
66 #define FUNC(name) cbs_jpeg_write_ ## name
67 
68 #define xu(width, name, range_min, range_max, subs, ...) do { \
69  uint32_t value = current->name; \
70  CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \
71  SUBSCRIPTS(subs, __VA_ARGS__), \
72  value, range_min, range_max)); \
73  } while (0)
74 
75 
77 
78 #undef WRITE
79 #undef READWRITE
80 #undef RWContext
81 #undef FUNC
82 #undef xu
83 
84 
87  int header)
88 {
89  AVBufferRef *data_ref;
90  uint8_t *data;
91  size_t data_size;
92  int start, end, marker, next_start, next_marker;
93  int err, i, j, length;
94 
95  if (frag->data_size < 4) {
96  // Definitely too short to be meaningful.
97  return AVERROR_INVALIDDATA;
98  }
99 
100  for (i = 0; i + 1 < frag->data_size && frag->data[i] != 0xff; i++);
101  if (i > 0) {
102  av_log(ctx->log_ctx, AV_LOG_WARNING, "Discarding %d bytes at "
103  "beginning of image.\n", i);
104  }
105  for (++i; i + 1 < frag->data_size && frag->data[i] == 0xff; i++);
106  if (i + 1 >= frag->data_size && frag->data[i]) {
107  av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid JPEG image: "
108  "no SOI marker found.\n");
109  return AVERROR_INVALIDDATA;
110  }
111  marker = frag->data[i];
112  if (marker != JPEG_MARKER_SOI) {
113  av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid JPEG image: first "
114  "marker is %02x, should be SOI.\n", marker);
115  return AVERROR_INVALIDDATA;
116  }
117  for (++i; i + 1 < frag->data_size && frag->data[i] == 0xff; i++);
118  if (i + 1 >= frag->data_size) {
119  av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid JPEG image: "
120  "no image content found.\n");
121  return AVERROR_INVALIDDATA;
122  }
123  marker = frag->data[i];
124  start = i + 1;
125 
126  do {
127  if (marker == JPEG_MARKER_EOI) {
128  break;
129  } else if (marker == JPEG_MARKER_SOS) {
130  next_marker = -1;
131  end = start;
132  for (i = start; i + 1 < frag->data_size; i++) {
133  if (frag->data[i] != 0xff)
134  continue;
135  end = i;
136  for (++i; i + 1 < frag->data_size &&
137  frag->data[i] == 0xff; i++);
138  if (i + 1 < frag->data_size) {
139  if (frag->data[i] == 0x00)
140  continue;
141  next_marker = frag->data[i];
142  next_start = i + 1;
143  }
144  break;
145  }
146  } else {
147  i = start;
148  if (i + 2 > frag->data_size) {
149  av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid JPEG image: "
150  "truncated at %02x marker.\n", marker);
151  return AVERROR_INVALIDDATA;
152  }
153  length = AV_RB16(frag->data + i);
154  if (i + length > frag->data_size) {
155  av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid JPEG image: "
156  "truncated at %02x marker segment.\n", marker);
157  return AVERROR_INVALIDDATA;
158  }
159  end = start + length;
160 
161  i = end;
162  if (frag->data[i] != 0xff) {
163  next_marker = -1;
164  } else {
165  for (++i; i + 1 < frag->data_size &&
166  frag->data[i] == 0xff; i++);
167  if (i + 1 >= frag->data_size) {
168  next_marker = -1;
169  } else {
170  next_marker = frag->data[i];
171  next_start = i + 1;
172  }
173  }
174  }
175 
176  if (marker == JPEG_MARKER_SOS) {
177  length = AV_RB16(frag->data + start);
178 
179  if (length > end - start)
180  return AVERROR_INVALIDDATA;
181 
182  data_ref = NULL;
183  data = av_malloc(end - start +
185  if (!data)
186  return AVERROR(ENOMEM);
187 
188  memcpy(data, frag->data + start, length);
189  for (i = start + length, j = length; i < end; i++, j++) {
190  if (frag->data[i] == 0xff) {
191  while (frag->data[i] == 0xff)
192  ++i;
193  data[j] = 0xff;
194  } else {
195  data[j] = frag->data[i];
196  }
197  }
198  data_size = j;
199 
200  memset(data + data_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
201 
202  } else {
203  data = frag->data + start;
204  data_size = end - start;
205  data_ref = frag->data_ref;
206  }
207 
208  err = ff_cbs_append_unit_data(frag, marker,
209  data, data_size, data_ref);
210  if (err < 0)
211  return err;
212 
213  marker = next_marker;
214  start = next_start;
215  } while (next_marker != -1);
216 
217  return 0;
218 }
219 
221  CodedBitstreamUnit *unit)
222 {
223  GetBitContext gbc;
224  int err;
225 
226  err = init_get_bits(&gbc, unit->data, 8 * unit->data_size);
227  if (err < 0)
228  return err;
229 
230  err = ff_cbs_alloc_unit_content(ctx, unit);
231  if (err < 0)
232  return err;
233 
234  if (unit->type >= JPEG_MARKER_SOF0 &&
235  unit->type <= JPEG_MARKER_SOF3) {
236  err = cbs_jpeg_read_frame_header(ctx, &gbc, unit->content);
237  if (err < 0)
238  return err;
239 
240  } else if (unit->type >= JPEG_MARKER_APPN &&
241  unit->type <= JPEG_MARKER_APPN + 15) {
242  err = cbs_jpeg_read_application_data(ctx, &gbc, unit->content);
243  if (err < 0)
244  return err;
245 
246  } else if (unit->type == JPEG_MARKER_SOS) {
247  JPEGRawScan *scan = unit->content;
248  int pos;
249 
250  err = cbs_jpeg_read_scan_header(ctx, &gbc, &scan->header);
251  if (err < 0)
252  return err;
253 
254  pos = get_bits_count(&gbc);
255  av_assert0(pos % 8 == 0);
256  if (pos > 0) {
257  scan->data_size = unit->data_size - pos / 8;
258  scan->data_ref = av_buffer_ref(unit->data_ref);
259  if (!scan->data_ref)
260  return AVERROR(ENOMEM);
261  scan->data = unit->data + pos / 8;
262  }
263 
264  } else {
265  switch (unit->type) {
266 #define SEGMENT(marker, func) \
267  case JPEG_MARKER_ ## marker: \
268  { \
269  err = cbs_jpeg_read_ ## func(ctx, &gbc, unit->content); \
270  if (err < 0) \
271  return err; \
272  } \
273  break
274  SEGMENT(DQT, dqt);
275  SEGMENT(DHT, dht);
276  SEGMENT(COM, comment);
277 #undef SEGMENT
278  default:
279  return AVERROR(ENOSYS);
280  }
281  }
282 
283  return 0;
284 }
285 
287  CodedBitstreamUnit *unit,
288  PutBitContext *pbc)
289 {
290  JPEGRawScan *scan = unit->content;
291  int err;
292 
293  err = cbs_jpeg_write_scan_header(ctx, pbc, &scan->header);
294  if (err < 0)
295  return err;
296 
297  if (scan->data) {
298  if (scan->data_size * 8 > put_bits_left(pbc))
299  return AVERROR(ENOSPC);
300 
301  av_assert0(put_bits_count(pbc) % 8 == 0);
302 
303  flush_put_bits(pbc);
304 
305  memcpy(put_bits_ptr(pbc), scan->data, scan->data_size);
306  skip_put_bytes(pbc, scan->data_size);
307  }
308 
309  return 0;
310 }
311 
313  CodedBitstreamUnit *unit,
314  PutBitContext *pbc)
315 {
316  int err;
317 
318  if (unit->type >= JPEG_MARKER_SOF0 &&
319  unit->type <= JPEG_MARKER_SOF3) {
320  err = cbs_jpeg_write_frame_header(ctx, pbc, unit->content);
321  } else if (unit->type >= JPEG_MARKER_APPN &&
322  unit->type <= JPEG_MARKER_APPN + 15) {
323  err = cbs_jpeg_write_application_data(ctx, pbc, unit->content);
324  } else {
325  switch (unit->type) {
326 #define SEGMENT(marker, func) \
327  case JPEG_MARKER_ ## marker: \
328  err = cbs_jpeg_write_ ## func(ctx, pbc, unit->content); \
329  break;
330  SEGMENT(DQT, dqt);
331  SEGMENT(DHT, dht);
332  SEGMENT(COM, comment);
333  default:
334  return AVERROR_PATCHWELCOME;
335  }
336  }
337 
338  return err;
339 }
340 
342  CodedBitstreamUnit *unit,
343  PutBitContext *pbc)
344 {
345  if (unit->type == JPEG_MARKER_SOS)
346  return cbs_jpeg_write_scan (ctx, unit, pbc);
347  else
348  return cbs_jpeg_write_segment(ctx, unit, pbc);
349 }
350 
353 {
354  const CodedBitstreamUnit *unit;
355  uint8_t *data;
356  size_t size, dp, sp;
357  int i;
358 
359  size = 4; // SOI + EOI.
360  for (i = 0; i < frag->nb_units; i++) {
361  unit = &frag->units[i];
362  size += 2 + unit->data_size;
363  if (unit->type == JPEG_MARKER_SOS) {
364  for (sp = 0; sp < unit->data_size; sp++) {
365  if (unit->data[sp] == 0xff)
366  ++size;
367  }
368  }
369  }
370 
372  if (!frag->data_ref)
373  return AVERROR(ENOMEM);
374  data = frag->data_ref->data;
375 
376  dp = 0;
377 
378  data[dp++] = 0xff;
379  data[dp++] = JPEG_MARKER_SOI;
380 
381  for (i = 0; i < frag->nb_units; i++) {
382  unit = &frag->units[i];
383 
384  data[dp++] = 0xff;
385  data[dp++] = unit->type;
386 
387  if (unit->type != JPEG_MARKER_SOS) {
388  memcpy(data + dp, unit->data, unit->data_size);
389  dp += unit->data_size;
390  } else {
391  sp = AV_RB16(unit->data);
392  av_assert0(sp <= unit->data_size);
393  memcpy(data + dp, unit->data, sp);
394  dp += sp;
395 
396  for (; sp < unit->data_size; sp++) {
397  if (unit->data[sp] == 0xff) {
398  data[dp++] = 0xff;
399  data[dp++] = 0x00;
400  } else {
401  data[dp++] = unit->data[sp];
402  }
403  }
404  }
405  }
406 
407  data[dp++] = 0xff;
408  data[dp++] = JPEG_MARKER_EOI;
409 
410  av_assert0(dp == size);
411 
412  memset(data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
413  frag->data = data;
414  frag->data_size = size;
415 
416  return 0;
417 }
418 
421 
424 
426 
429 
431 
433 };
434 
437 
438  .unit_types = cbs_jpeg_unit_types,
439 
440  .split_fragment = &cbs_jpeg_split_fragment,
441  .read_unit = &cbs_jpeg_read_unit,
442  .write_unit = &cbs_jpeg_write_unit,
443  .assemble_fragment = &cbs_jpeg_assemble_fragment,
444 };
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
JPEG_MARKER_EOI
@ JPEG_MARKER_EOI
Definition: cbs_jpeg.h:36
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
cbs_jpeg.h
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:90
CodedBitstreamUnit::content
void * content
Pointer to the decomposed form of this unit.
Definition: cbs.h:106
JPEG_MARKER_COM
@ JPEG_MARKER_COM
Definition: cbs_jpeg.h:42
get_bits_count
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:219
cbs_jpeg_syntax_template.c
JPEGRawScan::data_ref
AVBufferRef * data_ref
Definition: cbs_jpeg.h:83
CodedBitstreamContext
Context structure for coded bitstream operations.
Definition: cbs.h:173
data
const char data[16]
Definition: mxf.c:146
JPEG_MARKER_DHT
@ JPEG_MARKER_DHT
Definition: cbs_jpeg.h:34
CBS_UNIT_RANGE_POD
#define CBS_UNIT_RANGE_POD(range_start, range_end, structure)
Definition: cbs_internal.h:202
CodedBitstreamUnit::type
CodedBitstreamUnitType type
Codec-specific type of this unit.
Definition: cbs.h:73
cbs.h
JPEGRawScan::data
uint8_t * data
Definition: cbs_jpeg.h:82
av_buffer_ref
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition: buffer.c:103
init_get_bits
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:649
CodedBitstreamUnit
Coded bitstream unit structure.
Definition: cbs.h:69
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
cbs_jpeg_write_segment
static int cbs_jpeg_write_segment(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
Definition: cbs_jpeg.c:312
SEGMENT
#define SEGMENT(marker, func)
CBS_UNIT_TYPE_INTERNAL_REF
#define CBS_UNIT_TYPE_INTERNAL_REF(type, structure, ref_field)
Definition: cbs_internal.h:219
GetBitContext
Definition: get_bits.h:61
JPEGRawScan::data_size
size_t data_size
Definition: cbs_jpeg.h:84
put_bits_left
static int put_bits_left(PutBitContext *s)
Definition: put_bits.h:125
JPEGRawQuantisationTableSpecification
Definition: cbs_jpeg.h:93
CodedBitstreamUnit::data
uint8_t * data
Pointer to the directly-parsable bitstream form of this unit.
Definition: cbs.h:80
JPEG_MARKER_SOS
@ JPEG_MARKER_SOS
Definition: cbs_jpeg.h:37
CodedBitstreamFragment::units
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units_allocated.
Definition: cbs.h:167
CodedBitstreamUnitTypeDescriptor
Definition: cbs_internal.h:55
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
COM
@ COM
Definition: mjpeg.h:111
cbs_jpeg_unit_types
static const CodedBitstreamUnitTypeDescriptor cbs_jpeg_unit_types[]
Definition: cbs_jpeg.c:419
CodedBitstreamFragment
Coded bitstream fragment structure, combining one or more units.
Definition: cbs.h:121
CodedBitstreamFragment::data_size
size_t data_size
The number of bytes in the bitstream.
Definition: cbs.h:134
cbs_jpeg_assemble_fragment
static int cbs_jpeg_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Definition: cbs_jpeg.c:351
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
JPEG_MARKER_SOF0
@ JPEG_MARKER_SOF0
Definition: cbs_jpeg.h:29
ctx
AVFormatContext * ctx
Definition: movenc.c:48
ff_cbs_append_unit_data
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.
Definition: cbs.c:813
cbs_internal.h
CodedBitstreamType::codec_id
enum AVCodecID codec_id
Definition: cbs_internal.h:102
JPEG_MARKER_SOF3
@ JPEG_MARKER_SOF3
Definition: cbs_jpeg.h:32
PutBitContext
Definition: put_bits.h:50
cbs_jpeg_write_scan
static int cbs_jpeg_write_scan(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
Definition: cbs_jpeg.c:286
NULL
#define NULL
Definition: coverity.c:32
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
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:85
JPEG_MARKER_SOI
@ JPEG_MARKER_SOI
Definition: cbs_jpeg.h:35
CBS_UNIT_RANGE_INTERNAL_REF
#define CBS_UNIT_RANGE_INTERNAL_REF(range_start, range_end, structure, ref_field)
Definition: cbs_internal.h:222
cbs_jpeg_read_unit
static int cbs_jpeg_read_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Definition: cbs_jpeg.c:220
JPEGRawHuffmanTableSpecification
Definition: cbs_jpeg.h:105
sp
#define sp
Definition: regdef.h:63
size
int size
Definition: twinvq_data.h:10344
CodedBitstreamFragment::data
uint8_t * data
Pointer to the bitstream form of this fragment.
Definition: cbs.h:127
JPEG_MARKER_DQT
@ JPEG_MARKER_DQT
Definition: cbs_jpeg.h:38
ff_cbs_type_jpeg
const CodedBitstreamType ff_cbs_type_jpeg
Definition: cbs_jpeg.c:435
header
static const uint8_t header[24]
Definition: sdr2.c:67
CBS_UNIT_TYPE_POD
#define CBS_UNIT_TYPE_POD(type_, structure)
Definition: cbs_internal.h:195
CodedBitstreamType
Definition: cbs_internal.h:101
av_buffer_alloc
AVBufferRef * av_buffer_alloc(size_t size)
Allocate an AVBuffer of the given size using av_malloc().
Definition: buffer.c:77
DQT
@ DQT
Definition: mjpeg.h:73
AV_CODEC_ID_MJPEG
@ AV_CODEC_ID_MJPEG
Definition: codec_id.h:59
JPEGRawScan::header
JPEGRawScanHeader header
Definition: cbs_jpeg.h:81
CodedBitstreamUnit::data_ref
AVBufferRef * data_ref
A reference to the buffer containing data.
Definition: cbs.h:97
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
put_bits_count
static int put_bits_count(PutBitContext *s)
Definition: put_bits.h:80
DHT
@ DHT
Definition: mjpeg.h:56
JPEGRawApplicationData
Definition: cbs_jpeg.h:110
cbs_jpeg_split_fragment
static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header)
Definition: cbs_jpeg.c:85
CBS_UNIT_TYPE_END_OF_LIST
#define CBS_UNIT_TYPE_END_OF_LIST
Definition: cbs_internal.h:242
JPEGRawScan
Definition: cbs_jpeg.h:80
comment
static int FUNC() comment(CodedBitstreamContext *ctx, RWContext *rw, JPEGRawComment *current)
Definition: cbs_jpeg_syntax_template.c:174
dht
static int FUNC() dht(CodedBitstreamContext *ctx, RWContext *rw, JPEGRawHuffmanTableSpecification *current)
Definition: cbs_jpeg_syntax_template.c:102
pos
unsigned int pos
Definition: spdifenc.c:412
ff_cbs_alloc_unit_content
int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit)
Allocate a new internal content buffer matching the type of the unit.
Definition: cbs.c:878
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
cbs_jpeg_write_unit
static int cbs_jpeg_write_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc)
Definition: cbs_jpeg.c:341
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:370
skip_put_bytes
static void skip_put_bytes(PutBitContext *s, int n)
Skip the given number of bytes.
Definition: put_bits.h:379
dqt
static int FUNC() dqt(CodedBitstreamContext *ctx, RWContext *rw, JPEGRawQuantisationTableSpecification *current)
Definition: cbs_jpeg_syntax_template.c:62
JPEG_MARKER_APPN
@ JPEG_MARKER_APPN
Definition: cbs_jpeg.h:40
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:143
JPEGRawFrameHeader
Definition: cbs_jpeg.h:53
JPEGRawComment
Definition: cbs_jpeg.h:116
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:144
CodedBitstreamFragment::nb_units
int nb_units
Number of units in this fragment.
Definition: cbs.h:152
AV_RB16
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_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
Definition: bytestream.h:98