[FFmpeg-devel] [PATCH 3/3] lavu/hwcontext_[vaapi|vulkan]: support mapping VUYA and Y416

Philip Langdale philipl at overt.org
Mon Aug 15 00:33:13 EEST 2022


These two of the Microsoft formats used by Intel VAAPI are sufficiently
conventional that we can add simple mappings for them in the hwcontexts
to enable back and forth mapping so that Vulkan filters can be used
with vaapi decoding/encoding of these formats.

Signed-off-by: Philip Langdale <philipl at overt.org>
---
 libavutil/hwcontext_vaapi.c  | 4 ++++
 libavutil/hwcontext_vulkan.c | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index c3e79907fd..d2d327567e 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -1021,6 +1021,10 @@ static const struct {
 #endif
     DRM_MAP(ARGB, 1, DRM_FORMAT_BGRA8888),
     DRM_MAP(XRGB, 1, DRM_FORMAT_BGRX8888),
+#ifdef VA_FOURCC_Y416
+    DRM_MAP(AYUV, 1, DRM_FORMAT_AYUV),
+    DRM_MAP(Y416, 1, DRM_FORMAT_Y416),
+#endif
 };
 #undef DRM_MAP
 
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 237caa4bc0..be08238ff3 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -210,6 +210,9 @@ static const struct {
     { AV_PIX_FMT_YUVA444P12, { VK_FORMAT_R16_UNORM, VK_FORMAT_R16_UNORM, VK_FORMAT_R16_UNORM, VK_FORMAT_R16_UNORM } },
     { AV_PIX_FMT_YUVA444P16, { VK_FORMAT_R16_UNORM, VK_FORMAT_R16_UNORM, VK_FORMAT_R16_UNORM, VK_FORMAT_R16_UNORM } },
 
+    { AV_PIX_FMT_VUYA,   { VK_FORMAT_R8G8B8A8_UNORM } },
+    { AV_PIX_FMT_Y416,   { VK_FORMAT_R16G16B16A16_UNORM } },
+
     { AV_PIX_FMT_BGRA,   { VK_FORMAT_B8G8R8A8_UNORM } },
     { AV_PIX_FMT_RGBA,   { VK_FORMAT_R8G8B8A8_UNORM } },
     { AV_PIX_FMT_RGB24,  { VK_FORMAT_R8G8B8_UNORM } },
@@ -2629,6 +2632,9 @@ static const struct {
     { DRM_FORMAT_XRGB8888, VK_FORMAT_B8G8R8A8_UNORM },
     { DRM_FORMAT_ABGR8888, VK_FORMAT_R8G8B8A8_UNORM },
     { DRM_FORMAT_XBGR8888, VK_FORMAT_R8G8B8A8_UNORM },
+
+    { DRM_FORMAT_AYUV,     VK_FORMAT_R8G8B8A8_UNORM     },
+    { DRM_FORMAT_Y416,     VK_FORMAT_R16G16B16A16_UNORM },
 };
 
 static inline VkFormat drm_to_vulkan_fmt(uint32_t drm_fourcc)
-- 
2.34.1



More information about the ffmpeg-devel mailing list