diff mbox series

[FFmpeg-devel,1/2] avcodec/dnxhddec: properly set colorspace

Message ID 20200124123952.15984-1-onemda@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,1/2] avcodec/dnxhddec: properly set colorspace
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Paul B Mahol Jan. 24, 2020, 12:39 p.m. UTC
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/dnxhddec.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 1e95086696..2ec004333f 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -235,7 +235,14 @@  static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
         av_log(ctx->avctx, AV_LOG_WARNING,
                "Adaptive MB interlace flag in an unsupported profile.\n");
 
-    ctx->act = buf[0x2C] & 7;
+    switch ((buf[0x2C] >> 1) & 3) {
+    case 0: frame->colorspace = AVCOL_SPC_BT709;       break;
+    case 1: frame->colorspace = AVCOL_SPC_BT2020_NCL;  break;
+    case 2: frame->colorspace = AVCOL_SPC_BT2020_CL;   break;
+    case 3: frame->colorspace = AVCOL_SPC_UNSPECIFIED; break;
+    }
+
+    ctx->act = buf[0x2C] & 1;
     if (ctx->act && ctx->cid_table->cid != 1256 && ctx->cid_table->cid != 1270)
         av_log(ctx->avctx, AV_LOG_WARNING,
                "Adaptive color transform in an unsupported profile.\n");