diff mbox series

[FFmpeg-devel,1/2] lavu/hwcontext_qsv: add support for UYVY

Message ID 20230203063448.4440-1-haihao.xiang@intel.com
State Accepted
Commit f1355ec9f6125ff8eb644e5beb3e3ccd6e35da28
Headers show
Series [FFmpeg-devel,1/2] lavu/hwcontext_qsv: add support for UYVY | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Xiang, Haihao Feb. 3, 2023, 6:34 a.m. UTC
From: Haihao Xiang <haihao.xiang@intel.com>

The SDK supports UYVY from version 1.17, and VPP may support UYVY
input on Linux [1]

$ ffmpeg -loglevel verbose -init_hw_device qsv=intel -f lavfi -i \
yuvtestsrc -vf \
"format=uyvy422,hwupload=extra_hw_frames=32,vpp_qsv=format=nv12" \
-f null -

[1] https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/samples/readme-vpp_linux.md

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
---
 libavutil/hwcontext_qsv.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Xiang, Haihao Feb. 6, 2023, 7:52 a.m. UTC | #1
On Vr, 2023-02-03 at 14:34 +0800, Xiang, Haihao wrote:
> From: Haihao Xiang <haihao.xiang@intel.com>
> 
> The SDK supports UYVY from version 1.17, and VPP may support UYVY
> input on Linux [1]
> 
> $ ffmpeg -loglevel verbose -init_hw_device qsv=intel -f lavfi -i \
> yuvtestsrc -vf \
> "format=uyvy422,hwupload=extra_hw_frames=32,vpp_qsv=format=nv12" \
> -f null -
> 
> [1] 
> https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/samples/readme-vpp_linux.md
> 
> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> ---
>  libavutil/hwcontext_qsv.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
> index ec0f72b329..42851d4fd5 100644
> --- a/libavutil/hwcontext_qsv.c
> +++ b/libavutil/hwcontext_qsv.c
> @@ -118,6 +118,8 @@ static const struct {
>  #if CONFIG_VAAPI
>      { AV_PIX_FMT_YUYV422,
>                         MFX_FOURCC_YUY2, 0 },
> +    { AV_PIX_FMT_UYVY422,
> +                       MFX_FOURCC_UYVY, 0 },
>      { AV_PIX_FMT_Y210,
>                         MFX_FOURCC_Y210, 1 },
>      // VUYX is used for VAAPI child device,
> @@ -1556,6 +1558,11 @@ static int map_frame_to_surface(const AVFrame *frame,
> mfxFrameSurface1 *surface)
>          // use the value from the frame.
>          surface->Data.A = frame->data[0] + 6;
>          break;
> +    case AV_PIX_FMT_UYVY422:
> +        surface->Data.Y = frame->data[0] + 1;
> +        surface->Data.U = frame->data[0];
> +        surface->Data.V = frame->data[0] + 2;
> +        break;
>  #endif
>      default:
>          return MFX_ERR_UNSUPPORTED;

Will apply this patchset.

- Haihao
diff mbox series

Patch

diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index ec0f72b329..42851d4fd5 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -118,6 +118,8 @@  static const struct {
 #if CONFIG_VAAPI
     { AV_PIX_FMT_YUYV422,
                        MFX_FOURCC_YUY2, 0 },
+    { AV_PIX_FMT_UYVY422,
+                       MFX_FOURCC_UYVY, 0 },
     { AV_PIX_FMT_Y210,
                        MFX_FOURCC_Y210, 1 },
     // VUYX is used for VAAPI child device,
@@ -1556,6 +1558,11 @@  static int map_frame_to_surface(const AVFrame *frame, mfxFrameSurface1 *surface)
         // use the value from the frame.
         surface->Data.A = frame->data[0] + 6;
         break;
+    case AV_PIX_FMT_UYVY422:
+        surface->Data.Y = frame->data[0] + 1;
+        surface->Data.U = frame->data[0];
+        surface->Data.V = frame->data[0] + 2;
+        break;
 #endif
     default:
         return MFX_ERR_UNSUPPORTED;