tests: h265parser: Add test parsing range extension in PPS
authorWangfei <fei.w.wang@intel.com>
Tue, 27 Aug 2019 09:04:50 +0000 (17:04 +0800)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 31 Aug 2019 23:22:44 +0000 (23:22 +0000)
tests/check/libs/h265parser.c

index 0056a64..d932d07 100644 (file)
@@ -39,6 +39,51 @@ static const guint8 h265_vps_with_nonzero_max_layer_id[] = {
   0x5d, 0xac, 0x59
 };
 
+static const guint8 h265_pps_with_range_extension[] = {
+  0x00, 0x00, 0x00, 0x01, 0x44, 0x01, 0x30, 0x42, 0x13, 0x1c, 0x0c, 0x60,
+  0xe1, 0xd9, 0x38, 0x83, 0xb6, 0x38, 0x2c, 0x19, 0x29, 0x82, 0x42, 0xee,
+  0x61, 0xec, 0x28, 0x11, 0x1a, 0x51, 0xc1, 0x60, 0xc9, 0x4c, 0x12, 0x17,
+  0x73, 0x0f, 0x61, 0x40, 0x88, 0xd1, 0x05, 0x38, 0x20, 0x28, 0x94, 0xc5,
+  0x1c, 0x26, 0x70, 0xb0, 0x44, 0x20, 0x30, 0x69, 0x4a, 0x16, 0x12, 0x2c,
+  0x20, 0x83, 0xe3, 0x06, 0x87, 0x87, 0xc7, 0x30, 0xa9, 0x22, 0xd0, 0xb1,
+  0x01, 0x40, 0x98, 0xa1, 0x02, 0x47, 0x33, 0x85, 0x43, 0xc1, 0x31, 0x01,
+  0x18, 0x68, 0x2e, 0x3a, 0x20, 0x22, 0x20, 0x48, 0xc0, 0xd8, 0xe0, 0xa8,
+  0xa1, 0xc5, 0x04, 0x05, 0x12, 0x98, 0xa3, 0x84, 0xce, 0x16, 0x08, 0x84,
+  0x06, 0x0d, 0x29, 0x42, 0xc2, 0x45, 0x84, 0x10, 0x7c, 0x60, 0xd0, 0xf0,
+  0xf8, 0xe6, 0x15, 0x24, 0x5a, 0x16, 0x20, 0x28, 0x13, 0x14, 0x20, 0x48,
+  0xe6, 0x70, 0xa8, 0x78, 0x26, 0x20, 0x23, 0x0d, 0x05, 0xc7, 0x44, 0x04,
+  0x44, 0x09, 0x18, 0x1b, 0x1c, 0x15, 0x14, 0x3a, 0x08, 0x0a, 0x25, 0x31,
+  0x47, 0x09, 0x9c, 0x2c, 0x11, 0x08, 0x0c, 0x1a, 0x52, 0x85, 0x84, 0x8b,
+  0x08, 0x20, 0xf8, 0xc1, 0xa1, 0xe1, 0xf1, 0xcc, 0x2a, 0x48, 0xb4, 0x2c,
+  0x40, 0x50, 0x26, 0x28, 0x40, 0x91, 0xcc, 0xe1, 0x50, 0xf0, 0x4c, 0x40,
+  0x46, 0x1a, 0x0b, 0x8e, 0x88, 0x08, 0x88, 0x12, 0x30, 0x36, 0x38, 0x2a,
+  0x28, 0x71, 0x41, 0x01, 0x44, 0xa6, 0x28, 0xe1, 0x33, 0x85, 0x82, 0x21,
+  0x01, 0x83, 0x4a, 0x50, 0xb0, 0x91, 0x61, 0x04, 0x1f, 0x18, 0x34, 0x3c,
+  0x3e, 0x39, 0x85, 0x49, 0x16, 0x85, 0x88, 0x0a, 0x04, 0xc5, 0x08, 0x12,
+  0x39, 0x9c, 0x2a, 0x1e, 0x09, 0x88, 0x08, 0xc3, 0x41, 0x71, 0xd1, 0x01,
+  0x11, 0x02, 0x46, 0x06, 0xc7, 0x05, 0x45, 0x0e, 0x82, 0x00, 0x88, 0xc0,
+  0xa9, 0xc3, 0x08, 0xc1, 0xf0, 0xf1, 0x43, 0xe2, 0x04, 0x04, 0x83, 0x28,
+  0x51, 0x03, 0x64, 0x20, 0x70, 0x22, 0x13, 0x08, 0x18, 0x68, 0xd1, 0xc3,
+  0x04, 0x8d, 0x87, 0x85, 0x86, 0x43, 0x81, 0x50, 0xd0, 0xf0, 0x98, 0x70,
+  0xa6, 0x1e, 0x34, 0x31, 0x0d, 0x87, 0x82, 0xe8, 0xf0, 0xc0, 0xd2, 0x94,
+  0xa1, 0x20, 0xcb, 0x31, 0x88, 0xa0, 0x80, 0x22, 0x30, 0x2a, 0x70, 0xc2,
+  0x30, 0x7c, 0x3c, 0x50, 0xf8, 0x81, 0x01, 0x20, 0xca, 0x14, 0x40, 0xd9,
+  0x08, 0x1c, 0x08, 0x84, 0xc2, 0x06, 0x1a, 0x34, 0x70, 0xc1, 0x23, 0x61,
+  0xe1, 0x61, 0x90, 0xe0, 0x54, 0x34, 0x3c, 0x26, 0x1c, 0x29, 0x87, 0x8d,
+  0x0c, 0x43, 0x61, 0xe0, 0xba, 0x3c, 0x30, 0x34, 0xa5, 0x28, 0x48, 0x32,
+  0xcc, 0x68, 0x20, 0x08, 0x8c, 0x0a, 0x9c, 0x30, 0x8c, 0x1f, 0x0f, 0x14,
+  0x3e, 0x20, 0x40, 0x48, 0x32, 0x85, 0x10, 0x36, 0x42, 0x07, 0x02, 0x21,
+  0x30, 0x81, 0x86, 0x8d, 0x1c, 0x30, 0x48, 0xd8, 0x78, 0x58, 0x64, 0x38,
+  0x15, 0x0d, 0x0f, 0x09, 0x87, 0x0a, 0x61, 0xe3, 0x43, 0x10, 0xd8, 0x78,
+  0x2e, 0x8f, 0x0c, 0x0d, 0x29, 0x4a, 0x12, 0x0c, 0xb3, 0x1a, 0x08, 0x02,
+  0x23, 0x02, 0xa7, 0x0c, 0x23, 0x07, 0xc3, 0xc5, 0x0f, 0x88, 0x10, 0x12,
+  0x0c, 0xa1, 0x44, 0x0d, 0x90, 0x81, 0xc0, 0x88, 0x4c, 0x20, 0x61, 0xa3,
+  0x47, 0x0c, 0x12, 0x36, 0x1e, 0x16, 0x19, 0x0e, 0x05, 0x43, 0x43, 0xc2,
+  0x61, 0xc2, 0x98, 0x78, 0xd0, 0xc4, 0x36, 0x1e, 0x0b, 0xa3, 0xc3, 0x03,
+  0x4a, 0x52, 0x84, 0x83, 0x2c, 0xc6, 0x4a, 0x56, 0x01, 0x46, 0x89, 0x0c,
+  0xce, 0x25, 0x04, 0x83, 0x21, 0x96, 0x3b, 0x80,
+};
+
 GST_START_TEST (test_h265_parse_slice_eos_slice_eob)
 {
   GstH265ParserResult res;
@@ -366,6 +411,51 @@ GST_START_TEST (test_h265_parse_vps)
 
 GST_END_TEST;
 
+GST_START_TEST (test_h265_parse_pps)
+{
+  GstH265Parser *parser;
+  GstH265NalUnit nalu;
+  GstH265ParserResult res;
+  GstH265PPS pps;
+
+  parser = gst_h265_parser_new ();
+
+  /*init sps[15] to avoid return error in gst_h265_parser_parse_pps */
+  parser->sps[15].valid = TRUE;
+  parser->sps[15].log2_diff_max_min_luma_coding_block_size = 1;
+
+  res = gst_h265_parser_identify_nalu_unchecked (parser,
+      h265_pps_with_range_extension, 0,
+      sizeof (h265_pps_with_range_extension), &nalu);
+
+  assert_equals_int (res, GST_H265_PARSER_OK);
+  assert_equals_int (nalu.type, GST_H265_NAL_PPS);
+
+  res = gst_h265_parser_parse_pps (parser, &nalu, &pps);
+
+  assert_equals_int (res, GST_H265_PARSER_OK);
+  assert_equals_int (pps.pps_range_extension_flag, 1);
+  assert_equals_int (pps.pps_multilayer_extension_flag, 0);
+  assert_equals_int (pps.pps_3d_extension_flag, 0);
+  assert_equals_int (pps.pps_extension_5bits, 0);
+  assert_equals_int (pps.
+      pps_extension_params.log2_max_transform_skip_block_size_minus2, 0);
+  assert_equals_int (pps.
+      pps_extension_params.cross_component_prediction_enabled_flag, 0);
+  assert_equals_int (pps.
+      pps_extension_params.chroma_qp_offset_list_enabled_flag, 1);
+  assert_equals_int (pps.pps_extension_params.diff_cu_chroma_qp_offset_depth,
+      1);
+  assert_equals_int (pps.pps_extension_params.chroma_qp_offset_list_len_minus1,
+      5);
+  assert_equals_int (pps.pps_extension_params.log2_sao_offset_scale_luma, 0);
+  assert_equals_int (pps.pps_extension_params.log2_sao_offset_scale_chroma, 0);
+
+  gst_h265_parser_free (parser);
+}
+
+GST_END_TEST;
+
 static Suite *
 h265parser_suite (void)
 {
@@ -381,6 +471,7 @@ h265parser_suite (void)
   tcase_add_test (tc_chain, test_h265_format_range_profiles_exact_match);
   tcase_add_test (tc_chain, test_h265_format_range_profiles_partial_match);
   tcase_add_test (tc_chain, test_h265_parse_vps);
+  tcase_add_test (tc_chain, test_h265_parse_pps);
 
   return s;
 }