FFmpeg  4.0
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  unsigned int decomp_size;
62  uint8_t pal[768];
64  int width, height;
65  int fmt;
66  int comp;
67  int flags;
68  int stride;
69  int bw, bh, bx, by;
71  z_stream zstream;
73  int (*decode_xor)(struct ZmbvContext *c);
74 } ZmbvContext;
75 
76 /**
77  * Decode XOR'ed frame - 8bpp version
78  */
79 
81 {
82  uint8_t *src = c->decomp_buf;
83  uint8_t *output, *prev;
84  int8_t *mvec;
85  int x, y;
86  int d, dx, dy, bw2, bh2;
87  int block;
88  int i, j;
89  int mx, my;
90 
91  output = c->cur;
92  prev = c->prev;
93 
94  if (c->flags & ZMBV_DELTAPAL) {
95  for (i = 0; i < 768; i++)
96  c->pal[i] ^= *src++;
97  }
98 
99  mvec = (int8_t*)src;
100  src += ((c->bx * c->by * 2 + 3) & ~3);
101 
102  block = 0;
103  for (y = 0; y < c->height; y += c->bh) {
104  bh2 = ((c->height - y) > c->bh) ? c->bh : (c->height - y);
105  for (x = 0; x < c->width; x += c->bw) {
106  uint8_t *out, *tprev;
107 
108  d = mvec[block] & 1;
109  dx = mvec[block] >> 1;
110  dy = mvec[block + 1] >> 1;
111  block += 2;
112 
113  bw2 = ((c->width - x) > c->bw) ? c->bw : (c->width - x);
114 
115  /* copy block - motion vectors out of bounds are used to zero blocks */
116  out = output + x;
117  tprev = prev + x + dx + dy * c->width;
118  mx = x + dx;
119  my = y + dy;
120  for (j = 0; j < bh2; j++) {
121  if (my + j < 0 || my + j >= c->height) {
122  memset(out, 0, bw2);
123  } else {
124  for (i = 0; i < bw2; i++) {
125  if (mx + i < 0 || mx + i >= c->width)
126  out[i] = 0;
127  else
128  out[i] = tprev[i];
129  }
130  }
131  out += c->width;
132  tprev += c->width;
133  }
134 
135  if (d) { /* apply XOR'ed difference */
136  out = output + x;
137  for (j = 0; j < bh2; j++) {
138  for (i = 0; i < bw2; i++)
139  out[i] ^= *src++;
140  out += c->width;
141  }
142  }
143  }
144  output += c->width * c->bh;
145  prev += c->width * c->bh;
146  }
147  if (src - c->decomp_buf != c->decomp_len)
148  av_log(c->avctx, AV_LOG_ERROR, "Used %"PTRDIFF_SPECIFIER" of %i bytes\n",
149  src-c->decomp_buf, c->decomp_len);
150  return 0;
151 }
152 
153 /**
154  * Decode XOR'ed frame - 15bpp and 16bpp version
155  */
156 
158 {
159  uint8_t *src = c->decomp_buf;
160  uint16_t *output, *prev;
161  int8_t *mvec;
162  int x, y;
163  int d, dx, dy, bw2, bh2;
164  int block;
165  int i, j;
166  int mx, my;
167 
168  output = (uint16_t*)c->cur;
169  prev = (uint16_t*)c->prev;
170 
171  mvec = (int8_t*)src;
172  src += ((c->bx * c->by * 2 + 3) & ~3);
173 
174  block = 0;
175  for (y = 0; y < c->height; y += c->bh) {
176  bh2 = ((c->height - y) > c->bh) ? c->bh : (c->height - y);
177  for (x = 0; x < c->width; x += c->bw) {
178  uint16_t *out, *tprev;
179 
180  d = mvec[block] & 1;
181  dx = mvec[block] >> 1;
182  dy = mvec[block + 1] >> 1;
183  block += 2;
184 
185  bw2 = ((c->width - x) > c->bw) ? c->bw : (c->width - x);
186 
187  /* copy block - motion vectors out of bounds are used to zero blocks */
188  out = output + x;
189  tprev = prev + x + dx + dy * c->width;
190  mx = x + dx;
191  my = y + dy;
192  for (j = 0; j < bh2; j++) {
193  if (my + j < 0 || my + j >= c->height) {
194  memset(out, 0, bw2 * 2);
195  } else {
196  for (i = 0; i < bw2; i++) {
197  if (mx + i < 0 || mx + i >= c->width)
198  out[i] = 0;
199  else
200  out[i] = tprev[i];
201  }
202  }
203  out += c->width;
204  tprev += c->width;
205  }
206 
207  if (d) { /* apply XOR'ed difference */
208  out = output + x;
209  for (j = 0; j < bh2; j++){
210  for (i = 0; i < bw2; i++) {
211  out[i] ^= *((uint16_t*)src);
212  src += 2;
213  }
214  out += c->width;
215  }
216  }
217  }
218  output += c->width * c->bh;
219  prev += c->width * c->bh;
220  }
221  if (src - c->decomp_buf != c->decomp_len)
222  av_log(c->avctx, AV_LOG_ERROR, "Used %"PTRDIFF_SPECIFIER" of %i bytes\n",
223  src-c->decomp_buf, c->decomp_len);
224  return 0;
225 }
226 
227 #ifdef ZMBV_ENABLE_24BPP
228 /**
229  * Decode XOR'ed frame - 24bpp version
230  */
231 
232 static int zmbv_decode_xor_24(ZmbvContext *c)
233 {
234  uint8_t *src = c->decomp_buf;
235  uint8_t *output, *prev;
236  int8_t *mvec;
237  int x, y;
238  int d, dx, dy, bw2, bh2;
239  int block;
240  int i, j;
241  int mx, my;
242  int stride;
243 
244  output = c->cur;
245  prev = c->prev;
246 
247  stride = c->width * 3;
248  mvec = (int8_t*)src;
249  src += ((c->bx * c->by * 2 + 3) & ~3);
250 
251  block = 0;
252  for (y = 0; y < c->height; y += c->bh) {
253  bh2 = ((c->height - y) > c->bh) ? c->bh : (c->height - y);
254  for (x = 0; x < c->width; x += c->bw) {
255  uint8_t *out, *tprev;
256 
257  d = mvec[block] & 1;
258  dx = mvec[block] >> 1;
259  dy = mvec[block + 1] >> 1;
260  block += 2;
261 
262  bw2 = ((c->width - x) > c->bw) ? c->bw : (c->width - x);
263 
264  /* copy block - motion vectors out of bounds are used to zero blocks */
265  out = output + x * 3;
266  tprev = prev + (x + dx) * 3 + dy * stride;
267  mx = x + dx;
268  my = y + dy;
269  for (j = 0; j < bh2; j++) {
270  if (my + j < 0 || my + j >= c->height) {
271  memset(out, 0, bw2 * 3);
272  } else {
273  for (i = 0; i < bw2; i++){
274  if (mx + i < 0 || mx + i >= c->width) {
275  out[i * 3 + 0] = 0;
276  out[i * 3 + 1] = 0;
277  out[i * 3 + 2] = 0;
278  } else {
279  out[i * 3 + 0] = tprev[i * 3 + 0];
280  out[i * 3 + 1] = tprev[i * 3 + 1];
281  out[i * 3 + 2] = tprev[i * 3 + 2];
282  }
283  }
284  }
285  out += stride;
286  tprev += stride;
287  }
288 
289  if (d) { /* apply XOR'ed difference */
290  out = output + x * 3;
291  for (j = 0; j < bh2; j++) {
292  for (i = 0; i < bw2; i++) {
293  out[i * 3 + 0] ^= *src++;
294  out[i * 3 + 1] ^= *src++;
295  out[i * 3 + 2] ^= *src++;
296  }
297  out += stride;
298  }
299  }
300  }
301  output += stride * c->bh;
302  prev += stride * c->bh;
303  }
304  if (src - c->decomp_buf != c->decomp_len)
305  av_log(c->avctx, AV_LOG_ERROR, "Used %i of %i bytes\n",
306  src-c->decomp_buf, c->decomp_len);
307  return 0;
308 }
309 #endif //ZMBV_ENABLE_24BPP
310 
311 /**
312  * Decode XOR'ed frame - 32bpp version
313  */
314 
316 {
317  uint8_t *src = c->decomp_buf;
318  uint32_t *output, *prev;
319  int8_t *mvec;
320  int x, y;
321  int d, dx, dy, bw2, bh2;
322  int block;
323  int i, j;
324  int mx, my;
325 
326  output = (uint32_t*)c->cur;
327  prev = (uint32_t*)c->prev;
328 
329  mvec = (int8_t*)src;
330  src += ((c->bx * c->by * 2 + 3) & ~3);
331 
332  block = 0;
333  for (y = 0; y < c->height; y += c->bh) {
334  bh2 = ((c->height - y) > c->bh) ? c->bh : (c->height - y);
335  for (x = 0; x < c->width; x += c->bw) {
336  uint32_t *out, *tprev;
337 
338  d = mvec[block] & 1;
339  dx = mvec[block] >> 1;
340  dy = mvec[block + 1] >> 1;
341  block += 2;
342 
343  bw2 = ((c->width - x) > c->bw) ? c->bw : (c->width - x);
344 
345  /* copy block - motion vectors out of bounds are used to zero blocks */
346  out = output + x;
347  tprev = prev + x + dx + dy * c->width;
348  mx = x + dx;
349  my = y + dy;
350  for (j = 0; j < bh2; j++) {
351  if (my + j < 0 || my + j >= c->height) {
352  memset(out, 0, bw2 * 4);
353  } else {
354  for (i = 0; i < bw2; i++){
355  if (mx + i < 0 || mx + i >= c->width)
356  out[i] = 0;
357  else
358  out[i] = tprev[i];
359  }
360  }
361  out += c->width;
362  tprev += c->width;
363  }
364 
365  if (d) { /* apply XOR'ed difference */
366  out = output + x;
367  for (j = 0; j < bh2; j++){
368  for (i = 0; i < bw2; i++) {
369  out[i] ^= *((uint32_t *) src);
370  src += 4;
371  }
372  out += c->width;
373  }
374  }
375  }
376  output += c->width * c->bh;
377  prev += c->width * c->bh;
378  }
379  if (src - c->decomp_buf != c->decomp_len)
380  av_log(c->avctx, AV_LOG_ERROR, "Used %"PTRDIFF_SPECIFIER" of %i bytes\n",
381  src-c->decomp_buf, c->decomp_len);
382  return 0;
383 }
384 
385 /**
386  * Decode intraframe
387  */
389 {
390  uint8_t *src = c->decomp_buf;
391 
392  /* make the palette available on the way out */
393  if (c->fmt == ZMBV_FMT_8BPP) {
394  memcpy(c->pal, src, 768);
395  src += 768;
396  }
397 
398  memcpy(c->cur, src, c->width * c->height * (c->bpp / 8));
399  return 0;
400 }
401 
402 static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
403 {
404  AVFrame *frame = data;
405  const uint8_t *buf = avpkt->data;
406  int buf_size = avpkt->size;
407  ZmbvContext * const c = avctx->priv_data;
408  int zret = Z_OK; // Zlib return code
409  int len = buf_size;
410  int hi_ver, lo_ver, ret;
411 
412  /* parse header */
413  if (len < 1)
414  return AVERROR_INVALIDDATA;
415  c->flags = buf[0];
416  buf++; len--;
417  if (c->flags & ZMBV_KEYFRAME) {
418  void *decode_intra = NULL;
419  c->decode_intra= NULL;
420 
421  if (len < 6)
422  return AVERROR_INVALIDDATA;
423  hi_ver = buf[0];
424  lo_ver = buf[1];
425  c->comp = buf[2];
426  c->fmt = buf[3];
427  c->bw = buf[4];
428  c->bh = buf[5];
429  c->decode_intra = NULL;
430  c->decode_xor = NULL;
431 
432  buf += 6;
433  len -= 6;
434  av_log(avctx, AV_LOG_DEBUG,
435  "Flags=%X ver=%i.%i comp=%i fmt=%i blk=%ix%i\n",
436  c->flags,hi_ver,lo_ver,c->comp,c->fmt,c->bw,c->bh);
437  if (hi_ver != 0 || lo_ver != 1) {
438  avpriv_request_sample(avctx, "Version %i.%i", hi_ver, lo_ver);
439  return AVERROR_PATCHWELCOME;
440  }
441  if (c->bw == 0 || c->bh == 0) {
442  avpriv_request_sample(avctx, "Block size %ix%i", c->bw, c->bh);
443  return AVERROR_PATCHWELCOME;
444  }
445  if (c->comp != 0 && c->comp != 1) {
446  avpriv_request_sample(avctx, "Compression type %i", c->comp);
447  return AVERROR_PATCHWELCOME;
448  }
449 
450  switch (c->fmt) {
451  case ZMBV_FMT_8BPP:
452  c->bpp = 8;
453  decode_intra = zmbv_decode_intra;
455  avctx->pix_fmt = AV_PIX_FMT_PAL8;
456  c->stride = c->width;
457  break;
458  case ZMBV_FMT_15BPP:
459  case ZMBV_FMT_16BPP:
460  c->bpp = 16;
461  decode_intra = zmbv_decode_intra;
463  if (c->fmt == ZMBV_FMT_15BPP)
464  avctx->pix_fmt = AV_PIX_FMT_RGB555LE;
465  else
466  avctx->pix_fmt = AV_PIX_FMT_RGB565LE;
467  c->stride = c->width * 2;
468  break;
469 #ifdef ZMBV_ENABLE_24BPP
470  case ZMBV_FMT_24BPP:
471  c->bpp = 24;
472  decode_intra = zmbv_decode_intra;
473  c->decode_xor = zmbv_decode_xor_24;
474  avctx->pix_fmt = AV_PIX_FMT_RGB24;
475  c->stride = c->width * 3;
476  break;
477 #endif //ZMBV_ENABLE_24BPP
478  case ZMBV_FMT_32BPP:
479  c->bpp = 32;
480  decode_intra = zmbv_decode_intra;
482  avctx->pix_fmt = AV_PIX_FMT_BGR0;
483  c->stride = c->width * 4;
484  break;
485  default:
486  c->decode_xor = NULL;
487  avpriv_request_sample(avctx, "Format %i", c->fmt);
488  return AVERROR_PATCHWELCOME;
489  }
490 
491  zret = inflateReset(&c->zstream);
492  if (zret != Z_OK) {
493  av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
494  return AVERROR_UNKNOWN;
495  }
496 
497  c->cur = av_realloc_f(c->cur, avctx->width * avctx->height, (c->bpp / 8));
498  c->prev = av_realloc_f(c->prev, avctx->width * avctx->height, (c->bpp / 8));
499  c->bx = (c->width + c->bw - 1) / c->bw;
500  c->by = (c->height+ c->bh - 1) / c->bh;
501  if (!c->cur || !c->prev)
502  return AVERROR(ENOMEM);
503  memset(c->cur, 0, avctx->width * avctx->height * (c->bpp / 8));
504  memset(c->prev, 0, avctx->width * avctx->height * (c->bpp / 8));
506  }
507 
508  if (!c->decode_intra) {
509  av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n");
510  return AVERROR_INVALIDDATA;
511  }
512 
513  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
514  return ret;
515 
516  if (c->comp == 0) { // uncompressed data
517  if (c->decomp_size < len) {
518  av_log(avctx, AV_LOG_ERROR, "Buffer too small\n");
519  return AVERROR_INVALIDDATA;
520  }
521  memcpy(c->decomp_buf, buf, len);
522  } else { // ZLIB-compressed data
523  c->zstream.total_in = c->zstream.total_out = 0;
524  c->zstream.next_in = (uint8_t*)buf;
525  c->zstream.avail_in = len;
526  c->zstream.next_out = c->decomp_buf;
527  c->zstream.avail_out = c->decomp_size;
528  zret = inflate(&c->zstream, Z_SYNC_FLUSH);
529  if (zret != Z_OK && zret != Z_STREAM_END) {
530  av_log(avctx, AV_LOG_ERROR, "inflate error %d\n", zret);
531  return AVERROR_INVALIDDATA;
532  }
533  c->decomp_len = c->zstream.total_out;
534  }
535  if (c->flags & ZMBV_KEYFRAME) {
536  frame->key_frame = 1;
537  frame->pict_type = AV_PICTURE_TYPE_I;
538  c->decode_intra(c);
539  } else {
540  frame->key_frame = 0;
541  frame->pict_type = AV_PICTURE_TYPE_P;
542  if (c->decomp_len < 2LL * ((c->width + c->bw - 1) / c->bw) * ((c->height + c->bh - 1) / c->bh))
543  return AVERROR_INVALIDDATA;
544  if (c->decomp_len)
545  c->decode_xor(c);
546  }
547 
548  /* update frames */
549  {
550  uint8_t *out, *src;
551  int j;
552 
553  out = frame->data[0];
554  src = c->cur;
555  switch (c->fmt) {
556  case ZMBV_FMT_8BPP:
557  for (j = 0; j < 256; j++)
558  AV_WN32(&frame->data[1][j * 4], 0xFFU << 24 | AV_RB24(&c->pal[j * 3]));
559  case ZMBV_FMT_15BPP:
560  case ZMBV_FMT_16BPP:
561 #ifdef ZMBV_ENABLE_24BPP
562  case ZMBV_FMT_24BPP:
563 #endif
564  case ZMBV_FMT_32BPP:
565  av_image_copy_plane(out, frame->linesize[0], src, c->stride,
566  c->stride, c->height);
567  break;
568  default:
569  av_log(avctx, AV_LOG_ERROR, "Cannot handle format %i\n", c->fmt);
570  }
571  FFSWAP(uint8_t *, c->cur, c->prev);
572  }
573  *got_frame = 1;
574 
575  /* always report that the buffer was completely consumed */
576  return buf_size;
577 }
578 
580 {
581  ZmbvContext * const c = avctx->priv_data;
582  int zret; // Zlib return code
583 
584  c->avctx = avctx;
585 
586  c->width = avctx->width;
587  c->height = avctx->height;
588 
589  c->bpp = avctx->bits_per_coded_sample;
590 
591  // Needed if zlib unused or init aborted before inflateInit
592  memset(&c->zstream, 0, sizeof(z_stream));
593 
594  if ((avctx->width + 255ULL) * (avctx->height + 64ULL) > FFMIN(avctx->max_pixels, INT_MAX / 4) ) {
595  av_log(avctx, AV_LOG_ERROR, "Internal buffer (decomp_size) larger than max_pixels or too large\n");
596  return AVERROR_INVALIDDATA;
597  }
598 
599  c->decomp_size = (avctx->width + 255) * 4 * (avctx->height + 64);
600 
601  /* Allocate decompression buffer */
602  if (c->decomp_size) {
603  if (!(c->decomp_buf = av_mallocz(c->decomp_size))) {
604  av_log(avctx, AV_LOG_ERROR,
605  "Can't allocate decompression buffer.\n");
606  return AVERROR(ENOMEM);
607  }
608  }
609 
610  c->zstream.zalloc = Z_NULL;
611  c->zstream.zfree = Z_NULL;
612  c->zstream.opaque = Z_NULL;
613  zret = inflateInit(&c->zstream);
614  if (zret != Z_OK) {
615  av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
616  return AVERROR_UNKNOWN;
617  }
618 
619  return 0;
620 }
621 
623 {
624  ZmbvContext * const c = avctx->priv_data;
625 
626  av_freep(&c->decomp_buf);
627 
628  inflateEnd(&c->zstream);
629  av_freep(&c->cur);
630  av_freep(&c->prev);
631 
632  return 0;
633 }
634 
636  .name = "zmbv",
637  .long_name = NULL_IF_CONFIG_SMALL("Zip Motion Blocks Video"),
638  .type = AVMEDIA_TYPE_VIDEO,
639  .id = AV_CODEC_ID_ZMBV,
640  .priv_data_size = sizeof(ZmbvContext),
641  .init = decode_init,
642  .close = decode_end,
643  .decode = decode_frame,
644  .capabilities = AV_CODEC_CAP_DR1,
645 };
#define NULL
Definition: coverity.c:32
uint8_t pal[768]
Definition: zmbv.c:62
int stride
Definition: zmbv.c:68
#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:218
int decomp_len
Definition: zmbv.c:70
misc image utilities
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:64
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static int zmbv_decode_xor_32(ZmbvContext *c)
Decode XOR&#39;ed frame - 32bpp version.
Definition: zmbv.c:315
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: zmbv.c:402
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined ...
Definition: pixfmt.h:104
int size
Definition: avcodec.h:1431
#define AV_RB24
Definition: intreadwrite.h:64
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1727
AVCodecContext * avctx
Definition: zmbv.c:57
#define src
Definition: vp8dsp.c:254
AVCodec.
Definition: avcodec.h:3408
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:42
AVCodec ff_zmbv_decoder
Definition: zmbv.c:635
int flags
Definition: zmbv.c:67
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
Definition: pixfmt.h:102
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.
int(* decode_xor)(struct ZmbvContext *c)
Definition: zmbv.c:73
uint8_t
#define av_cold
Definition: attributes.h:82
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:73
int comp
Definition: zmbv.c:66
static AVFrame * frame
const char data[16]
Definition: mxf.c:90
uint8_t * data
Definition: avcodec.h:1430
static void inflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord)
Definition: vf_neighbor.c:129
static av_cold int decode_init(AVCodecContext *avctx)
Definition: zmbv.c:579
#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:2734
#define av_log(a,...)
static int zmbv_decode_xor_8(ZmbvContext *c)
Decode XOR&#39;ed frame - 8bpp version.
Definition: zmbv.c:80
int by
Definition: zmbv.c:69
#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:69
#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:69
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
const char * name
Name of the codec implementation.
Definition: avcodec.h:3415
static av_cold int decode_end(AVCodecContext *avctx)
Definition: zmbv.c:622
int64_t max_pixels
The number of pixels per image to maximally accept.
Definition: avcodec.h:3227
int(* decode_intra)(struct ZmbvContext *c)
Definition: zmbv.c:72
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:301
#define FFMIN(a, b)
Definition: common.h:96
int width
picture width / height.
Definition: avcodec.h:1690
uint8_t * decomp_buf
Definition: zmbv.c:61
int bh
Definition: zmbv.c:69
unsigned int decomp_size
Definition: zmbv.c:60
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
Libavcodec external API header.
static int zmbv_decode_xor_16(ZmbvContext *c)
Decode XOR&#39;ed frame - 15bpp and 16bpp version.
Definition: zmbv.c:157
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:249
main external API structure.
Definition: avcodec.h:1518
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1891
void * buf
Definition: avisynth_c.h:690
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:236
int height
Definition: zmbv.c:64
z_stream zstream
Definition: zmbv.c:71
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:232
int bpp
Definition: zmbv.c:59
int width
Definition: zmbv.c:64
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:63
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:71
void * priv_data
Definition: avcodec.h:1545
int len
int fmt
Definition: zmbv.c:65
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:296
static int zmbv_decode_intra(ZmbvContext *c)
Decode intraframe.
Definition: zmbv.c:388
FILE * out
Definition: movenc.c:54
#define av_freep(p)
#define ZMBV_DELTAPAL
Definition: zmbv.c:39
uint8_t * cur
Definition: zmbv.c:63
#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
This structure stores compressed data.
Definition: avcodec.h:1407
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:959
Predicted.
Definition: avutil.h:275