d3d11: Add support for BGRx and RGBx formats

For such formats, we can re-use existing BGRA/RGBA implementations
but ignoring alpha channel

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2174>
This commit is contained in:
Seungha Yang 2021-04-20 02:00:18 +09:00 committed by GStreamer Marge Bot
parent 33078bf54a
commit 817544860d
3 changed files with 18 additions and 6 deletions

View file

@ -494,11 +494,23 @@ gst_d3d11_device_setup_format_table (GstD3D11Device * self)
priv->format_table[n_formats].dxgi_format = DXGI_FORMAT_B8G8R8A8_UNORM;
n_formats++;
/* Identical to BGRA, but alpha will be ignored */
priv->format_table[n_formats].format = GST_VIDEO_FORMAT_BGRx;
priv->format_table[n_formats].resource_format[0] = DXGI_FORMAT_B8G8R8A8_UNORM;
priv->format_table[n_formats].dxgi_format = DXGI_FORMAT_B8G8R8A8_UNORM;
n_formats++;
priv->format_table[n_formats].format = GST_VIDEO_FORMAT_RGBA;
priv->format_table[n_formats].resource_format[0] = DXGI_FORMAT_R8G8B8A8_UNORM;
priv->format_table[n_formats].dxgi_format = DXGI_FORMAT_R8G8B8A8_UNORM;
n_formats++;
/* Identical to RGBA, but alpha will be ignored */
priv->format_table[n_formats].format = GST_VIDEO_FORMAT_RGBx;
priv->format_table[n_formats].resource_format[0] = DXGI_FORMAT_R8G8B8A8_UNORM;
priv->format_table[n_formats].dxgi_format = DXGI_FORMAT_R8G8B8A8_UNORM;
n_formats++;
priv->format_table[n_formats].format = GST_VIDEO_FORMAT_RGB10A2_LE;
priv->format_table[n_formats].resource_format[0] =
DXGI_FORMAT_R10G10B10A2_UNORM;

View file

@ -27,7 +27,7 @@
G_BEGIN_DECLS
#define GST_D3D11_COMMON_FORMATS \
"BGRA, RGBA, RGB10A2_LE, VUYA, NV12, P010_10LE, P016_LE, I420, I420_10LE"
"BGRA, RGBA, RGB10A2_LE, BGRx, RGBx, VUYA, NV12, P010_10LE, P016_LE, I420, I420_10LE"
#define GST_D3D11_EXTRA_IN_FORMATS \
"YUY2, UYVY, VYUY, Y210, Y410"
@ -41,7 +41,7 @@ G_BEGIN_DECLS
#define GST_D3D11_ALL_FORMATS \
"{ " GST_D3D11_COMMON_FORMATS " ," GST_D3D11_EXTRA_IN_FORMATS " }"
#define GST_D3D11_N_FORMATS 14
#define GST_D3D11_N_FORMATS 16
struct _GstD3D11Format
{

View file

@ -187,7 +187,7 @@ GST_START_TEST (test_d3d11_color_convert_yuv_rgb)
"VUYA", "NV12", "P010_10LE", "P016_LE", "I420", "I420_10LE"
};
const gchar *out_format_list[] = {
"BGRA", "RGBA", "RGB10A2_LE",
"BGRA", "RGBA", "RGB10A2_LE", "BGRx", "RGBx",
};
@ -210,7 +210,7 @@ GST_END_TEST;
GST_START_TEST (test_d3d11_color_convert_rgb_yuv)
{
const gchar *in_format_list[] = {
"BGRA", "RGBA", "RGB10A2_LE",
"BGRA", "RGBA", "RGB10A2_LE", "BGRx", "RGBx",
};
const gchar *out_format_list[] = {
"VUYA", "NV12", "P010_10LE", "P016_LE", "I420", "I420_10LE"
@ -232,7 +232,7 @@ GST_END_TEST;
GST_START_TEST (test_d3d11_color_convert_rgb_rgb)
{
const gchar *format_list[] = {
"BGRA", "RGBA", "RGB10A2_LE",
"BGRA", "RGBA", "RGB10A2_LE", "BGRx", "RGBx",
};
gint i, j;
@ -278,7 +278,7 @@ GST_START_TEST (test_d3d11_color_convert_packed_yuv_rgb)
"YUY2", "UYVY", "VYUY", "Y210", "Y410",
};
const gchar *out_format_list[] = {
"BGRA", "RGBA", "RGB10A2_LE",
"BGRA", "RGBA", "RGB10A2_LE", "BGRx", "RGBx",
};
gint i, j;