summaryrefslogtreecommitdiffstats
path: root/video/out/gpu/video.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2022-01-04 01:50:00 +0100
committerNiklas Haas <github-daiK1o@haasn.dev>2022-01-07 06:28:14 +0100
commitd09c73c7b2b0135cb24ab2173b3c4ee1c55840b0 (patch)
tree02b33ac09f5720cfa328c747d2481a6a82d7d09b /video/out/gpu/video.c
parentf3fccfc395ddb7a504ab2aae48452178fa92d907 (diff)
downloadmpv-d09c73c7b2b0135cb24ab2173b3c4ee1c55840b0.tar.bz2
mpv-d09c73c7b2b0135cb24ab2173b3c4ee1c55840b0.tar.xz
vo_gpu: add --tone-mapping-mode
This merges the old desaturation control options into a single enumeration, with the goal of both simplifying how these options work and also making this list more extensible (including, notably, new options only supported by vo_gpu_next). For the hybrid option, I decided to port the (slightly tweaked) values from libplacebo's pre-refactor defaults, rather than the old values we had in mpv, to more visually match the look of the vo_gpu_next hybrid.
Diffstat (limited to 'video/out/gpu/video.c')
-rw-r--r--video/out/gpu/video.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c
index 8236a7b43f..d0d0509792 100644
--- a/video/out/gpu/video.c
+++ b/video/out/gpu/video.c
@@ -329,8 +329,6 @@ static const struct gl_video_opts gl_video_opts_def = {
.decay_rate = 100.0,
.scene_threshold_low = 5.5,
.scene_threshold_high = 10.0,
- .desat = 0.75,
- .desat_exp = 1.5,
},
.early_flush = -1,
.hwdec_interop = "auto",
@@ -394,9 +392,12 @@ const struct m_sub_options gl_video_conf = {
M_RANGE(0.0, 0.3)},
{"tone-mapping-max-boost", OPT_FLOAT(tone_map.max_boost),
M_RANGE(1.0, 10.0)},
- {"tone-mapping-desaturate", OPT_FLOAT(tone_map.desat)},
- {"tone-mapping-desaturate-exponent", OPT_FLOAT(tone_map.desat_exp),
- M_RANGE(0.0, 20.0)},
+ {"tone-mapping-mode", OPT_CHOICE(tone_map.mode,
+ {"auto", TONE_MAP_MODE_AUTO},
+ {"rgb", TONE_MAP_MODE_RGB},
+ {"max", TONE_MAP_MODE_MAX},
+ {"hybrid", TONE_MAP_MODE_HYBRID},
+ {"luma", TONE_MAP_MODE_LUMA})},
{"gamut-mapping-mode", OPT_CHOICE(tone_map.gamut_mode,
{"auto", GAMUT_AUTO},
{"clip", GAMUT_CLIP},
@@ -479,6 +480,8 @@ const struct m_sub_options gl_video_conf = {
"--linear-downscaling")},
{"gamut-warning", OPT_REMOVED("Replaced by --gamut-mapping-mode=warn")},
{"gamut-clipping", OPT_REMOVED("Replaced by --gamut-mapping-mode=desaturate")},
+ {"tone-mapping-desaturate", OPT_REMOVED("Replaced by --tone-mapping-mode")},
+ {"tone-mapping-desaturate-exponent", OPT_REMOVED("Replaced by --tone-mapping-mode")},
{0}
},
.size = sizeof(struct gl_video_opts),
@@ -2644,6 +2647,18 @@ static void pass_colormanage(struct gl_video *p, struct mp_colorspace src,
break;
}
+ switch (p->opts.tone_map.mode) {
+ case TONE_MAP_MODE_AUTO:
+ case TONE_MAP_MODE_RGB:
+ case TONE_MAP_MODE_MAX:
+ case TONE_MAP_MODE_HYBRID:
+ break;
+ default:
+ MP_WARN(p, "Tone mapping mode unsupported by vo_gpu, falling back.\n");
+ p->opts.tone_map.mode = TONE_MAP_MODE_AUTO;
+ break;
+ }
+
switch (p->opts.tone_map.gamut_mode) {
case GAMUT_AUTO:
case GAMUT_WARN: