FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
zmbv.c
Go to the documentation of this file.
1 /*
2  * Zip Motion Blocks Video (ZMBV) decoder
3  * Copyright (c) 2006 Konstantin Shishkov
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * Zip Motion Blocks Video decoder
25  */
26 
27 #include <stdio.h>
28 #include <stdlib.h>
29 
30 #include "libavutil/common.h"
31 #include "libavutil/imgutils.h"
32 #include "libavutil/intreadwrite.h"
33 #include "avcodec.h"
34 #include "internal.h"
35 
36 #include <zlib.h>
37 
38 #define ZMBV_KEYFRAME 1
39 #define ZMBV_DELTAPAL 2
40 
41 enum ZmbvFormat {
51 };
52 
53 /*
54  * Decoder context
55  */
56 typedef struct ZmbvContext {
58 
59  int bpp;
60  int alloc_bpp;
61  unsigned int decomp_size;
63  uint8_t pal[768];
65  int width, height;
66  int fmt;
67  int comp;
68  int flags;
69  int stride;
70  int bw, bh, bx, by;
72  z_stream zstream;
74  int (*decode_xor)(struct ZmbvContext *c);
75 } ZmbvContext;
76 
77 /**
78  * Decode XOR'ed frame - 8bpp version
79  */
80 
82 {
83  uint8_t *src = c->decomp_buf;
84  uint8_t *output, *prev;
85  int8_t *mvec;
86  int x, y;
87  int d, dx, dy, bw2, bh2;
88  int block;
89  int i, j;
90  int mx, my;
91 
92  output = c->cur;
93  prev = c->prev;
94 
95  if (c->flags & ZMBV_DELTAPAL) {
96  for (i = 0; i < 768; i++)
97  c->pal[i] ^= *src++;
98  }
99 
100  mvec = (int8_t*)src;
101  src += ((c->bx * c->by * 2 + 3) & ~3);
102 
103  block = 0;
104  for (y = 0; y < c->height; y += c->bh) {
105  bh2 = ((c->height - y) > c->bh) ? c->bh : (c->height - y);
106  for (x = 0; x < c->width; x += c->bw) {
107  uint8_t *out, *tprev;
108 
109  d = mvec[block] & 1;
110  dx = mvec[block] >> 1;
111  dy = mvec[block + 1] >> 1;
112  block += 2;
113 
114  bw2 = ((c->width - x) > c->bw) ? c->bw : (c->width - x);
115 
116  /* copy block - motion vectors out of bounds are used to zero blocks */
117  out = output + x;
118  tprev = prev + x + dx + dy * c->width;
119  mx = x + dx;
120  my = y + dy;
121  for (j = 0; j < bh2; j++) {
122  if (my + j < 0 || my + j >= c->height) {
123  memset(out, 0, bw2);
124  } else {
125  for (i = 0; i < bw2; i++) {
126  if (mx + i < 0 || mx + i >= c->width)
127  out[i] = 0;
128  else
129  out[i] = tprev[i];
130  }
131  }
132  out += c->width;
133  tprev += c->width;
134  }
135 
136  if (d) { /* apply XOR'ed difference */
137  out = output + x;
138  for (j = 0; j < bh2; j++) {
139  for (i = 0; i < bw2; i++)
140  out[i] ^= *src++;
141  out += c->width;
142  }
143  }
144  }
145  output += c->width * c->bh;
146  prev += c->width * c->bh;
147  }
148  if (src - c->decomp_buf != c->decomp_len)
149  av_log(c->avctx, AV_LOG_ERROR, "Used %"PTRDIFF_SPECIFIER" of %i bytes\n",
150  src-c->decomp_buf, c->decomp_len);
151  return 0;
152 }
153 
154 /**
155  * Decode XOR'ed frame - 15bpp and 16bpp version
156  */
157 
159 {
160  uint8_t *src = c->decomp_buf;
161  uint16_t *output, *prev;
162  int8_t *mvec;
163  int x, y;
164  int d, dx, dy, bw2, bh2;
165  int block;
166  int i, j;
167  int mx, my;
168 
169  output = (uint16_t*)c->cur;
170  prev = (uint16_t*)c->prev;
171 
172  mvec = (int8_t*)src;
173  src += ((c->bx * c->by * 2 + 3) & ~3);
174 
175  block = 0;
176  for (y = 0; y < c->height; y += c->bh) {
177  bh2 = ((c->height - y) > c->bh) ? c->bh : (c->height - y);
178  for (x = 0; x < c->width; x += c->bw) {
179  uint16_t *out, *tprev;
180 
181  d = mvec[block] & 1;
182  dx = mvec[block] >> 1;
183  dy = mvec[block + 1] >> 1;
184  block += 2;
185 
186  bw2 = ((c->width - x) > c->bw) ? c->bw : (c->width - x);
187 
188  /* copy block - motion vectors out of bounds are used to zero blocks */
189  out = output + x;
190  tprev = prev + x + dx + dy * c->width;
191  mx = x + dx;
192  my = y + dy;
193  for (j = 0; j < bh2; j++) {
194  if (my + j < 0 || my + j >= c->height) {
195  memset(out, 0, bw2 * 2);
196  } else {
197  for (i = 0; i < bw2; i++) {
198  if (mx + i < 0 || mx + i >= c->width)
199  out[i] = 0;
200  else
201  out[i] = tprev[i];
202  }
203  }
204  out += c->width;
205  tprev += c->width;
206  }
207 
208  if (d) { /* apply XOR'ed difference */
209  out = output + x;
210  for (j = 0; j < bh2; j++){
211  for (i = 0; i < bw2; i++) {
212  out[i] ^= *((uint16_t*)src);
213  src += 2;
214  }
215  out += c->width;
216  }
217  }
218  }
219  output += c->width * c->bh;
220  prev += c->width * c->bh;
221  }
222  if (src - c->decomp_buf != c->decomp_len)
223  av_log(c->avctx, AV_LOG_ERROR, "Used %"PTRDIFF_SPECIFIER" of %i bytes\n",
224  src-c->decomp_buf, c->decomp_len);
225  return 0;
226 }
227 
228 #ifdef ZMBV_ENABLE_24BPP
229 /**
230  * Decode XOR'ed frame - 24bpp version
231  */
232 
233 static int zmbv_decode_xor_24(ZmbvContext *c)
234 {
235  uint8_t *src = c->decomp_buf;
236  uint8_t *output, *prev;
237  int8_t *mvec;
238  int x, y;
239  int d, dx, dy, bw2, bh2;
240  int block;
241  int i, j;
242  int mx, my;
243  int stride;
244 
245  output = c->cur;
246  prev = c->prev;
247 
248  stride = c->width * 3;
249  mvec = (int8_t*)src;
250  src += ((c->bx * c->by * 2 + 3) & ~3);
251 
252  block = 0;
253  for (y = 0; y < c->height; y += c->bh) {
254  bh2 = ((c->height - y) > c->bh) ? c->bh : (c->height - y);
255  for (x = 0; x < c->width; x += c->bw) {
256  uint8_t *out, *tprev;
257 
258  d = mvec[block] & 1;
259  dx = mvec[block] >> 1;
260  dy = mvec[block + 1] >> 1;
261  block += 2;
262 
263  bw2 = ((c->width - x) > c->bw) ? c->bw : (c->width - x);
264 
265  /* copy block - motion vectors out of bounds are used to zero blocks */
266  out = output + x * 3;
267  tprev = prev + (x + dx) * 3 + dy * stride;
268  mx = x + dx;
269  my = y + dy;
270  for (j = 0; j < bh2; j++) {
271  if (my + j < 0 || my + j >= c->height) {
272  memset(out, 0, bw2 * 3);
273  } else {
274  for (i = 0; i < bw2; i++){
275  if (mx + i < 0 || mx + i >= c->width) {
276  out[i * 3 + 0] = 0;
277  out[i * 3 + 1] = 0;
278  out[i * 3 + 2] = 0;
279  } else {
280  out[i * 3 + 0] = tprev[i * 3 + 0];
281  out[i * 3 + 1] = tprev[i * 3 + 1];
282  out[i * 3 + 2] = tprev[i * 3 + 2];
283  }
284  }
285  }
286  out += stride;
287  tprev += stride;
288  }
289 
290  if (d) { /* apply XOR'ed difference */
291  out = output + x * 3;
292  for (j = 0; j < bh2; j++) {
293  for (i = 0; i < bw2; i++) {
294  out[i * 3 + 0] ^= *src++;
295  out[i * 3 + 1] ^= *src++;
296  out[i * 3 + 2] ^= *src++;
297  }
298  out += stride;
299  }
300  }
301  }
302  output += stride * c->bh;
303  prev += stride * c->bh;
304  }
305  if (src - c->decomp_buf != c->decomp_len)
306  av_log(c->avctx, AV_LOG_ERROR, "Used %i of %i bytes\n",
307  src-c->decomp_buf, c->decomp_len);
308  return 0;
309 }
310 #endif //ZMBV_ENABLE_24BPP
311 
312 /**
313  * Decode XOR'ed frame - 32bpp version
314  */
315 
317 {
318  uint8_t *src = c->decomp_buf;
319  uint32_t *output, *prev;
320  int8_t *mvec;
321  int x, y;
322  int d, dx, dy, bw2, bh2;
323  int block;
324  int i, j;
325  int mx, my;
326 
327  output = (uint32_t*)c->cur;
328  prev = (uint32_t*)c->prev;
329 
330  mvec = (int8_t*)src;
331  src += ((c->bx * c->by * 2 + 3) & ~3);
332 
333  block = 0;
334  for (y = 0; y < c->height; y += c->bh) {
335  bh2 = ((c->height - y) > c->bh) ? c->bh : (c->height - y);
336  for (x = 0; x < c->width; x += c->bw) {
337  uint32_t *out, *tprev;
338 
339  d = mvec[block] & 1;
340  dx = mvec[block] >> 1;
341  dy = mvec[block + 1] >> 1;
342  block += 2;
343 
344  bw2 = ((c->width - x) > c->bw) ? c->bw : (c->width - x);
345 
346  /* copy block - motion vectors out of bounds are used to zero blocks */
347  out = output + x;
348  tprev = prev + x + dx + dy * c->width;
349  mx = x + dx;
350  my = y + dy;
351  for (j = 0; j < bh2; j++) {
352  if (my + j < 0 || my + j >= c->height) {
353  memset(out, 0, bw2 * 4);
354  } else {
355  for (i = 0; i < bw2; i++){
356  if (mx + i < 0 || mx + i >= c->width)
357  out[i] = 0;
358  else
359  out[i] = tprev[i];
360  }
361  }
362  out += c->width;
363  tprev += c->width;
364  }
365 
366  if (d) { /* apply XOR'ed difference */
367  out = output + x;
368  for (j = 0; j < bh2; j++){
369  for (i = 0; i < bw2; i++) {
370  out[i] ^= *((uint32_t *) src);
371  src += 4;
372  }
373  out += c->width;
374  }
375  }
376  }
377  output += c->width * c->bh;
378  prev += c->width * c->bh;
379  }
380  if (src - c->decomp_buf != c->decomp_len)
381  av_log(c->avctx, AV_LOG_ERROR, "Used %"PTRDIFF_SPECIFIER" of %i bytes\n",
382  src-c->decomp_buf, c->decomp_len);
383  return 0;
384 }
385 
386 /**
387  * Decode intraframe
388  */
390 {
391  uint8_t *src = c->decomp_buf;
392 
393  /* make the palette available on the way out */
394  if (c->fmt == ZMBV_FMT_8BPP) {
395  memcpy(c->pal, src, 768);
396  src += 768;
397  }
398 
399  memcpy(c->cur, src, c->width * c->height * (c->bpp / 8));
400  return 0;
401 }
402 
403 static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
404 {
405  AVFrame *frame = data;
406  const uint8_t *buf = avpkt->data;
407  int buf_size = avpkt->size;
408  ZmbvContext * const c = avctx->priv_data;
409  int zret = Z_OK; // Zlib return code
410  int len = buf_size;
411  int hi_ver, lo_ver, ret;
412  int expected_size;
413 
414  /* parse header */
415  if (len < 1)
416  return AVERROR_INVALIDDATA;
417  c->flags = buf[0];
418  buf++; len--;
419  if (c->flags & ZMBV_KEYFRAME) {
420  void *decode_intra = NULL;
421  c->decode_intra= NULL;
422 
423  if (len < 6)
424  return AVERROR_INVALIDDATA;
425  hi_ver = buf[0];
426  lo_ver = buf[1];
427  c->comp = buf[2];
428  c->fmt = buf[3];
429  c->bw = buf[4];
430  c->bh = buf[5];
431  c->decode_intra = NULL;
432  c->decode_xor = NULL;
433 
434  buf += 6;
435  len -= 6;
436  av_log(avctx, AV_LOG_DEBUG,
437  "Flags=%X ver=%i.%i comp=%i fmt=%i blk=%ix%i\n",
438  c->flags,hi_ver,lo_ver,c->comp,c->fmt,c->bw,c->bh);
439  if (hi_ver != 0 || lo_ver != 1) {
440  avpriv_request_sample(avctx, "Version %i.%i", hi_ver, lo_ver);
441  return AVERROR_PATCHWELCOME;
442  }
443  if (c->bw == 0 || c->bh == 0) {
444  avpriv_request_sample(avctx, "Block size %ix%i", c->bw, c->bh);
445  return AVERROR_PATCHWELCOME;
446  }
447  if (c->comp != 0 && c->comp != 1) {
448  avpriv_request_sample(avctx, "Compression type %i", c->comp);
449  return AVERROR_PATCHWELCOME;
450  }
451 
452  switch (c->fmt) {
453  case ZMBV_FMT_8BPP:
454  c->bpp = 8;
455  decode_intra = zmbv_decode_intra;
457  avctx->pix_fmt = AV_PIX_FMT_PAL8;
458  c->stride = c->width;
459  break;
460  case ZMBV_FMT_15BPP:
461  case ZMBV_FMT_16BPP:
462  c->bpp = 16;
463  decode_intra = zmbv_decode_intra;
465  if (c->fmt == ZMBV_FMT_15BPP)
466  avctx->pix_fmt = AV_PIX_FMT_RGB555LE;
467  else
468  avctx->pix_fmt = AV_PIX_FMT_RGB565LE;
469  c->stride = c->width * 2;
470  break;
471 #ifdef ZMBV_ENABLE_24BPP
472  case ZMBV_FMT_24BPP:
473  c->bpp = 24;
474  decode_intra = zmbv_decode_intra;
475  c->decode_xor = zmbv_decode_xor_24;
476  avctx->pix_fmt = AV_PIX_FMT_RGB24;
477  c->stride = c->width * 3;
478  break;
479 #endif //ZMBV_ENABLE_24BPP
480  case ZMBV_FMT_32BPP:
481  c->bpp = 32;
482  decode_intra = zmbv_decode_intra;
484  avctx->pix_fmt = AV_PIX_FMT_BGR0;
485  c->stride = c->width * 4;
486  break;
487  default:
488  c->decode_xor = NULL;
489  avpriv_request_sample(avctx, "Format %i", c->fmt);
490  return AVERROR_PATCHWELCOME;
491  }
492 
493  zret = inflateReset(&c->zstream);
494  if (zret != Z_OK) {
495  av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
496  return AVERROR_UNKNOWN;
497  }
498 
499  if (c->alloc_bpp < c->bpp) {
500  c->cur = av_realloc_f(c->cur, avctx->width * avctx->height, (c->bpp / 8));
501  c->prev = av_realloc_f(c->prev, avctx->width * avctx->height, (c->bpp / 8));
502  c->alloc_bpp = c->bpp;
503  }
504  c->bx = (c->width + c->bw - 1) / c->bw;
505  c->by = (c->height+ c->bh - 1) / c->bh;
506  if (!c->cur || !c->prev) {
507  c->alloc_bpp = 0;
508  return AVERROR(ENOMEM);
509  }
510  memset(c->cur, 0, avctx->width * avctx->height * (c->bpp / 8));
511  memset(c->prev, 0, avctx->width * avctx->height * (c->bpp / 8));
513  }
514  if (c->flags & ZMBV_KEYFRAME) {
515  expected_size = avctx->width * avctx->height * (c->bpp / 8);
516  } else {
517  expected_size = (c->bx * c->by * 2 + 3) & ~3;
518  }
519  if (avctx->pix_fmt == AV_PIX_FMT_PAL8 &&
520  (c->flags & (ZMBV_DELTAPAL | ZMBV_KEYFRAME)))
521  expected_size += 768;
522 
523  if (!c->decode_intra) {
524  av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n");
525  return AVERROR_INVALIDDATA;
526  }
527 
528  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
529  return ret;
530 
531  if (c->comp == 0) { // uncompressed data
532  if (c->decomp_size < len) {
533  av_log(avctx, AV_LOG_ERROR, "Buffer too small\n");
534  return AVERROR_INVALIDDATA;
535  }
536  memcpy(c->decomp_buf, buf, len);
537  c->decomp_len = len;
538  } else { // ZLIB-compressed data
539  c->zstream.total_in = c->zstream.total_out = 0;
540  c->zstream.next_in = (uint8_t*)buf;
541  c->zstream.avail_in = len;
542  c->zstream.next_out = c->decomp_buf;
543  c->zstream.avail_out = c->decomp_size;
544  zret = inflate(&c->zstream, Z_SYNC_FLUSH);
545  if (zret != Z_OK && zret != Z_STREAM_END) {
546  av_log(avctx, AV_LOG_ERROR, "inflate error %d\n", zret);
547  return AVERROR_INVALIDDATA;
548  }
549  c->decomp_len = c->zstream.total_out;
550  }
551  if (expected_size > c->decomp_len ||
552  (c->flags & ZMBV_KEYFRAME) && expected_size < c->decomp_len) {
553  av_log(avctx, AV_LOG_ERROR, "decompressed size %d is incorrect, expected %d\n", c->decomp_len, expected_size);
554  return AVERROR_INVALIDDATA;
555  }
556  if (c->flags & ZMBV_KEYFRAME) {
557  frame->key_frame = 1;
558  frame->pict_type = AV_PICTURE_TYPE_I;
559  c->decode_intra(c);
560  } else {
561  frame->key_frame = 0;
562  frame->pict_type = AV_PICTURE_TYPE_P;
563  if (c->decomp_len < 2LL * ((c->width + c->bw - 1) / c->bw) * ((c->height + c->bh - 1) / c->bh))
564  return AVERROR_INVALIDDATA;
565  if (c->decomp_len)
566  c->decode_xor(c);
567  }
568 
569  /* update frames */
570  {
571  uint8_t *out, *src;
572  int j;
573 
574  out = frame->data[0];
575  src = c->cur;
576  switch (c->fmt) {
577  case ZMBV_FMT_8BPP:
578  for (j = 0; j < 256; j++)
579  AV_WN32(&frame->data[1][j * 4], 0xFFU << 24 | AV_RB24(&c->pal[j * 3]));
580  case ZMBV_FMT_15BPP:
581  case ZMBV_FMT_16BPP:
582 #ifdef ZMBV_ENABLE_24BPP
583  case ZMBV_FMT_24BPP:
584 #endif
585  case ZMBV_FMT_32BPP:
586  av_image_copy_plane(out, frame->linesize[0], src, c->stride,
587  c->stride, c->height);
588  break;
589  default:
590  av_log(avctx, AV_LOG_ERROR, "Cannot handle format %i\n", c->fmt);
591  }
592  FFSWAP(uint8_t *, c->cur, c->prev);
593  }
594  *got_frame = 1;
595 
596  /* always report that the buffer was completely consumed */
597  return buf_size;
598 }
599 
601 {
602  ZmbvContext * const c = avctx->priv_data;
603  int zret; // Zlib return code
604 
605  c->avctx = avctx;
606 
607  c->width = avctx->width;
608  c->height = avctx->height;
609 
610  c->bpp = avctx->bits_per_coded_sample;
611 
612  // Needed if zlib unused or init aborted before inflateInit
613  memset(&c->zstream, 0, sizeof(z_stream));
614 
615  if ((avctx->width + 255ULL) * (avctx->height + 64ULL) > FFMIN(avctx->max_pixels, INT_MAX / 4) ) {
616  av_log(avctx, AV_LOG_ERROR, "Internal buffer (decomp_size) larger than max_pixels or too large\n");
617  return AVERROR_INVALIDDATA;
618  }
619 
620  c->decomp_size = (avctx->width + 255) * 4 * (avctx->height + 64);
621 
622  /* Allocate decompression buffer */
624  if (!c->decomp_buf) {
625  av_log(avctx, AV_LOG_ERROR,
626  "Can't allocate decompression buffer.\n");
627  return AVERROR(ENOMEM);
628  }
629 
630  c->zstream.zalloc = Z_NULL;
631  c->zstream.zfree = Z_NULL;
632  c->zstream.opaque = Z_NULL;
633  zret = inflateInit(&c->zstream);
634  if (zret != Z_OK) {
635  av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
636  return AVERROR_UNKNOWN;
637  }
638 
639  return 0;
640 }
641 
643 {
644  ZmbvContext * const c = avctx->priv_data;
645 
646  av_freep(&c->decomp_buf);
647 
648  inflateEnd(&c->zstream);
649  av_freep(&c->cur);
650  av_freep(&c->prev);
651 
652  return 0;
653 }
654 
656  .name = "zmbv",
657  .long_name = NULL_IF_CONFIG_SMALL("Zip Motion Blocks Video"),
658  .type = AVMEDIA_TYPE_VIDEO,
659  .id = AV_CODEC_ID_ZMBV,
660  .priv_data_size = sizeof(ZmbvContext),
661  .init = decode_init,
662  .close = decode_end,
663  .decode = decode_frame,
664  .capabilities = AV_CODEC_CAP_DR1,
665  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
666 };
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: internal.h:48
int(* decode_xor)(struct ZmbvContext *c)
Definition: zmbv.c:74
#define NULL
Definition: coverity.c:32
uint8_t pal[768]
Definition: zmbv.c:63
int stride
Definition: zmbv.c:69
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
#define av_realloc_f(p, o, n)
This structure describes decoded (raw) audio or video data.
Definition: frame.h:226
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
int decomp_len
Definition: zmbv.c:71
misc image utilities
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:68
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static int zmbv_decode_xor_32(ZmbvContext *c)
Decode XOR'ed frame - 32bpp version.
Definition: zmbv.c:316
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: zmbv.c:403
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined ...
Definition: pixfmt.h:108
int size
Definition: avcodec.h:1446
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1743
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:236
AVCodecContext * avctx
Definition: zmbv.c:57
#define src
Definition: vp8dsp.c:254
AVCodec.
Definition: avcodec.h:3424
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:42
AVCodec ff_zmbv_decoder
Definition: zmbv.c:655
int flags
Definition: zmbv.c:68
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
Definition: pixfmt.h:106
static int16_t block[64]
Definition: dct.c:115
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
uint8_t
#define av_cold
Definition: attributes.h:82
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:77
int comp
Definition: zmbv.c:67
static AVFrame * frame
uint8_t * data
Definition: avcodec.h:1445
static void inflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord)
Definition: vf_neighbor.c:189
static av_cold int decode_init(AVCodecContext *avctx)
Definition: zmbv.c:600
#define ZMBV_KEYFRAME
Definition: zmbv.c:38
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:2750
#define av_log(a,...)
static int zmbv_decode_xor_8(ZmbvContext *c)
Decode XOR'ed frame - 8bpp version.
Definition: zmbv.c:81
int by
Definition: zmbv.c:70
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
#define PTRDIFF_SPECIFIER
Definition: internal.h:261
#define AVERROR(e)
Definition: error.h:43
int bx
Definition: zmbv.c:70
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
ZmbvFormat
Definition: zmbv.c:41
int bw
Definition: zmbv.c:70
const char * name
Name of the codec implementation.
Definition: avcodec.h:3431
static av_cold int decode_end(AVCodecContext *avctx)
Definition: zmbv.c:642
int64_t max_pixels
The number of pixels per image to maximally accept.
Definition: avcodec.h:3243
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:309
#define FFMIN(a, b)
Definition: common.h:96
int width
picture width / height.
Definition: avcodec.h:1706
uint8_t * decomp_buf
Definition: zmbv.c:62
int bh
Definition: zmbv.c:70
unsigned int decomp_size
Definition: zmbv.c:61
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
int alloc_bpp
Definition: zmbv.c:60
Libavcodec external API header.
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_RB24
Definition: bytestream.h:87
static int zmbv_decode_xor_16(ZmbvContext *c)
Decode XOR'ed frame - 15bpp and 16bpp version.
Definition: zmbv.c:158
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:1533
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1918
void * buf
Definition: avisynth_c.h:690
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:240
int height
Definition: zmbv.c:65
z_stream zstream
Definition: zmbv.c:72
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:240
int bpp
Definition: zmbv.c:59
int width
Definition: zmbv.c:65
int
common internal api header.
common internal and external API header
#define AV_WN32(p, v)
Definition: intreadwrite.h:376
static double c[64]
uint8_t * prev
Definition: zmbv.c:64
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:71
void * priv_data
Definition: avcodec.h:1560
int len
int fmt
Definition: zmbv.c:66
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:304
int(* decode_intra)(struct ZmbvContext *c)
Definition: zmbv.c:73
static int zmbv_decode_intra(ZmbvContext *c)
Decode intraframe.
Definition: zmbv.c:389
FILE * out
Definition: movenc.c:54
#define av_freep(p)
#define ZMBV_DELTAPAL
Definition: zmbv.c:39
uint8_t * cur
Definition: zmbv.c:64
#define FFSWAP(type, a, b)
Definition: common.h:99
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
Definition: imgutils.c:338
#define stride
This structure stores compressed data.
Definition: avcodec.h:1422
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:968
Predicted.
Definition: avutil.h:275
static int decode_intra(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame)
Definition: imm4.c:206