d3d12mipmapping: Add YUV and 64bits output formats

Add support for YUV and 64bits output formats to avoid
colorspace conversion and bitdepth loss

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8255>
This commit is contained in:
Seungha Yang 2025-01-08 00:38:39 +09:00 committed by GStreamer Marge Bot
parent 33259e7ea4
commit ca82e717c6
2 changed files with 10 additions and 4 deletions

View file

@ -267,7 +267,11 @@ gst_d3d12_mip_gen_execute (GstD3D12MipGen * gen, ID3D12Resource * resource,
cl->SetPipelineState (priv->pso.Get ());
D3D12_SHADER_RESOURCE_VIEW_DESC srv_desc = { };
srv_desc.Format = desc.Format;
DXGI_FORMAT view_format = desc.Format;
if (desc.Format == DXGI_FORMAT_AYUV)
view_format = DXGI_FORMAT_R8G8B8A8_UNORM;
srv_desc.Format = view_format;
srv_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
srv_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
srv_desc.Texture2D.MipLevels = desc.MipLevels;
@ -335,7 +339,7 @@ gst_d3d12_mip_gen_execute (GstD3D12MipGen * gen, ID3D12Resource * resource,
for (guint mip = 0; mip < mipCount; mip++) {
D3D12_UNORDERED_ACCESS_VIEW_DESC uavDesc = { };
uavDesc.Format = desc.Format;
uavDesc.Format = view_format;
uavDesc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
uavDesc.Texture2D.MipSlice = srcMip + mip + 1;

View file

@ -49,6 +49,8 @@ using namespace Microsoft::WRL;
GST_DEBUG_CATEGORY_STATIC (gst_d3d12_mip_mapping_debug);
#define GST_CAT_DEFAULT gst_d3d12_mip_mapping_debug
#define OUTPUT_FORMATS "{ VUYA, RGBA, AYUV64, RGBA64_LE }"
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
@ -63,11 +65,11 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_D3D12_MEMORY, "RGBA") "; "
(GST_CAPS_FEATURE_MEMORY_D3D12_MEMORY, OUTPUT_FORMATS) "; "
GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_D3D12_MEMORY ","
GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION,
"RGBA")));
OUTPUT_FORMATS)));
enum
{