FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gdv.c
Go to the documentation of this file.
1 /*
2  * Gremlin Digital Video (GDV) decoder
3  * Copyright (c) 2017 Konstantin Shishkov
4  * Copyright (c) 2017 Paul B Mahol
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #include "libavutil/common.h"
24 #include "avcodec.h"
25 #include "bytestream.h"
26 #include "internal.h"
27 
28 typedef struct GDVContext {
30 
34 
35  uint32_t pal[256];
37  unsigned frame_size;
38  unsigned scale_h, scale_v;
39 } GDVContext;
40 
41 typedef struct Bits8 {
44 } Bits8;
45 
46 typedef struct Bits32 {
47  uint32_t queue;
49 } Bits32;
50 
51 #define PREAMBLE_SIZE 4096
52 
54 {
55  GDVContext *gdv = avctx->priv_data;
56  int i, j, k;
57 
58  avctx->pix_fmt = AV_PIX_FMT_PAL8;
59  gdv->frame_size = avctx->width * avctx->height + PREAMBLE_SIZE;
60  gdv->frame = av_calloc(gdv->frame_size, 1);
61  if (!gdv->frame)
62  return AVERROR(ENOMEM);
63 
64  for (i = 0; i < 2; i++) {
65  for (j = 0; j < 256; j++) {
66  for (k = 0; k < 8; k++) {
67  gdv->frame[i * 2048 + j * 8 + k] = j;
68  }
69  }
70  }
71 
72  return 0;
73 }
74 
75 static void rescale(GDVContext *gdv, uint8_t *dst, int w, int h, int scale_v, int scale_h)
76 {
77  int j, y, x;
78 
79  if ((gdv->scale_v == scale_v) && (gdv->scale_h == scale_h)) {
80  return;
81  }
82 
83  if (gdv->scale_v) {
84  for (j = 0; j < h; j++) {
85  int y = h - j - 1;
86  uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w;
87  uint8_t *src1 = dst + PREAMBLE_SIZE + (y>>!!gdv->scale_h) * (w>>1);
88 
89  for (x = w - 1; x >= 0 && !(x&1); x--) {
90  dst1[x] = src1[(x>>1)];
91  }
92 
93  for (x--; x >= 0; x-=2) {
94  dst1[x ] =
95  dst1[x+1] = src1[(x>>1)];
96  }
97  }
98  } else if (gdv->scale_h) {
99  for (j = 0; j < h; j++) {
100  int y = h - j - 1;
101  uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w;
102  uint8_t *src1 = dst + PREAMBLE_SIZE + (y>>1) * w;
103  memcpy(dst1, src1, w);
104  }
105  }
106 
107  if (scale_h && scale_v) {
108  for (y = 0; y < (h>>1); y++) {
109  uint8_t *dst1 = dst + PREAMBLE_SIZE + y * (w>>1);
110  uint8_t *src1 = dst + PREAMBLE_SIZE + y*2 * w;
111  for (x = 0; x < (w>>1); x++) {
112  dst1[x] = src1[x*2];
113  }
114  }
115  } else if (scale_h) {
116  for (y = 0; y < (h>>1); y++) {
117  uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w;
118  uint8_t *src1 = dst + PREAMBLE_SIZE + y*2 * w;
119  memcpy(dst1, src1, w);
120  }
121  } else if (scale_v) {
122  for (y = 0; y < h; y++) {
123  uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w;
124  for (x = 0; x < (w>>1); x++) {
125  dst1[x] = dst1[x*2];
126  }
127  }
128  }
129 
130  gdv->scale_v = scale_v;
131  gdv->scale_h = scale_h;
132 }
133 
134 static int read_bits2(Bits8 *bits, GetByteContext *gb)
135 {
136  int res;
137 
138  if (bits->fill == 0) {
139  bits->queue |= bytestream2_get_byte(gb);
140  bits->fill = 8;
141  }
142  res = bits->queue >> 6;
143  bits->queue <<= 2;
144  bits->fill -= 2;
145 
146  return res;
147 }
148 
149 static void fill_bits32(Bits32 *bits, GetByteContext *gb)
150 {
151  bits->queue = bytestream2_get_le32(gb);
152  bits->fill = 32;
153 }
154 
155 static int read_bits32(Bits32 *bits, GetByteContext *gb, int nbits)
156 {
157  int res = bits->queue & ((1 << nbits) - 1);
158 
159  bits->queue >>= nbits;
160  bits->fill -= nbits;
161  if (bits->fill <= 16) {
162  bits->queue |= bytestream2_get_le16(gb) << bits->fill;
163  bits->fill += 16;
164  }
165 
166  return res;
167 }
168 
169 static void lz_copy(PutByteContext *pb, GetByteContext *g2, int offset, unsigned len)
170 {
171  int i;
172 
173  if (offset == -1) {
174  int c;
175 
176  bytestream2_seek(g2, bytestream2_tell_p(pb) - 1, SEEK_SET);
177  c = bytestream2_get_byte(g2);
178  for (i = 0; i < len; i++) {
179  bytestream2_put_byte(pb, c);
180  }
181  } else if (offset < 0) {
182  int start = bytestream2_tell_p(pb) - (-offset);
183 
184  bytestream2_seek(g2, start, SEEK_SET);
185  for (i = 0; i < len; i++) {
186  bytestream2_put_byte(pb, bytestream2_get_byte(g2));
187  }
188  } else {
189  int start = bytestream2_tell_p(pb) + offset;
190 
191  bytestream2_seek(g2, start, SEEK_SET);
192  for (i = 0; i < len; i++) {
193  bytestream2_put_byte(pb, bytestream2_get_byte(g2));
194  }
195  }
196 }
197 
198 static int decompress_2(AVCodecContext *avctx)
199 {
200  GDVContext *gdv = avctx->priv_data;
201  GetByteContext *gb = &gdv->gb;
202  GetByteContext *g2 = &gdv->g2;
203  PutByteContext *pb = &gdv->pb;
204  Bits8 bits = { 0 };
205  int c, i;
206 
207  bytestream2_init(g2, gdv->frame, gdv->frame_size);
209 
210  for (c = 0; c < 256; c++) {
211  for (i = 0; i < 16; i++) {
212  gdv->frame[c * 16 + i] = c;
213  }
214  }
215 
216  while (bytestream2_get_bytes_left_p(pb) > 0 && bytestream2_get_bytes_left(gb) > 0) {
217  int tag = read_bits2(&bits, gb);
218  if (tag == 0) {
219  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
220  } else if (tag == 1) {
221  int b = bytestream2_get_byte(gb);
222  int len = (b & 0xF) + 3;
223  int top = (b >> 4) & 0xF;
224  int off = (bytestream2_get_byte(gb) << 4) + top - 4096;
225  lz_copy(pb, g2, off, len);
226  } else if (tag == 2) {
227  int len = (bytestream2_get_byte(gb)) + 2;
228  bytestream2_skip_p(pb, len);
229  } else {
230  break;
231  }
232  }
233 
234  if (bytestream2_get_bytes_left_p(pb) > 0)
235  return AVERROR_INVALIDDATA;
236 
237  return 0;
238 }
239 
240 static int decompress_5(AVCodecContext *avctx, unsigned skip)
241 {
242  GDVContext *gdv = avctx->priv_data;
243  GetByteContext *gb = &gdv->gb;
244  GetByteContext *g2 = &gdv->g2;
245  PutByteContext *pb = &gdv->pb;
246  Bits8 bits = { 0 };
247 
248  bytestream2_init(g2, gdv->frame, gdv->frame_size);
249  bytestream2_skip_p(pb, skip + PREAMBLE_SIZE);
250 
251  while (bytestream2_get_bytes_left_p(pb) > 0 && bytestream2_get_bytes_left(gb) > 0) {
252  int tag = read_bits2(&bits, gb);
253  if (tag == 0) {
254  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
255  } else if (tag == 1) {
256  int b = bytestream2_get_byte(gb);
257  int len = (b & 0xF) + 3;
258  int top = b >> 4;
259  int off = (bytestream2_get_byte(gb) << 4) + top - 4096;
260  lz_copy(pb, g2, off, len);
261  } else if (tag == 2) {
262  int len;
263  int b = bytestream2_get_byte(gb);
264  if (b == 0) {
265  break;
266  }
267  if (b != 0xFF) {
268  len = b;
269  } else {
270  len = bytestream2_get_le16(gb);
271  }
272  bytestream2_skip_p(pb, len + 1);
273  } else {
274  int b = bytestream2_get_byte(gb);
275  int len = (b & 0x3) + 2;
276  int off = -(b >> 2) - 1;
277  lz_copy(pb, g2, off, len);
278  }
279  }
280  return 0;
281 }
282 
283 static int decompress_68(AVCodecContext *avctx, unsigned skip, unsigned use8)
284 {
285  GDVContext *gdv = avctx->priv_data;
286  GetByteContext *gb = &gdv->gb;
287  GetByteContext *g2 = &gdv->g2;
288  PutByteContext *pb = &gdv->pb;
289  Bits32 bits;
290 
291  bytestream2_init(g2, gdv->frame, gdv->frame_size);
292  bytestream2_skip_p(pb, skip + PREAMBLE_SIZE);
293  fill_bits32(&bits, gb);
294 
295  while (bytestream2_get_bytes_left_p(pb) > 0 && bytestream2_get_bytes_left(gb) > 0) {
296  int tag = read_bits32(&bits, gb, 2);
297  if (tag == 0) {
298  int b = read_bits32(&bits, gb, 1);
299  if (b == 0) {
300  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
301  } else {
302  int i, len = 2;
303  int lbits = 0;
304  while (1) {
305  int val;
306 
307  lbits += 1;
308  val = read_bits32(&bits, gb, lbits);
309  len += val;
310  if (val != ((1 << lbits) - 1)) {
311  break;
312  }
313  assert(lbits < 16);
314  }
315  for (i = 0; i < len; i++) {
316  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
317  }
318  }
319  } else if (tag == 1) {
320  int b = read_bits32(&bits, gb, 1);
321  int len;
322 
323  if (b == 0) {
324  len = (read_bits32(&bits, gb, 4)) + 2;
325  } else {
326  int bb = bytestream2_get_byte(gb);
327  if ((bb & 0x80) == 0) {
328  len = bb + 18;
329  } else {
330  int top = (bb & 0x7F) << 8;
331  len = top + bytestream2_get_byte(gb) + 146;
332  }
333  }
334  bytestream2_skip_p(pb, len);
335  } else if (tag == 2) {
336  int i, subtag = read_bits32(&bits, gb, 2);
337 
338  if (subtag != 3) {
339  int top = (read_bits32(&bits, gb, 4)) << 8;
340  int offs = top + bytestream2_get_byte(gb);
341  if ((subtag != 0) || (offs <= 0xF80)) {
342  int len = (subtag) + 3;
343  lz_copy(pb, g2, (offs) - 4096, len);
344  } else {
345  int real_off, len, c1, c2;
346 
347  if (offs == 0xFFF) {
348  return 0;
349  }
350 
351  real_off = ((offs >> 4) & 0x7) + 1;
352  len = ((offs & 0xF) + 2) * 2;
353  c1 = gdv->frame[bytestream2_tell_p(pb) - real_off];
354  c2 = gdv->frame[bytestream2_tell_p(pb) - real_off + 1];
355  for (i = 0; i < len/2; i++) {
356  bytestream2_put_byte(pb, c1);
357  bytestream2_put_byte(pb, c2);
358  }
359  }
360  } else {
361  int b = bytestream2_get_byte(gb);
362  int off = ((b & 0x7F)) + 1;
363  int len = ((b & 0x80) == 0) ? 2 : 3;
364 
365  lz_copy(pb, g2, -off, len);
366  }
367  } else {
368  int len;
369  int off;
370  if (use8) {
371  int q, b = bytestream2_get_byte(gb);
372  if ((b & 0xC0) == 0xC0) {
373  len = ((b & 0x3F)) + 8;
374  q = read_bits32(&bits, gb, 4);
375  off = (q << 8) + (bytestream2_get_byte(gb)) + 1;
376  } else {
377  int ofs1;
378  if ((b & 0x80) == 0) {
379  len = ((b >> 4)) + 6;
380  ofs1 = (b & 0xF);
381  } else {
382  len = ((b & 0x3F)) + 14;
383  ofs1 = read_bits32(&bits, gb, 4);
384  }
385  off = (ofs1 << 8) + (bytestream2_get_byte(gb)) - 4096;
386  }
387  } else {
388  int ofs1, b = bytestream2_get_byte(gb);
389 
390  if ((b >> 4) == 0xF) {
391  len = bytestream2_get_byte(gb) + 21;
392  } else {
393  len = (b >> 4) + 6;
394  }
395  ofs1 = (b & 0xF);
396  off = (ofs1 << 8) + bytestream2_get_byte(gb) - 4096;
397  }
398  lz_copy(pb, g2, off, len);
399  }
400  }
401 
402  return 0;
403 }
404 
405 static int gdv_decode_frame(AVCodecContext *avctx, void *data,
406  int *got_frame, AVPacket *avpkt)
407 {
408  GDVContext *gdv = avctx->priv_data;
409  GetByteContext *gb = &gdv->gb;
410  PutByteContext *pb = &gdv->pb;
411  AVFrame *frame = data;
412  int ret, i, pal_size;
413  const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
414  int compression;
415  unsigned flags;
416  uint8_t *dst;
417 
418  bytestream2_init(gb, avpkt->data, avpkt->size);
419  bytestream2_init_writer(pb, gdv->frame, gdv->frame_size);
420 
421  flags = bytestream2_get_le32(gb);
422  compression = flags & 0xF;
423 
424  if (compression == 4 || compression == 7 || compression > 8)
425  return AVERROR_INVALIDDATA;
426 
427  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
428  return ret;
429  if (pal && pal_size == AVPALETTE_SIZE)
430  memcpy(gdv->pal, pal, AVPALETTE_SIZE);
431 
432  rescale(gdv, gdv->frame, avctx->width, avctx->height,
433  !!(flags & 0x10), !!(flags & 0x20));
434 
435  switch (compression) {
436  case 1:
437  memset(gdv->frame + PREAMBLE_SIZE, 0, gdv->frame_size - PREAMBLE_SIZE);
438  case 0:
439  if (bytestream2_get_bytes_left(gb) < 256*3)
440  return AVERROR_INVALIDDATA;
441  for (i = 0; i < 256; i++) {
442  unsigned r = bytestream2_get_byte(gb);
443  unsigned g = bytestream2_get_byte(gb);
444  unsigned b = bytestream2_get_byte(gb);
445  gdv->pal[i] = 0xFFU << 24 | r << 18 | g << 10 | b << 2;
446  }
447  break;
448  case 2:
449  ret = decompress_2(avctx);
450  break;
451  case 3:
452  break;
453  case 5:
454  ret = decompress_5(avctx, flags >> 8);
455  break;
456  case 6:
457  ret = decompress_68(avctx, flags >> 8, 0);
458  break;
459  case 8:
460  ret = decompress_68(avctx, flags >> 8, 1);
461  break;
462  default:
463  av_assert0(0);
464  }
465  if (ret < 0)
466  return ret;
467 
468  memcpy(frame->data[1], gdv->pal, AVPALETTE_SIZE);
469  dst = frame->data[0];
470 
471  if (!gdv->scale_v && !gdv->scale_h) {
472  int sidx = PREAMBLE_SIZE, didx = 0;
473  int y, x;
474 
475  for (y = 0; y < avctx->height; y++) {
476  for (x = 0; x < avctx->width; x++) {
477  dst[x+didx] = gdv->frame[x+sidx];
478  }
479  sidx += avctx->width;
480  didx += frame->linesize[0];
481  }
482  } else {
483  int sidx = PREAMBLE_SIZE, didx = 0;
484  int y, x;
485 
486  for (y = 0; y < avctx->height; y++) {
487  if (!gdv->scale_v) {
488  memcpy(dst + didx, gdv->frame + sidx, avctx->width);
489  } else {
490  for (x = 0; x < avctx->width - 1; x+=2) {
491  dst[didx + x ] =
492  dst[didx + x + 1] = gdv->frame[sidx + (x>>1)];
493  }
494  for (; x < avctx->width; x++) {
495  dst[didx + x] = gdv->frame[sidx + (x>>1)];
496  }
497  }
498  if (!gdv->scale_h || ((y & 1) == 1)) {
499  sidx += !gdv->scale_v ? avctx->width : avctx->width/2;
500  }
501  didx += frame->linesize[0];
502  }
503  }
504 
505  *got_frame = 1;
506 
507  return ret < 0 ? ret : avpkt->size;
508 }
509 
511 {
512  GDVContext *gdv = avctx->priv_data;
513  av_freep(&gdv->frame);
514  return 0;
515 }
516 
518  .name = "gdv",
519  .long_name = NULL_IF_CONFIG_SMALL("Gremlin Digital Video"),
520  .type = AVMEDIA_TYPE_VIDEO,
521  .id = AV_CODEC_ID_GDV,
522  .priv_data_size = sizeof(GDVContext),
524  .close = gdv_decode_close,
526  .capabilities = AV_CODEC_CAP_DR1,
527  .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
528 };
const char const char void * val
Definition: avisynth_c.h:771
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
GetByteContext gb
Definition: gdv.c:31
This structure describes decoded (raw) audio or video data.
Definition: frame.h:226
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
const char * g
Definition: vf_curves.c:115
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
int size
Definition: avcodec.h:1445
const char * b
Definition: vf_curves.c:116
static av_always_inline void bytestream2_init_writer(PutByteContext *p, uint8_t *buf, int buf_size)
Definition: bytestream.h:143
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1742
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition: bytestream.h:133
AVCodec ff_gdv_decoder
Definition: gdv.c:517
AVCodec.
Definition: avcodec.h:3423
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:42
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
Definition: mem.c:244
unsigned scale_h
Definition: gdv.c:38
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:40
uint8_t
#define av_cold
Definition: attributes.h:82
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:77
#define AVPALETTE_SIZE
Definition: pixfmt.h:32
static AVFrame * frame
uint8_t fill
Definition: gdv.c:43
uint8_t * data
Definition: avcodec.h:1444
uint32_t tag
Definition: movenc.c:1483
static const uint64_t c1
Definition: murmur3.c:49
static int gdv_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: gdv.c:405
unsigned scale_v
Definition: gdv.c:38
uint32_t pal[256]
Definition: gdv.c:35
#define U(x)
Definition: vp56_arith.h:37
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette...
Definition: avcodec.h:1157
static av_always_inline unsigned int bytestream2_get_bytes_left_p(PutByteContext *p)
Definition: bytestream.h:159
#define AVERROR(e)
Definition: error.h:43
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
Definition: avpacket.c:350
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
const char * r
Definition: vf_curves.c:114
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
Definition: bytestream.h:154
Definition: gdv.c:28
uint8_t queue
Definition: gdv.c:42
const char * name
Name of the codec implementation.
Definition: avcodec.h:3430
static const uint8_t offset[127][2]
Definition: vf_spp.c:92
static av_always_inline int bytestream2_tell_p(PutByteContext *p)
Definition: bytestream.h:193
static av_always_inline void bytestream2_skip_p(PutByteContext *p, unsigned int size)
Definition: bytestream.h:176
static void rescale(GDVContext *gdv, uint8_t *dst, int w, int h, int scale_v, int scale_h)
Definition: gdv.c:75
int width
picture width / height.
Definition: avcodec.h:1705
uint8_t w
Definition: llviddspenc.c:38
#define src1
Definition: h264pred.c:139
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:257
main external API structure.
Definition: avcodec.h:1532
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1922
static av_cold int gdv_decode_close(AVCodecContext *avctx)
Definition: gdv.c:510
uint8_t fill
Definition: gdv.c:48
static void fill_bits32(Bits32 *bits, GetByteContext *gb)
Definition: gdv.c:149
static int decompress_68(AVCodecContext *avctx, unsigned skip, unsigned use8)
Definition: gdv.c:283
static int read_bits32(Bits32 *bits, GetByteContext *gb, int nbits)
Definition: gdv.c:155
static av_cold int gdv_decode_init(AVCodecContext *avctx)
Definition: gdv.c:53
static int decompress_5(AVCodecContext *avctx, unsigned skip)
Definition: gdv.c:240
#define PREAMBLE_SIZE
Definition: gdv.c:51
#define flags(name, subs,...)
Definition: cbs_av1.c:596
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:240
static void lz_copy(PutByteContext *pb, GetByteContext *g2, int offset, unsigned len)
Definition: gdv.c:169
static int decompress_2(AVCodecContext *avctx)
Definition: gdv.c:198
common internal api header.
common internal and external API header
Definition: gdv.c:46
static double c[64]
unsigned frame_size
Definition: gdv.c:37
uint8_t * frame
Definition: gdv.c:36
static const uint64_t c2
Definition: murmur3.c:50
Definition: gdv.c:41
void * priv_data
Definition: avcodec.h:1559
int len
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
Definition: bytestream.h:208
#define av_freep(p)
void INT64 start
Definition: avisynth_c.h:690
AVCodecContext * avctx
Definition: gdv.c:29
This structure stores compressed data.
Definition: avcodec.h:1421
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:967
uint32_t queue
Definition: gdv.c:47
PutByteContext pb
Definition: gdv.c:33
GetByteContext g2
Definition: gdv.c:32
static int read_bits2(Bits8 *bits, GetByteContext *gb)
Definition: gdv.c:134