From dbda4cf409e97ae213c78187bce438d013c3f898 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Wed, 16 Feb 2022 02:23:58 +0900 Subject: [PATCH] d3d11converter: Fix for missing GRAY conversion Add missing Y410 -> GRAY and GRAY -> semi-planar conversion Part-of: --- .../sys/d3d11/gstd3d11converter.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11converter.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11converter.cpp index 499949a8cd..39c8993ec1 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11converter.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11converter.cpp @@ -313,6 +313,14 @@ static const gchar templ_YUV_to_GRAY_BODY[] = " sample.a = 0.0;\n" " output.Plane_0 = sample;\n"; +static const gchar templ_PACKED_YUV_TO_GRAY[] = + " float4 sample;\n" + " sample.x = shaderTexture[0].Sample(samplerState, input.Texture).%c;\n" + " sample.y = 0.0;\n" + " sample.z = 0.0;\n" + " sample.a = 0.0;\n" + " output.Plane_0 = sample;\n"; + static const gchar templ_GRAY_to_GRAY_BODY[] = " float4 sample;\n" " sample.x = shaderTexture[0].Sample(samplerState, input.Texture).x;\n" @@ -1337,6 +1345,14 @@ setup_convert_info_yuv_to_gray (GstD3D11Converter * self, info->ps_body[0] = g_strdup_printf (templ_YUV_to_GRAY_BODY, scale); break; } + case GST_VIDEO_FORMAT_Y410: + { + gchar y, u, v; + get_packed_yuv_components (self, GST_VIDEO_FORMAT_Y410, &y, &u, &v); + + info->ps_body[0] = g_strdup_printf (templ_PACKED_YUV_TO_GRAY, y); + break; + } default: GST_ERROR ("Unhandled input format %s", gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (in_info))); @@ -1434,6 +1450,7 @@ setup_convert_info_gray_to_yuv (GstD3D11Converter * self, info->ps_body[1] = g_strdup_printf (templ_GRAY_to_SEMI_PLANAR_CHROMA_BODY); info->ps_output[1] = HLSL_PS_OUTPUT_ONE_PLANE_BODY; + break; default: GST_ERROR ("Unhandled output format %s", gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (out_info)));