mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 16:21:17 +00:00
x265enc: 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:
parent
f05effe024
commit
770a851e03
1 changed files with 12 additions and 54 deletions
|
@ -942,70 +942,28 @@ gst_x265_enc_init_encoder (GstX265Enc * encoder)
|
|||
|
||||
if (gst_video_mastering_display_info_from_caps (&minfo,
|
||||
encoder->input_state->caps)) {
|
||||
guint16 displayPrimaryX[3];
|
||||
guint16 displayPrimaryY[3];
|
||||
guint16 whitePointX, whitePointY;
|
||||
guint32 maxDisplayMasteringLuminance;
|
||||
guint32 minDisplayMasteringLuminance;
|
||||
const guint chroma_scale = 50000;
|
||||
const guint luma_scale = 10000;
|
||||
|
||||
GST_DEBUG_OBJECT (encoder, "Apply mastering display info");
|
||||
|
||||
displayPrimaryX[0] =
|
||||
(guint16) gst_util_uint64_scale_round (minfo.Gx_n, chroma_scale,
|
||||
minfo.Gx_d);
|
||||
displayPrimaryX[1] =
|
||||
(guint16) gst_util_uint64_scale_round (minfo.Bx_n, chroma_scale,
|
||||
minfo.Bx_d);
|
||||
displayPrimaryX[2] =
|
||||
(guint16) gst_util_uint64_scale_round (minfo.Rx_n, chroma_scale,
|
||||
minfo.Rx_d);
|
||||
|
||||
displayPrimaryY[0] =
|
||||
(guint16) gst_util_uint64_scale_round (minfo.Gy_n, chroma_scale,
|
||||
minfo.Gy_d);
|
||||
displayPrimaryY[1] =
|
||||
(guint16) gst_util_uint64_scale_round (minfo.By_n, chroma_scale,
|
||||
minfo.By_d);
|
||||
displayPrimaryY[2] =
|
||||
(guint16) gst_util_uint64_scale_round (minfo.Ry_n, chroma_scale,
|
||||
minfo.Ry_d);
|
||||
|
||||
whitePointX =
|
||||
(guint16) gst_util_uint64_scale_round (minfo.Wx_n, chroma_scale,
|
||||
minfo.Wx_d);
|
||||
whitePointY =
|
||||
(guint16) gst_util_uint64_scale_round (minfo.Wy_n, chroma_scale,
|
||||
minfo.Wy_d);
|
||||
|
||||
maxDisplayMasteringLuminance =
|
||||
(guint32) gst_util_uint64_scale_round (minfo.max_luma_n, luma_scale,
|
||||
minfo.max_luma_d);
|
||||
minDisplayMasteringLuminance =
|
||||
(guint32) gst_util_uint64_scale_round (minfo.min_luma_n, luma_scale,
|
||||
minfo.min_luma_d);
|
||||
|
||||
/* GstVideoMasteringDisplayInfo::display_primaries is rgb order but
|
||||
* HEVC uses gbr order
|
||||
* See spec D.3.28 display_primaries_x and display_primaries_y
|
||||
*/
|
||||
encoder->x265param.masteringDisplayColorVolume =
|
||||
g_strdup_printf ("G(%hu,%hu)B(%hu,%hu)R(%hu,%hu)WP(%hu,%hu)L(%u,%u)",
|
||||
displayPrimaryX[0], displayPrimaryY[0],
|
||||
displayPrimaryX[1], displayPrimaryY[1],
|
||||
displayPrimaryX[2], displayPrimaryY[2],
|
||||
whitePointX, whitePointY,
|
||||
maxDisplayMasteringLuminance, minDisplayMasteringLuminance);
|
||||
minfo.display_primaries[1].x, minfo.display_primaries[1].y,
|
||||
minfo.display_primaries[2].x, minfo.display_primaries[2].y,
|
||||
minfo.display_primaries[0].x, minfo.display_primaries[0].y,
|
||||
minfo.white_point.x, minfo.white_point.y,
|
||||
minfo.max_display_mastering_luminance,
|
||||
minfo.min_display_mastering_luminance);
|
||||
}
|
||||
|
||||
if (gst_video_content_light_level_from_caps (&cll,
|
||||
encoder->input_state->caps)) {
|
||||
gdouble val;
|
||||
|
||||
GST_DEBUG_OBJECT (encoder, "Apply content light level");
|
||||
|
||||
gst_util_fraction_to_double (cll.maxCLL_n, cll.maxCLL_d, &val);
|
||||
encoder->x265param.maxCLL = (guint16) val;
|
||||
|
||||
gst_util_fraction_to_double (cll.maxFALL_n, cll.maxFALL_d, &val);
|
||||
encoder->x265param.maxFALL = (guint16) val;
|
||||
encoder->x265param.maxCLL = cll.max_content_light_level;
|
||||
encoder->x265param.maxFALL = cll.max_frame_average_light_level;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue