d3d11: Add support for Y216 and Y416 formats

We were mapping Y212 and Y412 formats to DXGI_FORMAT_{Y216,Y416}.
Reuse already implemented shaders for the new formats

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6745>
This commit is contained in:
Seungha Yang 2024-04-27 01:13:18 +09:00 committed by GStreamer Marge Bot
parent c8d01d7d1a
commit 66c1383051
4 changed files with 15 additions and 1 deletions

View file

@ -44,7 +44,7 @@ G_BEGIN_DECLS
/* DXGI (semi) native formats */
#define GST_D3D11_TIER_0_FORMATS \
"RGBA64_LE, BGRA64_LE, Y412_LE, RGB10A2_LE, Y410, BGR10A2_LE, Y212_LE, " \
"RGBA64_LE, BGRA64_LE, Y416_LE, Y412_LE, RGB10A2_LE, Y410, BGR10A2_LE, Y216_LE, Y212_LE, " \
"Y210, VUYA, RGBA, BGRA, RBGA, P016_LE, P012_LE, P010_10LE, RGBx, BGRx, " \
"YUY2, NV12"
@ -179,9 +179,15 @@ static const GstD3D11Format _gst_d3d11_default_format_map[] = {
MAKE_FORMAT_MAP_FULL (GST_VIDEO_FORMAT_Y212_LE, Y216,
R16G16B16A16_UNORM, UNKNOWN, UNKNOWN, UNKNOWN,
D3D11_FORMAT_SUPPORT_SHADER_SAMPLE),
MAKE_FORMAT_MAP_FULL (GST_VIDEO_FORMAT_Y216_LE, Y216,
R16G16B16A16_UNORM, UNKNOWN, UNKNOWN, UNKNOWN,
D3D11_FORMAT_SUPPORT_SHADER_SAMPLE),
MAKE_FORMAT_MAP_FULL (GST_VIDEO_FORMAT_Y412_LE, Y416,
R16G16B16A16_UNORM, UNKNOWN, UNKNOWN, UNKNOWN,
D3D11_FORMAT_SUPPORT_SHADER_SAMPLE),
MAKE_FORMAT_MAP_FULL (GST_VIDEO_FORMAT_Y416_LE, Y416,
R16G16B16A16_UNORM, UNKNOWN, UNKNOWN, UNKNOWN,
D3D11_FORMAT_SUPPORT_SHADER_SAMPLE),
MAKE_FORMAT_MAP_FULL (GST_VIDEO_FORMAT_BGRA64_LE, Y416,
R16G16B16A16_UNORM, UNKNOWN, UNKNOWN, UNKNOWN,
D3D11_FORMAT_SUPPORT_SHADER_SAMPLE),

View file

@ -1992,11 +1992,13 @@ get_shader_format (GstVideoFormat format, gboolean is_input)
return GST_VIDEO_FORMAT_AYUV;
case GST_VIDEO_FORMAT_Y210:
case GST_VIDEO_FORMAT_Y212_LE:
case GST_VIDEO_FORMAT_Y216_LE:
case GST_VIDEO_FORMAT_v210:
case GST_VIDEO_FORMAT_v216:
return GST_VIDEO_FORMAT_AYUV64;
case GST_VIDEO_FORMAT_Y410:
case GST_VIDEO_FORMAT_Y412_LE:
case GST_VIDEO_FORMAT_Y416_LE:
if (!is_input)
return GST_VIDEO_FORMAT_AYUV64;
break;

View file

@ -561,7 +561,9 @@ gst_d3d11_device_setup_format_table (GstD3D11Device * self)
case GST_VIDEO_FORMAT_YUY2:
case GST_VIDEO_FORMAT_Y210:
case GST_VIDEO_FORMAT_Y212_LE:
case GST_VIDEO_FORMAT_Y216_LE:
case GST_VIDEO_FORMAT_Y412_LE:
case GST_VIDEO_FORMAT_Y416_LE:
case GST_VIDEO_FORMAT_BGRA64_LE:
case GST_VIDEO_FORMAT_BGR10A2_LE:
case GST_VIDEO_FORMAT_RBGA:

View file

@ -288,6 +288,7 @@ gst_d3d_converter_shader_get_cs_blob (GstVideoFormat in_format,
break;
case GST_VIDEO_FORMAT_Y210:
case GST_VIDEO_FORMAT_Y212_LE:
case GST_VIDEO_FORMAT_Y216_LE:
srv_format = DXGI_FORMAT_R16G16B16A16_UNORM;
in_format_str = "YUY2";
x_unit = 16;
@ -394,6 +395,7 @@ gst_d3d_converter_shader_get_cs_blob (GstVideoFormat in_format,
break;
case GST_VIDEO_FORMAT_Y210:
case GST_VIDEO_FORMAT_Y212_LE:
case GST_VIDEO_FORMAT_Y216_LE:
uav_format = DXGI_FORMAT_R16G16B16A16_UNORM;
out_format_str = "YUY2";
x_unit = 16;
@ -424,6 +426,7 @@ gst_d3d_converter_shader_get_cs_blob (GstVideoFormat in_format,
x_unit = 8;
break;
case GST_VIDEO_FORMAT_Y412_LE:
case GST_VIDEO_FORMAT_Y416_LE:
uav_format = DXGI_FORMAT_R16G16B16A16_UNORM;
out_format_str = "Y410";
x_unit = 8;
@ -691,6 +694,7 @@ conv_ps_make_input (GstVideoFormat format, gboolean premul)
return "GBRAPremul_12";
return "GBRA_12";
case GST_VIDEO_FORMAT_Y412_LE:
case GST_VIDEO_FORMAT_Y416_LE:
if (premul)
return "Y412Premul";
return "Y412";