From 923e3c7b20f0a238062b0ac538a751c6c363a8cb Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Wed, 29 Jun 2016 09:28:17 +0200 Subject: vo_opengl: generalize HDR tone mapping mechanism This involves multiple changes: 1. Brightness metadata is split into nominal peak and signal peak. For a quick and dirty explanation: nominal peak is the brightest value that your color space can represent (i.e. the brightness of an encoded 1.0), and signal peak is the brightest value that actually occurs in the video (i.e. the brightest thing that's displayed). 2. vo_opengl uses a new decision logic to figure out the right nom_peak and sig_peak for all situations. It also does a better job of picking the right target gamut/colorspace to use for the OSD. (Which still is and still should be treated as sRGB). This change in logic also fixes #3293 en passant. 3. Since it was growing rapidly, the logic for auto-guessing / inferring the right colorimetry configuration (in pass_colormanage) was split from the logic for actually performing the adaptation (now pass_color_map). Right now, the new logic doesn't do a whole lot since HDR metadata is still ignored (but not for long). --- video/csputils.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'video/csputils.h') diff --git a/video/csputils.h b/video/csputils.h index 0743f2bee5..0406ddf35f 100644 --- a/video/csputils.h +++ b/video/csputils.h @@ -121,7 +121,8 @@ struct mp_colorspace { enum mp_csp_levels levels; enum mp_csp_prim primaries; enum mp_csp_trc gamma; - float peak; // 0 = auto/unknown + float nom_peak; // nominal (absolute) peak. 0 = auto/unknown + float sig_peak; // signal peak, highest value that occurs in the source }; struct mp_csp_params { @@ -226,7 +227,7 @@ int mp_chroma_location_to_av(enum mp_chroma_location mploc); void mp_get_chroma_location(enum mp_chroma_location loc, int *x, int *y); struct mp_csp_primaries mp_get_csp_primaries(enum mp_csp_prim csp); -float mp_csp_trc_rel_peak(enum mp_csp_trc trc); +float mp_csp_trc_nom_peak(enum mp_csp_trc trc, float ref_peak); bool mp_trc_is_hdr(enum mp_csp_trc trc); /* Color conversion matrix: RGB = m * YUV + c -- cgit v1.2.3