summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/video.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2017-07-06 05:43:00 +0200
committerNiklas Haas <git@haasn.xyz>2017-07-06 05:43:00 +0200
commit9e04018f920c6c8eed46a779af00f9543e6539d6 (patch)
treed88e2b05dfb2f6f2a9d902d69357ef976ab99017 /video/out/opengl/video.c
parent6f77444f6c2d82feeebcd46a2b2f7ae3252648ef (diff)
downloadmpv-9e04018f920c6c8eed46a779af00f9543e6539d6.tar.bz2
mpv-9e04018f920c6c8eed46a779af00f9543e6539d6.tar.xz
vo_opengl: add --tone-mapping-desaturate
This helps prevent unnaturally, weirdly colorized blown out highlights for direct images of the sunlit sky and other way-too-bright HDR content. I was debating whether to set the default at 1.0 or 2.0, but went with the more conservative option that preserves more detail/color.
Diffstat (limited to 'video/out/opengl/video.c')
-rw-r--r--video/out/opengl/video.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c
index bc218792fd..f2f5260c74 100644
--- a/video/out/opengl/video.c
+++ b/video/out/opengl/video.c
@@ -311,6 +311,7 @@ static const struct gl_video_opts gl_video_opts_def = {
.gamma = 1.0f,
.hdr_tone_mapping = TONE_MAPPING_MOBIUS,
.tone_mapping_param = NAN,
+ .tone_mapping_desat = 2.0,
.early_flush = -1,
};
@@ -352,6 +353,7 @@ const struct m_sub_options gl_video_conf = {
{"gamma", TONE_MAPPING_GAMMA},
{"linear", TONE_MAPPING_LINEAR})),
OPT_FLOAT("tone-mapping-param", tone_mapping_param, 0),
+ OPT_FLOAT("tone-mapping-desaturate", tone_mapping_desat, 0),
OPT_FLAG("opengl-pbo", pbo, 0),
SCALER_OPTS("scale", SCALER_SCALE),
SCALER_OPTS("dscale", SCALER_DSCALE),
@@ -2251,7 +2253,8 @@ static void pass_colormanage(struct gl_video *p, struct mp_colorspace src, bool
// Adapt from src to dst as necessary
pass_color_map(p->sc, src, dst, p->opts.hdr_tone_mapping,
- p->opts.tone_mapping_param, p->use_linear && !osd);
+ p->opts.tone_mapping_param, p->opts.tone_mapping_desat,
+ p->use_linear && !osd);
if (p->use_lut_3d) {
gl_sc_uniform_tex(p->sc, "lut_3d", GL_TEXTURE_3D, p->lut_3d_texture);
@@ -3201,6 +3204,7 @@ static void check_gl_features(struct gl_video *p)
.tex_pad_y = p->opts.tex_pad_y,
.hdr_tone_mapping = p->opts.hdr_tone_mapping,
.tone_mapping_param = p->opts.tone_mapping_param,
+ .tone_mapping_desat = p->opts.tone_mapping_desat,
.early_flush = p->opts.early_flush,
};
for (int n = 0; n < SCALER_COUNT; n++)