summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2018-09-05 19:48:50 +0200
committerJan Ekström <jeebjp@gmail.com>2018-09-29 23:06:49 +0300
commit5ae13ad13b0a9c56bc1d0ff48ebea3f84d58df28 (patch)
tree0b7d206f531ed26b9aed7e792e580c8634e3ad7f
parent0a92548684370a60e54c572e666b997a2bf9d572 (diff)
downloadmpv-5ae13ad13b0a9c56bc1d0ff48ebea3f84d58df28.tar.bz2
mpv-5ae13ad13b0a9c56bc1d0ff48ebea3f84d58df28.tar.xz
mp_image: strip all HDR peak information from SDR clips
By overriding it with 1.0 (aka SDR). This prevents blowing up on mistagged clips. Fixes #6111 (cherry picked from commit 48c38f730d87b105716d9321a375175d2f01d401)
-rw-r--r--video/mp_image.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/video/mp_image.c b/video/mp_image.c
index eadff83e5b..92c3e57b95 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -812,6 +812,12 @@ void mp_image_params_guess_csp(struct mp_image_params *params)
}
}
+ if (!mp_trc_is_hdr(params->color.gamma)) {
+ // Some clips have leftover HDR metadata after conversion to SDR, so to
+ // avoid blowing up the tone mapping code, strip/sanitize it
+ params->color.sig_peak = 1.0;
+ }
+
if (params->chroma_location == MP_CHROMA_AUTO) {
if (params->color.levels == MP_CSP_LEVELS_TV)
params->chroma_location = MP_CHROMA_LEFT;