From f82ba75bd457a139afddd8ca58f99dc2f270a0b2 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Tue, 27 Jun 2017 00:31:51 +0200 Subject: [PATCH] mp_image: infer correct HLG sig_peak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- video/mp_image.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/video/mp_image.c b/video/mp_image.c index f088e18b36..7974588330 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -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