h264parse,h265parse: Update for video-hdr struct change

See the change of -base https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/594
This commit is contained in:
Seungha Yang 2020-03-13 16:17:07 +09:00
parent 355719bae7
commit f05effe024
4 changed files with 90 additions and 98 deletions

View file

@ -784,48 +784,47 @@ gst_h264_parse_process_sei (GstH264Parse * h264parse, GstH264NalUnit * nalu)
case GST_H264_SEI_MASTERING_DISPLAY_COLOUR_VOLUME: case GST_H264_SEI_MASTERING_DISPLAY_COLOUR_VOLUME:
{ {
/* Precision defined by spec. /* Precision defined by spec.
* See D.3.28 Mastering display colour volume SEI message semantics */ * See D.2.29 Mastering display colour volume SEI message semantics */
const guint chroma_den = 50000;
const guint luma_den = 10000;
GstVideoMasteringDisplayInfo minfo; GstVideoMasteringDisplayInfo minfo;
gint j, k;
minfo.Gx_n = /* GstVideoMasteringDisplayInfo::display_primaries is rgb order but
sei.payload.mastering_display_colour_volume.display_primaries_x[0]; * AVC uses gbr order.
minfo.Gy_n = * See spec D.2.29 display_primaries_x and display_primaries_y
sei.payload.mastering_display_colour_volume.display_primaries_y[0]; */
minfo.Bx_n = for (j = 0, k = 2; j < G_N_ELEMENTS (minfo.display_primaries); j++, k++) {
sei.payload.mastering_display_colour_volume.display_primaries_x[1]; minfo.display_primaries[j].x =
minfo.By_n =
sei.payload.mastering_display_colour_volume.display_primaries_y[1];
minfo.Rx_n =
sei.payload.mastering_display_colour_volume.display_primaries_x[2];
minfo.Ry_n =
sei.payload.mastering_display_colour_volume.display_primaries_y[2];
minfo.Wx_n = sei.payload.mastering_display_colour_volume.white_point_x;
minfo.Wy_n = sei.payload.mastering_display_colour_volume.white_point_y;
minfo.max_luma_n =
sei.payload. sei.payload.
mastering_display_colour_volume.max_display_mastering_luminance; mastering_display_colour_volume.display_primaries_x[k % 3];
minfo.min_luma_n = minfo.display_primaries[j].y =
sei.payload. sei.payload.
mastering_display_colour_volume.min_display_mastering_luminance; mastering_display_colour_volume.display_primaries_y[k % 3];
}
minfo.Gx_d = minfo.Gy_d = minfo.Bx_d = minfo.By_d = minfo.white_point.x =
minfo.Rx_d = minfo.Ry_d = minfo.Wx_d = minfo.Wy_d = chroma_den; sei.payload.mastering_display_colour_volume.white_point_x;
minfo.white_point.y =
minfo.max_luma_d = minfo.min_luma_d = luma_den; sei.payload.mastering_display_colour_volume.white_point_y;
minfo.max_display_mastering_luminance =
sei.payload.mastering_display_colour_volume.
max_display_mastering_luminance;
minfo.min_display_mastering_luminance =
sei.payload.mastering_display_colour_volume.
min_display_mastering_luminance;
GST_LOG_OBJECT (h264parse, "mastering display info found: " GST_LOG_OBJECT (h264parse, "mastering display info found: "
"Red(%u/%u, %u/%u) " "Red(%u, %u) "
"Green(%u/%u, %u/%u) " "Green(%u, %u) "
"Blue(%u/%u, %u/%u) " "Blue(%u, %u) "
"White(%u/%u, %u/%u) " "White(%u, %u) "
"max_luminance(%u/%u) " "max_luminance(%u) "
"min_luminance(%u/%u) ", minfo.Rx_n, minfo.Rx_d, minfo.Ry_n, "min_luminance(%u) ",
minfo.Ry_d, minfo.Gx_n, minfo.Gx_d, minfo.Gy_n, minfo.Gy_d, minfo.display_primaries[0].x, minfo.display_primaries[0].y,
minfo.Bx_n, minfo.Bx_d, minfo.By_n, minfo.By_d, minfo.Wx_n, minfo.display_primaries[1].x, minfo.display_primaries[1].y,
minfo.Wx_d, minfo.Wy_n, minfo.Wy_d, minfo.max_luma_n, minfo.display_primaries[2].x, minfo.display_primaries[2].y,
minfo.max_luma_d, minfo.min_luma_n, minfo.min_luma_d); minfo.white_point.x, minfo.white_point.y,
minfo.max_display_mastering_luminance,
minfo.min_display_mastering_luminance);
if (h264parse->mastering_display_info_state == if (h264parse->mastering_display_info_state ==
GST_H264_PARSE_SEI_EXPIRED) { GST_H264_PARSE_SEI_EXPIRED) {
@ -844,24 +843,21 @@ gst_h264_parse_process_sei (GstH264Parse * h264parse, GstH264NalUnit * nalu)
{ {
GstVideoContentLightLevel cll; GstVideoContentLightLevel cll;
cll.maxCLL_n = sei.payload.content_light_level.max_content_light_level; cll.max_content_light_level =
cll.maxFALL_n = sei.payload.content_light_level.max_content_light_level;
cll.max_frame_average_light_level =
sei.payload.content_light_level.max_pic_average_light_level; sei.payload.content_light_level.max_pic_average_light_level;
cll.maxCLL_d = cll.maxFALL_d = 1;
GST_LOG_OBJECT (h264parse, "content light level found: " GST_LOG_OBJECT (h264parse, "content light level found: "
"maxCLL:(%u/%u), maxFALL:(%u/%u)", cll.maxCLL_n, cll.maxCLL_d, "maxCLL:(%u), maxFALL:(%u)", cll.max_content_light_level,
cll.maxFALL_n, cll.maxFALL_d); cll.max_frame_average_light_level);
if (h264parse->content_light_level_state == GST_H264_PARSE_SEI_EXPIRED) { if (h264parse->content_light_level_state == GST_H264_PARSE_SEI_EXPIRED) {
h264parse->update_caps = TRUE; h264parse->update_caps = TRUE;
} else if (gst_util_fraction_compare (cll.maxCLL_n, cll.maxCLL_d, } else if (cll.max_content_light_level !=
h264parse->content_light_level.maxCLL_n, h264parse->content_light_level.max_frame_average_light_level ||
h264parse->content_light_level.maxCLL_d) cll.max_content_light_level !=
|| gst_util_fraction_compare (cll.maxFALL_n, cll.maxFALL_d, h264parse->content_light_level.max_frame_average_light_level) {
h264parse->content_light_level.maxFALL_n,
h264parse->content_light_level.maxFALL_d)) {
h264parse->update_caps = TRUE; h264parse->update_caps = TRUE;
} }

View file

@ -584,47 +584,46 @@ gst_h265_parse_process_sei (GstH265Parse * h265parse, GstH265NalUnit * nalu)
{ {
/* Precision defined by spec. /* Precision defined by spec.
* See D.3.28 Mastering display colour volume SEI message semantics */ * See D.3.28 Mastering display colour volume SEI message semantics */
const guint chroma_den = 50000;
const guint luma_den = 10000;
GstVideoMasteringDisplayInfo minfo; GstVideoMasteringDisplayInfo minfo;
gint j, k;
minfo.Gx_n = /* GstVideoMasteringDisplayInfo::display_primaries is rgb order but
sei.payload.mastering_display_colour_volume.display_primaries_x[0]; * HEVC uses gbr order
minfo.Gy_n = * See spec D.3.28 display_primaries_x and display_primaries_y
sei.payload.mastering_display_colour_volume.display_primaries_y[0]; */
minfo.Bx_n = for (j = 0, k = 2; j < G_N_ELEMENTS (minfo.display_primaries); j++, k++) {
sei.payload.mastering_display_colour_volume.display_primaries_x[1]; minfo.display_primaries[j].x =
minfo.By_n = sei.payload.
sei.payload.mastering_display_colour_volume.display_primaries_y[1]; mastering_display_colour_volume.display_primaries_x[k % 3];
minfo.Rx_n = minfo.display_primaries[j].y =
sei.payload.mastering_display_colour_volume.display_primaries_x[2]; sei.payload.
minfo.Ry_n = mastering_display_colour_volume.display_primaries_y[k % 3];
sei.payload.mastering_display_colour_volume.display_primaries_y[2]; }
minfo.Wx_n = sei.payload.mastering_display_colour_volume.white_point_x;
minfo.Wy_n = sei.payload.mastering_display_colour_volume.white_point_y; minfo.white_point.x =
minfo.max_luma_n = sei.payload.mastering_display_colour_volume.white_point_x;
minfo.white_point.y =
sei.payload.mastering_display_colour_volume.white_point_y;
minfo.max_display_mastering_luminance =
sei.payload.mastering_display_colour_volume. sei.payload.mastering_display_colour_volume.
max_display_mastering_luminance; max_display_mastering_luminance;
minfo.min_luma_n = minfo.min_display_mastering_luminance =
sei.payload.mastering_display_colour_volume. sei.payload.mastering_display_colour_volume.
min_display_mastering_luminance; min_display_mastering_luminance;
minfo.Gx_d = minfo.Gy_d = minfo.Bx_d = minfo.By_d =
minfo.Rx_d = minfo.Ry_d = minfo.Wx_d = minfo.Wy_d = chroma_den;
minfo.max_luma_d = minfo.min_luma_d = luma_den;
GST_LOG_OBJECT (h265parse, "mastering display info found: " GST_LOG_OBJECT (h265parse, "mastering display info found: "
"Red(%u/%u, %u/%u) " "Red(%u, %u) "
"Green(%u/%u, %u/%u) " "Green(%u, %u) "
"Blue(%u/%u, %u/%u) " "Blue(%u, %u) "
"White(%u/%u, %u/%u) " "White(%u, %u) "
"max_luminance(%u/%u) " "max_luminance(%u) "
"min_luminance(%u/%u) ", minfo.Rx_n, minfo.Rx_d, minfo.Ry_n, "min_luminance(%u) ",
minfo.Ry_d, minfo.Gx_n, minfo.Gx_d, minfo.Gy_n, minfo.Gy_d, minfo.display_primaries[0].x, minfo.display_primaries[0].y,
minfo.Bx_n, minfo.Bx_d, minfo.By_n, minfo.By_d, minfo.Wx_n, minfo.display_primaries[1].x, minfo.display_primaries[1].y,
minfo.Wx_d, minfo.Wy_n, minfo.Wy_d, minfo.max_luma_n, minfo.display_primaries[2].x, minfo.display_primaries[2].y,
minfo.max_luma_d, minfo.min_luma_n, minfo.min_luma_d); minfo.white_point.x, minfo.white_point.y,
minfo.max_display_mastering_luminance,
minfo.min_display_mastering_luminance);
if (h265parse->mastering_display_info_state == if (h265parse->mastering_display_info_state ==
GST_H265_PARSE_SEI_EXPIRED) { GST_H265_PARSE_SEI_EXPIRED) {
@ -643,24 +642,21 @@ gst_h265_parse_process_sei (GstH265Parse * h265parse, GstH265NalUnit * nalu)
{ {
GstVideoContentLightLevel cll; GstVideoContentLightLevel cll;
cll.maxCLL_n = sei.payload.content_light_level.max_content_light_level; cll.max_content_light_level =
cll.maxFALL_n = sei.payload.content_light_level.max_content_light_level;
cll.max_frame_average_light_level =
sei.payload.content_light_level.max_pic_average_light_level; sei.payload.content_light_level.max_pic_average_light_level;
cll.maxCLL_d = cll.maxFALL_d = 1;
GST_LOG_OBJECT (h265parse, "content light level found: " GST_LOG_OBJECT (h265parse, "content light level found: "
"maxCLL:(%u/%u), maxFALL:(%u/%u)", cll.maxCLL_n, cll.maxCLL_d, "maxCLL:(%u), maxFALL:(%u)", cll.max_content_light_level,
cll.maxFALL_n, cll.maxFALL_d); cll.max_frame_average_light_level);
if (h265parse->content_light_level_state == GST_H265_PARSE_SEI_EXPIRED) { if (h265parse->content_light_level_state == GST_H265_PARSE_SEI_EXPIRED) {
h265parse->update_caps = TRUE; h265parse->update_caps = TRUE;
} else if (gst_util_fraction_compare (cll.maxCLL_n, cll.maxCLL_d, } else if (cll.max_content_light_level !=
h265parse->content_light_level.maxCLL_n, h265parse->content_light_level.max_frame_average_light_level ||
h265parse->content_light_level.maxCLL_d) cll.max_content_light_level !=
|| gst_util_fraction_compare (cll.maxFALL_n, cll.maxFALL_d, h265parse->content_light_level.max_frame_average_light_level) {
h265parse->content_light_level.maxFALL_n,
h265parse->content_light_level.maxFALL_d)) {
h265parse->update_caps = TRUE; h265parse->update_caps = TRUE;
} }

View file

@ -484,9 +484,9 @@ GST_START_TEST (test_parse_detect_stream_with_hdr_sei)
fail_unless_structure_field_string_equals (s, "level", "2.1"); fail_unless_structure_field_string_equals (s, "level", "2.1");
fail_unless_structure_field_string_equals (s, "mastering-display-info", fail_unless_structure_field_string_equals (s, "mastering-display-info",
"3:20:3:50:17:25:8:25:33:125:69:100:3127:10000:329:1000:1000:1:1:10000"); "7500:3000:34000:16000:13200:34500:15635:16450:10000000:1");
fail_unless_structure_field_string_equals (s, "content-light-level", fail_unless_structure_field_string_equals (s, "content-light-level",
"1000:1:400:1"); "1000:400");
if (ctx_codec_data) { if (ctx_codec_data) {
fail_unless (gst_structure_has_field (s, "codec_data")); fail_unless (gst_structure_has_field (s, "codec_data"));

View file

@ -238,9 +238,9 @@ GST_START_TEST (test_parse_detect_stream_with_hdr_sei)
fail_unless_structure_field_string_equals (s, "tier", "main"); fail_unless_structure_field_string_equals (s, "tier", "main");
fail_unless_structure_field_string_equals (s, "level", "2.1"); fail_unless_structure_field_string_equals (s, "level", "2.1");
fail_unless_structure_field_string_equals (s, "mastering-display-info", fail_unless_structure_field_string_equals (s, "mastering-display-info",
"17:25:8:25:53:200:69:100:3:20:3:50:3127:10000:329:1000:1000:1:1:10000"); "34000:16000:13250:34500:7500:3000:15635:16450:10000000:1");
fail_unless_structure_field_string_equals (s, "content-light-level", fail_unless_structure_field_string_equals (s, "content-light-level",
"1000:1:400:1"); "1000:400");
g_free (h265_idr_plus_sei); g_free (h265_idr_plus_sei);
gst_caps_unref (caps); gst_caps_unref (caps);