diff options
author | Niklas Haas <git@haasn.xyz> | 2017-06-27 00:31:51 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.xyz> | 2017-06-27 00:33:42 +0200 |
commit | f82ba75bd457a139afddd8ca58f99dc2f270a0b2 (patch) | |
tree | bc2f4ea0cd27dc8720fc703f931f1da186381d44 /video/mp_image.c | |
parent | 50008adf4af5360f87109d6264aa77ac82f2a80a (diff) | |
download | mpv-f82ba75bd457a139afddd8ca58f99dc2f270a0b2.tar.bz2 mpv-f82ba75bd457a139afddd8ca58f99dc2f270a0b2.tar.xz |
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.
Diffstat (limited to 'video/mp_image.c')
-rw-r--r-- | video/mp_image.c | 13 |
1 files 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 |