summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-04-15 11:57:00 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-04-15 11:57:38 +0200
commit0842df2619a005ae8b02a2759a955e2e1248cd55 (patch)
tree49ec28098059ba1fdd4ac829286da6bc4a0cbda6 /libavcodec
parent0fbe18b63eab17562bea4b98df8307ba3a90686b (diff)
parentec89f35e3e5eb9ec5221266e801efeee7ecab4df (diff)
Merge commit 'ec89f35e3e5eb9ec5221266e801efeee7ecab4df'
* commit 'ec89f35e3e5eb9ec5221266e801efeee7ecab4df': x265: Map color parameters Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/libx265.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index ed453e362b..8924657cc2 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;