FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
magicyuv.c
Go to the documentation of this file.
1 /*
2  * MagicYUV decoder
3  * Copyright (c) 2016 Paul B Mahol
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 #include <stdlib.h>
23 #include <string.h>
24 
25 #include "libavutil/pixdesc.h"
26 #include "libavutil/qsort.h"
27 
28 #include "avcodec.h"
29 #include "bytestream.h"
30 #include "get_bits.h"
31 #include "huffyuvdsp.h"
32 #include "internal.h"
33 #include "thread.h"
34 
35 typedef struct Slice {
36  uint32_t start;
37  uint32_t size;
38 } Slice;
39 
40 typedef enum Prediction {
41  LEFT = 1,
44 } Prediction;
45 
46 typedef struct HuffEntry {
49  uint32_t code;
50 } HuffEntry;
51 
52 typedef struct MagicYUVContext {
55  int nb_slices;
56  int planes; // number of encoded planes in bitstream
57  int decorrelate; // postprocessing work
58  int interlaced; // video is interlaced
59  uint8_t *buf; // pointer to AVPacket->data
60  int hshift[4];
61  int vshift[4];
62  Slice *slices[4]; // slice bitstream positions for each plane
63  unsigned int slices_size[4]; // slice sizes for each plane
64  uint8_t len[4][256]; // table of code lengths for each plane
65  VLC vlc[4]; // VLC for each plane
68 
69 static int huff_cmp_len(const void *a, const void *b)
70 {
71  const HuffEntry *aa = a, *bb = b;
72  return (aa->len - bb->len) * 256 + aa->sym - bb->sym;
73 }
74 
75 static int huff_build(VLC *vlc, uint8_t *len)
76 {
77  HuffEntry he[256];
78  uint32_t codes[256];
79  uint8_t bits[256];
80  uint8_t syms[256];
81  uint32_t code;
82  int i;
83 
84  for (i = 0; i < 256; i++) {
85  he[i].sym = 255 - i;
86  he[i].len = len[i];
87  }
88  AV_QSORT(he, 256, HuffEntry, huff_cmp_len);
89 
90  code = 1;
91  for (i = 255; i >= 0; i--) {
92  codes[i] = code >> (32 - he[i].len);
93  bits[i] = he[i].len;
94  syms[i] = he[i].sym;
95  code += 0x80000000u >> (he[i].len - 1);
96  }
97 
98  ff_free_vlc(vlc);
99  return ff_init_vlc_sparse(vlc, FFMIN(he[255].len, 12), 256,
100  bits, sizeof(*bits), sizeof(*bits),
101  codes, sizeof(*codes), sizeof(*codes),
102  syms, sizeof(*syms), sizeof(*syms), 0);
103 }
104 
105 static int magy_decode_slice(AVCodecContext *avctx, void *tdata,
106  int j, int threadnr)
107 {
108  MagicYUVContext *s = avctx->priv_data;
109  int interlaced = s->interlaced;
110  AVFrame *p = s->p;
111  int i, k, x;
112  GetBitContext gb;
113  uint8_t *dst;
114 
115  for (i = 0; i < s->planes; i++) {
116  int left, lefttop, top;
117  int height = AV_CEIL_RSHIFT(FFMIN(s->slice_height, avctx->coded_height - j * s->slice_height), s->vshift[i]);
118  int width = AV_CEIL_RSHIFT(avctx->coded_width, s->hshift[i]);
119  int sheight = AV_CEIL_RSHIFT(s->slice_height, s->vshift[i]);
120  ptrdiff_t fake_stride = p->linesize[i] * (1 + interlaced);
121  ptrdiff_t stride = p->linesize[i];
122  int flags, pred;
123  int ret = init_get_bits8(&gb, s->buf + s->slices[i][j].start,
124  s->slices[i][j].size);
125 
126  if (ret < 0)
127  return ret;
128 
129  flags = get_bits(&gb, 8);
130  pred = get_bits(&gb, 8);
131 
132  dst = p->data[i] + j * sheight * stride;
133  if (flags & 1) {
134  for (k = 0; k < height; k++) {
135  for (x = 0; x < width; x++)
136  dst[x] = get_bits(&gb, 8);
137 
138  dst += stride;
139  }
140  } else {
141  for (k = 0; k < height; k++) {
142  for (x = 0; x < width; x++) {
143  int pix;
144  if (get_bits_left(&gb) <= 0)
145  return AVERROR_INVALIDDATA;
146 
147  pix = get_vlc2(&gb, s->vlc[i].table, s->vlc[i].bits, 3);
148  if (pix < 0)
149  return AVERROR_INVALIDDATA;
150 
151  dst[x] = 255 - pix;
152  }
153  dst += stride;
154  }
155  }
156 
157  switch (pred) {
158  case LEFT:
159  dst = p->data[i] + j * sheight * stride;
160  s->hdsp.add_hfyu_left_pred(dst, dst, width, 0);
161  dst += stride;
162  if (interlaced) {
163  s->hdsp.add_hfyu_left_pred(dst, dst, width, 0);
164  dst += stride;
165  }
166  for (k = 1 + interlaced; k < height; k++) {
167  s->hdsp.add_hfyu_left_pred(dst, dst, width, dst[-fake_stride]);
168  dst += stride;
169  }
170  break;
171  case GRADIENT:
172  dst = p->data[i] + j * sheight * stride;
173  s->hdsp.add_hfyu_left_pred(dst, dst, width, 0);
174  left = lefttop = 0;
175  dst += stride;
176  if (interlaced) {
177  s->hdsp.add_hfyu_left_pred(dst, dst, width, 0);
178  left = lefttop = 0;
179  dst += stride;
180  }
181  for (k = 1 + interlaced; k < height; k++) {
182  top = dst[-fake_stride];
183  left = top + dst[0];
184  dst[0] = left;
185  for (x = 1; x < width; x++) {
186  top = dst[x - fake_stride];
187  lefttop = dst[x - (fake_stride + 1)];
188  left += top - lefttop + dst[x];
189  dst[x] = left;
190  }
191  dst += stride;
192  }
193  break;
194  case MEDIAN:
195  dst = p->data[i] + j * sheight * stride;
196  lefttop = left = dst[0];
197  s->hdsp.add_hfyu_left_pred(dst, dst, width, 0);
198  dst += stride;
199  if (interlaced) {
200  lefttop = left = dst[0];
201  s->hdsp.add_hfyu_left_pred(dst, dst, width, 0);
202  dst += stride;
203  }
204  for (k = 1 + interlaced; k < height; k++) {
205  s->hdsp.add_hfyu_median_pred(dst, dst - fake_stride,
206  dst, width, &left, &lefttop);
207  lefttop = left = dst[0];
208  dst += stride;
209  }
210  break;
211  default:
212  avpriv_request_sample(avctx, "Unknown prediction: %d", pred);
213  }
214  }
215 
216  if (s->decorrelate) {
217  int height = FFMIN(s->slice_height, avctx->coded_height - j * s->slice_height);
218  int width = avctx->coded_width;
219  uint8_t *b = p->data[0] + j * s->slice_height * p->linesize[0];
220  uint8_t *g = p->data[1] + j * s->slice_height * p->linesize[1];
221  uint8_t *r = p->data[2] + j * s->slice_height * p->linesize[2];
222 
223  for (i = 0; i < height; i++) {
224  s->hdsp.add_bytes(b, g, width);
225  s->hdsp.add_bytes(r, g, width);
226  b += p->linesize[0];
227  g += p->linesize[1];
228  r += p->linesize[2];
229  }
230  }
231 
232  return 0;
233 }
234 
235 static int magy_decode_frame(AVCodecContext *avctx, void *data,
236  int *got_frame, AVPacket *avpkt)
237 {
238  MagicYUVContext *s = avctx->priv_data;
239  ThreadFrame frame = { .f = data };
240  AVFrame *p = data;
241  GetByteContext gbyte;
242  GetBitContext gbit;
243  uint32_t first_offset, offset, next_offset, header_size, slice_width;
244  int width, height, format, version, table_size;
245  int ret, i, j, k;
246 
247  bytestream2_init(&gbyte, avpkt->data, avpkt->size);
248  if (bytestream2_get_le32(&gbyte) != MKTAG('M', 'A', 'G', 'Y'))
249  return AVERROR_INVALIDDATA;
250 
251  header_size = bytestream2_get_le32(&gbyte);
252  if (header_size < 32 || header_size >= avpkt->size) {
253  av_log(avctx, AV_LOG_ERROR,
254  "header or packet too small %"PRIu32"\n", header_size);
255  return AVERROR_INVALIDDATA;
256  }
257 
258  version = bytestream2_get_byte(&gbyte);
259  if (version != 7) {
260  avpriv_request_sample(avctx, "Version %d", version);
261  return AVERROR_PATCHWELCOME;
262  }
263 
264  s->hshift[1] =
265  s->vshift[1] =
266  s->hshift[2] =
267  s->vshift[2] = 0;
268  s->decorrelate = 0;
269 
270  format = bytestream2_get_byte(&gbyte);
271  switch (format) {
272  case 0x65:
273  avctx->pix_fmt = AV_PIX_FMT_GBRP;
274  s->decorrelate = 1;
275  break;
276  case 0x66:
277  avctx->pix_fmt = AV_PIX_FMT_GBRAP;
278  s->decorrelate = 1;
279  break;
280  case 0x67:
281  avctx->pix_fmt = AV_PIX_FMT_YUV444P;
282  break;
283  case 0x68:
284  avctx->pix_fmt = AV_PIX_FMT_YUV422P;
285  s->hshift[1] =
286  s->hshift[2] = 1;
287  break;
288  case 0x69:
289  avctx->pix_fmt = AV_PIX_FMT_YUV420P;
290  s->hshift[1] =
291  s->vshift[1] =
292  s->hshift[2] =
293  s->vshift[2] = 1;
294  break;
295  case 0x6a:
296  avctx->pix_fmt = AV_PIX_FMT_YUVA444P;
297  break;
298  case 0x6b:
299  avctx->pix_fmt = AV_PIX_FMT_GRAY8;
300  break;
301  default:
302  avpriv_request_sample(avctx, "Format 0x%X", format);
303  return AVERROR_PATCHWELCOME;
304  }
306 
307  bytestream2_skip(&gbyte, 2);
308  s->interlaced = !!(bytestream2_get_byte(&gbyte) & 2);
309  bytestream2_skip(&gbyte, 3);
310 
311  width = bytestream2_get_le32(&gbyte);
312  height = bytestream2_get_le32(&gbyte);
313  ret = ff_set_dimensions(avctx, width, height);
314  if (ret < 0)
315  return ret;
316 
317  slice_width = bytestream2_get_le32(&gbyte);
318  if (slice_width != avctx->coded_width) {
319  avpriv_request_sample(avctx, "Slice width %"PRIu32, slice_width);
320  return AVERROR_PATCHWELCOME;
321  }
322  s->slice_height = bytestream2_get_le32(&gbyte);
323  if (s->slice_height <= 0 || s->slice_height > INT_MAX - avctx->coded_height) {
324  av_log(avctx, AV_LOG_ERROR,
325  "invalid slice height: %d\n", s->slice_height);
326  return AVERROR_INVALIDDATA;
327  }
328 
329  bytestream2_skip(&gbyte, 4);
330 
331  s->nb_slices = (avctx->coded_height + s->slice_height - 1) / s->slice_height;
332  if (s->nb_slices > INT_MAX / sizeof(Slice)) {
333  av_log(avctx, AV_LOG_ERROR,
334  "invalid number of slices: %d\n", s->nb_slices);
335  return AVERROR_INVALIDDATA;
336  }
337 
338  for (i = 0; i < s->planes; i++) {
339  av_fast_malloc(&s->slices[i], &s->slices_size[i], s->nb_slices * sizeof(Slice));
340  if (!s->slices[i])
341  return AVERROR(ENOMEM);
342 
343  offset = bytestream2_get_le32(&gbyte);
344  if (offset >= avpkt->size - header_size)
345  return AVERROR_INVALIDDATA;
346 
347  if (i == 0)
348  first_offset = offset;
349 
350  for (j = 0; j < s->nb_slices - 1; j++) {
351  s->slices[i][j].start = offset + header_size;
352 
353  next_offset = bytestream2_get_le32(&gbyte);
354  if (next_offset <= offset || next_offset >= avpkt->size - header_size)
355  return AVERROR_INVALIDDATA;
356 
357  s->slices[i][j].size = next_offset - offset;
358  offset = next_offset;
359  }
360 
361  s->slices[i][j].start = offset + header_size;
362  s->slices[i][j].size = avpkt->size - s->slices[i][j].start;
363  }
364 
365  if (bytestream2_get_byte(&gbyte) != s->planes)
366  return AVERROR_INVALIDDATA;
367 
368  bytestream2_skip(&gbyte, s->nb_slices * s->planes);
369 
370  table_size = header_size + first_offset - bytestream2_tell(&gbyte);
371  if (table_size < 2)
372  return AVERROR_INVALIDDATA;
373 
374  ret = init_get_bits8(&gbit, avpkt->data + bytestream2_tell(&gbyte), table_size);
375  if (ret < 0)
376  return ret;
377 
378  memset(s->len, 0, sizeof(s->len));
379  j = i = 0;
380  while (get_bits_left(&gbit) >= 8) {
381  int b = get_bits(&gbit, 4);
382  int x = get_bits(&gbit, 4);
383  int l = get_bitsz(&gbit, b) + 1;
384 
385  for (k = 0; k < l; k++)
386  if (j + k < 256)
387  s->len[i][j + k] = x;
388 
389  j += l;
390  if (j == 256) {
391  j = 0;
392  if (huff_build(&s->vlc[i], s->len[i])) {
393  av_log(avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n");
394  return AVERROR_INVALIDDATA;
395  }
396  i++;
397  if (i == s->planes) {
398  break;
399  }
400  } else if (j > 256) {
401  return AVERROR_INVALIDDATA;
402  }
403  }
404 
405  if (i != s->planes) {
406  av_log(avctx, AV_LOG_ERROR, "Huffman tables too short\n");
407  return AVERROR_INVALIDDATA;
408  }
409 
411  p->key_frame = 1;
412 
413  if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
414  return ret;
415 
416  s->buf = avpkt->data;
417  s->p = p;
418  avctx->execute2(avctx, magy_decode_slice, NULL, NULL, s->nb_slices);
419 
420  if (avctx->pix_fmt == AV_PIX_FMT_GBRP ||
421  avctx->pix_fmt == AV_PIX_FMT_GBRAP) {
422  FFSWAP(uint8_t*, p->data[0], p->data[1]);
423  FFSWAP(int, p->linesize[0], p->linesize[1]);
424  }
425 
426  *got_frame = 1;
427 
428  return avpkt->size;
429 }
430 
431 #if HAVE_THREADS
432 static int magy_init_thread_copy(AVCodecContext *avctx)
433 {
434  MagicYUVContext *s = avctx->priv_data;
435  int i;
436 
437  for (i = 0; i < FF_ARRAY_ELEMS(s->slices); i++) {
438  s->slices[i] = NULL;
439  s->slices_size[i] = 0;
440  }
441 
442  return 0;
443 }
444 #endif
445 
447 {
448  MagicYUVContext *s = avctx->priv_data;
450  return 0;
451 }
452 
454 {
455  MagicYUVContext * const s = avctx->priv_data;
456  int i;
457 
458  for (i = 0; i < FF_ARRAY_ELEMS(s->slices); i++) {
459  av_freep(&s->slices[i]);
460  s->slices_size[i] = 0;
461  ff_free_vlc(&s->vlc[i]);
462  }
463 
464  return 0;
465 }
466 
468  .name = "magicyuv",
469  .long_name = NULL_IF_CONFIG_SMALL("MagicYUV video"),
470  .type = AVMEDIA_TYPE_VIDEO,
471  .id = AV_CODEC_ID_MAGICYUV,
472  .priv_data_size = sizeof(MagicYUVContext),
474  .init_thread_copy = ONLY_IF_THREADS_ENABLED(magy_init_thread_copy),
475  .close = magy_decode_end,
476  .decode = magy_decode_frame,
477  .capabilities = AV_CODEC_CAP_DR1 |
480  .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
481 };
#define NULL
Definition: coverity.c:32
const char * s
Definition: avisynth_c.h:768
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
int vshift[4]
Definition: magicyuv.c:61
This structure describes decoded (raw) audio or video data.
Definition: frame.h:184
int hshift[4]
Definition: magicyuv.c:60
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
int coded_width
Bitstream width / height, may be different from width/height e.g.
Definition: avcodec.h:1878
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:67
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:247
static int init_thread_copy(AVCodecContext *avctx)
Definition: tta.c:392
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2306
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
Definition: utils.c:210
const char * g
Definition: vf_curves.c:112
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
int ff_init_vlc_sparse(VLC *vlc_arg, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, const void *symbols, int symbols_wrap, int symbols_size, int flags)
Definition: bitstream.c:275
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:180
int size
Definition: avcodec.h:1602
const char * b
Definition: vf_curves.c:113
av_cold void ff_huffyuvdsp_init(HuffYUVDSPContext *c)
Definition: huffyuvdsp.c:108
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1904
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition: bytestream.h:133
int version
Definition: avisynth_c.h:766
unsigned int slices_size[4]
Definition: magicyuv.c:63
AVCodec.
Definition: avcodec.h:3600
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
#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 bits
Definition: crc.c:296
uint8_t
#define av_cold
Definition: attributes.h:82
Multithreading support functions.
static AVFrame * frame
Prediction
Definition: magicyuv.c:40
#define height
uint8_t * data
Definition: avcodec.h:1601
bitstream reader API header.
void(* add_hfyu_median_pred)(uint8_t *dst, const uint8_t *top, const uint8_t *diff, intptr_t w, int *left, int *left_top)
Definition: huffyuvdsp.h:40
uint32_t code
Definition: magicyuv.c:49
#define av_log(a,...)
static int magy_decode_slice(AVCodecContext *avctx, void *tdata, int j, int threadnr)
Definition: magicyuv.c:105
static int huff_cmp_len(const void *a, const void *b)
Definition: magicyuv.c:69
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:568
void(* add_bytes)(uint8_t *dst, uint8_t *src, intptr_t w)
Definition: huffyuvdsp.h:38
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
int slice_height
Definition: magicyuv.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
uint8_t sym
Definition: magicyuv.c:47
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
const char * r
Definition: vf_curves.c:111
const char * name
Name of the codec implementation.
Definition: avcodec.h:3607
static const uint8_t offset[127][2]
Definition: vf_spp.c:92
int(* add_hfyu_left_pred)(uint8_t *dst, const uint8_t *src, intptr_t w, int left)
Definition: huffyuvdsp.h:43
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: avcodec.h:1022
Definition: vlc.h:26
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:66
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
Definition: internal.h:215
Slice * slices[4]
Definition: magicyuv.c:62
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
Definition: mem.c:499
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:258
#define FFMIN(a, b)
Definition: common.h:96
uint8_t interlaced
Definition: mxfenc.c:1822
#define width
HuffYUVDSPContext hdsp
Definition: magicyuv.c:66
Definition: magicyuv.c:35
AVFrame * p
Definition: magicyuv.c:53
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
Definition: get_bits.h:535
#define FF_ARRAY_ELEMS(a)
int bits
Definition: vlc.h:27
static const float pred[4]
Definition: siprdata.h:259
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
Definition: avcodec.h:1026
static av_cold int magy_decode_init(AVCodecContext *avctx)
Definition: magicyuv.c:446
static av_always_inline int bytestream2_tell(GetByteContext *g)
Definition: bytestream.h:188
uint8_t len
Definition: magicyuv.c:48
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:215
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:437
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:189
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
main external API structure.
Definition: avcodec.h:1676
static int magy_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: magicyuv.c:235
uint32_t size
Definition: magicyuv.c:37
uint32_t start
Definition: magicyuv.c:36
int coded_height
Definition: avcodec.h:1878
static const char * format
Definition: movenc.c:47
uint8_t len[4][256]
Definition: magicyuv.c:64
AVCodec ff_magicyuv_decoder
Definition: magicyuv.c:467
Definition: magicyuv.c:41
#define u(width,...)
VLC vlc[4]
Definition: magicyuv.c:65
uint8_t * buf
Definition: magicyuv.c:59
static int flags
Definition: cpu.c:47
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:198
static av_cold int magy_decode_end(AVCodecContext *avctx)
Definition: magicyuv.c:453
GLint GLenum GLboolean GLsizei stride
Definition: opengl_enc.c:105
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:62
Y , 8bpp.
Definition: pixfmt.h:70
common internal api header.
if(ret< 0)
Definition: vf_mcdeint.c:282
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:229
void * priv_data
Definition: avcodec.h:1718
static int huff_build(VLC *vlc, uint8_t *len)
Definition: magicyuv.c:75
int len
int(* execute2)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count)
The codec may call this to execute several independent things.
Definition: avcodec.h:3167
VLC_TYPE(* table)[2]
code, bits
Definition: vlc.h:28
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:253
#define av_freep(p)
#define FFSWAP(type, a, b)
Definition: common.h:99
#define stride
#define MKTAG(a, b, c, d)
Definition: common.h:342
This structure stores compressed data.
Definition: avcodec.h:1578
void ff_free_vlc(VLC *vlc)
Definition: bitstream.c:360
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:959
#define AV_QSORT(p, num, type, cmp)
Quicksort This sort is fast, and fully inplace but not stable and it is possible to construct input t...
Definition: qsort.h:33
static av_always_inline int get_bitsz(GetBitContext *s, int n)
Read 0-25 bits.
Definition: get_bits.h:262
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58