summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2017-06-10 14:02:55 +0200
committerwm4 <wm4@nowhere>2017-06-18 20:54:44 +0200
commitdeb93707791092e608b1e5f8f1d1773b0057ce59 (patch)
tree0b6c2e37a105b1bf51ccebd96818c6d25422c6d9 /demux
parentc335e84230916d7d7a38288031516e8b2ec1c36b (diff)
downloadmpv-deb93707791092e608b1e5f8f1d1773b0057ce59.tar.bz2
mpv-deb93707791092e608b1e5f8f1d1773b0057ce59.tar.xz
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.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_mkv.c7
1 files changed, 6 insertions, 1 deletions
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) {