FFmpeg  4.3.8
fmvc.c
Go to the documentation of this file.
1 /*
2  * FM Screen Capture Codec decoder
3  *
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 <stdio.h>
24 #include <stdlib.h>
25 #include <string.h>
26 
27 #include "avcodec.h"
28 #include "bytestream.h"
29 #include "internal.h"
30 
31 #define BLOCK_HEIGHT 112u
32 #define BLOCK_WIDTH 84u
33 
34 typedef struct InterBlock {
35  int w, h;
36  int size;
37  int xor;
38 } InterBlock;
39 
40 typedef struct FMVCContext {
44  size_t buffer_size;
46  size_t pbuffer_size;
47  ptrdiff_t stride;
48  int bpp;
49  int yb, xb;
51  unsigned nb_blocks;
52 } FMVCContext;
53 
55 {
56  unsigned repeat = 0, first = 1, opcode = 0;
57  int i, len, pos;
58 
59  while (bytestream2_get_bytes_left(gb) > 0) {
60  GetByteContext gbc;
61 
62  while (bytestream2_get_bytes_left(gb) > 0) {
63  if (first) {
64  first = 0;
65  if (bytestream2_peek_byte(gb) > 17) {
66  len = bytestream2_get_byte(gb) - 17;
67  if (len < 4) {
68  do {
69  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
70  --len;
71  } while (len);
72  opcode = bytestream2_peek_byte(gb);
73  continue;
74  } else {
75  do {
76  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
77  --len;
78  } while (len);
79  opcode = bytestream2_peek_byte(gb);
80  if (opcode < 0x10) {
81  bytestream2_skip(gb, 1);
82  pos = - (opcode >> 2) - 4 * bytestream2_get_byte(gb) - 2049;
83 
85  bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET);
86 
87  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
88  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
89  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
90  len = opcode & 3;
91  if (!len) {
92  repeat = 1;
93  } else {
94  do {
95  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
96  --len;
97  } while (len);
98  opcode = bytestream2_peek_byte(gb);
99  }
100  continue;
101  }
102  }
103  }
104  repeat = 1;
105  }
106  if (repeat) {
107  repeat = 0;
108  opcode = bytestream2_peek_byte(gb);
109  if (opcode < 0x10) {
110  bytestream2_skip(gb, 1);
111  if (!opcode) {
112  if (!bytestream2_peek_byte(gb)) {
113  do {
114  bytestream2_skip(gb, 1);
115  opcode += 255;
116  } while (!bytestream2_peek_byte(gb) && bytestream2_get_bytes_left(gb) > 0);
117  }
118  opcode += bytestream2_get_byte(gb) + 15;
119  }
120  bytestream2_put_le32(pb, bytestream2_get_le32(gb));
121  for (i = opcode - 1; i > 0; --i)
122  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
123  opcode = bytestream2_peek_byte(gb);
124  if (opcode < 0x10) {
125  bytestream2_skip(gb, 1);
126  pos = - (opcode >> 2) - 4 * bytestream2_get_byte(gb) - 2049;
127 
129  bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET);
130 
131  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
132  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
133  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
134  len = opcode & 3;
135  if (!len) {
136  repeat = 1;
137  } else {
138  do {
139  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
140  --len;
141  } while (len);
142  opcode = bytestream2_peek_byte(gb);
143  }
144  continue;
145  }
146  }
147  }
148 
149  if (opcode >= 0x40) {
150  bytestream2_skip(gb, 1);
151  pos = - ((opcode >> 2) & 7) - 1 - 8 * bytestream2_get_byte(gb);
152  len = (opcode >> 5) - 1;
153 
155  bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET);
156 
157  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
158  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
159  do {
160  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
161  --len;
162  } while (len);
163 
164  len = opcode & 3;
165 
166  if (!len) {
167  repeat = 1;
168  } else {
169  do {
170  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
171  --len;
172  } while (len);
173  opcode = bytestream2_peek_byte(gb);
174  }
175  continue;
176  } else if (opcode < 0x20) {
177  break;
178  }
179  len = opcode & 0x1F;
180  bytestream2_skip(gb, 1);
181  if (!len) {
182  if (!bytestream2_peek_byte(gb)) {
183  do {
184  bytestream2_skip(gb, 1);
185  len += 255;
186  } while (!bytestream2_peek_byte(gb) && bytestream2_get_bytes_left(gb) > 0);
187  }
188  len += bytestream2_get_byte(gb) + 31;
189  }
190  i = bytestream2_get_le16(gb);
191  pos = - (i >> 2) - 1;
192 
194  bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET);
195 
196  if (len < 6 || bytestream2_tell_p(pb) - bytestream2_tell(&gbc) < 4) {
197  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
198  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
199  do {
200  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
201  --len;
202  } while (len);
203  } else {
204  bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
205  for (len = len - 2; len; --len)
206  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
207  }
208  len = i & 3;
209  if (!len) {
210  repeat = 1;
211  } else {
212  do {
213  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
214  --len;
215  } while (len);
216  opcode = bytestream2_peek_byte(gb);
217  }
218  }
219  bytestream2_skip(gb, 1);
220  if (opcode < 0x10) {
221  pos = -(opcode >> 2) - 1 - 4 * bytestream2_get_byte(gb);
222 
224  bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET);
225 
226  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
227  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
228  len = opcode & 3;
229  if (!len) {
230  repeat = 1;
231  } else {
232  do {
233  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
234  --len;
235  } while (len);
236  opcode = bytestream2_peek_byte(gb);
237  }
238  continue;
239  }
240  len = opcode & 7;
241  if (!len) {
242  if (!bytestream2_peek_byte(gb)) {
243  do {
244  bytestream2_skip(gb, 1);
245  len += 255;
246  } while (!bytestream2_peek_byte(gb) && bytestream2_get_bytes_left(gb) > 0);
247  }
248  len += bytestream2_get_byte(gb) + 7;
249  }
250  i = bytestream2_get_le16(gb);
251  pos = bytestream2_tell_p(pb) - 2048 * (opcode & 8);
252  pos = pos - (i >> 2);
253  if (pos == bytestream2_tell_p(pb))
254  break;
255 
256  pos = pos - 0x4000;
258  bytestream2_seek(&gbc, pos, SEEK_SET);
259 
260  if (len < 6 || bytestream2_tell_p(pb) - bytestream2_tell(&gbc) < 4) {
261  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
262  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
263  do {
264  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
265  --len;
266  } while (len);
267  } else {
268  bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
269  for (len = len - 2; len; --len)
270  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
271  }
272 
273  len = i & 3;
274  if (!len) {
275  repeat = 1;
276  } else {
277  do {
278  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
279  --len;
280  } while (len);
281  opcode = bytestream2_peek_byte(gb);
282  }
283  }
284 
285  return 0;
286 }
287 
289 {
290  unsigned opcode = 0, len;
291  int high = 0;
292  int i, pos;
293 
294  while (bytestream2_get_bytes_left(gb) > 0) {
295  GetByteContext gbc;
296 
297  while (bytestream2_get_bytes_left(gb) > 0) {
298  while (bytestream2_get_bytes_left(gb) > 0) {
299  opcode = bytestream2_get_byte(gb);
300  high = opcode >= 0x20;
301  if (high)
302  break;
303  if (opcode)
304  break;
305  opcode = bytestream2_get_byte(gb);
306  if (opcode < 0xF8) {
307  opcode += 32;
308  break;
309  }
310  i = opcode - 0xF8;
311  if (i) {
312  len = 256;
313  do {
314  len *= 2;
315  --i;
316  } while (i);
317  } else {
318  len = 280;
319  }
320  do {
321  bytestream2_put_le32(pb, bytestream2_get_le32(gb));
322  bytestream2_put_le32(pb, bytestream2_get_le32(gb));
323  len -= 8;
324  } while (len && bytestream2_get_bytes_left(gb) > 0);
325  }
326 
327  if (!high) {
328  do {
329  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
330  --opcode;
331  } while (opcode && bytestream2_get_bytes_left(gb) > 0);
332 
333  while (bytestream2_get_bytes_left(gb) > 0) {
334  GetByteContext gbc;
335 
336  opcode = bytestream2_get_byte(gb);
337  if (opcode >= 0x20)
338  break;
340 
341  pos = -(opcode | 32 * bytestream2_get_byte(gb)) - 1;
342  bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET);
343  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
344  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
345  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
346  bytestream2_put_byte(pb, bytestream2_get_byte(gb));
347  }
348  }
349  high = 0;
350  if (opcode < 0x40)
351  break;
353  pos = (-((opcode & 0x1F) | 32 * bytestream2_get_byte(gb)) - 1);
354  bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos, SEEK_SET);
355  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
356  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
357  len = (opcode >> 5) - 1;
358  do {
359  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
360  --len;
361  } while (len && bytestream2_get_bytes_left(&gbc) > 0);
362  }
363  len = opcode & 0x1F;
364  if (!len) {
365  if (!bytestream2_peek_byte(gb)) {
366  do {
367  bytestream2_skip(gb, 1);
368  len += 255;
369  } while (!bytestream2_peek_byte(gb) && bytestream2_get_bytes_left(gb) > 0);
370  }
371  len += bytestream2_get_byte(gb) + 31;
372  }
373  pos = -bytestream2_get_byte(gb);
375  bytestream2_seek(&gbc, bytestream2_tell_p(pb) + pos - (bytestream2_get_byte(gb) << 8), SEEK_SET);
376  if (bytestream2_tell_p(pb) == bytestream2_tell(&gbc))
377  break;
378  if (len < 5 || bytestream2_tell_p(pb) - bytestream2_tell(&gbc) < 4) {
379  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
380  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
381  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
382  } else {
383  bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
384  len--;
385  }
386  do {
387  bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
388  len--;
389  } while (len && bytestream2_get_bytes_left(&gbc) > 0);
390  }
391 
392  return 0;
393 }
394 
395 static int decode_frame(AVCodecContext *avctx, void *data,
396  int *got_frame, AVPacket *avpkt)
397 {
398  FMVCContext *s = avctx->priv_data;
399  GetByteContext *gb = &s->gb;
400  PutByteContext *pb = &s->pb;
401  AVFrame *frame = data;
402  int ret, y, x;
403  int key_frame;
404 
405  if (avpkt->size < 8)
406  return AVERROR_INVALIDDATA;
407 
408  bytestream2_init(gb, avpkt->data, avpkt->size);
409  bytestream2_skip(gb, 2);
410 
411  key_frame = !!bytestream2_get_le16(gb);
412 
413  if (key_frame) {
414  const uint8_t *src;
415  unsigned type, size;
416  uint8_t *dst;
417 
418  type = bytestream2_get_le16(gb);
419  size = bytestream2_get_le16(gb);
420  if (size > bytestream2_get_bytes_left(gb))
421  return AVERROR_INVALIDDATA;
422 
424  if (type == 1) {
425  decode_type1(gb, pb);
426  } else if (type == 2){
427  decode_type2(gb, pb);
428  } else {
429  avpriv_report_missing_feature(avctx, "Compression type %d", type);
430  return AVERROR_PATCHWELCOME;
431  }
432 
433  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
434  return ret;
435 
436  frame->key_frame = 1;
437  frame->pict_type = AV_PICTURE_TYPE_I;
438 
439  src = s->buffer;
440  dst = frame->data[0] + (avctx->height - 1) * frame->linesize[0];
441  for (y = 0; y < avctx->height; y++) {
442  memcpy(dst, src, avctx->width * s->bpp);
443  dst -= frame->linesize[0];
444  src += s->stride * 4;
445  }
446  } else {
447  unsigned block, nb_blocks;
448  int type, k, l;
449  uint8_t *ssrc, *ddst;
450  const uint32_t *src;
451  uint32_t *dst;
452 
453  for (block = 0; block < s->nb_blocks; block++)
454  s->blocks[block].xor = 0;
455 
456  nb_blocks = bytestream2_get_le16(gb);
457  if (nb_blocks > s->nb_blocks)
458  return AVERROR_INVALIDDATA;
459 
461 
462  type = bytestream2_get_le16(gb);
463  for (block = 0; block < nb_blocks; block++) {
464  unsigned size, offset;
465  int start = 0;
466 
467  offset = bytestream2_get_le16(gb);
468  if (offset >= s->nb_blocks)
469  return AVERROR_INVALIDDATA;
470 
471  size = bytestream2_get_le16(gb);
472  if (size > bytestream2_get_bytes_left(gb))
473  return AVERROR_INVALIDDATA;
474 
475  start = bytestream2_tell_p(pb);
476  if (type == 1) {
477  decode_type1(gb, pb);
478  } else if (type == 2){
479  decode_type2(gb, pb);
480  } else {
481  avpriv_report_missing_feature(avctx, "Compression type %d", type);
482  return AVERROR_PATCHWELCOME;
483  }
484 
485  if (s->blocks[offset].size * 4 != bytestream2_tell_p(pb) - start)
486  return AVERROR_INVALIDDATA;
487 
488  s->blocks[offset].xor = 1;
489  }
490 
491  src = (const uint32_t *)s->pbuffer;
492  dst = (uint32_t *)s->buffer;
493 
494  for (block = 0, y = 0; y < s->yb; y++) {
495  int block_h = s->blocks[block].h;
496  uint32_t *rect = dst;
497 
498  for (x = 0; x < s->xb; x++) {
499  int block_w = s->blocks[block].w;
500  uint32_t *row = dst;
501 
502  block_h = s->blocks[block].h;
503  if (s->blocks[block].xor) {
504  for (k = 0; k < block_h; k++) {
505  uint32_t *column = dst;
506  for (l = 0; l < block_w; l++)
507  *dst++ ^= *src++;
508  dst = &column[s->stride];
509  }
510  }
511  dst = &row[block_w];
512  ++block;
513  }
514  dst = &rect[block_h * s->stride];
515  }
516 
517  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
518  return ret;
519 
520  frame->key_frame = 0;
521  frame->pict_type = AV_PICTURE_TYPE_P;
522 
523  ssrc = s->buffer;
524  ddst = frame->data[0] + (avctx->height - 1) * frame->linesize[0];
525  for (y = 0; y < avctx->height; y++) {
526  memcpy(ddst, ssrc, avctx->width * s->bpp);
527  ddst -= frame->linesize[0];
528  ssrc += s->stride * 4;
529  }
530  }
531 
532  *got_frame = 1;
533 
534  return avpkt->size;
535 }
536 
538 {
539  FMVCContext *s = avctx->priv_data;
540  int i, j, m, block = 0, h = BLOCK_HEIGHT, w = BLOCK_WIDTH;
541 
542  switch (avctx->bits_per_coded_sample) {
543  case 16:
544  avctx->pix_fmt = AV_PIX_FMT_RGB555LE;
545  break;
546  case 24:
547  avctx->pix_fmt = AV_PIX_FMT_BGR24;
548  break;
549  case 32:
550  avctx->pix_fmt = AV_PIX_FMT_BGRA;
551  break;
552  default:
553  av_log(avctx, AV_LOG_ERROR, "Unsupported bitdepth %i\n",
554  avctx->bits_per_coded_sample);
555  return AVERROR_INVALIDDATA;
556  }
557 
558  s->stride = (avctx->width * avctx->bits_per_coded_sample + 31) / 32;
559  s->xb = s->stride / BLOCK_WIDTH;
560  m = s->stride % BLOCK_WIDTH;
561  if (m) {
562  if (m < 37) {
563  w = m + BLOCK_WIDTH;
564  } else {
565  w = m;
566  s->xb++;
567  }
568  }
569 
570  s->yb = avctx->height / BLOCK_HEIGHT;
571  m = avctx->height % BLOCK_HEIGHT;
572  if (m) {
573  if (m < 49) {
574  h = m + BLOCK_HEIGHT;
575  } else {
576  h = m;
577  s->yb++;
578  }
579  }
580 
581  s->nb_blocks = s->xb * s->yb;
582  if (!s->nb_blocks)
583  return AVERROR_INVALIDDATA;
584  s->blocks = av_calloc(s->nb_blocks, sizeof(*s->blocks));
585  if (!s->blocks)
586  return AVERROR(ENOMEM);
587 
588  for (i = 0; i < s->yb; i++) {
589  for (j = 0; j < s->xb; j++) {
590  if (i != (s->yb - 1) || j != (s->xb - 1)) {
591  if (i == s->yb - 1) {
592  s->blocks[block].w = BLOCK_WIDTH;
593  s->blocks[block].h = h;
594  s->blocks[block].size = BLOCK_WIDTH * h;
595  } else if (j == s->xb - 1) {
596  s->blocks[block].w = w;
597  s->blocks[block].h = BLOCK_HEIGHT;
598  s->blocks[block].size = BLOCK_HEIGHT * w;
599  } else {
600  s->blocks[block].w = BLOCK_WIDTH;
601  s->blocks[block].h = BLOCK_HEIGHT;
603  }
604  } else {
605  s->blocks[block].w = w;
606  s->blocks[block].h = h;
607  s->blocks[block].size = w * h;
608  }
609  block++;
610  }
611  }
612 
613  s->bpp = avctx->bits_per_coded_sample >> 3;
614  s->buffer_size = avctx->width * avctx->height * 4;
615  s->pbuffer_size = avctx->width * avctx->height * 4;
616  s->buffer = av_mallocz(s->buffer_size);
618  if (!s->buffer || !s->pbuffer)
619  return AVERROR(ENOMEM);
620 
621  return 0;
622 }
623 
625 {
626  FMVCContext *s = avctx->priv_data;
627 
628  av_freep(&s->buffer);
629  av_freep(&s->pbuffer);
630  av_freep(&s->blocks);
631 
632  return 0;
633 }
634 
636  .name = "fmvc",
637  .long_name = NULL_IF_CONFIG_SMALL("FM Screen Capture Codec"),
638  .type = AVMEDIA_TYPE_VIDEO,
639  .id = AV_CODEC_ID_FMVC,
640  .priv_data_size = sizeof(FMVCContext),
641  .init = decode_init,
642  .close = decode_close,
643  .decode = decode_frame,
644  .capabilities = AV_CODEC_CAP_DR1,
645  .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE |
647 };
size_t pbuffer_size
Definition: fmvc.c:46
#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
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
This structure describes decoded (raw) audio or video data.
Definition: frame.h:300
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined ...
Definition: pixfmt.h:108
int size
Definition: packet.h:356
static av_always_inline void bytestream2_init_writer(PutByteContext *p, uint8_t *buf, int buf_size)
Definition: bytestream.h:143
uint8_t * pbuffer
Definition: fmvc.c:45
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:736
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition: bytestream.h:133
AVCodec.
Definition: codec.h:190
int size
Definition: fmvc.c:36
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:71
GetByteContext gb
Definition: fmvc.c:41
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
Definition: mem.c:245
static int16_t block[64]
Definition: dct.c:115
static av_cold int decode_init(AVCodecContext *avctx)
Definition: fmvc.c:537
#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:88
static av_cold int decode_close(AVCodecContext *avctx)
Definition: fmvc.c:624
int h
Definition: fmvc.c:35
static AVFrame * frame
const char data[16]
Definition: mxf.c:91
InterBlock * blocks
Definition: fmvc.c:50
uint8_t * data
Definition: packet.h:355
int xor
Definition: fmvc.c:37
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:1750
#define av_log(a,...)
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
Definition: bytestream.h:154
#define src
Definition: vp8dsp.c:254
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
unsigned nb_blocks
Definition: fmvc.c:51
static int decode_type2(GetByteContext *gb, PutByteContext *pb)
Definition: fmvc.c:54
#define AVERROR(e)
Definition: error.h:43
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
Definition: bytestream.h:164
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:188
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:95
unsigned int pos
Definition: spdifenc.c:412
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:237
const char * name
Name of the codec implementation.
Definition: codec.h:197
uint8_t * buffer
Definition: fmvc.c:43
static const uint8_t offset[127][2]
Definition: vf_spp.c:93
static av_always_inline int bytestream2_tell_p(PutByteContext *p)
Definition: bytestream.h:193
int yb
Definition: fmvc.c:49
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:383
uint8_t * buffer_start
Definition: bytestream.h:38
int width
picture width / height.
Definition: avcodec.h:699
int w
Definition: fmvc.c:35
#define s(width, name)
Definition: cbs_vp9.c:257
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:69
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
static av_always_inline int bytestream2_tell(GetByteContext *g)
Definition: bytestream.h:188
int xb
Definition: fmvc.c:49
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:331
main external API structure.
Definition: avcodec.h:526
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1854
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: fmvc.c:395
Definition: f_ebur128.c:91
static int decode_type1(GetByteContext *gb, PutByteContext *pb)
Definition: fmvc.c:288
cl_device_type type
AVCodec ff_fmvc_decoder
Definition: fmvc.c:635
#define BLOCK_HEIGHT
Definition: fmvc.c:31
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:314
PutByteContext pb
Definition: fmvc.c:42
ptrdiff_t stride
Definition: fmvc.c:47
common internal api header.
#define BLOCK_WIDTH
Definition: fmvc.c:32
int bpp
Definition: fmvc.c:48
void * priv_data
Definition: avcodec.h:553
int len
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:378
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
Definition: bytestream.h:208
#define av_freep(p)
size_t buffer_size
Definition: fmvc.c:44
This structure stores compressed data.
Definition: packet.h:332
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:50
for(j=16;j >0;--j)
Predicted.
Definition: avutil.h:275
uint8_t * buffer_end
Definition: bytestream.h:38