From deb93707791092e608b1e5f8f1d1773b0057ce59 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sat, 10 Jun 2017 14:02:55 +0200 Subject: vd: use ST.2086 / HDR10 MaxCLL in addition to mastering metadata MaxCLL is the more authoritative source for the metadata we are interested in. The use of mastering metadata is sort of a hack anyway, since there's no clearly-defined relationship between the mastering peak brightness and the actual content. (Unlike MaxCLL, which is an explicit relationship) Also move the parameter fixing to `fix_image_params` I don't know if the avutil check is strictly necessary but I've included it anyway to be on the safe side. --- demux/demux_mkv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'demux/demux_mkv.c') diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index da50b1ee0f..add99a9c2d 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -568,7 +568,12 @@ static void parse_trackcolour(struct demuxer *demuxer, struct mkv_track *track, MP_VERBOSE(demuxer, "| + Levels: %s\n", m_opt_choice_str(mp_csp_levels_names, track->color.levels)); } - if (colour->n_mastering_metadata) { + if (colour->n_max_cll) { + track->color.sig_peak = colour->max_cll / MP_REF_WHITE; + MP_VERBOSE(demuxer, "| + MaxCLL: %lu\n", colour->max_cll); + } + // if MaxCLL is unavailable, try falling back to the mastering metadata + if (!track->color.sig_peak && colour->n_mastering_metadata) { struct ebml_mastering_metadata *mastering = &colour->mastering_metadata; if (mastering->n_luminance_max) { -- cgit v1.2.3