diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2015-03-28 17:36:02 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2015-03-28 20:01:22 +0100 |
commit | 8bd7bf1a3cb43584bec29452bca322efc45a60bd (patch) | |
tree | 94bdb878aee3c414a3e5cec01d4f67c4ee513f76 | |
parent | f90c9bbbca32620a9cb78898a2b1b7d2cce9ad0f (diff) | |
download | ffmpeg-8bd7bf1a3cb43584bec29452bca322efc45a60bd.tar.gz |
lavc/dnxhd: Fix pix_fmt change.
Fixes ticket #4400.
(cherry picked from commit dcac15a84c8fc087ec85b2172db13d2e0d543e50)
-rw-r--r-- | libavcodec/dnxhddec.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index 2b0e2de0a0..0ed960dfb6 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -119,6 +119,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, static const uint8_t header_prefix[] = { 0x00, 0x00, 0x02, 0x80, 0x01 }; static const uint8_t header_prefix444[] = { 0x00, 0x00, 0x02, 0x80, 0x02 }; int i, cid, ret; + int old_bit_depth = ctx->bit_depth; if (buf_size < 0x280) { av_log(ctx->avctx, AV_LOG_ERROR, "buffer too small (%d < 640).\n", @@ -143,10 +144,6 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, av_dlog(ctx->avctx, "width %d, height %d\n", ctx->width, ctx->height); - if (!ctx->bit_depth) { - ff_blockdsp_init(&ctx->bdsp, ctx->avctx); - ff_idctdsp_init(&ctx->idsp, ctx->avctx); - } if (buf[0x21] == 0x58) { /* 10 bit */ ctx->bit_depth = ctx->avctx->bits_per_raw_sample = 10; @@ -170,6 +167,10 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, buf[0x21]); return AVERROR_INVALIDDATA; } + if (ctx->bit_depth != old_bit_depth) { + ff_blockdsp_init(&ctx->bdsp, ctx->avctx); + ff_idctdsp_init(&ctx->idsp, ctx->avctx); + } cid = AV_RB32(buf + 0x28); av_dlog(ctx->avctx, "compression id %d\n", cid); |