FFmpeg  2.8.17
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
utvideodec.c
Go to the documentation of this file.
1 /*
2  * Ut Video decoder
3  * Copyright (c) 2011 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  * Ut Video decoder
25  */
26 
27 #include <inttypes.h>
28 #include <stdlib.h>
29 
30 #include "libavutil/intreadwrite.h"
31 #include "libavutil/pixdesc.h"
32 #include "avcodec.h"
33 #include "bswapdsp.h"
34 #include "bytestream.h"
35 #include "get_bits.h"
36 #include "thread.h"
37 #include "utvideo.h"
38 
39 static int build_huff(const uint8_t *src, VLC *vlc, int *fsym)
40 {
41  int i;
42  HuffEntry he[256];
43  int last;
44  uint32_t codes[256];
45  uint8_t bits[256];
46  uint8_t syms[256];
47  uint32_t code;
48 
49  *fsym = -1;
50  for (i = 0; i < 256; i++) {
51  he[i].sym = i;
52  he[i].len = *src++;
53  }
54  qsort(he, 256, sizeof(*he), ff_ut_huff_cmp_len);
55 
56  if (!he[0].len) {
57  *fsym = he[0].sym;
58  return 0;
59  }
60 
61  last = 255;
62  while (he[last].len == 255 && last)
63  last--;
64 
65  if (he[last].len > 32)
66  return -1;
67 
68  code = 1;
69  for (i = last; i >= 0; i--) {
70  codes[i] = code >> (32 - he[i].len);
71  bits[i] = he[i].len;
72  syms[i] = he[i].sym;
73  code += 0x80000000u >> (he[i].len - 1);
74  }
75 
76  return ff_init_vlc_sparse(vlc, FFMIN(he[last].len, 11), last + 1,
77  bits, sizeof(*bits), sizeof(*bits),
78  codes, sizeof(*codes), sizeof(*codes),
79  syms, sizeof(*syms), sizeof(*syms), 0);
80 }
81 
82 static int decode_plane(UtvideoContext *c, int plane_no,
83  uint8_t *dst, int step, int stride,
84  int width, int height,
85  const uint8_t *src, int use_pred)
86 {
87  int i, j, slice, pix;
88  int sstart, send;
89  VLC vlc;
90  GetBitContext gb;
91  int prev, fsym;
92  const int cmask = ~(!plane_no && c->avctx->pix_fmt == AV_PIX_FMT_YUV420P);
93 
94  if (build_huff(src, &vlc, &fsym)) {
95  av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n");
96  return AVERROR_INVALIDDATA;
97  }
98  if (fsym >= 0) { // build_huff reported a symbol to fill slices with
99  send = 0;
100  for (slice = 0; slice < c->slices; slice++) {
101  uint8_t *dest;
102 
103  sstart = send;
104  send = (height * (slice + 1) / c->slices) & cmask;
105  dest = dst + sstart * stride;
106 
107  prev = 0x80;
108  for (j = sstart; j < send; j++) {
109  for (i = 0; i < width * step; i += step) {
110  pix = fsym;
111  if (use_pred) {
112  prev += (unsigned)pix;
113  pix = prev;
114  }
115  dest[i] = pix;
116  }
117  dest += stride;
118  }
119  }
120  return 0;
121  }
122 
123  src += 256;
124 
125  send = 0;
126  for (slice = 0; slice < c->slices; slice++) {
127  uint8_t *dest;
128  int slice_data_start, slice_data_end, slice_size;
129 
130  sstart = send;
131  send = (height * (slice + 1) / c->slices) & cmask;
132  dest = dst + sstart * stride;
133 
134  // slice offset and size validation was done earlier
135  slice_data_start = slice ? AV_RL32(src + slice * 4 - 4) : 0;
136  slice_data_end = AV_RL32(src + slice * 4);
137  slice_size = slice_data_end - slice_data_start;
138 
139  if (!slice_size) {
140  av_log(c->avctx, AV_LOG_ERROR, "Plane has more than one symbol "
141  "yet a slice has a length of zero.\n");
142  goto fail;
143  }
144 
145  memcpy(c->slice_bits, src + slice_data_start + c->slices * 4,
146  slice_size);
147  memset(c->slice_bits + slice_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
148  c->bdsp.bswap_buf((uint32_t *) c->slice_bits,
149  (uint32_t *) c->slice_bits,
150  (slice_data_end - slice_data_start + 3) >> 2);
151  init_get_bits(&gb, c->slice_bits, slice_size * 8);
152 
153  prev = 0x80;
154  for (j = sstart; j < send; j++) {
155  for (i = 0; i < width * step; i += step) {
156  if (get_bits_left(&gb) <= 0) {
158  "Slice decoding ran out of bits\n");
159  goto fail;
160  }
161  pix = get_vlc2(&gb, vlc.table, vlc.bits, 3);
162  if (pix < 0) {
163  av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
164  goto fail;
165  }
166  if (use_pred) {
167  prev += pix;
168  pix = prev;
169  }
170  dest[i] = pix;
171  }
172  dest += stride;
173  }
174  if (get_bits_left(&gb) > 32)
176  "%d bits left after decoding slice\n", get_bits_left(&gb));
177  }
178 
179  ff_free_vlc(&vlc);
180 
181  return 0;
182 fail:
183  ff_free_vlc(&vlc);
184  return AVERROR_INVALIDDATA;
185 }
186 
187 static void restore_rgb_planes(uint8_t *src, int step, int stride, int width,
188  int height)
189 {
190  int i, j;
191  uint8_t r, g, b;
192 
193  for (j = 0; j < height; j++) {
194  for (i = 0; i < width * step; i += step) {
195  r = src[i];
196  g = src[i + 1];
197  b = src[i + 2];
198  src[i] = r + g - 0x80;
199  src[i + 2] = b + g - 0x80;
200  }
201  src += stride;
202  }
203 }
204 
205 static void restore_median(uint8_t *src, int step, int stride,
206  int width, int height, int slices, int rmode)
207 {
208  int i, j, slice;
209  int A, B, C;
210  uint8_t *bsrc;
211  int slice_start, slice_height;
212  const int cmask = ~rmode;
213 
214  for (slice = 0; slice < slices; slice++) {
215  slice_start = ((slice * height) / slices) & cmask;
216  slice_height = ((((slice + 1) * height) / slices) & cmask) -
217  slice_start;
218 
219  if (!slice_height)
220  continue;
221  bsrc = src + slice_start * stride;
222 
223  // first line - left neighbour prediction
224  bsrc[0] += 0x80;
225  A = bsrc[0];
226  for (i = step; i < width * step; i += step) {
227  bsrc[i] += A;
228  A = bsrc[i];
229  }
230  bsrc += stride;
231  if (slice_height <= 1)
232  continue;
233  // second line - first element has top prediction, the rest uses median
234  C = bsrc[-stride];
235  bsrc[0] += C;
236  A = bsrc[0];
237  for (i = step; i < width * step; i += step) {
238  B = bsrc[i - stride];
239  bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
240  C = B;
241  A = bsrc[i];
242  }
243  bsrc += stride;
244  // the rest of lines use continuous median prediction
245  for (j = 2; j < slice_height; j++) {
246  for (i = 0; i < width * step; i += step) {
247  B = bsrc[i - stride];
248  bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
249  C = B;
250  A = bsrc[i];
251  }
252  bsrc += stride;
253  }
254  }
255 }
256 
257 /* UtVideo interlaced mode treats every two lines as a single one,
258  * so restoring function should take care of possible padding between
259  * two parts of the same "line".
260  */
261 static void restore_median_il(uint8_t *src, int step, int stride,
262  int width, int height, int slices, int rmode)
263 {
264  int i, j, slice;
265  int A, B, C;
266  uint8_t *bsrc;
267  int slice_start, slice_height;
268  const int cmask = ~(rmode ? 3 : 1);
269  const int stride2 = stride << 1;
270 
271  for (slice = 0; slice < slices; slice++) {
272  slice_start = ((slice * height) / slices) & cmask;
273  slice_height = ((((slice + 1) * height) / slices) & cmask) -
274  slice_start;
275  slice_height >>= 1;
276  if (!slice_height)
277  continue;
278 
279  bsrc = src + slice_start * stride;
280 
281  // first line - left neighbour prediction
282  bsrc[0] += 0x80;
283  A = bsrc[0];
284  for (i = step; i < width * step; i += step) {
285  bsrc[i] += A;
286  A = bsrc[i];
287  }
288  for (i = 0; i < width * step; i += step) {
289  bsrc[stride + i] += A;
290  A = bsrc[stride + i];
291  }
292  bsrc += stride2;
293  if (slice_height <= 1)
294  continue;
295  // second line - first element has top prediction, the rest uses median
296  C = bsrc[-stride2];
297  bsrc[0] += C;
298  A = bsrc[0];
299  for (i = step; i < width * step; i += step) {
300  B = bsrc[i - stride2];
301  bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
302  C = B;
303  A = bsrc[i];
304  }
305  for (i = 0; i < width * step; i += step) {
306  B = bsrc[i - stride];
307  bsrc[stride + i] += mid_pred(A, B, (uint8_t)(A + B - C));
308  C = B;
309  A = bsrc[stride + i];
310  }
311  bsrc += stride2;
312  // the rest of lines use continuous median prediction
313  for (j = 2; j < slice_height; j++) {
314  for (i = 0; i < width * step; i += step) {
315  B = bsrc[i - stride2];
316  bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
317  C = B;
318  A = bsrc[i];
319  }
320  for (i = 0; i < width * step; i += step) {
321  B = bsrc[i - stride];
322  bsrc[i + stride] += mid_pred(A, B, (uint8_t)(A + B - C));
323  C = B;
324  A = bsrc[i + stride];
325  }
326  bsrc += stride2;
327  }
328  }
329 }
330 
331 static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
332  AVPacket *avpkt)
333 {
334  const uint8_t *buf = avpkt->data;
335  int buf_size = avpkt->size;
336  UtvideoContext *c = avctx->priv_data;
337  int i, j;
338  const uint8_t *plane_start[5];
339  int plane_size, max_slice_size = 0, slice_start, slice_end, slice_size;
340  int ret;
341  GetByteContext gb;
342  ThreadFrame frame = { .f = data };
343 
344  if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
345  return ret;
346 
347  /* parse plane structure to get frame flags and validate slice offsets */
348  bytestream2_init(&gb, buf, buf_size);
349  for (i = 0; i < c->planes; i++) {
350  plane_start[i] = gb.buffer;
351  if (bytestream2_get_bytes_left(&gb) < 256 + 4 * c->slices) {
352  av_log(avctx, AV_LOG_ERROR, "Insufficient data for a plane\n");
353  return AVERROR_INVALIDDATA;
354  }
355  bytestream2_skipu(&gb, 256);
356  slice_start = 0;
357  slice_end = 0;
358  for (j = 0; j < c->slices; j++) {
359  slice_end = bytestream2_get_le32u(&gb);
360  slice_size = slice_end - slice_start;
361  if (slice_end < 0 || slice_size < 0 ||
362  bytestream2_get_bytes_left(&gb) < slice_end) {
363  av_log(avctx, AV_LOG_ERROR, "Incorrect slice size\n");
364  return AVERROR_INVALIDDATA;
365  }
366  slice_start = slice_end;
367  max_slice_size = FFMAX(max_slice_size, slice_size);
368  }
369  plane_size = slice_end;
370  bytestream2_skipu(&gb, plane_size);
371  }
372  plane_start[c->planes] = gb.buffer;
374  av_log(avctx, AV_LOG_ERROR, "Not enough data for frame information\n");
375  return AVERROR_INVALIDDATA;
376  }
377  c->frame_info = bytestream2_get_le32u(&gb);
378  av_log(avctx, AV_LOG_DEBUG, "frame information flags %"PRIX32"\n",
379  c->frame_info);
380 
381  c->frame_pred = (c->frame_info >> 8) & 3;
382 
383  if (c->frame_pred == PRED_GRADIENT) {
384  avpriv_request_sample(avctx, "Frame with gradient prediction");
385  return AVERROR_PATCHWELCOME;
386  }
387 
389  max_slice_size + AV_INPUT_BUFFER_PADDING_SIZE);
390 
391  if (!c->slice_bits) {
392  av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");
393  return AVERROR(ENOMEM);
394  }
395 
396  switch (c->avctx->pix_fmt) {
397  case AV_PIX_FMT_RGB24:
398  case AV_PIX_FMT_RGBA:
399  for (i = 0; i < c->planes; i++) {
400  ret = decode_plane(c, i, frame.f->data[0] + ff_ut_rgb_order[i],
401  c->planes, frame.f->linesize[0], avctx->width,
402  avctx->height, plane_start[i],
403  c->frame_pred == PRED_LEFT);
404  if (ret)
405  return ret;
406  if (c->frame_pred == PRED_MEDIAN) {
407  if (!c->interlaced) {
408  restore_median(frame.f->data[0] + ff_ut_rgb_order[i],
409  c->planes, frame.f->linesize[0], avctx->width,
410  avctx->height, c->slices, 0);
411  } else {
412  restore_median_il(frame.f->data[0] + ff_ut_rgb_order[i],
413  c->planes, frame.f->linesize[0],
414  avctx->width, avctx->height, c->slices,
415  0);
416  }
417  }
418  }
419  restore_rgb_planes(frame.f->data[0], c->planes, frame.f->linesize[0],
420  avctx->width, avctx->height);
421  break;
422  case AV_PIX_FMT_YUV420P:
423  for (i = 0; i < 3; i++) {
424  ret = decode_plane(c, i, frame.f->data[i], 1, frame.f->linesize[i],
425  avctx->width >> !!i, avctx->height >> !!i,
426  plane_start[i], c->frame_pred == PRED_LEFT);
427  if (ret)
428  return ret;
429  if (c->frame_pred == PRED_MEDIAN) {
430  if (!c->interlaced) {
431  restore_median(frame.f->data[i], 1, frame.f->linesize[i],
432  avctx->width >> !!i, avctx->height >> !!i,
433  c->slices, !i);
434  } else {
435  restore_median_il(frame.f->data[i], 1, frame.f->linesize[i],
436  avctx->width >> !!i,
437  avctx->height >> !!i,
438  c->slices, !i);
439  }
440  }
441  }
442  break;
443  case AV_PIX_FMT_YUV422P:
444  for (i = 0; i < 3; i++) {
445  ret = decode_plane(c, i, frame.f->data[i], 1, frame.f->linesize[i],
446  avctx->width >> !!i, avctx->height,
447  plane_start[i], c->frame_pred == PRED_LEFT);
448  if (ret)
449  return ret;
450  if (c->frame_pred == PRED_MEDIAN) {
451  if (!c->interlaced) {
452  restore_median(frame.f->data[i], 1, frame.f->linesize[i],
453  avctx->width >> !!i, avctx->height,
454  c->slices, 0);
455  } else {
456  restore_median_il(frame.f->data[i], 1, frame.f->linesize[i],
457  avctx->width >> !!i, avctx->height,
458  c->slices, 0);
459  }
460  }
461  }
462  break;
463  }
464 
465  frame.f->key_frame = 1;
466  frame.f->pict_type = AV_PICTURE_TYPE_I;
467  frame.f->interlaced_frame = !!c->interlaced;
468 
469  *got_frame = 1;
470 
471  /* always report that the buffer was completely consumed */
472  return buf_size;
473 }
474 
476 {
477  UtvideoContext * const c = avctx->priv_data;
478  int h_shift, v_shift;
479 
480  c->avctx = avctx;
481 
482  ff_bswapdsp_init(&c->bdsp);
483 
484  if (avctx->extradata_size < 16) {
485  av_log(avctx, AV_LOG_ERROR,
486  "Insufficient extradata size %d, should be at least 16\n",
487  avctx->extradata_size);
488  return AVERROR_INVALIDDATA;
489  }
490 
491  av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d.%d.%d\n",
492  avctx->extradata[3], avctx->extradata[2],
493  avctx->extradata[1], avctx->extradata[0]);
494  av_log(avctx, AV_LOG_DEBUG, "Original format %"PRIX32"\n",
495  AV_RB32(avctx->extradata + 4));
496  c->frame_info_size = AV_RL32(avctx->extradata + 8);
497  c->flags = AV_RL32(avctx->extradata + 12);
498 
499  if (c->frame_info_size != 4)
500  avpriv_request_sample(avctx, "Frame info not 4 bytes");
501  av_log(avctx, AV_LOG_DEBUG, "Encoding parameters %08"PRIX32"\n", c->flags);
502  c->slices = (c->flags >> 24) + 1;
503  c->compression = c->flags & 1;
504  c->interlaced = c->flags & 0x800;
505 
506  c->slice_bits_size = 0;
507 
508  switch (avctx->codec_tag) {
509  case MKTAG('U', 'L', 'R', 'G'):
510  c->planes = 3;
511  avctx->pix_fmt = AV_PIX_FMT_RGB24;
512  break;
513  case MKTAG('U', 'L', 'R', 'A'):
514  c->planes = 4;
515  avctx->pix_fmt = AV_PIX_FMT_RGBA;
516  break;
517  case MKTAG('U', 'L', 'Y', '0'):
518  c->planes = 3;
519  avctx->pix_fmt = AV_PIX_FMT_YUV420P;
520  avctx->colorspace = AVCOL_SPC_BT470BG;
521  break;
522  case MKTAG('U', 'L', 'Y', '2'):
523  c->planes = 3;
524  avctx->pix_fmt = AV_PIX_FMT_YUV422P;
525  avctx->colorspace = AVCOL_SPC_BT470BG;
526  break;
527  case MKTAG('U', 'L', 'H', '0'):
528  c->planes = 3;
529  avctx->pix_fmt = AV_PIX_FMT_YUV420P;
530  avctx->colorspace = AVCOL_SPC_BT709;
531  break;
532  case MKTAG('U', 'L', 'H', '2'):
533  c->planes = 3;
534  avctx->pix_fmt = AV_PIX_FMT_YUV422P;
535  avctx->colorspace = AVCOL_SPC_BT709;
536  break;
537  default:
538  av_log(avctx, AV_LOG_ERROR, "Unknown Ut Video FOURCC provided (%08X)\n",
539  avctx->codec_tag);
540  return AVERROR_INVALIDDATA;
541  }
542 
543  av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &h_shift, &v_shift);
544  if ((avctx->width & ((1<<h_shift)-1)) ||
545  (avctx->height & ((1<<v_shift)-1))) {
546  avpriv_request_sample(avctx, "Odd dimensions");
547  return AVERROR_PATCHWELCOME;
548  }
549 
550  return 0;
551 }
552 
554 {
555  UtvideoContext * const c = avctx->priv_data;
556 
557  av_freep(&c->slice_bits);
558 
559  return 0;
560 }
561 
563  .name = "utvideo",
564  .long_name = NULL_IF_CONFIG_SMALL("Ut Video"),
565  .type = AVMEDIA_TYPE_VIDEO,
566  .id = AV_CODEC_ID_UTVIDEO,
567  .priv_data_size = sizeof(UtvideoContext),
568  .init = decode_init,
569  .close = decode_end,
570  .decode = decode_frame,
572 };
static void restore_median(uint8_t *src, int step, int stride, int width, int height, int slices, int rmode)
Definition: utvideodec.c:205
void(* bswap_buf)(uint32_t *dst, const uint32_t *src, int w)
Definition: bswapdsp.h:25
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
Definition: pixfmt.h:523
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
#define C
uint32_t flags
Definition: utvideo.h:72
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
AVFrame * f
Definition: thread.h:36
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:69
const char * g
Definition: vf_curves.c:108
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 ...
Definition: pixfmt.h:527
#define avpriv_request_sample(...)
int slice_bits_size
Definition: utvideo.h:81
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:279
int size
Definition: avcodec.h:1434
const char * b
Definition: vf_curves.c:109
static int decode_plane(UtvideoContext *c, int plane_no, uint8_t *dst, int step, int stride, int width, int height, const uint8_t *src, int use_pred)
Definition: utvideodec.c:82
static av_cold int decode_end(AVCodecContext *avctx)
Definition: utvideodec.c:553
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1732
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition: bytestream.h:133
AVCodec.
Definition: avcodec.h:3482
int interlaced
Definition: utvideo.h:76
uint8_t bits
Definition: crc.c:295
uint8_t
#define av_cold
Definition: attributes.h:74
#define AV_RB32
Definition: intreadwrite.h:130
Multithreading support functions.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:1627
uint32_t frame_info
Definition: utvideo.h:72
static void restore_median_il(uint8_t *src, int step, int stride, int width, int height, int slices, int rmode)
Definition: utvideodec.c:261
static AVFrame * frame
uint8_t * data
Definition: avcodec.h:1433
const uint8_t * buffer
Definition: bytestream.h:34
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
Definition: bytestream.h:170
bitstream reader API header.
int interlaced_frame
The content of the picture is interlaced.
Definition: frame.h:367
#define A(x)
Definition: vp56_arith.h:28
const int ff_ut_rgb_order[4]
Definition: utvideo.c:33
#define av_log(a,...)
static int build_huff(const uint8_t *src, VLC *vlc, int *fsym)
Definition: utvideodec.c:39
BswapDSPContext bdsp
Definition: utvideo.h:69
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:594
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
static av_cold int decode_init(AVCodecContext *avctx)
Definition: utvideodec.c:475
#define AVERROR(e)
Definition: error.h:43
uint8_t sym
Definition: utvideo.h:85
int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
Utility function to access log2_chroma_w log2_chroma_h from the pixel format AVPixFmtDescriptor.
Definition: pixdesc.c:2157
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:178
AVCodecContext * avctx
Definition: utvideo.h:68
const char * r
Definition: vf_curves.c:107
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
Definition: bytestream.h:154
const char * name
Name of the codec implementation.
Definition: avcodec.h:3489
uint32_t frame_info_size
Definition: utvideo.h:72
#define FFMAX(a, b)
Definition: common.h:90
Libavcodec external API header.
#define fail()
Definition: checkasm.h:57
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: avcodec.h:920
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:99
Definition: get_bits.h:64
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:71
int compression
Definition: utvideo.h:75
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:242
#define FFMIN(a, b)
Definition: common.h:92
int width
picture width / height.
Definition: avcodec.h:1691
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:561
#define AV_RL32
Definition: intreadwrite.h:146
float u
int bits
Definition: get_bits.h:65
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
static void restore_rgb_planes(uint8_t *src, int step, int stride, int width, int height)
Definition: utvideodec.c:187
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: utvideodec.c:331
Common Ut Video header.
int frame_pred
Definition: utvideo.h:77
uint8_t len
Definition: utvideo.h:86
AVS_Value src
Definition: avisynth_c.h:482
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:199
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:1512
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Definition: avcodec.h:1544
void * buf
Definition: avisynth_c.h:553
int extradata_size
Definition: avcodec.h:1628
BYTE int const BYTE int int int height
Definition: avisynth_c.h:676
enum AVColorSpace colorspace
YUV colorspace type.
Definition: avcodec.h:2240
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:415
#define mid_pred
Definition: mathops.h:95
uint8_t * slice_bits
Definition: utvideo.h:80
int ff_ut_huff_cmp_len(const void *a, const void *b)
Definition: utvideo.c:35
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:182
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
Definition: ccaption_dec.c:521
GLint GLenum GLboolean GLsizei stride
Definition: opengl_enc.c:105
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:511
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:67
static double c[64]
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
Definition: avcodec.h:636
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
Definition: mpeg12dec.c:2095
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
Definition: bswapdsp.c:49
void * priv_data
Definition: avcodec.h:1554
Definition: vf_geq.c:46
int len
VLC_TYPE(* table)[2]
code, bits
Definition: get_bits.h:66
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:237
#define av_freep(p)
#define stride
#define MKTAG(a, b, c, d)
Definition: common.h:341
AVCodec ff_utvideo_decoder
Definition: utvideodec.c:562
This structure stores compressed data.
Definition: avcodec.h:1410
void ff_free_vlc(VLC *vlc)
Definition: bitstream.c:364
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:857
static int width