On Mon, Apr 13, 2015 at 11:12 AM, Luca Barbato <[email protected]> wrote:
> ---
>  libavcodec/libx265.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
> index c04299a..36d8897 100644
> --- a/libavcodec/libx265.c
> +++ b/libavcodec/libx265.c
> @@ -124,6 +124,21 @@ 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)) {

why this huge check at the start? better to split it off case by case

> +         ctx->params->vui.bEnableColorDescriptionPresentFlag = 1;

Isn't this done internally?

> +        if (avctx->color_primaries <= AVCOL_PRI_BT2020)
> +            ctx->params->vui.colorPrimaries          = 
> avctx->color_primaries;
> +        if (avctx->color_trc <= AVCOL_TRC_BT2020_12)
> +            ctx->params->vui.transferCharacteristics = avctx->color_trc;
> +        if (avctx->colorspace <= AVCOL_SPC_BT2020_CL)
> +            ctx->params->vui.matrixCoeffs            = avctx->colorspace;
> +    }

You should check that all thse are >= 0 too if you want to be extra sure.
-- 
Vittorio
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to