From: Seungha Yang Date: Mon, 19 Apr 2021 17:00:18 +0000 (+0900) Subject: d3d11: Add support for BGRx and RGBx formats X-Git-Tag: 1.19.3~507^2~502 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=817544860d96d8ef3a1ec50be45ead9b72f87713;p=platform%2Fupstream%2Fgstreamer.git 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: --- diff --git a/gst-libs/gst/d3d11/gstd3d11device.c b/gst-libs/gst/d3d11/gstd3d11device.c index 946732a..b6d0982 100644 --- a/gst-libs/gst/d3d11/gstd3d11device.c +++ b/gst-libs/gst/d3d11/gstd3d11device.c @@ -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; diff --git a/gst-libs/gst/d3d11/gstd3d11format.h b/gst-libs/gst/d3d11/gstd3d11format.h index 10ae5e1..1ac521e 100644 --- a/gst-libs/gst/d3d11/gstd3d11format.h +++ b/gst-libs/gst/d3d11/gstd3d11format.h @@ -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 { diff --git a/tests/check/elements/d3d11colorconvert.c b/tests/check/elements/d3d11colorconvert.c index fc96fa8..6cd010a 100644 --- a/tests/check/elements/d3d11colorconvert.c +++ b/tests/check/elements/d3d11colorconvert.c @@ -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;