aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-01-29 20:54:25 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-01-29 20:54:25 +0100
commit64e7cf12532ecca43535db7a10303b99538a41dc (patch)
tree44e8d30cd71c64e9b1fc7de042b87fa4b5b2f57a /libavcodec
parente5b7e2224f62e9cb6697e664b7d1245302cca9e7 (diff)
parent598f7d046cbf306706623210c5baafa3b7cd1df3 (diff)
downloadffmpeg-64e7cf12532ecca43535db7a10303b99538a41dc.tar.gz
Merge commit '598f7d046cbf306706623210c5baafa3b7cd1df3'
* commit '598f7d046cbf306706623210c5baafa3b7cd1df3': DNxHD: Simplify pixel format detection Conflicts: libavcodec/dnxhddec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dnxhddec.c45
1 files changed, 20 insertions, 25 deletions
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 790db89780..b9ee2ef16e 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -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);
- ctx->is_444 = 0;
- if (buf[0x4] == 0x2) {
- ctx->pix_fmt = AV_PIX_FMT_YUV444P10;
- 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;
+ 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;
+
+ if (buf[0x4] == 0x2) {
ctx->decode_dct_block = dnxhd_decode_dct_block_10_444;
- }
- ctx->is_444 = 1;
- } else if (buf[0x21] & 0x40) {
- 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->pix_fmt = AV_PIX_FMT_YUV444P10;
+ ctx->is_444 = 1;
+ } else {
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->avctx->bits_per_raw_sample = 8;
- if (ctx->bit_depth != 8) {
- ff_blockdsp_init(&ctx->bdsp, ctx->avctx);
- ff_idctdsp_init(&ctx->idsp, ctx->avctx);
- ctx->bit_depth = 8;
- ctx->decode_dct_block = dnxhd_decode_dct_block_8;
- }
+ ctx->decode_dct_block = dnxhd_decode_dct_block_8;
+ } else {
+ av_log(ctx->avctx, AV_LOG_ERROR, "invalid bit depth value (%d).\n",
+ buf[0x21]);
+ return AVERROR_INVALIDDATA;
}
cid = AV_RB32(buf + 0x28);