--- libavcodec/vaapi_encode_h265.c | 45 +++++----------------------------- 1 file changed, 6 insertions(+), 39 deletions(-)
diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c index 538862a9d5..443139dfdb 100644 --- a/libavcodec/vaapi_encode_h265.c +++ b/libavcodec/vaapi_encode_h265.c @@ -750,39 +750,10 @@ static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx, AVMasteringDisplayMetadata *mdm = (AVMasteringDisplayMetadata *)sd->data; - // SEI is needed when both the primaries and luminance are set + // Only needed when both primaries and luminance are set. if (mdm->has_primaries && mdm->has_luminance) { - H265RawSEIMasteringDisplayColourVolume *mdcv = - &priv->sei_mastering_display; - const int mapping[3] = {1, 2, 0}; - const int chroma_den = 50000; - const int luma_den = 10000; - - for (i = 0; i < 3; i++) { - const int j = mapping[i]; - mdcv->display_primaries_x[i] = - FFMIN(lrint(chroma_den * - av_q2d(mdm->display_primaries[j][0])), - chroma_den); - mdcv->display_primaries_y[i] = - FFMIN(lrint(chroma_den * - av_q2d(mdm->display_primaries[j][1])), - chroma_den); - } - - mdcv->white_point_x = - FFMIN(lrint(chroma_den * av_q2d(mdm->white_point[0])), - chroma_den); - mdcv->white_point_y = - FFMIN(lrint(chroma_den * av_q2d(mdm->white_point[1])), - chroma_den); - - mdcv->max_display_mastering_luminance = - lrint(luma_den * av_q2d(mdm->max_luminance)); - mdcv->min_display_mastering_luminance = - FFMIN(lrint(luma_den * av_q2d(mdm->min_luminance)), - mdcv->max_display_mastering_luminance); - + ff_cbs_h265_fill_sei_mastering_display( + &priv->sei_mastering_display, mdm); priv->sei_needed |= SEI_MASTERING_DISPLAY; } } @@ -795,13 +766,9 @@ static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL); if (sd) { - AVContentLightMetadata *clm = - (AVContentLightMetadata *)sd->data; - H265RawSEIContentLightLevelInfo *clli = - &priv->sei_content_light_level; - - clli->max_content_light_level = FFMIN(clm->MaxCLL, 65535); - clli->max_pic_average_light_level = FFMIN(clm->MaxFALL, 65535); + ff_cbs_h265_fill_sei_content_light_level( + &priv->sei_content_light_level, + (const AVContentLightMetadata*)sd->data); priv->sei_needed |= SEI_CONTENT_LIGHT_LEVEL; } -- 2.25.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".