[FFmpeg-cvslog] x265: Map color parameters

Luca Barbato git at videolan.org
Wed Apr 15 12:06:22 CEST 2015


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Mon Apr 13 10:45:51 2015 +0200| [ec89f35e3e5eb9ec5221266e801efeee7ecab4df] | committer: Luca Barbato

x265: Map color parameters

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

 libavcodec/libx265.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index c04299a..2fe7889 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -124,6 +124,22 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
     ctx->params->sourceHeight    = avctx->height;
     ctx->params->bEnablePsnr     = !!(avctx->flags & CODEC_FLAG_PSNR);
 
+    if ((avctx->color_primaries <= AVCOL_PRI_BT2020 &&
+         avctx->color_primaries != AVCOL_PRI_UNSPECIFIED) ||
+        (avctx->color_trc <= AVCOL_TRC_BT2020_12 &&
+         avctx->color_trc != AVCOL_TRC_UNSPECIFIED) ||
+        (avctx->colorspace <= AVCOL_SPC_BT2020_CL &&
+         avctx->colorspace != AVCOL_SPC_UNSPECIFIED)) {
+
+        ctx->params->vui.bEnableVideoSignalTypePresentFlag  = 1;
+        ctx->params->vui.bEnableColorDescriptionPresentFlag = 1;
+
+        // x265 validates the parameters internally
+        ctx->params->vui.colorPrimaries          = avctx->color_primaries;
+        ctx->params->vui.transferCharacteristics = avctx->color_trc;
+        ctx->params->vui.matrixCoeffs            = avctx->colorspace;
+    }
+
     if (avctx->sample_aspect_ratio.num > 0 && avctx->sample_aspect_ratio.den > 0) {
         char sar[12];
         int sar_num, sar_den;



More information about the ffmpeg-cvslog mailing list