path: root/video/csputils.h
diff options
authorNiklas Haas <>2016-06-29 09:28:17 +0200
committerwm4 <wm4@nowhere>2016-07-03 19:42:52 +0200
commit923e3c7b20f0a238062b0ac538a751c6c363a8cb (patch)
treed86988c4fe3a603df877e7cf91216ccc20b09a27 /video/csputils.h
parentd81fb97f4587f73f62a760b99f686139f9b8d966 (diff)
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).
Diffstat (limited to 'video/csputils.h')
1 files changed, 3 insertions, 2 deletions
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