[FFmpeg-devel] [PATCH v2] libavcodec/qsvenc: Do not pass RGB solorspace to VPL/MSDK

Xiang, Haihao haihao.xiang at intel.com
Thu Feb 16 03:23:05 EET 2023


On Ma, 2023-02-13 at 16:49 +0800, wenbin.chen-at-intel.com at ffmpeg.org wrote:
> From: Wenbin Chen <wenbin.chen at intel.com>
> 
> When encode RGB frame, Intel driver convert RGB to YUV, so we cannot
> set RGB colorspace to VPL/MSDK.
> 
> Signed-off-by: Wenbin Chen <wenbin.chen at intel.com>
> ---
>  libavcodec/qsvenc.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 2f0e94a914..d3f7532fc0 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -1185,7 +1185,12 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>          q->extvsi.ColourDescriptionPresent = 1;
>          q->extvsi.ColourPrimaries = avctx->color_primaries;
>          q->extvsi.TransferCharacteristics = avctx->color_trc;
> -        q->extvsi.MatrixCoefficients = avctx->colorspace;
> +        if (avctx->colorspace == AVCOL_SPC_RGB)
> +            // RGB will be converted to YUV, so RGB colorspace is not
> supported
> +            q->extvsi.MatrixCoefficients = AVCOL_SPC_UNSPECIFIED;
> +        else
> +            q->extvsi.MatrixCoefficients = avctx->colorspace;
> +
>      }
>  
>      if ((avctx->codec_id != AV_CODEC_ID_VP9) && (q->extvsi.VideoFullRange ||
> q->extvsi.ColourDescriptionPresent)) {

LGTM, will apply

Thanks
Haihao



More information about the ffmpeg-devel mailing list