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
This commit is contained in:
Niklas Haas 2019-09-15 01:33:27 +02:00
parent ee0f4444f9
commit a416b3f084
1 changed files with 4 additions and 1 deletions

View File

@ -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)