diff options
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/vo_gpu_next.c | 32 |
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: |