mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
d3d12: Add YUV 4:1:0 and 4:1:1 format support
Adding Y41B, YUV9, and YVU9 format support Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7093>
This commit is contained in:
parent
69ea20b739
commit
52bc28c93d
4 changed files with 48 additions and 6 deletions
|
@ -51,7 +51,7 @@
|
|||
"AYUV64, GBRA_12LE, GBRA_10LE, AYUV, ABGR, ARGB, GBRA, Y444_16LE, " \
|
||||
"GBR_16LE, Y444_12LE, GBR_12LE, I422_12LE, I420_12LE, Y444_10LE, GBR_10LE, " \
|
||||
"I422_10LE, I420_10LE, Y444, BGRP, GBR, RGBP, xBGR, xRGB, Y42B, NV21, " \
|
||||
"I420, YV12, GRAY16_LE, GRAY8"
|
||||
"I420, YV12, Y41B, YUV9, YVU9, GRAY16_LE, GRAY8"
|
||||
|
||||
/* pre/post processing required formats */
|
||||
#define GST_D3D12_TIER_LAST_FORMATS \
|
||||
|
|
|
@ -216,11 +216,14 @@ gst_d3d12_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
|||
if (params->d3d12_format.resource_format[i] == DXGI_FORMAT_UNKNOWN)
|
||||
break;
|
||||
|
||||
guint width = GST_VIDEO_INFO_COMP_WIDTH (¶ms->aligned_info, i);
|
||||
guint height = GST_VIDEO_INFO_COMP_HEIGHT (¶ms->aligned_info, i);
|
||||
width = MAX (width, 1);
|
||||
height = MAX (height, 1);
|
||||
|
||||
desc[i] =
|
||||
CD3DX12_RESOURCE_DESC::Tex2D (params->d3d12_format.resource_format[i],
|
||||
GST_VIDEO_INFO_COMP_WIDTH (¶ms->aligned_info, i),
|
||||
GST_VIDEO_INFO_COMP_HEIGHT (¶ms->aligned_info, i),
|
||||
params->array_size, 1, 1, 0, params->resource_flags);
|
||||
width, height, params->array_size, 1, 1, 0, params->resource_flags);
|
||||
|
||||
gst_d3d12_buffer_pool_do_align (desc[i]);
|
||||
|
||||
|
|
|
@ -1198,6 +1198,37 @@ gst_d3d12_converter_update_dest_rect (GstD3D12Converter * self)
|
|||
gst_d3d12_converter_update_clear_background (self);
|
||||
|
||||
switch (GST_VIDEO_INFO_FORMAT (&priv->out_info)) {
|
||||
case GST_VIDEO_FORMAT_YUV9:
|
||||
case GST_VIDEO_FORMAT_YVU9:
|
||||
priv->viewport[1].TopLeftX = priv->viewport[0].TopLeftX / 4;
|
||||
priv->viewport[1].TopLeftY = priv->viewport[0].TopLeftY / 4;
|
||||
priv->viewport[1].Width = priv->viewport[0].Width / 4;
|
||||
priv->viewport[1].Height = priv->viewport[0].Height / 4;
|
||||
|
||||
priv->scissor_rect[1].left = priv->scissor_rect[0].left / 4;
|
||||
priv->scissor_rect[1].top = priv->scissor_rect[0].top / 4;
|
||||
priv->scissor_rect[1].right = priv->scissor_rect[0].right / 4;
|
||||
priv->scissor_rect[1].bottom = priv->scissor_rect[0].bottom / 4;
|
||||
for (guint i = 2; i < GST_VIDEO_INFO_N_PLANES (&priv->out_info); i++) {
|
||||
priv->viewport[i] = priv->viewport[1];
|
||||
priv->scissor_rect[i] = priv->scissor_rect[1];
|
||||
}
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_Y41B:
|
||||
priv->viewport[1].TopLeftX = priv->viewport[0].TopLeftX / 4;
|
||||
priv->viewport[1].TopLeftY = priv->viewport[0].TopLeftY;
|
||||
priv->viewport[1].Width = priv->viewport[0].Width / 4;
|
||||
priv->viewport[1].Height = priv->viewport[0].Height;
|
||||
|
||||
priv->scissor_rect[1].left = priv->scissor_rect[0].left / 4;
|
||||
priv->scissor_rect[1].top = priv->scissor_rect[0].top;
|
||||
priv->scissor_rect[1].right = priv->scissor_rect[0].right / 4;
|
||||
priv->scissor_rect[1].bottom = priv->scissor_rect[0].bottom;
|
||||
for (guint i = 2; i < GST_VIDEO_INFO_N_PLANES (&priv->out_info); i++) {
|
||||
priv->viewport[i] = priv->viewport[1];
|
||||
priv->scissor_rect[i] = priv->scissor_rect[1];
|
||||
}
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_NV12:
|
||||
case GST_VIDEO_FORMAT_NV21:
|
||||
case GST_VIDEO_FORMAT_P010_10LE:
|
||||
|
@ -1221,7 +1252,6 @@ gst_d3d12_converter_update_dest_rect (GstD3D12Converter * self)
|
|||
priv->viewport[i] = priv->viewport[1];
|
||||
priv->scissor_rect[i] = priv->scissor_rect[1];
|
||||
}
|
||||
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_Y42B:
|
||||
case GST_VIDEO_FORMAT_I422_10LE:
|
||||
|
@ -1562,6 +1592,9 @@ gst_d3d12_converter_calculate_border_color (GstD3D12Converter * self)
|
|||
priv->clear_color[1][2] = 0;
|
||||
priv->clear_color[1][3] = 1.0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_YUV9:
|
||||
case GST_VIDEO_FORMAT_YVU9:
|
||||
case GST_VIDEO_FORMAT_Y41B:
|
||||
case GST_VIDEO_FORMAT_I420:
|
||||
case GST_VIDEO_FORMAT_YV12:
|
||||
case GST_VIDEO_FORMAT_I420_10LE:
|
||||
|
@ -1577,7 +1610,7 @@ gst_d3d12_converter_calculate_border_color (GstD3D12Converter * self)
|
|||
priv->clear_color[0][1] = 0;
|
||||
priv->clear_color[0][2] = 0;
|
||||
priv->clear_color[0][3] = 1.0;
|
||||
if (format == GST_VIDEO_FORMAT_YV12) {
|
||||
if (format == GST_VIDEO_FORMAT_YV12 || format == GST_VIDEO_FORMAT_YVU9) {
|
||||
priv->clear_color[1][0] = converted[2];
|
||||
priv->clear_color[2][0] = converted[1];
|
||||
} else {
|
||||
|
|
|
@ -650,12 +650,15 @@ conv_ps_make_input (GstVideoFormat format, gboolean premul)
|
|||
return "NV12";
|
||||
case GST_VIDEO_FORMAT_NV21:
|
||||
return "NV21";
|
||||
case GST_VIDEO_FORMAT_YUV9:
|
||||
case GST_VIDEO_FORMAT_Y41B:
|
||||
case GST_VIDEO_FORMAT_I420:
|
||||
case GST_VIDEO_FORMAT_Y42B:
|
||||
case GST_VIDEO_FORMAT_Y444:
|
||||
case GST_VIDEO_FORMAT_Y444_16LE:
|
||||
return "I420";
|
||||
case GST_VIDEO_FORMAT_YV12:
|
||||
case GST_VIDEO_FORMAT_YVU9:
|
||||
return "YV12";
|
||||
case GST_VIDEO_FORMAT_I420_10LE:
|
||||
case GST_VIDEO_FORMAT_I422_10LE:
|
||||
|
@ -782,6 +785,8 @@ conv_ps_make_output (GstVideoFormat format, gboolean premul)
|
|||
ret.push_back({PS_OUTPUT::LUMA, "Luma"});
|
||||
ret.push_back({PS_OUTPUT::CHROMA, "ChromaNV21"});
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_YUV9:
|
||||
case GST_VIDEO_FORMAT_Y41B:
|
||||
case GST_VIDEO_FORMAT_I420:
|
||||
case GST_VIDEO_FORMAT_Y42B:
|
||||
ret.push_back({PS_OUTPUT::LUMA, "Luma"});
|
||||
|
@ -792,6 +797,7 @@ conv_ps_make_output (GstVideoFormat format, gboolean premul)
|
|||
ret.push_back({PS_OUTPUT::PLANAR, "Y444"});
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_YV12:
|
||||
case GST_VIDEO_FORMAT_YVU9:
|
||||
ret.push_back({PS_OUTPUT::LUMA, "Luma"});
|
||||
ret.push_back({PS_OUTPUT::CHROMA_PLANAR, "ChromaYV12"});
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue