d3d11convert: Add support for YUY2 and Y410 output

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5691>
This commit is contained in:
Seungha Yang 2023-11-18 22:51:41 +09:00
parent 2afa0fe7d0
commit ca14eeeeaa
2 changed files with 22 additions and 11 deletions

View file

@ -32,21 +32,18 @@ G_BEGIN_DECLS
#define GST_D3D11_COMMON_FORMATS \
"RGBA64_LE, RGB10A2_LE, BGRA, RGBA, BGRx, RGBx, VUYA, NV12, NV21, " \
"P010_10LE, P012_LE, P016_LE, I420, YV12, I420_10LE, I420_12LE, " \
"Y42B, I422_10LE, I422_12LE, Y444, Y444_10LE, Y444_12LE, Y444_16LE, " \
"Y42B, I422_10LE, I422_12LE, Y444, Y444_10LE, Y444_12LE, Y444_16LE, YUY2, Y410, " \
"GRAY8, GRAY16_LE, AYUV, AYUV64, RGBP, BGRP, GBR, GBR_10LE, GBR_12LE, " \
"GBR_16LE, GBRA, GBRA_10LE, GBRA_12LE"
#define GST_D3D11_EXTRA_IN_FORMATS \
"Y410, YUY2"
#define GST_D3D11_SINK_FORMATS \
"{ " GST_D3D11_COMMON_FORMATS " ," GST_D3D11_EXTRA_IN_FORMATS " }"
"{ " GST_D3D11_COMMON_FORMATS " }"
#define GST_D3D11_SRC_FORMATS \
"{ " GST_D3D11_COMMON_FORMATS " }"
#define GST_D3D11_ALL_FORMATS \
"{ " GST_D3D11_COMMON_FORMATS " ," GST_D3D11_EXTRA_IN_FORMATS " }"
"{ " GST_D3D11_COMMON_FORMATS " }"
#define GST_TYPE_D3D11_FORMAT_SUPPORT (gst_d3d11_format_support_get_type())
GType gst_d3d11_format_support_get_type (void);

View file

@ -1446,7 +1446,7 @@ gst_d3d11_base_convert_decide_allocation (GstBaseTransform * trans,
GstVideoInfo info;
guint i;
GstD3D11Format d3d11_format;
guint bind_flags = D3D11_BIND_RENDER_TARGET;
guint bind_flags = 0;
DXGI_FORMAT dxgi_format = DXGI_FORMAT_UNKNOWN;
UINT supported = 0;
HRESULT hr;
@ -1481,12 +1481,26 @@ gst_d3d11_base_convert_decide_allocation (GstBaseTransform * trans,
device_handle = gst_d3d11_device_get_device_handle (filter->device);
hr = device_handle->CheckFormatSupport (dxgi_format, &supported);
if (gst_d3d11_result (hr, filter->device) &&
(supported & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE) ==
D3D11_FORMAT_SUPPORT_SHADER_SAMPLE) {
bind_flags |= D3D11_BIND_SHADER_RESOURCE;
if (!gst_d3d11_result (hr, filter->device)) {
GST_ERROR_OBJECT (self, "CheckFormatSupport failed");
return FALSE;
}
if ((supported & D3D11_FORMAT_SUPPORT_RENDER_TARGET) != 0) {
bind_flags |= D3D11_BIND_RENDER_TARGET;
} else {
if (d3d11_format.dxgi_format != DXGI_FORMAT_UNKNOWN &&
(supported & D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT) != 0) {
bind_flags |= D3D11_BIND_RENDER_TARGET;
}
if ((supported & D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW) != 0)
bind_flags |= D3D11_BIND_UNORDERED_ACCESS;
}
if ((supported & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE) != 0)
bind_flags |= D3D11_BIND_SHADER_RESOURCE;
size = GST_VIDEO_INFO_SIZE (&info);
if (gst_query_get_n_allocation_pools (query) > 0) {