[FFmpeg-cvslog] avcodec/dnxhddec: Do not overwrite colorspace if the container has set it.

Steven Robertson git at videolan.org
Thu Nov 30 03:46:47 EET 2017


ffmpeg | branch: master | Steven Robertson <steven at strobe.cc> | Tue Nov 28 16:49:46 2017 -0800| [c6a905b91d935f78f5c33f6ce2dbe294b3353b77] | committer: Michael Niedermayer

avcodec/dnxhddec: Do not overwrite colorspace if the container has set it.

The existing logic overrides container metadata even in cases where the
container metadata must be trusted (e.g. HDR). The original spec had no
provision for specifying color volume, so many files rely on the
assumption of Rec. 709.

An update to the spec included a 'clv' field for explicitly signaling
that the container should be trusted in an existing bitfield in the
frame header, but the default of 0 from old encoders forces Rec. 709,
which would break any HDR stream. Because there is no place in DNxHR for
specifying a transfer function, DNxHR HDR files must include
container-level color information.

This patch maintains the existing behavior of choosing the 709 over the
601 matrix when container-level information is missing, and allows
container-level information to win if present.

Signed-off-by: Steven Robertson <steven at strobe.cc>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c6a905b91d935f78f5c33f6ce2dbe294b3353b77
---

 libavcodec/dnxhddec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index f46e41a456..05f4458f99 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -93,7 +93,9 @@ static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
 
     ctx->avctx = avctx;
     ctx->cid = -1;
-    avctx->colorspace = AVCOL_SPC_BT709;
+    if (avctx->colorspace == AVCOL_SPC_UNSPECIFIED) {
+        avctx->colorspace = AVCOL_SPC_BT709;
+    }
 
     avctx->coded_width  = FFALIGN(avctx->width,  16);
     avctx->coded_height = FFALIGN(avctx->height, 16);



More information about the ffmpeg-cvslog mailing list