FFmpeg  4.2.1
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 scaleup(uint8_t *dst, const uint8_t *src, int w)
76 {
77  int x;
78  for (x = 0; x < w - 7; x+=8) {
79  dst[x + 0] =
80  dst[x + 1] = src[(x>>1) + 0];
81  dst[x + 2] =
82  dst[x + 3] = src[(x>>1) + 1];
83  dst[x + 4] =
84  dst[x + 5] = src[(x>>1) + 2];
85  dst[x + 6] =
86  dst[x + 7] = src[(x>>1) + 3];
87  }
88  for (; x < w; x++) {
89  dst[x] = src[(x>>1)];
90  }
91 }
92 
93 static void scaleup_rev(uint8_t *dst, const uint8_t *src, int w)
94 {
95  int x;
96 
97  for (x = w - 1; (x+1) & 7; x--) {
98  dst[x] = src[(x>>1)];
99  }
100  for (x -= 7; x >= 0; x -= 8) {
101  dst[x + 6] =
102  dst[x + 7] = src[(x>>1) + 3];
103  dst[x + 4] =
104  dst[x + 5] = src[(x>>1) + 2];
105  dst[x + 2] =
106  dst[x + 3] = src[(x>>1) + 1];
107  dst[x + 0] =
108  dst[x + 1] = src[(x>>1) + 0];
109  }
110 }
111 
112 static void scaledown(uint8_t *dst, const uint8_t *src, int w)
113 {
114  int x;
115  for (x = 0; x < w - 7; x+=8) {
116  dst[x + 0] = src[2*x + 0];
117  dst[x + 1] = src[2*x + 2];
118  dst[x + 2] = src[2*x + 4];
119  dst[x + 3] = src[2*x + 6];
120  dst[x + 4] = src[2*x + 8];
121  dst[x + 5] = src[2*x +10];
122  dst[x + 6] = src[2*x +12];
123  dst[x + 7] = src[2*x +14];
124  }
125  for (; x < w; x++) {
126  dst[x] = src[2*x];
127  }
128 }
129 
130 static void rescale(GDVContext *gdv, uint8_t *dst, int w, int h, int scale_v, int scale_h)
131 {
132  int j, y;
133 
134  if ((gdv->scale_v == scale_v) && (gdv->scale_h == scale_h)) {
135  return;
136  }
137 
138  if (gdv->scale_v) {
139  for (j = 0; j < h; j++) {
140  int y = h - j - 1;
141  uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w;
142  uint8_t *src1 = dst + PREAMBLE_SIZE + (y>>!!gdv->scale_h) * (w>>1);
143 
144  scaleup_rev(dst1, src1, w);
145  }
146  } else if (gdv->scale_h) {
147  for (j = 0; j < h; j++) {
148  int y = h - j - 1;
149  uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w;
150  uint8_t *src1 = dst + PREAMBLE_SIZE + (y>>1) * w;
151  memcpy(dst1, src1, w);
152  }
153  }
154 
155  if (scale_h && scale_v) {
156  for (y = 0; y < (h>>1); y++) {
157  uint8_t *dst1 = dst + PREAMBLE_SIZE + y * (w>>1);
158  uint8_t *src1 = dst + PREAMBLE_SIZE + y*2 * w;
159  scaledown(dst1, src1, w>>1);
160  }
161  } else if (scale_h) {
162  for (y = 0; y < (h>>1); y++) {
163  uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w;
164  uint8_t *src1 = dst + PREAMBLE_SIZE + y*2 * w;
165  memcpy(dst1, src1, w);
166  }
167  } else if (scale_v) {
168  for (y = 0; y < h; y++) {
169  uint8_t *dst1 = dst + PREAMBLE_SIZE + y * w;
170  scaledown(dst1, dst1, w>>1);
171  }
172  }
173 
174  gdv->scale_v = scale_v;
175  gdv->scale_h = scale_h;
176 }
177 
179 {
180  int res;
181 
182  if (bits->fill == 0) {
183  bits->queue |= bytestream2_get_byte(gb);
184  bits->fill = 8;
185  }
186  res = bits->queue >> 6;
187  bits->queue <<= 2;
188  bits->fill -= 2;
189 
190  return res;
191 }
192 
194 {
195  bits->queue = bytestream2_get_le32(gb);
196  bits->fill = 32;
197 }
198 
199 static int read_bits32(Bits32 *bits, GetByteContext *gb, int nbits)
200 {
201  int res = bits->queue & ((1 << nbits) - 1);
202 
203  bits->queue >>= nbits;
204  bits->fill -= nbits;
205  if (bits->fill <= 16) {
206  bits->queue |= bytestream2_get_le16(gb) << bits->fill;
207  bits->fill += 16;
208  }
209 
210  return res;
211 }
212 
213 static void lz_copy(PutByteContext *pb, GetByteContext *g2, int offset, unsigned len)
214 {
215  int i;
216 
217  if (offset == -1) {
218  int c;
219 
220  bytestream2_seek(g2, bytestream2_tell_p(pb) - 1, SEEK_SET);
221  c = bytestream2_get_byte(g2);
222  for (i = 0; i < len; i++) {
223  bytestream2_put_byte(pb, c);
224  }
225  } else if (offset < 0) {
226  int start = bytestream2_tell_p(pb) - (-offset);
227 
228  bytestream2_seek(g2, start, SEEK_SET);
229  for (i = 0; i < len; i++) {
230  bytestream2_put_byte(pb, bytestream2_get_byte(g2));
231  }
232  } else {
233  int start = bytestream2_tell_p(pb) + offset;
234 
235  bytestream2_seek(g2, start, SEEK_SET);
236  for (i = 0; i < len; i++) {
237  bytestream2_put_byte(pb, bytestream2_get_byte(g2));
238  }
239  }
240 }
241 
243 {
244  GDVContext *gdv = avctx->priv_data;
245  GetByteContext *gb = &gdv->gb;
246  GetByteContext *g2 = &gdv->g2;
247  PutByteContext *pb = &gdv->pb;
248  Bits8 bits = { 0 };
249  int c, i;
250 
251  bytestream2_init(g2, gdv->frame, gdv->frame_size);
253 
254  for (c = 0; c < 256; c++) {
255  for (i = 0; i < 16; i++) {
256  gdv->frame[c * 16 + i] = c;
257  }
258  }
259 
260  while (bytestream2_get_bytes_left_p(pb) > 0 && bytestream2_get_bytes_left(gb) > 0) {
261  int tag = read_bits2(&bits, gb);
262  if (tag == 0) {
263  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
264  } else if (tag == 1) {
265  int b = bytestream2_get_byte(gb);
266  int len = (b & 0xF) + 3;
267  int top = (b >> 4) & 0xF;
268  int off = (bytestream2_get_byte(gb) << 4) + top - 4096;
269  lz_copy(pb, g2, off, len);
270  } else if (tag == 2) {
271  int len = (bytestream2_get_byte(gb)) + 2;
272  bytestream2_skip_p(pb, len);
273  } else {
274  break;
275  }
276  }
277 
278  if (bytestream2_get_bytes_left_p(pb) > 0)
279  return AVERROR_INVALIDDATA;
280 
281  return 0;
282 }
283 
284 static int decompress_5(AVCodecContext *avctx, unsigned skip)
285 {
286  GDVContext *gdv = avctx->priv_data;
287  GetByteContext *gb = &gdv->gb;
288  GetByteContext *g2 = &gdv->g2;
289  PutByteContext *pb = &gdv->pb;
290  Bits8 bits = { 0 };
291 
292  bytestream2_init(g2, gdv->frame, gdv->frame_size);
293  bytestream2_skip_p(pb, skip + PREAMBLE_SIZE);
294 
295  while (bytestream2_get_bytes_left_p(pb) > 0 && bytestream2_get_bytes_left(gb) > 0) {
296  int tag = read_bits2(&bits, gb);
297  if (bytestream2_get_bytes_left(gb) < 1)
298  return AVERROR_INVALIDDATA;
299  if (tag == 0) {
300  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
301  } else if (tag == 1) {
302  int b = bytestream2_get_byte(gb);
303  int len = (b & 0xF) + 3;
304  int top = b >> 4;
305  int off = (bytestream2_get_byte(gb) << 4) + top - 4096;
306  lz_copy(pb, g2, off, len);
307  } else if (tag == 2) {
308  int len;
309  int b = bytestream2_get_byte(gb);
310  if (b == 0) {
311  return 0;
312  }
313  if (b != 0xFF) {
314  len = b;
315  } else {
316  len = bytestream2_get_le16(gb);
317  }
318  bytestream2_skip_p(pb, len + 1);
319  } else {
320  int b = bytestream2_get_byte(gb);
321  int len = (b & 0x3) + 2;
322  int off = -(b >> 2) - 1;
323  lz_copy(pb, g2, off, len);
324  }
325  }
326  if (bytestream2_get_bytes_left_p(pb) > 0)
327  return AVERROR_INVALIDDATA;
328  return 0;
329 }
330 
331 static int decompress_68(AVCodecContext *avctx, unsigned skip, unsigned use8)
332 {
333  GDVContext *gdv = avctx->priv_data;
334  GetByteContext *gb = &gdv->gb;
335  GetByteContext *g2 = &gdv->g2;
336  PutByteContext *pb = &gdv->pb;
337  Bits32 bits;
338 
339  bytestream2_init(g2, gdv->frame, gdv->frame_size);
340  bytestream2_skip_p(pb, skip + PREAMBLE_SIZE);
341  fill_bits32(&bits, gb);
342 
343  while (bytestream2_get_bytes_left_p(pb) > 0 && bytestream2_get_bytes_left(gb) > 0) {
344  int tag = read_bits32(&bits, gb, 2);
345  if (tag == 0) {
346  int b = read_bits32(&bits, gb, 1);
347  if (b == 0) {
348  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
349  } else {
350  int i, len = 2;
351  int lbits = 0;
352  while (1) {
353  int val;
354 
355  lbits += 1;
356  val = read_bits32(&bits, gb, lbits);
357  len += val;
358  if (val != ((1 << lbits) - 1)) {
359  break;
360  }
361  assert(lbits < 16);
362  }
363  for (i = 0; i < len; i++) {
364  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
365  }
366  }
367  } else if (tag == 1) {
368  int b = read_bits32(&bits, gb, 1);
369  int len;
370 
371  if (b == 0) {
372  len = (read_bits32(&bits, gb, 4)) + 2;
373  } else {
374  int bb = bytestream2_get_byte(gb);
375  if ((bb & 0x80) == 0) {
376  len = bb + 18;
377  } else {
378  int top = (bb & 0x7F) << 8;
379  len = top + bytestream2_get_byte(gb) + 146;
380  }
381  }
382  bytestream2_skip_p(pb, len);
383  } else if (tag == 2) {
384  int i, subtag = read_bits32(&bits, gb, 2);
385 
386  if (subtag != 3) {
387  int top = (read_bits32(&bits, gb, 4)) << 8;
388  int offs = top + bytestream2_get_byte(gb);
389  if ((subtag != 0) || (offs <= 0xF80)) {
390  int len = (subtag) + 3;
391  lz_copy(pb, g2, (offs) - 4096, len);
392  } else {
393  int real_off, len, c1, c2;
394 
395  if (offs == 0xFFF) {
396  return 0;
397  }
398 
399  real_off = ((offs >> 4) & 0x7) + 1;
400  len = ((offs & 0xF) + 2) * 2;
401  c1 = gdv->frame[bytestream2_tell_p(pb) - real_off];
402  c2 = gdv->frame[bytestream2_tell_p(pb) - real_off + 1];
403  for (i = 0; i < len/2; i++) {
404  bytestream2_put_byte(pb, c1);
405  bytestream2_put_byte(pb, c2);
406  }
407  }
408  } else {
409  int b = bytestream2_get_byte(gb);
410  int off = ((b & 0x7F)) + 1;
411  int len = ((b & 0x80) == 0) ? 2 : 3;
412 
413  lz_copy(pb, g2, -off, len);
414  }
415  } else {
416  int len;
417  int off;
418  if (use8) {
419  int q, b = bytestream2_get_byte(gb);
420  if ((b & 0xC0) == 0xC0) {
421  len = ((b & 0x3F)) + 8;
422  q = read_bits32(&bits, gb, 4);
423  off = (q << 8) + (bytestream2_get_byte(gb)) + 1;
424  } else {
425  int ofs1;
426  if ((b & 0x80) == 0) {
427  len = ((b >> 4)) + 6;
428  ofs1 = (b & 0xF);
429  } else {
430  len = ((b & 0x3F)) + 14;
431  ofs1 = read_bits32(&bits, gb, 4);
432  }
433  off = (ofs1 << 8) + (bytestream2_get_byte(gb)) - 4096;
434  }
435  } else {
436  int ofs1, b = bytestream2_get_byte(gb);
437 
438  if ((b >> 4) == 0xF) {
439  len = bytestream2_get_byte(gb) + 21;
440  } else {
441  len = (b >> 4) + 6;
442  }
443  ofs1 = (b & 0xF);
444  off = (ofs1 << 8) + bytestream2_get_byte(gb) - 4096;
445  }
446  lz_copy(pb, g2, off, len);
447  }
448  }
449 
450  if (bytestream2_get_bytes_left_p(pb) > 0)
451  return AVERROR_INVALIDDATA;
452 
453  return 0;
454 }
455 
457  int *got_frame, AVPacket *avpkt)
458 {
459  GDVContext *gdv = avctx->priv_data;
460  GetByteContext *gb = &gdv->gb;
461  PutByteContext *pb = &gdv->pb;
462  AVFrame *frame = data;
463  int ret, i, pal_size;
464  const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
465  int compression;
466  unsigned flags;
467  uint8_t *dst;
468 
469  bytestream2_init(gb, avpkt->data, avpkt->size);
470  bytestream2_init_writer(pb, gdv->frame, gdv->frame_size);
471 
472  flags = bytestream2_get_le32(gb);
473  compression = flags & 0xF;
474 
475  if (compression == 4 || compression == 7 || compression > 8)
476  return AVERROR_INVALIDDATA;
477 
478  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
479  return ret;
480  if (pal && pal_size == AVPALETTE_SIZE)
481  memcpy(gdv->pal, pal, AVPALETTE_SIZE);
482 
483  if (compression < 2 && bytestream2_get_bytes_left(gb) < 256*3)
484  return AVERROR_INVALIDDATA;
485  rescale(gdv, gdv->frame, avctx->width, avctx->height,
486  !!(flags & 0x10), !!(flags & 0x20));
487 
488  switch (compression) {
489  case 1:
490  memset(gdv->frame + PREAMBLE_SIZE, 0, gdv->frame_size - PREAMBLE_SIZE);
491  case 0:
492  for (i = 0; i < 256; i++) {
493  unsigned r = bytestream2_get_byte(gb);
494  unsigned g = bytestream2_get_byte(gb);
495  unsigned b = bytestream2_get_byte(gb);
496  gdv->pal[i] = 0xFFU << 24 | r << 18 | g << 10 | b << 2;
497  }
498  break;
499  case 2:
500  ret = decompress_2(avctx);
501  break;
502  case 3:
503  break;
504  case 5:
505  ret = decompress_5(avctx, flags >> 8);
506  break;
507  case 6:
508  ret = decompress_68(avctx, flags >> 8, 0);
509  break;
510  case 8:
511  ret = decompress_68(avctx, flags >> 8, 1);
512  break;
513  default:
514  av_assert0(0);
515  }
516  if (ret < 0)
517  return ret;
518 
519  memcpy(frame->data[1], gdv->pal, AVPALETTE_SIZE);
520  dst = frame->data[0];
521 
522  if (!gdv->scale_v && !gdv->scale_h) {
523  int sidx = PREAMBLE_SIZE, didx = 0;
524  int y;
525 
526  for (y = 0; y < avctx->height; y++) {
527  memcpy(dst + didx, gdv->frame + sidx, avctx->width);
528  sidx += avctx->width;
529  didx += frame->linesize[0];
530  }
531  } else {
532  int sidx = PREAMBLE_SIZE, didx = 0;
533  int y;
534 
535  for (y = 0; y < avctx->height; y++) {
536  if (!gdv->scale_v) {
537  memcpy(dst + didx, gdv->frame + sidx, avctx->width);
538  } else {
539  uint8_t *dst2 = dst + didx;
540  uint8_t *src2 = gdv->frame + sidx;
541 
542  scaleup(dst2, src2, avctx->width);
543  }
544  if (!gdv->scale_h || ((y & 1) == 1)) {
545  sidx += !gdv->scale_v ? avctx->width : avctx->width/2;
546  }
547  didx += frame->linesize[0];
548  }
549  }
550 
551  *got_frame = 1;
552 
553  return ret < 0 ? ret : avpkt->size;
554 }
555 
557 {
558  GDVContext *gdv = avctx->priv_data;
559  av_freep(&gdv->frame);
560  return 0;
561 }
562 
564  .name = "gdv",
565  .long_name = NULL_IF_CONFIG_SMALL("Gremlin Digital Video"),
566  .type = AVMEDIA_TYPE_VIDEO,
567  .id = AV_CODEC_ID_GDV,
568  .priv_data_size = sizeof(GDVContext),
570  .close = gdv_decode_close,
572  .capabilities = AV_CODEC_CAP_DR1,
573  .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
574 };
const char const char void * val
Definition: avisynth_c.h:863
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
static void scaledown(uint8_t *dst, const uint8_t *src, int w)
Definition: gdv.c:112
GetByteContext gb
Definition: gdv.c:31
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
const char * g
Definition: vf_curves.c:115
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
int size
Definition: avcodec.h:1478
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:1775
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:563
#define src
Definition: vp8dsp.c:254
AVCodec.
Definition: avcodec.h:3481
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
const char data[16]
Definition: mxf.c:91
uint8_t fill
Definition: gdv.c:43
uint8_t * data
Definition: avcodec.h:1477
uint32_t tag
Definition: movenc.c:1496
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:456
unsigned scale_v
Definition: gdv.c:38
uint32_t pal[256]
Definition: gdv.c:35
#define U(x)
Definition: vp56_arith.h:37
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette...
Definition: avcodec.h:1190
static av_always_inline unsigned int bytestream2_get_bytes_left_p(PutByteContext *p)
Definition: bytestream.h:159
static void scaleup_rev(uint8_t *dst, const uint8_t *src, int w)
Definition: gdv.c:93
#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:3488
uint8_t bits
Definition: vp3data.h:202
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:130
int width
picture width / height.
Definition: avcodec.h:1738
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:326
main external API structure.
Definition: avcodec.h:1565
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1964
static av_cold int gdv_decode_close(AVCodecContext *avctx)
Definition: gdv.c:556
uint8_t fill
Definition: gdv.c:48
static void fill_bits32(Bits32 *bits, GetByteContext *gb)
Definition: gdv.c:193
static int decompress_68(AVCodecContext *avctx, unsigned skip, unsigned use8)
Definition: gdv.c:331
static int read_bits32(Bits32 *bits, GetByteContext *gb, int nbits)
Definition: gdv.c:199
static av_cold int gdv_decode_init(AVCodecContext *avctx)
Definition: gdv.c:53
static int decompress_5(AVCodecContext *avctx, unsigned skip)
Definition: gdv.c:284
#define PREAMBLE_SIZE
Definition: gdv.c:51
#define flags(name, subs,...)
Definition: cbs_av1.c:561
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:309
static void lz_copy(PutByteContext *pb, GetByteContext *g2, int offset, unsigned len)
Definition: gdv.c:213
static int decompress_2(AVCodecContext *avctx)
Definition: gdv.c:242
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:1592
static void scaleup(uint8_t *dst, const uint8_t *src, int w)
Definition: gdv.c:75
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:766
AVCodecContext * avctx
Definition: gdv.c:29
This structure stores compressed data.
Definition: avcodec.h:1454
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:981
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:178