From d7bbcffe149007b34e9c1e7dbc00282a651af148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Tue, 9 May 2023 18:04:13 +0200 Subject: [PATCH] vkformat: add VK_FORMAT_G8_B8R8_2PLANE_420_UNORM Part-of: --- .../gst-libs/gst/vulkan/gstvkformat.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkformat.c b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkformat.c index 78edcefcae..294e1e198b 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkformat.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkformat.c @@ -126,6 +126,8 @@ #define SUB4204 { 0, 1, 1, 0 }, { 0, 1, 1, 0 } #define SUB4224 { 0, 1, 1, 0 }, { 0, 0, 0, 0 } +#define ASPECT_2PLANE (VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT) + /* *INDENT-OFF* */ static GstVulkanFormatInfo formats[] = { {FORMAT (R8G8B8A8, UNORM), FLAG (RGB) | FLAG (ALPHA) | NE, DPTH8888, PSTR4444, PLANE0, OFFS0123, SUB444, VK_IMAGE_ASPECT_COLOR_BIT}, @@ -170,7 +172,9 @@ static GstVulkanFormatInfo formats[] = { {FORMAT (R8, UINT), FLAG (RGB) | NE, DPTH8, PSTR4, PLANE0, OFFS0, SUB4, VK_IMAGE_ASPECT_COLOR_BIT}, {FORMAT (R8, SINT), FLAG (RGB) | NE, DPTH8, PSTR4, PLANE0, OFFS0, SUB4, VK_IMAGE_ASPECT_COLOR_BIT}, {FORMAT (R8, SRGB), FLAG (RGB) | NE, DPTH8, PSTR4, PLANE0, OFFS0, SUB4, VK_IMAGE_ASPECT_COLOR_BIT}, - +#if (defined(VK_VERSION_1_3) || defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 199) + {FORMAT (G8_B8R8_2PLANE_420, UNORM), FLAG (YUV), DPTH888, PSTR122, PLANE011, OFFS001, SUB420, ASPECT_2PLANE}, +#endif #if 0 FIXME: implement: {VK_FORMAT_R4G4_UNORM_PACK8, {0, 1, -1, -1}}, @@ -342,7 +346,6 @@ FIXME: implement: VK_FORMAT_G8B8G8R8_422_UNORM = 1000156000, VK_FORMAT_B8G8R8G8_422_UNORM = 1000156001, VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM = 1000156002, - VK_FORMAT_G8_B8R8_2PLANE_420_UNORM = 1000156003, VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM = 1000156004, VK_FORMAT_G8_B8R8_2PLANE_422_UNORM = 1000156005, VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM = 1000156006, @@ -456,7 +459,13 @@ const static struct { { GST_VIDEO_FORMAT_AYUV, VK_FORMAT_UNDEFINED, { VK_FORMAT_R8G8B8A8_UNORM, } }, { GST_VIDEO_FORMAT_YUY2, VK_FORMAT_UNDEFINED, { VK_FORMAT_R8G8_UNORM, } }, { GST_VIDEO_FORMAT_UYVY, VK_FORMAT_UNDEFINED, { VK_FORMAT_R8G8_UNORM, } }, - { GST_VIDEO_FORMAT_NV12, VK_FORMAT_UNDEFINED, { VK_FORMAT_R8_UNORM, VK_FORMAT_R8G8_UNORM } }, + { GST_VIDEO_FORMAT_NV12, +#if (defined(VK_VERSION_1_3) || defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 199) + VK_FORMAT_G8_B8R8_2PLANE_420_UNORM, +#else + VK_FORMAT_UNDEFINED, +#endif + { VK_FORMAT_R8_UNORM, VK_FORMAT_R8G8_UNORM } }, { GST_VIDEO_FORMAT_NV21, VK_FORMAT_UNDEFINED, { VK_FORMAT_R8_UNORM, VK_FORMAT_R8G8_UNORM } }, { GST_VIDEO_FORMAT_Y444, VK_FORMAT_UNDEFINED, { VK_FORMAT_R8_UNORM, } }, { GST_VIDEO_FORMAT_Y42B, VK_FORMAT_UNDEFINED, { VK_FORMAT_R8_UNORM, } },