mp_image: infer correct HLG sig_peak

For HLG, due to the usage of a reference OOTF configured for 1000 cd/m²,
the default sig_peak of =nom_peak was suboptimal. We can go down to
1000/100 (=10.0), since that's the true dynamic range of the output
signal after it passes through the OOTF.
This commit is contained in:
Niklas Haas 2017-06-27 00:31:51 +02:00
parent 50008adf4a
commit f82ba75bd4
1 changed files with 9 additions and 4 deletions

View File

@ -685,10 +685,15 @@ void mp_image_params_guess_csp(struct mp_image_params *params)
params->color.gamma = MP_CSP_TRC_AUTO;
}
// If the signal peak is unknown, we're forced to pick the TRC's nominal
// range as the signal peak to prevent clipping
if (!params->color.sig_peak)
params->color.sig_peak = mp_trc_nom_peak(params->color.gamma);
if (!params->color.sig_peak) {
if (params->color.gamma == MP_CSP_TRC_HLG) {
params->color.sig_peak = 1000 / MP_REF_WHITE; // reference display
} else {
// If the signal peak is unknown, we're forced to pick the TRC's
// nominal range as the signal peak to prevent clipping
params->color.sig_peak = mp_trc_nom_peak(params->color.gamma);
}
}
if (params->color.light == MP_CSP_LIGHT_AUTO) {
// HLG is always scene-referred (using its own OOTF), everything else