summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2023-05-24 21:24:48 +0200
committerNiklas Haas <git@haasn.dev>2023-05-24 21:32:23 +0200
commita5da8b2c87dc3ace0038ccb5dc8f221df7f52206 (patch)
tree15732aba28ae349264b661297fc31db0835ad666 /video/out
parentdc13d47c735f10ff95015cd2feb82ab66e52a219 (diff)
downloadmpv-a5da8b2c87dc3ace0038ccb5dc8f221df7f52206.tar.bz2
mpv-a5da8b2c87dc3ace0038ccb5dc8f221df7f52206.tar.xz
vo_gpu_next: update to new libplacebo gamut mapping API
This just replaces the API calls to get rid of deprecation warnings, it doesn't yet expand the enum, nor replace them by the proper options. The translation from tone map modes to hybrid mix parameters is taken from the libplacebo source code.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/vo_gpu_next.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c
index 1bf94f7955..f7b011626d 100644
--- a/video/out/vo_gpu_next.c
+++ b/video/out/vo_gpu_next.c
@@ -1847,6 +1847,22 @@ static void update_render_options(struct vo *vo)
[TONE_MAPPING_ST2094_10] = &pl_tone_map_st2094_10,
};
+#if PL_API_VER >= 269
+ static const struct pl_gamut_map_function *gamut_modes[] = {
+ [GAMUT_CLIP] = &pl_gamut_map_clip,
+ [GAMUT_WARN] = &pl_gamut_map_highlight,
+ [GAMUT_DESATURATE] = &pl_gamut_map_desaturate,
+ [GAMUT_DARKEN] = &pl_gamut_map_darken,
+ };
+
+ // Back-compat approximation, taken from libplacebo source code
+ static const float hybrid_mix[] = {
+ [TONE_MAP_MODE_RGB] = 1.0f,
+ [TONE_MAP_MODE_MAX] = 0.0f,
+ [TONE_MAP_MODE_LUMA] = 0.0f,
+ [TONE_MAP_MODE_HYBRID] = 0.20f,
+ };
+#else
static const enum pl_gamut_mode gamut_modes[] = {
[GAMUT_CLIP] = PL_GAMUT_CLIP,
[GAMUT_WARN] = PL_GAMUT_WARN,
@@ -1861,18 +1877,28 @@ static void update_render_options(struct vo *vo)
[TONE_MAP_MODE_HYBRID] = PL_TONE_MAP_HYBRID,
[TONE_MAP_MODE_LUMA] = PL_TONE_MAP_LUMA,
};
+#endif
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];
p->color_map.tone_mapping_param = opts->tone_map.curve_param;
p->color_map.inverse_tone_mapping = opts->tone_map.inverse;
- p->color_map.tone_mapping_mode = tone_map_modes[opts->tone_map.mode];
if (isnan(p->color_map.tone_mapping_param)) // vo_gpu compatibility
p->color_map.tone_mapping_param = 0.0;
+ p->color_map.visualize_lut = opts->tone_map.visualize;
+
+#if PL_API_VER >= 269
+ if (opts->tone_map.gamut_mode != GAMUT_AUTO)
+ p->color_map.gamut_mapping = gamut_modes[opts->tone_map.gamut_mode];
+ if (opts->tone_map.mode != TONE_MAP_MODE_AUTO)
+ p->color_map.hybrid_mix = hybrid_mix[opts->tone_map.mode];
+#else
+ p->color_map.intent = opts->icc_opts->intent;
+ p->color_map.tone_mapping_crosstalk = opts->tone_map.crosstalk;
+ p->color_map.tone_mapping_mode = tone_map_modes[opts->tone_map.mode];
if (opts->tone_map.gamut_mode != GAMUT_AUTO)
p->color_map.gamut_mode = gamut_modes[opts->tone_map.gamut_mode];
- p->color_map.visualize_lut = opts->tone_map.visualize;
+#endif
switch (opts->dither_algo) {
case DITHER_NONE: