Commit 74f81a1a authored by Seungha Yang's avatar Seungha Yang 🐑 Committed by GStreamer Marge Bot
Browse files

d3d11: Add support for YV12 and NV21 formats

Handle UV swapped 4:2:0 8bits formats

Part-of: <!2290>
parent 73067bfe
Pipeline #331889 waiting for manual action with stages
in 38 seconds
......@@ -90,6 +90,8 @@ enum
#define DEFAULT_ADAPTER 0
#define DEFAULT_CREATE_FLAGS 0
#define GST_D3D11_N_FORMATS 18
struct _GstD3D11DevicePrivate
{
guint adapter;
......@@ -590,6 +592,13 @@ gst_d3d11_device_setup_format_table (GstD3D11Device * self)
priv->format_table[n_formats].dxgi_format = DXGI_FORMAT_UNKNOWN;
n_formats++;
/* no native format for NV21 */
priv->format_table[n_formats].format = GST_VIDEO_FORMAT_NV21;
priv->format_table[n_formats].resource_format[0] = DXGI_FORMAT_R8_UNORM;
priv->format_table[n_formats].resource_format[1] = DXGI_FORMAT_R8G8_UNORM;
priv->format_table[n_formats].dxgi_format = DXGI_FORMAT_UNKNOWN;
n_formats++;
priv->format_table[n_formats].format = GST_VIDEO_FORMAT_P010_10LE;
priv->format_table[n_formats].resource_format[0] = DXGI_FORMAT_R16_UNORM;
priv->format_table[n_formats].resource_format[1] = DXGI_FORMAT_R16G16_UNORM;
......@@ -619,6 +628,12 @@ gst_d3d11_device_setup_format_table (GstD3D11Device * self)
priv->format_table[n_formats].resource_format[2] = DXGI_FORMAT_R8_UNORM;
n_formats++;
priv->format_table[n_formats].format = GST_VIDEO_FORMAT_YV12;
priv->format_table[n_formats].resource_format[0] = DXGI_FORMAT_R8_UNORM;
priv->format_table[n_formats].resource_format[1] = DXGI_FORMAT_R8_UNORM;
priv->format_table[n_formats].resource_format[2] = DXGI_FORMAT_R8_UNORM;
n_formats++;
priv->format_table[n_formats].format = GST_VIDEO_FORMAT_I420_10LE;
priv->format_table[n_formats].resource_format[0] = DXGI_FORMAT_R16_UNORM;
priv->format_table[n_formats].resource_format[1] = DXGI_FORMAT_R16_UNORM;
......
......@@ -27,7 +27,8 @@
G_BEGIN_DECLS
#define GST_D3D11_COMMON_FORMATS \
"BGRA, RGBA, RGB10A2_LE, BGRx, RGBx, VUYA, NV12, P010_10LE, P016_LE, I420, I420_10LE"
"BGRA, RGBA, RGB10A2_LE, BGRx, RGBx, VUYA, NV12, NV21, " \
"P010_10LE, P016_LE, I420, YV12, I420_10LE"
#define GST_D3D11_EXTRA_IN_FORMATS \
"YUY2, UYVY, VYUY, Y210, Y410"
......@@ -41,8 +42,6 @@ G_BEGIN_DECLS
#define GST_D3D11_ALL_FORMATS \
"{ " GST_D3D11_COMMON_FORMATS " ," GST_D3D11_EXTRA_IN_FORMATS " }"
#define GST_D3D11_N_FORMATS 16
struct _GstD3D11Format
{
GstVideoFormat format;
......
This diff is collapsed.
......@@ -163,7 +163,7 @@ run_convert_pipelne (const gchar * in_format, const gchar * out_format)
GST_START_TEST (test_d3d11_color_convert_yuv_yuv)
{
const gchar *format_list[] = {
"VUYA", "NV12", "P010_10LE", "P016_LE", "I420", "I420_10LE"
"VUYA", "NV12", "P010_10LE", "P016_LE", "I420", "I420_10LE", "YV12", "NV21"
};
gint i, j;
......@@ -184,7 +184,7 @@ GST_END_TEST;
GST_START_TEST (test_d3d11_color_convert_yuv_rgb)
{
const gchar *in_format_list[] = {
"VUYA", "NV12", "P010_10LE", "P016_LE", "I420", "I420_10LE"
"VUYA", "NV12", "P010_10LE", "P016_LE", "I420", "I420_10LE", "YV12", "NV21"
};
const gchar *out_format_list[] = {
"BGRA", "RGBA", "RGB10A2_LE", "BGRx", "RGBx",
......@@ -213,7 +213,7 @@ GST_START_TEST (test_d3d11_color_convert_rgb_yuv)
"BGRA", "RGBA", "RGB10A2_LE", "BGRx", "RGBx",
};
const gchar *out_format_list[] = {
"VUYA", "NV12", "P010_10LE", "P016_LE", "I420", "I420_10LE"
"VUYA", "NV12", "P010_10LE", "P016_LE", "I420", "I420_10LE", "YV12", "NV21"
};
gint i, j;
......@@ -256,7 +256,7 @@ GST_START_TEST (test_d3d11_color_convert_packed_yuv_yuv)
"YUY2", "UYVY", "VYUY", "Y210", "Y410",
};
const gchar *out_format_list[] = {
"VUYA", "NV12", "P010_10LE", "P016_LE", "I420", "I420_10LE"
"VUYA", "NV12", "P010_10LE", "P016_LE", "I420", "I420_10LE", "YV12", "NV21"
};
gint i, j;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment