From f1355ec9f6125ff8eb644e5beb3e3ccd6e35da28 Mon Sep 17 00:00:00 2001 From: Haihao Xiang Date: Thu, 10 Mar 2022 14:34:22 +0800 Subject: [PATCH] lavu/hwcontext_qsv: add support for UYVY 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 --- 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;