summaryrefslogtreecommitdiffstats
path: root/video/out/vo_gpu_next.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2022-01-03 04:31:50 +0100
committerNiklas Haas <github-daiK1o@haasn.dev>2022-01-07 06:28:14 +0100
commitf3fccfc395ddb7a504ab2aae48452178fa92d907 (patch)
treef273e2a3e74820aeb718601bd709e84cebf123e0 /video/out/vo_gpu_next.c
parent2332445d8d78d569015cabbacb3d9cf5552e5c73 (diff)
downloadmpv-f3fccfc395ddb7a504ab2aae48452178fa92d907.tar.bz2
mpv-f3fccfc395ddb7a504ab2aae48452178fa92d907.tar.xz
vo_gpu: add --gamut-mapping-mode
Merge --gamut-clipping and --gamut-warning into a single option, --gamut-mapping-mode, better corresponding to the new vo_gpu_next APIs and allowing us to easily extend this option as new modes are added in the future.
Diffstat (limited to 'video/out/vo_gpu_next.c')
-rw-r--r--video/out/vo_gpu_next.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c
index 14e2fdeadc..390852ff71 100644
--- a/video/out/vo_gpu_next.c
+++ b/video/out/vo_gpu_next.c
@@ -1399,6 +1399,13 @@ static void update_render_options(struct priv *p)
[TONE_MAPPING_BT_2446A] = &pl_tone_map_bt2446a,
};
+ static const enum pl_gamut_mode gamut_modes[] = {
+ [GAMUT_CLIP] = PL_GAMUT_CLIP,
+ [GAMUT_WARN] = PL_GAMUT_WARN,
+ [GAMUT_DESATURATE] = PL_GAMUT_DESATURATE,
+ [GAMUT_DARKEN] = PL_GAMUT_DARKEN,
+ };
+
p->color_map = pl_color_map_default_params;
p->color_map.intent = opts->icc_opts->intent;
p->color_map.tone_mapping_function = tone_map_funs[opts->tone_map.curve];
@@ -1407,11 +1414,8 @@ static void update_render_options(struct priv *p)
p->color_map.tone_mapping_crosstalk = opts->tone_map.crosstalk;
if (isnan(p->color_map.tone_mapping_param)) // vo_gpu compatibility
p->color_map.tone_mapping_param = 0.0;
- if (opts->tone_map.gamut_clipping) {
- p->color_map.gamut_mode = PL_GAMUT_DESATURATE;
- } else if (opts->tone_map.gamut_warning) {
- p->color_map.gamut_mode = PL_GAMUT_WARN;
- }
+ if (opts->tone_map.gamut_mode != GAMUT_AUTO)
+ p->color_map.gamut_mode = gamut_modes[opts->tone_map.gamut_mode];
switch (opts->dither_algo) {
case DITHER_ERROR_DIFFUSION: