summaryrefslogtreecommitdiffstats
path: root/video/mp_image.c
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2016-06-29 09:28:17 +0200
committerwm4 <wm4@nowhere>2016-07-03 19:42:52 +0200
commit923e3c7b20f0a238062b0ac538a751c6c363a8cb (patch)
treed86988c4fe3a603df877e7cf91216ccc20b09a27 /video/mp_image.c
parentd81fb97f4587f73f62a760b99f686139f9b8d966 (diff)
downloadmpv-923e3c7b20f0a238062b0ac538a751c6c363a8cb.tar.bz2
mpv-923e3c7b20f0a238062b0ac538a751c6c363a8cb.tar.xz
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/mp_image.c')
-rw-r--r--video/mp_image.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/video/mp_image.c b/video/mp_image.c
index 286e40bf62..a4ce6d1cc5 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -395,7 +395,8 @@ void mp_image_copy_attributes(struct mp_image *dst, struct mp_image *src)
}
dst->params.color.primaries = src->params.color.primaries;
dst->params.color.gamma = src->params.color.gamma;
- dst->params.color.peak = src->params.color.peak;
+ dst->params.color.nom_peak = src->params.color.nom_peak;
+ dst->params.color.sig_peak = src->params.color.sig_peak;
if ((dst->fmt.flags & MP_IMGFLAG_YUV) == (src->fmt.flags & MP_IMGFLAG_YUV)) {
dst->params.color.space = src->params.color.space;
dst->params.color.levels = src->params.color.levels;
@@ -668,8 +669,8 @@ void mp_image_params_guess_csp(struct mp_image_params *params)
// Guess the nominal peak (independent of the colorspace)
if (params->color.gamma == MP_CSP_TRC_SMPTE_ST2084) {
- if (!params->color.peak)
- params->color.peak = 10000; // As per the spec
+ if (!params->color.nom_peak)
+ params->color.nom_peak = 10000; // As per the spec
}
}