dnxhddec.c
Go to the documentation of this file.
1 /*
2  * VC3/DNxHD decoder.
3  * Copyright (c) 2007 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
4  * Copyright (c) 2011 MirriAd Ltd
5  *
6  * 10 bit support added by MirriAd Ltd, Joseph Artsimovich <joseph@mirriad.com>
7  *
8  * This file is part of Libav.
9  *
10  * Libav is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * Libav is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with Libav; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  */
24 
25 //#define TRACE
26 //#define DEBUG
27 
28 #include "libavutil/imgutils.h"
29 #include "avcodec.h"
30 #include "get_bits.h"
31 #include "dnxhddata.h"
32 #include "dsputil.h"
33 #include "internal.h"
34 
35 typedef struct DNXHDContext {
39  int cid;
40  unsigned int width, height;
41  unsigned int mb_width, mb_height;
42  uint32_t mb_scan_index[68]; /* max for 1080p */
43  int cur_field;
45  int last_dc[3];
50  int bit_depth; // 8, 10 or 0 if not initialized at all.
52  int n, int qscale);
53 } DNXHDContext;
54 
55 #define DNXHD_VLC_BITS 9
56 #define DNXHD_DC_VLC_BITS 7
57 
58 static void dnxhd_decode_dct_block_8(DNXHDContext *ctx, DCTELEM *block, int n, int qscale);
59 static void dnxhd_decode_dct_block_10(DNXHDContext *ctx, DCTELEM *block, int n, int qscale);
60 
62 {
63  DNXHDContext *ctx = avctx->priv_data;
64 
65  ctx->avctx = avctx;
66  avctx->coded_frame = &ctx->picture;
68  ctx->picture.key_frame = 1;
69  return 0;
70 }
71 
72 static int dnxhd_init_vlc(DNXHDContext *ctx, int cid)
73 {
74  if (cid != ctx->cid) {
75  int index;
76 
77  if ((index = ff_dnxhd_get_cid_table(cid)) < 0) {
78  av_log(ctx->avctx, AV_LOG_ERROR, "unsupported cid %d\n", cid);
79  return -1;
80  }
82 
83  ff_free_vlc(&ctx->ac_vlc);
84  ff_free_vlc(&ctx->dc_vlc);
85  ff_free_vlc(&ctx->run_vlc);
86 
87  init_vlc(&ctx->ac_vlc, DNXHD_VLC_BITS, 257,
88  ctx->cid_table->ac_bits, 1, 1,
89  ctx->cid_table->ac_codes, 2, 2, 0);
90  init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, ctx->bit_depth + 4,
91  ctx->cid_table->dc_bits, 1, 1,
92  ctx->cid_table->dc_codes, 1, 1, 0);
93  init_vlc(&ctx->run_vlc, DNXHD_VLC_BITS, 62,
94  ctx->cid_table->run_bits, 1, 1,
95  ctx->cid_table->run_codes, 2, 2, 0);
96 
98  ctx->cid = cid;
99  }
100  return 0;
101 }
102 
103 static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_size, int first_field)
104 {
105  static const uint8_t header_prefix[] = { 0x00, 0x00, 0x02, 0x80, 0x01 };
106  int i, cid;
107 
108  if (buf_size < 0x280)
109  return -1;
110 
111  if (memcmp(buf, header_prefix, 5)) {
112  av_log(ctx->avctx, AV_LOG_ERROR, "error in header\n");
113  return -1;
114  }
115  if (buf[5] & 2) { /* interlaced */
116  ctx->cur_field = buf[5] & 1;
117  ctx->picture.interlaced_frame = 1;
118  ctx->picture.top_field_first = first_field ^ ctx->cur_field;
119  av_log(ctx->avctx, AV_LOG_DEBUG, "interlaced %d, cur field %d\n", buf[5] & 3, ctx->cur_field);
120  }
121 
122  ctx->height = AV_RB16(buf + 0x18);
123  ctx->width = AV_RB16(buf + 0x1a);
124 
125  av_dlog(ctx->avctx, "width %d, height %d\n", ctx->width, ctx->height);
126 
127  if (buf[0x21] & 0x40) {
129  ctx->avctx->bits_per_raw_sample = 10;
130  if (ctx->bit_depth != 10) {
131  ff_dsputil_init(&ctx->dsp, ctx->avctx);
132  ctx->bit_depth = 10;
134  }
135  } else {
137  ctx->avctx->bits_per_raw_sample = 8;
138  if (ctx->bit_depth != 8) {
139  ff_dsputil_init(&ctx->dsp, ctx->avctx);
140  ctx->bit_depth = 8;
142  }
143  }
144 
145  cid = AV_RB32(buf + 0x28);
146  av_dlog(ctx->avctx, "compression id %d\n", cid);
147 
148  if (dnxhd_init_vlc(ctx, cid) < 0)
149  return -1;
150 
151  if (buf_size < ctx->cid_table->coding_unit_size) {
152  av_log(ctx->avctx, AV_LOG_ERROR, "incorrect frame size\n");
153  return -1;
154  }
155 
156  ctx->mb_width = ctx->width>>4;
157  ctx->mb_height = buf[0x16d];
158 
159  av_dlog(ctx->avctx, "mb width %d, mb height %d\n", ctx->mb_width, ctx->mb_height);
160 
161  if ((ctx->height+15)>>4 == ctx->mb_height && ctx->picture.interlaced_frame)
162  ctx->height <<= 1;
163 
164  if (ctx->mb_height > 68 ||
165  (ctx->mb_height<<ctx->picture.interlaced_frame) > (ctx->height+15)>>4) {
166  av_log(ctx->avctx, AV_LOG_ERROR, "mb height too big: %d\n", ctx->mb_height);
167  return -1;
168  }
169 
170  for (i = 0; i < ctx->mb_height; i++) {
171  ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i<<2));
172  av_dlog(ctx->avctx, "mb scan index %d\n", ctx->mb_scan_index[i]);
173  if (buf_size < ctx->mb_scan_index[i] + 0x280) {
174  av_log(ctx->avctx, AV_LOG_ERROR, "invalid mb scan index\n");
175  return -1;
176  }
177  }
178 
179  return 0;
180 }
181 
183  DCTELEM *block, int n,
184  int qscale,
185  int index_bits,
186  int level_bias,
187  int level_shift)
188 {
189  int i, j, index1, index2, len;
190  int level, component, sign;
191  const uint8_t *weight_matrix;
192  OPEN_READER(bs, &ctx->gb);
193 
194  if (n&2) {
195  component = 1 + (n&1);
196  weight_matrix = ctx->cid_table->chroma_weight;
197  } else {
198  component = 0;
199  weight_matrix = ctx->cid_table->luma_weight;
200  }
201 
202  UPDATE_CACHE(bs, &ctx->gb);
203  GET_VLC(len, bs, &ctx->gb, ctx->dc_vlc.table, DNXHD_DC_VLC_BITS, 1);
204  if (len) {
205  level = GET_CACHE(bs, &ctx->gb);
206  LAST_SKIP_BITS(bs, &ctx->gb, len);
207  sign = ~level >> 31;
208  level = (NEG_USR32(sign ^ level, len) ^ sign) - sign;
209  ctx->last_dc[component] += level;
210  }
211  block[0] = ctx->last_dc[component];
212 
213  for (i = 1; ; i++) {
214  UPDATE_CACHE(bs, &ctx->gb);
215  GET_VLC(index1, bs, &ctx->gb, ctx->ac_vlc.table,
216  DNXHD_VLC_BITS, 2);
217  level = ctx->cid_table->ac_level[index1];
218  if (!level) /* EOB */
219  break;
220 
221  sign = SHOW_SBITS(bs, &ctx->gb, 1);
222  SKIP_BITS(bs, &ctx->gb, 1);
223 
224  if (ctx->cid_table->ac_index_flag[index1]) {
225  level += SHOW_UBITS(bs, &ctx->gb, index_bits) << 6;
226  SKIP_BITS(bs, &ctx->gb, index_bits);
227  }
228 
229  if (ctx->cid_table->ac_run_flag[index1]) {
230  UPDATE_CACHE(bs, &ctx->gb);
231  GET_VLC(index2, bs, &ctx->gb, ctx->run_vlc.table,
232  DNXHD_VLC_BITS, 2);
233  i += ctx->cid_table->run[index2];
234  }
235 
236  if (i > 63) {
237  av_log(ctx->avctx, AV_LOG_ERROR, "ac tex damaged %d, %d\n", n, i);
238  break;
239  }
240 
241  j = ctx->scantable.permutated[i];
242  level = (2*level+1) * qscale * weight_matrix[i];
243  if (level_bias < 32 || weight_matrix[i] != level_bias)
244  level += level_bias;
245  level >>= level_shift;
246 
247  block[j] = (level^sign) - sign;
248  }
249 
250  CLOSE_READER(bs, &ctx->gb);
251 }
252 
254  int n, int qscale)
255 {
256  dnxhd_decode_dct_block(ctx, block, n, qscale, 4, 32, 6);
257 }
258 
260  int n, int qscale)
261 {
262  dnxhd_decode_dct_block(ctx, block, n, qscale, 6, 8, 4);
263 }
264 
265 static int dnxhd_decode_macroblock(DNXHDContext *ctx, int x, int y)
266 {
267  int shift1 = ctx->bit_depth == 10;
268  int dct_linesize_luma = ctx->picture.linesize[0];
269  int dct_linesize_chroma = ctx->picture.linesize[1];
270  uint8_t *dest_y, *dest_u, *dest_v;
271  int dct_y_offset, dct_x_offset;
272  int qscale, i;
273 
274  qscale = get_bits(&ctx->gb, 11);
275  skip_bits1(&ctx->gb);
276 
277  for (i = 0; i < 8; i++) {
278  ctx->dsp.clear_block(ctx->blocks[i]);
279  ctx->decode_dct_block(ctx, ctx->blocks[i], i, qscale);
280  }
281 
282  if (ctx->picture.interlaced_frame) {
283  dct_linesize_luma <<= 1;
284  dct_linesize_chroma <<= 1;
285  }
286 
287  dest_y = ctx->picture.data[0] + ((y * dct_linesize_luma) << 4) + (x << (4 + shift1));
288  dest_u = ctx->picture.data[1] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1));
289  dest_v = ctx->picture.data[2] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1));
290 
291  if (ctx->cur_field) {
292  dest_y += ctx->picture.linesize[0];
293  dest_u += ctx->picture.linesize[1];
294  dest_v += ctx->picture.linesize[2];
295  }
296 
297  dct_y_offset = dct_linesize_luma << 3;
298  dct_x_offset = 8 << shift1;
299  ctx->dsp.idct_put(dest_y, dct_linesize_luma, ctx->blocks[0]);
300  ctx->dsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, ctx->blocks[1]);
301  ctx->dsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, ctx->blocks[4]);
302  ctx->dsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, ctx->blocks[5]);
303 
304  if (!(ctx->avctx->flags & CODEC_FLAG_GRAY)) {
305  dct_y_offset = dct_linesize_chroma << 3;
306  ctx->dsp.idct_put(dest_u, dct_linesize_chroma, ctx->blocks[2]);
307  ctx->dsp.idct_put(dest_v, dct_linesize_chroma, ctx->blocks[3]);
308  ctx->dsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, ctx->blocks[6]);
309  ctx->dsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, ctx->blocks[7]);
310  }
311 
312  return 0;
313 }
314 
315 static int dnxhd_decode_macroblocks(DNXHDContext *ctx, const uint8_t *buf, int buf_size)
316 {
317  int x, y;
318  for (y = 0; y < ctx->mb_height; y++) {
319  ctx->last_dc[0] =
320  ctx->last_dc[1] =
321  ctx->last_dc[2] = 1 << (ctx->bit_depth + 2); // for levels +2^(bitdepth-1)
322  init_get_bits(&ctx->gb, buf + ctx->mb_scan_index[y], (buf_size - ctx->mb_scan_index[y]) << 3);
323  for (x = 0; x < ctx->mb_width; x++) {
324  //START_TIMER;
325  dnxhd_decode_macroblock(ctx, x, y);
326  //STOP_TIMER("decode macroblock");
327  }
328  }
329  return 0;
330 }
331 
332 static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
333  AVPacket *avpkt)
334 {
335  const uint8_t *buf = avpkt->data;
336  int buf_size = avpkt->size;
337  DNXHDContext *ctx = avctx->priv_data;
338  AVFrame *picture = data;
339  int first_field = 1;
340 
341  av_dlog(avctx, "frame size %d\n", buf_size);
342 
343  decode_coding_unit:
344  if (dnxhd_decode_header(ctx, buf, buf_size, first_field) < 0)
345  return -1;
346 
347  if ((avctx->width || avctx->height) &&
348  (ctx->width != avctx->width || ctx->height != avctx->height)) {
349  av_log(avctx, AV_LOG_WARNING, "frame size changed: %dx%d -> %dx%d\n",
350  avctx->width, avctx->height, ctx->width, ctx->height);
351  first_field = 1;
352  }
353 
354  if (av_image_check_size(ctx->width, ctx->height, 0, avctx))
355  return -1;
356  avcodec_set_dimensions(avctx, ctx->width, ctx->height);
357 
358  if (first_field) {
359  if (ctx->picture.data[0])
360  avctx->release_buffer(avctx, &ctx->picture);
361  if (ff_get_buffer(avctx, &ctx->picture) < 0) {
362  av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
363  return -1;
364  }
365  }
366 
367  dnxhd_decode_macroblocks(ctx, buf + 0x280, buf_size - 0x280);
368 
369  if (first_field && ctx->picture.interlaced_frame) {
370  buf += ctx->cid_table->coding_unit_size;
371  buf_size -= ctx->cid_table->coding_unit_size;
372  first_field = 0;
373  goto decode_coding_unit;
374  }
375 
376  *picture = ctx->picture;
377  *got_frame = 1;
378  return buf_size;
379 }
380 
382 {
383  DNXHDContext *ctx = avctx->priv_data;
384 
385  if (ctx->picture.data[0])
386  avctx->release_buffer(avctx, &ctx->picture);
387  ff_free_vlc(&ctx->ac_vlc);
388  ff_free_vlc(&ctx->dc_vlc);
389  ff_free_vlc(&ctx->run_vlc);
390  return 0;
391 }
392 
394  .name = "dnxhd",
395  .type = AVMEDIA_TYPE_VIDEO,
396  .id = AV_CODEC_ID_DNXHD,
397  .priv_data_size = sizeof(DNXHDContext),
401  .capabilities = CODEC_CAP_DR1,
402  .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
403 };
DSPContext dsp
Definition: dnxhddec.c:46
av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx)
Definition: dsputil.c:2656
const uint8_t ff_zigzag_direct[64]
Definition: dsputil.c:59
This structure describes decoded (raw) audio or video data.
Definition: avcodec.h:989
const uint8_t * ac_level
Definition: dnxhddata.h:39
const uint8_t * dc_bits
Definition: dnxhddata.h:37
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
Definition: avcodec.h:2259
misc image utilities
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:237
const uint8_t * luma_weight
Definition: dnxhddata.h:36
AVFrame * coded_frame
the picture in the bitstream
Definition: avcodec.h:2725
int last_dc[3]
Definition: dnxhddec.c:45
Scantable.
Definition: dsputil.h:181
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
Definition: utils.c:149
int size
Definition: avcodec.h:916
const CIDEntry ff_dnxhd_cid_table[]
Definition: dnxhddata.c:1065
const uint16_t * run_codes
Definition: dnxhddata.h:41
static void dnxhd_decode_dct_block_10(DNXHDContext *ctx, DCTELEM *block, int n, int qscale)
Definition: dnxhddec.c:259
VLC run_vlc
Definition: dnxhddec.c:44
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1533
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
uint8_t permutated[64]
Definition: dsputil.h:183
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: avcodec.h:2711
VLC dc_vlc
Definition: dnxhddec.c:44
AVCodec.
Definition: avcodec.h:2960
static av_cold int dnxhd_decode_close(AVCodecContext *avctx)
Definition: dnxhddec.c:381
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
Definition: mimic.c:228
struct DNXHDContext DNXHDContext
uint8_t
#define AV_RB32
Definition: intreadwrite.h:130
static int dnxhd_decode_macroblock(DNXHDContext *ctx, int x, int y)
Definition: dnxhddec.c:265
const char data[16]
Definition: mxf.c:66
uint8_t * data
Definition: avcodec.h:915
const uint8_t * run_bits
Definition: dnxhddata.h:42
bitstream reader API header.
uint8_t idct_permutation[64]
idct input permutation.
Definition: dsputil.h:425
int bit_depth
Definition: dnxhddec.c:50
#define DNXHD_VLC_BITS
Definition: dnxhddec.c:55
int interlaced_frame
The content of the picture is interlaced.
Definition: avcodec.h:1232
unsigned int coding_unit_size
Definition: dnxhddata.h:33
#define DNXHD_DC_VLC_BITS
Definition: dnxhddec.c:56
const uint8_t * ac_index_flag
Definition: dnxhddata.h:40
static int init(AVCodecParserContext *s)
Definition: h264_parser.c:335
VLC ac_vlc
Definition: dnxhddec.c:44
const uint8_t * ac_bits
Definition: dnxhddata.h:39
const uint16_t * ac_codes
Definition: dnxhddata.h:38
#define UPDATE_CACHE(name, gb)
Definition: get_bits.h:160
int ff_dnxhd_get_cid_table(int cid)
Definition: dnxhddata.c:1138
static const int shift1[6]
Definition: dxa.c:48
static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_size, int first_field)
Definition: dnxhddec.c:103
#define AV_RB16
Definition: intreadwrite.h:53
uint32_t mb_scan_index[68]
Definition: dnxhddec.c:42
void(* idct_put)(uint8_t *dest, int line_size, DCTELEM *block)
block -> idct -> clip to unsigned 8 bit -> dest.
Definition: dsputil.h:405
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:88
int flags
CODEC_FLAG_*.
Definition: avcodec.h:1434
unsigned int height
Definition: dnxhddec.c:40
const uint8_t * dc_codes
Definition: dnxhddata.h:37
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:146
const char * name
Name of the codec implementation.
Definition: avcodec.h:2967
#define CLOSE_READER(name, gb)
Definition: get_bits.h:140
void(* clear_block)(DCTELEM *block)
Definition: dsputil.h:218
static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx, DCTELEM *block, int n, int qscale, int index_bits, int level_bias, int level_shift)
Definition: dnxhddec.c:182
Definition: get_bits.h:63
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:69
const uint8_t * chroma_weight
Definition: dnxhddata.h:36
#define SKIP_BITS(name, gb, num)
Definition: get_bits.h:175
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
Definition: imgutils.c:220
static AVFrame * picture
static DCTELEM block[64]
Definition: dct-test.c:169
int width
picture width / height.
Definition: avcodec.h:1508
#define NEG_USR32(a, s)
Definition: mathops.h:159
const uint8_t * run
Definition: dnxhddata.h:42
int type
type of the buffer (to keep track of who has to deallocate data[*])
Definition: avcodec.h:1217
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
Get a buffer for a frame.
Definition: utils.c:464
#define LAST_SKIP_BITS(name, gb, num)
Definition: get_bits.h:180
AVFrame picture
Definition: dnxhddec.c:37
ScanTable scantable
Definition: dnxhddec.c:48
unsigned int mb_width
Definition: dnxhddec.c:41
#define GET_VLC(code, name, gb, table, bits, max_depth)
If the vlc code is invalid and max_depth=1, then no bits will be removed.
Definition: get_bits.h:449
#define SHOW_UBITS(name, gb, num)
Definition: get_bits.h:186
int cid
compression id
Definition: dnxhddec.c:39
static int dnxhd_decode_macroblocks(DNXHDContext *ctx, const uint8_t *buf, int buf_size)
Definition: dnxhddec.c:315
unsigned int width
Definition: dnxhddec.c:40
external API header
int cur_field
current interlaced field
Definition: dnxhddec.c:43
unsigned int mb_height
Definition: dnxhddec.c:41
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
Definition: avcodec.h:1008
static int dnxhd_init_vlc(DNXHDContext *ctx, int cid)
Definition: dnxhddec.c:72
const uint8_t * ac_run_flag
Definition: dnxhddata.h:40
main external API structure.
Definition: avcodec.h:1339
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
static void close(AVCodecParserContext *s)
Definition: h264_parser.c:326
#define OPEN_READER(name, gb)
Definition: get_bits.h:124
#define init_vlc(vlc, nb_bits, nb_codes,bits, bits_wrap, bits_size,codes, codes_wrap, codes_size,flags)
Definition: get_bits.h:418
static void skip_bits1(GetBitContext *s)
Definition: get_bits.h:293
int index
Definition: gxfenc.c:72
void(* decode_dct_block)(struct DNXHDContext *ctx, DCTELEM *block, int n, int qscale)
Definition: dnxhddec.c:51
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:372
#define GET_CACHE(name, gb)
Definition: get_bits.h:190
short DCTELEM
Definition: dsputil.h:39
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: avcodec.h:997
uint8_t level
Definition: svq3.c:133
#define SHOW_SBITS(name, gb, num)
Definition: get_bits.h:187
common internal api header.
DCTELEM blocks[8][64]
Definition: dnxhddec.c:47
GetBitContext gb
Definition: dnxhddec.c:38
static void dnxhd_decode_dct_block_8(DNXHDContext *ctx, DCTELEM *block, int n, int qscale)
Definition: dnxhddec.c:253
DSP utils.
void * priv_data
Definition: avcodec.h:1382
int top_field_first
If the content is interlaced, is top field displayed first.
Definition: avcodec.h:1239
static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: dnxhddec.c:332
int len
void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
Definition: dsputil.c:122
VLC_TYPE(* table)[2]
code, bits
Definition: get_bits.h:65
AVCodecContext * avctx
Definition: dnxhddec.c:36
int key_frame
1 -> keyframe, 0-> not
Definition: avcodec.h:1058
AVCodec ff_dnxhd_decoder
Definition: dnxhddec.c:393
const CIDEntry * cid_table
Definition: dnxhddec.c:49
static int first_field(int fd)
Definition: v4l2.c:207
This structure stores compressed data.
Definition: avcodec.h:898
void ff_free_vlc(VLC *vlc)
Definition: bitstream.c:322
DSPContext.
Definition: dsputil.h:194
static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
Definition: dnxhddec.c:61