diff mbox series

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

Message ID 20230213055545.535005-1-wenbin.chen@intel.com
State New
Headers show
Series [FFmpeg-devel] libavcodec/qsvenc: Do not pass RGB solorspace to VPL/MSDK | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Chen, Wenbin Feb. 13, 2023, 5:55 a.m. UTC
From: Wenbin Chen <wenbin.chen@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@intel.com>
---
 libavcodec/qsvenc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Chen, Wenbin Feb. 13, 2023, 8:42 a.m. UTC | #1
> From: Wenbin Chen <wenbin.chen@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@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..944a76f4f1 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)
> +            //YUV will be converted to RGB, so RGB colorspace is not supported

Comment is wrong. It should be " RGB will be converted to YUV".  I will send patch v2.

> +            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)) {
> --
> 2.34.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 2f0e94a914..944a76f4f1 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)
+            //YUV will be converted to RGB, 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)) {