diff mbox series

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

Message ID 20220814213313.37948-4-philipl@overt.org
State New
Headers show
Series V2: VAAPI: Add high bit depth encode/decode support | expand

Checks

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

Commit Message

Philip Langdale Aug. 14, 2022, 9:33 p.m. UTC
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@overt.org>
---
 libavutil/hwcontext_vaapi.c  | 4 ++++
 libavutil/hwcontext_vulkan.c | 6 ++++++
 2 files changed, 10 insertions(+)
diff mbox series

Patch

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)