You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

530 lines
19KB

  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 FFmpeg.
  9. *
  10. * FFmpeg 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. * FFmpeg 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 FFmpeg; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. */
  24. #include "libavutil/imgutils.h"
  25. #include "libavutil/timer.h"
  26. #include "avcodec.h"
  27. #include "blockdsp.h"
  28. #include "get_bits.h"
  29. #include "dnxhddata.h"
  30. #include "idctdsp.h"
  31. #include "internal.h"
  32. #include "thread.h"
  33. typedef struct DNXHDContext {
  34. AVCodecContext *avctx;
  35. GetBitContext gb;
  36. BlockDSPContext bdsp;
  37. int64_t cid; ///< compression id
  38. unsigned int width, height;
  39. enum AVPixelFormat pix_fmt;
  40. unsigned int mb_width, mb_height;
  41. uint32_t mb_scan_index[68]; /* max for 1080p */
  42. int cur_field; ///< current interlaced field
  43. VLC ac_vlc, dc_vlc, run_vlc;
  44. int last_dc[3];
  45. IDCTDSPContext idsp;
  46. DECLARE_ALIGNED(16, int16_t, blocks)[12][64];
  47. ScanTable scantable;
  48. const CIDEntry *cid_table;
  49. int bit_depth; // 8, 10 or 0 if not initialized at all.
  50. int is_444;
  51. void (*decode_dct_block)(struct DNXHDContext *ctx, int16_t *block,
  52. int n, int qscale);
  53. int last_qscale;
  54. int luma_scale[64];
  55. int chroma_scale[64];
  56. } DNXHDContext;
  57. #define DNXHD_VLC_BITS 9
  58. #define DNXHD_DC_VLC_BITS 7
  59. static void dnxhd_decode_dct_block_8(DNXHDContext *ctx, int16_t *block,
  60. int n, int qscale);
  61. static void dnxhd_decode_dct_block_10(DNXHDContext *ctx, int16_t *block,
  62. int n, int qscale);
  63. static void dnxhd_decode_dct_block_10_444(DNXHDContext *ctx, int16_t *block,
  64. int n, int qscale);
  65. static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
  66. {
  67. DNXHDContext *ctx = avctx->priv_data;
  68. ctx->avctx = avctx;
  69. ctx->cid = -1;
  70. avctx->colorspace = AVCOL_SPC_BT709;
  71. return 0;
  72. }
  73. static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid)
  74. {
  75. if (cid != ctx->cid) {
  76. int index;
  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 AVERROR(ENOSYS);
  80. }
  81. if (ff_dnxhd_cid_table[index].bit_depth != ctx->bit_depth) {
  82. av_log(ctx->avctx, AV_LOG_ERROR, "bit depth mismatches %d %d\n", ff_dnxhd_cid_table[index].bit_depth, ctx->bit_depth);
  83. return AVERROR_INVALIDDATA;
  84. }
  85. ctx->cid_table = &ff_dnxhd_cid_table[index];
  86. av_log(ctx->avctx, AV_LOG_VERBOSE, "Profile cid %d.\n", cid);
  87. ff_free_vlc(&ctx->ac_vlc);
  88. ff_free_vlc(&ctx->dc_vlc);
  89. ff_free_vlc(&ctx->run_vlc);
  90. init_vlc(&ctx->ac_vlc, DNXHD_VLC_BITS, 257,
  91. ctx->cid_table->ac_bits, 1, 1,
  92. ctx->cid_table->ac_codes, 2, 2, 0);
  93. init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, ctx->bit_depth + 4,
  94. ctx->cid_table->dc_bits, 1, 1,
  95. ctx->cid_table->dc_codes, 1, 1, 0);
  96. init_vlc(&ctx->run_vlc, DNXHD_VLC_BITS, 62,
  97. ctx->cid_table->run_bits, 1, 1,
  98. ctx->cid_table->run_codes, 2, 2, 0);
  99. ff_init_scantable(ctx->idsp.idct_permutation, &ctx->scantable,
  100. ff_zigzag_direct);
  101. ctx->cid = cid;
  102. }
  103. return 0;
  104. }
  105. static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
  106. const uint8_t *buf, int buf_size,
  107. int first_field)
  108. {
  109. static const uint8_t header_prefix[] = { 0x00, 0x00, 0x02, 0x80, 0x01 };
  110. static const uint8_t header_prefix444[] = { 0x00, 0x00, 0x02, 0x80, 0x02 };
  111. int i, cid, ret;
  112. int old_bit_depth = ctx->bit_depth;
  113. if (buf_size < 0x280) {
  114. av_log(ctx->avctx, AV_LOG_ERROR, "buffer too small (%d < 640).\n",
  115. buf_size);
  116. return AVERROR_INVALIDDATA;
  117. }
  118. if (memcmp(buf, header_prefix, 5) && memcmp(buf, header_prefix444, 5)) {
  119. av_log(ctx->avctx, AV_LOG_ERROR,
  120. "unknown header 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n",
  121. buf[0], buf[1], buf[2], buf[3], buf[4]);
  122. return AVERROR_INVALIDDATA;
  123. }
  124. if (buf[5] & 2) { /* interlaced */
  125. ctx->cur_field = buf[5] & 1;
  126. frame->interlaced_frame = 1;
  127. frame->top_field_first = first_field ^ ctx->cur_field;
  128. av_log(ctx->avctx, AV_LOG_DEBUG,
  129. "interlaced %d, cur field %d\n", buf[5] & 3, ctx->cur_field);
  130. } else {
  131. ctx->cur_field = 0;
  132. }
  133. ctx->height = AV_RB16(buf + 0x18);
  134. ctx->width = AV_RB16(buf + 0x1a);
  135. ff_dlog(ctx->avctx, "width %d, height %d\n", ctx->width, ctx->height);
  136. if (buf[0x21] == 0x58) { /* 10 bit */
  137. ctx->bit_depth = ctx->avctx->bits_per_raw_sample = 10;
  138. if (buf[0x4] == 0x2) {
  139. ctx->decode_dct_block = dnxhd_decode_dct_block_10_444;
  140. ctx->pix_fmt = AV_PIX_FMT_YUV444P10;
  141. ctx->is_444 = 1;
  142. } else {
  143. ctx->decode_dct_block = dnxhd_decode_dct_block_10;
  144. ctx->pix_fmt = AV_PIX_FMT_YUV422P10;
  145. ctx->is_444 = 0;
  146. }
  147. } else if (buf[0x21] == 0x38) { /* 8 bit */
  148. ctx->bit_depth = ctx->avctx->bits_per_raw_sample = 8;
  149. ctx->pix_fmt = AV_PIX_FMT_YUV422P;
  150. ctx->is_444 = 0;
  151. ctx->decode_dct_block = dnxhd_decode_dct_block_8;
  152. } else {
  153. av_log(ctx->avctx, AV_LOG_ERROR, "invalid bit depth value (%d).\n",
  154. buf[0x21]);
  155. return AVERROR_INVALIDDATA;
  156. }
  157. if (ctx->bit_depth != old_bit_depth) {
  158. ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
  159. ff_idctdsp_init(&ctx->idsp, ctx->avctx);
  160. }
  161. cid = AV_RB32(buf + 0x28);
  162. ff_dlog(ctx->avctx, "compression id %d\n", cid);
  163. if ((ret = dnxhd_init_vlc(ctx, cid)) < 0)
  164. return ret;
  165. // make sure profile size constraints are respected
  166. // DNx100 allows 1920->1440 and 1280->960 subsampling
  167. if (ctx->width != ctx->cid_table->width) {
  168. av_reduce(&ctx->avctx->sample_aspect_ratio.num,
  169. &ctx->avctx->sample_aspect_ratio.den,
  170. ctx->width, ctx->cid_table->width, 255);
  171. ctx->width = ctx->cid_table->width;
  172. }
  173. if (buf_size < ctx->cid_table->coding_unit_size) {
  174. av_log(ctx->avctx, AV_LOG_ERROR, "incorrect frame size (%d < %d).\n",
  175. buf_size, ctx->cid_table->coding_unit_size);
  176. return AVERROR_INVALIDDATA;
  177. }
  178. ctx->mb_width = ctx->width >> 4;
  179. ctx->mb_height = buf[0x16d];
  180. ff_dlog(ctx->avctx,
  181. "mb width %d, mb height %d\n", ctx->mb_width, ctx->mb_height);
  182. if ((ctx->height + 15) >> 4 == ctx->mb_height && frame->interlaced_frame)
  183. ctx->height <<= 1;
  184. if (ctx->mb_height > 68 ||
  185. (ctx->mb_height << frame->interlaced_frame) > (ctx->height + 15) >> 4) {
  186. av_log(ctx->avctx, AV_LOG_ERROR,
  187. "mb height too big: %d\n", ctx->mb_height);
  188. return AVERROR_INVALIDDATA;
  189. }
  190. for (i = 0; i < ctx->mb_height; i++) {
  191. ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i << 2));
  192. ff_dlog(ctx->avctx, "mb scan index %d\n", ctx->mb_scan_index[i]);
  193. if (buf_size < ctx->mb_scan_index[i] + 0x280LL) {
  194. av_log(ctx->avctx, AV_LOG_ERROR,
  195. "invalid mb scan index (%d < %d).\n",
  196. buf_size, ctx->mb_scan_index[i] + 0x280);
  197. return AVERROR_INVALIDDATA;
  198. }
  199. }
  200. return 0;
  201. }
  202. static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
  203. int16_t *block, int n,
  204. int qscale,
  205. int index_bits,
  206. int level_bias,
  207. int level_shift)
  208. {
  209. int i, j, index1, index2, len, flags;
  210. int level, component, sign;
  211. const int *scale;
  212. const uint8_t *weight_matrix;
  213. const uint8_t *ac_level = ctx->cid_table->ac_level;
  214. const uint8_t *ac_flags = ctx->cid_table->ac_flags;
  215. const int eob_index = ctx->cid_table->eob_index;
  216. OPEN_READER(bs, &ctx->gb);
  217. if (!ctx->is_444) {
  218. if (n & 2) {
  219. component = 1 + (n & 1);
  220. scale = ctx->chroma_scale;
  221. weight_matrix = ctx->cid_table->chroma_weight;
  222. } else {
  223. component = 0;
  224. scale = ctx->luma_scale;
  225. weight_matrix = ctx->cid_table->luma_weight;
  226. }
  227. } else {
  228. component = (n >> 1) % 3;
  229. if (component) {
  230. scale = ctx->chroma_scale;
  231. weight_matrix = ctx->cid_table->chroma_weight;
  232. } else {
  233. scale = ctx->luma_scale;
  234. weight_matrix = ctx->cid_table->luma_weight;
  235. }
  236. }
  237. UPDATE_CACHE(bs, &ctx->gb);
  238. GET_VLC(len, bs, &ctx->gb, ctx->dc_vlc.table, DNXHD_DC_VLC_BITS, 1);
  239. if (len) {
  240. level = GET_CACHE(bs, &ctx->gb);
  241. LAST_SKIP_BITS(bs, &ctx->gb, len);
  242. sign = ~level >> 31;
  243. level = (NEG_USR32(sign ^ level, len) ^ sign) - sign;
  244. ctx->last_dc[component] += level;
  245. }
  246. block[0] = ctx->last_dc[component];
  247. i = 0;
  248. UPDATE_CACHE(bs, &ctx->gb);
  249. GET_VLC(index1, bs, &ctx->gb, ctx->ac_vlc.table,
  250. DNXHD_VLC_BITS, 2);
  251. while (index1 != eob_index) {
  252. level = ac_level[index1];
  253. flags = ac_flags[index1];
  254. sign = SHOW_SBITS(bs, &ctx->gb, 1);
  255. SKIP_BITS(bs, &ctx->gb, 1);
  256. if (flags & 1) {
  257. level += SHOW_UBITS(bs, &ctx->gb, index_bits) << 7;
  258. SKIP_BITS(bs, &ctx->gb, index_bits);
  259. }
  260. if (flags & 2) {
  261. UPDATE_CACHE(bs, &ctx->gb);
  262. GET_VLC(index2, bs, &ctx->gb, ctx->run_vlc.table,
  263. DNXHD_VLC_BITS, 2);
  264. i += ctx->cid_table->run[index2];
  265. }
  266. if (++i > 63) {
  267. av_log(ctx->avctx, AV_LOG_ERROR, "ac tex damaged %d, %d\n", n, i);
  268. break;
  269. }
  270. j = ctx->scantable.permutated[i];
  271. level *= scale[i];
  272. if (level_bias < 32 || weight_matrix[i] != level_bias)
  273. level += level_bias;
  274. level >>= level_shift;
  275. block[j] = (level ^ sign) - sign;
  276. UPDATE_CACHE(bs, &ctx->gb);
  277. GET_VLC(index1, bs, &ctx->gb, ctx->ac_vlc.table,
  278. DNXHD_VLC_BITS, 2);
  279. }
  280. CLOSE_READER(bs, &ctx->gb);
  281. }
  282. static void dnxhd_decode_dct_block_8(DNXHDContext *ctx, int16_t *block,
  283. int n, int qscale)
  284. {
  285. dnxhd_decode_dct_block(ctx, block, n, qscale, 4, 32, 6);
  286. }
  287. static void dnxhd_decode_dct_block_10(DNXHDContext *ctx, int16_t *block,
  288. int n, int qscale)
  289. {
  290. dnxhd_decode_dct_block(ctx, block, n, qscale, 6, 8, 4);
  291. }
  292. static void dnxhd_decode_dct_block_10_444(DNXHDContext *ctx, int16_t *block,
  293. int n, int qscale)
  294. {
  295. dnxhd_decode_dct_block(ctx, block, n, qscale, 6, 32, 6);
  296. }
  297. static int dnxhd_decode_macroblock(DNXHDContext *ctx, AVFrame *frame,
  298. int x, int y)
  299. {
  300. int shift1 = ctx->bit_depth == 10;
  301. int dct_linesize_luma = frame->linesize[0];
  302. int dct_linesize_chroma = frame->linesize[1];
  303. uint8_t *dest_y, *dest_u, *dest_v;
  304. int dct_y_offset, dct_x_offset;
  305. int qscale, i;
  306. int interlaced_mb = 0;
  307. if (ctx->cid_table->cid == 1260) {
  308. interlaced_mb = get_bits1(&ctx->gb);
  309. qscale = get_bits(&ctx->gb, 10);
  310. } else
  311. qscale = get_bits(&ctx->gb, 11);
  312. skip_bits1(&ctx->gb);
  313. if (qscale != ctx->last_qscale) {
  314. for (i = 0; i < 64; i++) {
  315. ctx->luma_scale[i] = qscale * ctx->cid_table->luma_weight[i];
  316. ctx->chroma_scale[i] = qscale * ctx->cid_table->chroma_weight[i];
  317. }
  318. ctx->last_qscale = qscale;
  319. }
  320. for (i = 0; i < 8; i++) {
  321. ctx->bdsp.clear_block(ctx->blocks[i]);
  322. ctx->decode_dct_block(ctx, ctx->blocks[i], i, qscale);
  323. }
  324. if (ctx->is_444) {
  325. for (; i < 12; i++) {
  326. ctx->bdsp.clear_block(ctx->blocks[i]);
  327. ctx->decode_dct_block(ctx, ctx->blocks[i], i, qscale);
  328. }
  329. }
  330. if (frame->interlaced_frame) {
  331. dct_linesize_luma <<= 1;
  332. dct_linesize_chroma <<= 1;
  333. }
  334. dest_y = frame->data[0] + ((y * dct_linesize_luma) << 4) + (x << (4 + shift1));
  335. dest_u = frame->data[1] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444));
  336. dest_v = frame->data[2] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444));
  337. if (frame->interlaced_frame && ctx->cur_field) {
  338. dest_y += frame->linesize[0];
  339. dest_u += frame->linesize[1];
  340. dest_v += frame->linesize[2];
  341. }
  342. if (interlaced_mb) {
  343. dct_linesize_luma <<= 1;
  344. dct_linesize_chroma <<= 1;
  345. }
  346. dct_y_offset = interlaced_mb ? frame->linesize[0] : (dct_linesize_luma << 3);
  347. dct_x_offset = 8 << shift1;
  348. if (!ctx->is_444) {
  349. ctx->idsp.idct_put(dest_y, dct_linesize_luma, ctx->blocks[0]);
  350. ctx->idsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, ctx->blocks[1]);
  351. ctx->idsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, ctx->blocks[4]);
  352. ctx->idsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, ctx->blocks[5]);
  353. if (!(ctx->avctx->flags & AV_CODEC_FLAG_GRAY)) {
  354. dct_y_offset = interlaced_mb ? frame->linesize[1] : (dct_linesize_chroma << 3);
  355. ctx->idsp.idct_put(dest_u, dct_linesize_chroma, ctx->blocks[2]);
  356. ctx->idsp.idct_put(dest_v, dct_linesize_chroma, ctx->blocks[3]);
  357. ctx->idsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, ctx->blocks[6]);
  358. ctx->idsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, ctx->blocks[7]);
  359. }
  360. } else {
  361. ctx->idsp.idct_put(dest_y, dct_linesize_luma, ctx->blocks[0]);
  362. ctx->idsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, ctx->blocks[1]);
  363. ctx->idsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, ctx->blocks[6]);
  364. ctx->idsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, ctx->blocks[7]);
  365. if (!(ctx->avctx->flags & AV_CODEC_FLAG_GRAY)) {
  366. dct_y_offset = interlaced_mb ? frame->linesize[1] : (dct_linesize_chroma << 3);
  367. ctx->idsp.idct_put(dest_u, dct_linesize_chroma, ctx->blocks[2]);
  368. ctx->idsp.idct_put(dest_u + dct_x_offset, dct_linesize_chroma, ctx->blocks[3]);
  369. ctx->idsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, ctx->blocks[8]);
  370. ctx->idsp.idct_put(dest_u + dct_y_offset + dct_x_offset, dct_linesize_chroma, ctx->blocks[9]);
  371. ctx->idsp.idct_put(dest_v, dct_linesize_chroma, ctx->blocks[4]);
  372. ctx->idsp.idct_put(dest_v + dct_x_offset, dct_linesize_chroma, ctx->blocks[5]);
  373. ctx->idsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, ctx->blocks[10]);
  374. ctx->idsp.idct_put(dest_v + dct_y_offset + dct_x_offset, dct_linesize_chroma, ctx->blocks[11]);
  375. }
  376. }
  377. return 0;
  378. }
  379. static int dnxhd_decode_macroblocks(DNXHDContext *ctx, AVFrame *frame,
  380. const uint8_t *buf, int buf_size)
  381. {
  382. int x, y;
  383. for (y = 0; y < ctx->mb_height; y++) {
  384. ctx->last_dc[0] =
  385. ctx->last_dc[1] =
  386. ctx->last_dc[2] = 1 << (ctx->bit_depth + 2); // for levels +2^(bitdepth-1)
  387. init_get_bits(&ctx->gb, buf + ctx->mb_scan_index[y], (buf_size - ctx->mb_scan_index[y]) << 3);
  388. for (x = 0; x < ctx->mb_width; x++) {
  389. //START_TIMER;
  390. dnxhd_decode_macroblock(ctx, frame, x, y);
  391. //STOP_TIMER("decode macroblock");
  392. }
  393. }
  394. return 0;
  395. }
  396. static int dnxhd_decode_frame(AVCodecContext *avctx, void *data,
  397. int *got_frame, AVPacket *avpkt)
  398. {
  399. const uint8_t *buf = avpkt->data;
  400. int buf_size = avpkt->size;
  401. DNXHDContext *ctx = avctx->priv_data;
  402. ThreadFrame frame = { .f = data };
  403. AVFrame *picture = data;
  404. int first_field = 1;
  405. int ret;
  406. ff_dlog(avctx, "frame size %d\n", buf_size);
  407. decode_coding_unit:
  408. if ((ret = dnxhd_decode_header(ctx, picture, buf, buf_size, first_field)) < 0)
  409. return ret;
  410. if ((avctx->width || avctx->height) &&
  411. (ctx->width != avctx->width || ctx->height != avctx->height)) {
  412. av_log(avctx, AV_LOG_WARNING, "frame size changed: %dx%d -> %dx%d\n",
  413. avctx->width, avctx->height, ctx->width, ctx->height);
  414. first_field = 1;
  415. }
  416. if (avctx->pix_fmt != AV_PIX_FMT_NONE && avctx->pix_fmt != ctx->pix_fmt) {
  417. av_log(avctx, AV_LOG_WARNING, "pix_fmt changed: %s -> %s\n",
  418. av_get_pix_fmt_name(avctx->pix_fmt), av_get_pix_fmt_name(ctx->pix_fmt));
  419. first_field = 1;
  420. }
  421. avctx->pix_fmt = ctx->pix_fmt;
  422. ret = ff_set_dimensions(avctx, ctx->width, ctx->height);
  423. if (ret < 0)
  424. return ret;
  425. if (first_field) {
  426. if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
  427. return ret;
  428. picture->pict_type = AV_PICTURE_TYPE_I;
  429. picture->key_frame = 1;
  430. }
  431. dnxhd_decode_macroblocks(ctx, picture, buf + 0x280, buf_size - 0x280);
  432. if (first_field && picture->interlaced_frame) {
  433. buf += ctx->cid_table->coding_unit_size;
  434. buf_size -= ctx->cid_table->coding_unit_size;
  435. first_field = 0;
  436. goto decode_coding_unit;
  437. }
  438. *got_frame = 1;
  439. return avpkt->size;
  440. }
  441. static av_cold int dnxhd_decode_close(AVCodecContext *avctx)
  442. {
  443. DNXHDContext *ctx = avctx->priv_data;
  444. ff_free_vlc(&ctx->ac_vlc);
  445. ff_free_vlc(&ctx->dc_vlc);
  446. ff_free_vlc(&ctx->run_vlc);
  447. return 0;
  448. }
  449. AVCodec ff_dnxhd_decoder = {
  450. .name = "dnxhd",
  451. .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
  452. .type = AVMEDIA_TYPE_VIDEO,
  453. .id = AV_CODEC_ID_DNXHD,
  454. .priv_data_size = sizeof(DNXHDContext),
  455. .init = dnxhd_decode_init,
  456. .close = dnxhd_decode_close,
  457. .decode = dnxhd_decode_frame,
  458. .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
  459. };