diff options
author | Seungha Yang <seungha@centricular.com> | 2021-06-21 17:13:33 +0900 |
---|---|---|
committer | GStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2021-06-23 15:35:36 +0000 |
commit | 7c94b9c4b0d70366bd016f4d2e22f06e576323cd (patch) | |
tree | 5963b3c10dbc51935036ccd0c2214e614918df21 /tests | |
parent | 52a0c3659859f3f7896620042ba49bf2274a072a (diff) | |
download | gstreamer-plugins-bad-7c94b9c4b0d70366bd016f4d2e22f06e576323cd.tar.gz |
d3d11: Add support for GRAY and more YUV formats
By this commit, following formats will be newly supported by d3d11 elements
* Y444_{8, 12, 16}LE formats:
Similar to other planar formats. Such Y444 variants are not supported
by Direct3D11 natively, but we can simply map each plane by
using R8 and/or R16 texture.
* P012_LE:
It is not different from P016_LE, but defining P012 and P016 separately
for more explicit signalling. Note that DXVA uses P016 texture
for 12bits encoded bitstreams.
* GRAY:
This format is required for some codecs (e.g., AV1) if monochrome
is supported
* 4:2:0 planar 12bits (I420_12LE) and 4:2:2 planar 8, 10, 12bits
formats (Y42B, I422_10LE, and I422_12LE)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2346>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check/elements/d3d11colorconvert.c | 201 |
1 files changed, 129 insertions, 72 deletions
diff --git a/tests/check/elements/d3d11colorconvert.c b/tests/check/elements/d3d11colorconvert.c index 675a68eab..44e937630 100644 --- a/tests/check/elements/d3d11colorconvert.c +++ b/tests/check/elements/d3d11colorconvert.c @@ -45,6 +45,24 @@ typedef struct _TestFrame static const guint8 rgba_reorder_data[] = { 0x49, 0x24, 0x72, 0xff }; static const guint8 bgra_reorder_data[] = { 0x72, 0x24, 0x49, 0xff }; +static const gchar *YUV_FORMATS[] = { + "VUYA", "NV12", "P010_10LE", "P012_LE", "P016_LE", "I420", "I420_10LE", + "I420_12LE", "YV12", "NV21", "Y444", "Y444_10LE", "Y444_12LE", "Y444_16LE", + "Y42B", "I422_10LE", "I422_12LE", +}; + +static const gchar *RGB_FORMATS[] = { + "BGRA", "RGBA", "RGB10A2_LE", "BGRx", "RGBx", +}; + +static const gchar *PACKED_YUV_FORMATS[] = { + "YUY2", "UYVY", "VYUY", "Y210", "Y410", +}; + +static const gchar *GRAY_FORMATS[] = { + "GRAY8", "GRAY16_LE" +}; + static TestFrame test_rgba_reorder[] = { {1, 1, GST_VIDEO_FORMAT_RGBA, {(guint8 *) & rgba_reorder_data}}, {1, 1, GST_VIDEO_FORMAT_BGRA, {(guint8 *) & bgra_reorder_data}}, @@ -102,7 +120,6 @@ GST_START_TEST (test_d3d11_color_convert_rgba_reorder) GST_END_TEST; -#if RUN_VISUAL_TEST static gboolean bus_cb (GstBus * bus, GstMessage * message, gpointer data) { @@ -162,19 +179,15 @@ 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", "YV12", "NV21" - }; - gint i, j; - for (i = 0; i < G_N_ELEMENTS (format_list); i++) { - for (j = 0; j < G_N_ELEMENTS (format_list); j++) { + for (i = 0; i < G_N_ELEMENTS (YUV_FORMATS); i++) { + for (j = 0; j < G_N_ELEMENTS (YUV_FORMATS); j++) { if (i == j) continue; - GST_DEBUG ("run conversion %s to %s", format_list[i], format_list[j]); - run_convert_pipelne (format_list[i], format_list[j]); + GST_DEBUG ("run conversion %s to %s", YUV_FORMATS[i], YUV_FORMATS[j]); + run_convert_pipelne (YUV_FORMATS[i], YUV_FORMATS[j]); } } } @@ -183,24 +196,32 @@ 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", "YV12", "NV21" - }; - const gchar *out_format_list[] = { - "BGRA", "RGBA", "RGB10A2_LE", "BGRx", "RGBx", - }; + gint i, j; + + for (i = 0; i < G_N_ELEMENTS (YUV_FORMATS); i++) { + for (j = 0; j < G_N_ELEMENTS (RGB_FORMATS); j++) { + if (i == j) + continue; + + GST_DEBUG ("run conversion %s to %s", YUV_FORMATS[i], RGB_FORMATS[j]); + run_convert_pipelne (YUV_FORMATS[i], RGB_FORMATS[j]); + } + } +} +GST_END_TEST; +GST_START_TEST (test_d3d11_color_convert_yuv_gray) +{ gint i, j; - for (i = 0; i < G_N_ELEMENTS (in_format_list); i++) { - for (j = 0; j < G_N_ELEMENTS (out_format_list); j++) { + for (i = 0; i < G_N_ELEMENTS (YUV_FORMATS); i++) { + for (j = 0; j < G_N_ELEMENTS (GRAY_FORMATS); j++) { if (i == j) continue; - GST_DEBUG ("run conversion %s to %s", in_format_list[i], - out_format_list[j]); - run_convert_pipelne (in_format_list[i], out_format_list[j]); + GST_DEBUG ("run conversion %s to %s", YUV_FORMATS[i], GRAY_FORMATS[j]); + run_convert_pipelne (YUV_FORMATS[i], GRAY_FORMATS[j]); } } } @@ -209,20 +230,12 @@ GST_END_TEST; GST_START_TEST (test_d3d11_color_convert_rgb_yuv) { - const gchar *in_format_list[] = { - "BGRA", "RGBA", "RGB10A2_LE", "BGRx", "RGBx", - }; - const gchar *out_format_list[] = { - "VUYA", "NV12", "P010_10LE", "P016_LE", "I420", "I420_10LE", "YV12", "NV21" - }; - gint i, j; - for (i = 0; i < G_N_ELEMENTS (in_format_list); i++) { - for (j = 0; j < G_N_ELEMENTS (out_format_list); j++) { - GST_DEBUG ("run conversion %s to %s", in_format_list[i], - out_format_list[j]); - run_convert_pipelne (in_format_list[i], out_format_list[j]); + for (i = 0; i < G_N_ELEMENTS (RGB_FORMATS); i++) { + for (j = 0; j < G_N_ELEMENTS (YUV_FORMATS); j++) { + GST_DEBUG ("run conversion %s to %s", RGB_FORMATS[i], YUV_FORMATS[j]); + run_convert_pipelne (RGB_FORMATS[i], YUV_FORMATS[j]); } } } @@ -231,41 +244,44 @@ GST_END_TEST; GST_START_TEST (test_d3d11_color_convert_rgb_rgb) { - const gchar *format_list[] = { - "BGRA", "RGBA", "RGB10A2_LE", "BGRx", "RGBx", - }; - gint i, j; - for (i = 0; i < G_N_ELEMENTS (format_list); i++) { - for (j = 0; j < G_N_ELEMENTS (format_list); j++) { + for (i = 0; i < G_N_ELEMENTS (RGB_FORMATS); i++) { + for (j = 0; j < G_N_ELEMENTS (RGB_FORMATS); j++) { if (i == j) continue; - GST_DEBUG ("run conversion %s to %s", format_list[i], format_list[j]); - run_convert_pipelne (format_list[i], format_list[j]); + GST_DEBUG ("run conversion %s to %s", RGB_FORMATS[i], RGB_FORMATS[j]); + run_convert_pipelne (RGB_FORMATS[i], RGB_FORMATS[j]); } } } GST_END_TEST; -GST_START_TEST (test_d3d11_color_convert_packed_yuv_yuv) +GST_START_TEST (test_d3d11_color_convert_rgb_gray) { - const gchar *in_format_list[] = { - "YUY2", "UYVY", "VYUY", "Y210", "Y410", - }; - const gchar *out_format_list[] = { - "VUYA", "NV12", "P010_10LE", "P016_LE", "I420", "I420_10LE", "YV12", "NV21" - }; + gint i, j; + for (i = 0; i < G_N_ELEMENTS (RGB_FORMATS); i++) { + for (j = 0; j < G_N_ELEMENTS (GRAY_FORMATS); j++) { + GST_DEBUG ("run conversion %s to %s", RGB_FORMATS[i], GRAY_FORMATS[j]); + run_convert_pipelne (RGB_FORMATS[i], GRAY_FORMATS[j]); + } + } +} + +GST_END_TEST; + +GST_START_TEST (test_d3d11_color_convert_packed_yuv_yuv) +{ gint i, j; - for (i = 0; i < G_N_ELEMENTS (in_format_list); i++) { - for (j = 0; j < G_N_ELEMENTS (out_format_list); j++) { - GST_DEBUG ("run conversion %s to %s", in_format_list[i], - out_format_list[j]); - run_convert_pipelne (in_format_list[i], out_format_list[j]); + for (i = 0; i < G_N_ELEMENTS (PACKED_YUV_FORMATS); i++) { + for (j = 0; j < G_N_ELEMENTS (YUV_FORMATS); j++) { + GST_DEBUG ("run conversion %s to %s", PACKED_YUV_FORMATS[i], + YUV_FORMATS[j]); + run_convert_pipelne (PACKED_YUV_FORMATS[i], YUV_FORMATS[j]); } } } @@ -274,43 +290,84 @@ GST_END_TEST; GST_START_TEST (test_d3d11_color_convert_packed_yuv_rgb) { - const gchar *in_format_list[] = { - "YUY2", "UYVY", "VYUY", "Y210", "Y410", - }; - const gchar *out_format_list[] = { - "BGRA", "RGBA", "RGB10A2_LE", "BGRx", "RGBx", - }; + gint i, j; + + for (i = 0; i < G_N_ELEMENTS (PACKED_YUV_FORMATS); i++) { + for (j = 0; j < G_N_ELEMENTS (RGB_FORMATS); j++) { + GST_DEBUG ("run conversion %s to %s", PACKED_YUV_FORMATS[i], + RGB_FORMATS[j]); + run_convert_pipelne (PACKED_YUV_FORMATS[i], RGB_FORMATS[j]); + } + } +} + +GST_END_TEST; +GST_START_TEST (test_d3d11_color_convert_packed_yuv_gray) +{ gint i, j; - for (i = 0; i < G_N_ELEMENTS (in_format_list); i++) { - for (j = 0; j < G_N_ELEMENTS (out_format_list); j++) { - GST_DEBUG ("run conversion %s to %s", in_format_list[i], - out_format_list[j]); - run_convert_pipelne (in_format_list[i], out_format_list[j]); + for (i = 0; i < G_N_ELEMENTS (PACKED_YUV_FORMATS); i++) { + for (j = 0; j < G_N_ELEMENTS (GRAY_FORMATS); j++) { + GST_DEBUG ("run conversion %s to %s", PACKED_YUV_FORMATS[i], + GRAY_FORMATS[j]); + run_convert_pipelne (PACKED_YUV_FORMATS[i], GRAY_FORMATS[j]); + } + } +} + +GST_END_TEST; + +GST_START_TEST (test_d3d11_color_convert_gray_yuv) +{ + gint i, j; + + for (i = 0; i < G_N_ELEMENTS (GRAY_FORMATS); i++) { + for (j = 0; j < G_N_ELEMENTS (YUV_FORMATS); j++) { + GST_DEBUG ("run conversion %s to %s", GRAY_FORMATS[i], YUV_FORMATS[j]); + run_convert_pipelne (GRAY_FORMATS[i], YUV_FORMATS[j]); + } + } +} + +GST_END_TEST; + +GST_START_TEST (test_d3d11_color_convert_gray_rgb) +{ + gint i, j; + + for (i = 0; i < G_N_ELEMENTS (GRAY_FORMATS); i++) { + for (j = 0; j < G_N_ELEMENTS (RGB_FORMATS); j++) { + GST_DEBUG ("run conversion %s to %s", GRAY_FORMATS[i], RGB_FORMATS[j]); + run_convert_pipelne (GRAY_FORMATS[i], RGB_FORMATS[j]); } } } GST_END_TEST; -#endif /* RUN_VISUAL_TEST */ static Suite * d3d11colorconvert_suite (void) { Suite *s = suite_create ("d3d11colorconvert"); TCase *tc_basic = tcase_create ("general"); + const gchar *run_visual_test = g_getenv ("RUN_VISUAL_TEST"); suite_add_tcase (s, tc_basic); tcase_add_test (tc_basic, test_d3d11_color_convert_rgba_reorder); -#if RUN_VISUAL_TEST - tcase_add_test (tc_basic, test_d3d11_color_convert_yuv_yuv); - tcase_add_test (tc_basic, test_d3d11_color_convert_yuv_rgb); - tcase_add_test (tc_basic, test_d3d11_color_convert_rgb_yuv); - tcase_add_test (tc_basic, test_d3d11_color_convert_rgb_rgb); - tcase_add_test (tc_basic, test_d3d11_color_convert_packed_yuv_yuv); - tcase_add_test (tc_basic, test_d3d11_color_convert_packed_yuv_rgb); -#endif + if (run_visual_test != NULL) { + tcase_add_test (tc_basic, test_d3d11_color_convert_yuv_yuv); + tcase_add_test (tc_basic, test_d3d11_color_convert_yuv_rgb); + tcase_add_test (tc_basic, test_d3d11_color_convert_yuv_gray); + tcase_add_test (tc_basic, test_d3d11_color_convert_rgb_yuv); + tcase_add_test (tc_basic, test_d3d11_color_convert_rgb_rgb); + tcase_add_test (tc_basic, test_d3d11_color_convert_rgb_gray); + tcase_add_test (tc_basic, test_d3d11_color_convert_packed_yuv_yuv); + tcase_add_test (tc_basic, test_d3d11_color_convert_packed_yuv_rgb); + tcase_add_test (tc_basic, test_d3d11_color_convert_packed_yuv_gray); + tcase_add_test (tc_basic, test_d3d11_color_convert_gray_yuv); + tcase_add_test (tc_basic, test_d3d11_color_convert_gray_rgb); + } return s; } |