Commit 64e7cf12 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '598f7d04'

* commit '598f7d04':
  DNxHD: Simplify pixel format detection

Conflicts:
	libavcodec/dnxhddec.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents e5b7e222 598f7d04
...@@ -143,35 +143,30 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, ...@@ -143,35 +143,30 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
av_dlog(ctx->avctx, "width %d, height %d\n", ctx->width, ctx->height); av_dlog(ctx->avctx, "width %d, height %d\n", ctx->width, ctx->height);
ctx->is_444 = 0; if (!ctx->bit_depth) {
if (buf[0x4] == 0x2) { ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
ctx->pix_fmt = AV_PIX_FMT_YUV444P10; ff_idctdsp_init(&ctx->idsp, ctx->avctx);
ctx->avctx->bits_per_raw_sample = 10; }
if (ctx->bit_depth != 10) { if (buf[0x21] == 0x58) { /* 10 bit */
ff_blockdsp_init(&ctx->bdsp, ctx->avctx); ctx->bit_depth = ctx->avctx->bits_per_raw_sample = 10;
ff_idctdsp_init(&ctx->idsp, ctx->avctx);
ctx->bit_depth = 10; if (buf[0x4] == 0x2) {
ctx->decode_dct_block = dnxhd_decode_dct_block_10_444; ctx->decode_dct_block = dnxhd_decode_dct_block_10_444;
} ctx->pix_fmt = AV_PIX_FMT_YUV444P10;
ctx->is_444 = 1; ctx->is_444 = 1;
} else if (buf[0x21] & 0x40) { } else {
ctx->pix_fmt = AV_PIX_FMT_YUV422P10;
ctx->avctx->bits_per_raw_sample = 10;
if (ctx->bit_depth != 10) {
ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
ff_idctdsp_init(&ctx->idsp, ctx->avctx);
ctx->bit_depth = 10;
ctx->decode_dct_block = dnxhd_decode_dct_block_10; ctx->decode_dct_block = dnxhd_decode_dct_block_10;
ctx->pix_fmt = AV_PIX_FMT_YUV422P10;
} }
} else { } else if (buf[0x21] == 0x38) { /* 8 bit */
ctx->bit_depth = ctx->avctx->bits_per_raw_sample = 8;
ctx->pix_fmt = AV_PIX_FMT_YUV422P; ctx->pix_fmt = AV_PIX_FMT_YUV422P;
ctx->avctx->bits_per_raw_sample = 8; ctx->decode_dct_block = dnxhd_decode_dct_block_8;
if (ctx->bit_depth != 8) { } else {
ff_blockdsp_init(&ctx->bdsp, ctx->avctx); av_log(ctx->avctx, AV_LOG_ERROR, "invalid bit depth value (%d).\n",
ff_idctdsp_init(&ctx->idsp, ctx->avctx); buf[0x21]);
ctx->bit_depth = 8; return AVERROR_INVALIDDATA;
ctx->decode_dct_block = dnxhd_decode_dct_block_8;
}
} }
cid = AV_RB32(buf + 0x28); cid = AV_RB32(buf + 0x28);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment