d3d11converter: Fix for missing GRAY conversion

Add missing Y410 -> GRAY and GRAY -> semi-planar conversion

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1724>
This commit is contained in:
Seungha Yang 2022-02-16 02:23:58 +09:00
parent 98345a141a
commit dbda4cf409

View file

@ -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)));