summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2018-02-26 17:26:07 +0100
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2018-03-05 13:22:12 -0500
commit9f25fcdfc9959bc8fd1154d233b567b36b06e278 (patch)
tree4e7a26b5392ec346690cfa6d113694d262d04693 /tests
parent977af86e8b413f953e24c830f1346b741c627e95 (diff)
h265parse: add support for 'Format range extensions profiles'
Those profiles have been introduced in version 2 of the HEVC spec (A.3.5). https://bugzilla.gnome.org/show_bug.cgi?id=793876
Diffstat (limited to 'tests')
-rw-r--r--tests/check/libs/h265parser.c148
1 files changed, 148 insertions, 0 deletions
diff --git a/tests/check/libs/h265parser.c b/tests/check/libs/h265parser.c
index 0a58e76e5..0a7a5e10c 100644
--- a/tests/check/libs/h265parser.c
+++ b/tests/check/libs/h265parser.c
@@ -70,6 +70,153 @@ GST_START_TEST (test_h265_base_profiles_compat)
GST_END_TEST;
+static void
+set_format_range_fields (GstH265ProfileTierLevel * ptl,
+ guint8 max_12bit_constraint_flag,
+ guint8 max_10bit_constraint_flag,
+ guint8 max_8bit_constraint_flag,
+ guint8 max_422chroma_constraint_flag,
+ guint8 max_420chroma_constraint_flag,
+ guint8 max_monochrome_constraint_flag,
+ guint8 intra_constraint_flag,
+ guint8 one_picture_only_constraint_flag,
+ guint8 lower_bit_rate_constraint_flag)
+{
+ ptl->max_12bit_constraint_flag = max_12bit_constraint_flag;
+ ptl->max_10bit_constraint_flag = max_10bit_constraint_flag;
+ ptl->max_8bit_constraint_flag = max_8bit_constraint_flag;
+ ptl->max_422chroma_constraint_flag = max_422chroma_constraint_flag;
+ ptl->max_420chroma_constraint_flag = max_420chroma_constraint_flag;
+ ptl->max_monochrome_constraint_flag = max_monochrome_constraint_flag;
+ ptl->intra_constraint_flag = intra_constraint_flag;
+ ptl->one_picture_only_constraint_flag = one_picture_only_constraint_flag;
+ ptl->lower_bit_rate_constraint_flag = lower_bit_rate_constraint_flag;
+}
+
+GST_START_TEST (test_h265_format_range_profiles_exact_match)
+{
+ /* Test all the combinations from Table A.2 */
+ GstH265ProfileTierLevel ptl;
+
+ memset (&ptl, 0, sizeof (ptl));
+ ptl.profile_idc = 4;
+
+ set_format_range_fields (&ptl, 1, 1, 1, 1, 1, 1, 0, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MONOCHROME);
+
+ set_format_range_fields (&ptl, 1, 0, 0, 1, 1, 1, 0, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MONOCHROME_12);
+
+ set_format_range_fields (&ptl, 0, 0, 0, 1, 1, 1, 0, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MONOCHROME_16);
+
+ set_format_range_fields (&ptl, 1, 0, 0, 1, 1, 0, 0, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_12);
+
+ set_format_range_fields (&ptl, 1, 1, 0, 1, 0, 0, 0, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_422_10);
+
+ set_format_range_fields (&ptl, 1, 0, 0, 1, 0, 0, 0, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_422_12);
+
+ set_format_range_fields (&ptl, 1, 1, 1, 0, 0, 0, 0, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_444);
+
+ set_format_range_fields (&ptl, 1, 1, 0, 0, 0, 0, 0, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_444_10);
+
+ set_format_range_fields (&ptl, 1, 0, 0, 0, 0, 0, 0, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_444_12);
+
+ set_format_range_fields (&ptl, 1, 1, 1, 1, 1, 0, 1, 0, 0);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_INTRA);
+ set_format_range_fields (&ptl, 1, 1, 1, 1, 1, 0, 1, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_INTRA);
+
+ set_format_range_fields (&ptl, 1, 1, 0, 1, 1, 0, 1, 0, 0);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_10_INTRA);
+ set_format_range_fields (&ptl, 1, 1, 0, 1, 1, 0, 1, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_10_INTRA);
+
+ set_format_range_fields (&ptl, 1, 0, 0, 1, 1, 0, 1, 0, 0);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_12_INTRA);
+ set_format_range_fields (&ptl, 1, 0, 0, 1, 1, 0, 1, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_12_INTRA);
+
+ set_format_range_fields (&ptl, 1, 1, 0, 1, 0, 0, 1, 0, 0);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_422_10_INTRA);
+ set_format_range_fields (&ptl, 1, 1, 0, 1, 0, 0, 1, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_422_10_INTRA);
+
+ set_format_range_fields (&ptl, 1, 0, 0, 1, 0, 0, 1, 0, 0);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_422_12_INTRA);
+ set_format_range_fields (&ptl, 1, 0, 0, 1, 0, 0, 1, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_422_12_INTRA);
+
+ set_format_range_fields (&ptl, 1, 1, 1, 0, 0, 0, 1, 0, 0);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_444_INTRA);
+ set_format_range_fields (&ptl, 1, 1, 1, 0, 0, 0, 1, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_444_INTRA);
+
+ set_format_range_fields (&ptl, 1, 1, 0, 0, 0, 0, 1, 0, 0);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_444_10_INTRA);
+ set_format_range_fields (&ptl, 1, 1, 0, 0, 0, 0, 1, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_444_10_INTRA);
+
+ set_format_range_fields (&ptl, 1, 0, 0, 0, 0, 0, 1, 0, 0);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_444_12_INTRA);
+ set_format_range_fields (&ptl, 1, 0, 0, 0, 0, 0, 1, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_444_12_INTRA);
+
+ set_format_range_fields (&ptl, 0, 0, 0, 0, 0, 0, 1, 0, 0);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_444_16_INTRA);
+ set_format_range_fields (&ptl, 0, 0, 0, 0, 0, 0, 1, 0, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_444_16_INTRA);
+
+ set_format_range_fields (&ptl, 1, 1, 1, 0, 0, 0, 1, 1, 0);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_444_STILL_PICTURE);
+ set_format_range_fields (&ptl, 1, 1, 1, 0, 0, 0, 1, 1, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_444_STILL_PICTURE);
+
+ set_format_range_fields (&ptl, 0, 0, 0, 0, 0, 0, 1, 1, 0);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_444_16_STILL_PICTURE);
+ set_format_range_fields (&ptl, 0, 0, 0, 0, 0, 0, 1, 1, 1);
+ g_assert_cmpuint (gst_h265_profile_tier_level_get_profile (&ptl), ==,
+ GST_H265_PROFILE_MAIN_444_16_STILL_PICTURE);
+}
+
+GST_END_TEST;
+
static Suite *
h265parser_suite (void)
{
@@ -80,6 +227,7 @@ h265parser_suite (void)
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_h265_base_profiles);
tcase_add_test (tc_chain, test_h265_base_profiles_compat);
+ tcase_add_test (tc_chain, test_h265_format_range_profiles_exact_match);
return s;
}