From a416b3f084350fae94049f60ef94f2af10a05f95 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sun, 15 Sep 2019 01:33:27 +0200 Subject: vo_gpu: correctly normalize src.sig_peak In some cases, src.sig_peak remains undefined as 0, which was definitely the case when using the OSD, since it never got passed through the usual color space normalization process. Most robust work-around is to simply force the normalization at the site where it's needed. This ensures this value is always valid and defined, to make the peak-dependent logic in these two functions always work. Fixes 4b25ec3a9d Fixes #6917 Fixes #6918 --- video/out/gpu/video.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'video/out') diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index 4b3d8017a7..b0c43ef20b 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -2539,9 +2539,12 @@ static void pass_colormanage(struct gl_video *p, struct mp_colorspace src, bool } // If there's no specific signal peak known for the output display, infer - // it from the chosen transfer function + // it from the chosen transfer function. Also normalize the src peak, in + // case it was unknown if (!dst.sig_peak) dst.sig_peak = mp_trc_nom_peak(dst.gamma); + if (!src.sig_peak) + src.sig_peak = mp_trc_nom_peak(src.gamma); struct gl_tone_map_opts tone_map = p->opts.tone_map; bool detect_peak = tone_map.compute_peak >= 0 && mp_trc_is_hdr(src.gamma) -- cgit v1.2.3