[vlc-devel] [PATCH 1/3] placebo: update for new tone mapping desaturation algo
Nicolas Chauvet
kwizart at gmail.com
Mon May 20 12:56:39 CEST 2019
Hi there,
As a fedora package maintainer perspective, I don't see any issue to
update libplacebo requirements for vlc-4.0
(with that said, we don't yet package vlc-4.0, even on side/development branch).
But we already have newer libplacebo for fedora 30 (so with
vlc-3.0.x), so I would better prefer that this patch can be backported
in the 3.0.x branch if it's good enough.
Thx in advance.
Le lun. 6 mai 2019 à 10:02, Thomas Guillem <thomas at gllm.fr> a écrit :
>
> Hello Niklas,
>
> Maybe it's time to drop old libplacebo support in VLC 4.0.
> I don't have any restrictions on only depending on last release of libplacebo for VLC 4.0
>
> Thoughts anyone ?
>
> On Mon, May 6, 2019, at 09:56, Niklas Haas wrote:
> > From: Niklas Haas <git at haasn.xyz>
> >
> > This was introduced in API version 10, and refactors the tone mapping
> > desaturation curve into a new, more tunable algorithm that has some
> > different behavior. In particular, it allows us to simulate exactly the
> > "hollywood" style of tone mapping, so we document those special values
> > specifically.
> > ---
> > modules/video_output/opengl/fragment_shaders.c | 6 ++++++
> > modules/video_output/opengl/vout_helper.h | 18 ++++++++++++++++--
> > modules/video_output/placebo_utils.h | 12 ++++++++++++
> > modules/video_output/vulkan/display.c | 18 ++++++++++++++++++
> > 4 files changed, 52 insertions(+), 2 deletions(-)
> >
> > diff --git a/modules/video_output/opengl/fragment_shaders.c
> > b/modules/video_output/opengl/fragment_shaders.c
> > index f58b4467b6..79bba13912 100644
> > --- a/modules/video_output/opengl/fragment_shaders.c
> > +++ b/modules/video_output/opengl/fragment_shaders.c
> > @@ -558,7 +558,13 @@
> > opengl_fragment_shader_init_impl(opengl_tex_converter_t *tc, GLenum
> > tex_target,
> > color_params.intent = var_InheritInteger(tc->gl,
> > "rendering-intent");
> > color_params.tone_mapping_algo = var_InheritInteger(tc->gl,
> > "tone-mapping");
> > color_params.tone_mapping_param = var_InheritFloat(tc->gl,
> > "tone-mapping-param");
> > +# if PL_API_VER >= 10
> > + color_params.desaturation_strength = var_InheritFloat(tc->gl,
> > "desat-strength");
> > + color_params.desaturation_exponent = var_InheritFloat(tc->gl,
> > "desat-exponent");
> > + color_params.desaturation_base = var_InheritFloat(tc->gl,
> > "desat-base");
> > +# else
> > color_params.tone_mapping_desaturate =
> > var_InheritFloat(tc->gl, "tone-mapping-desat");
> > +# endif
> > color_params.gamut_warning = var_InheritBool(tc->gl,
> > "tone-mapping-warn");
> >
> > struct pl_color_space dst_space = pl_color_space_unknown;
> > diff --git a/modules/video_output/opengl/vout_helper.h
> > b/modules/video_output/opengl/vout_helper.h
> > index a13f66c1cc..b078eb85a3 100644
> > --- a/modules/video_output/opengl/vout_helper.h
> > +++ b/modules/video_output/opengl/vout_helper.h
> > @@ -34,6 +34,21 @@
> > #ifdef HAVE_LIBPLACEBO
> > #include "../placebo_utils.h"
> >
> > +
> > +#if PL_API_VER >= 10
> > +#define add_desat_params() \
> > + add_float("desat-strength",
> > pl_color_map_default_params.desaturation_strength, \
> > + DESAT_STRENGTH_TEXT, DESAT_STRENGTH_LONGTEXT, false) \
> > + add_float("desat-exponent",
> > pl_color_map_default_params.desaturation_exponent, \
> > + DESAT_EXPONENT_TEXT, DESAT_EXPONENT_LONGTEXT, false) \
> > + add_float("desat-base",
> > pl_color_map_default_params.desaturation_base, \
> > + DESAT_BASE_TEXT, DESAT_BASE_LONGTEXT, false)
> > +#else
> > +#define add_desat_params() \
> > + add_float("tone-mapping-desat",
> > pl_color_map_default_params.tone_mapping_desaturate, \
> > + TONEMAP_DESAT_TEXT, TONEMAP_DESAT_LONGTEXT, false)
> > +#endif
> > +
> > #define add_glopts_placebo() \
> > set_section(N_("Colorspace conversion"), NULL) \
> > add_integer("rendering-intent",
> > pl_color_map_default_params.intent, \
> > @@ -47,10 +62,9 @@
> > add_integer("tone-mapping", PL_TONE_MAPPING_HABLE, \
> > TONEMAPPING_TEXT, TONEMAPPING_LONGTEXT, false) \
> > change_integer_list(tone_values, tone_text) \
> > + add_desat_params() \
> > add_float("tone-mapping-param",
> > pl_color_map_default_params.tone_mapping_param, \
> > TONEMAP_PARAM_TEXT, TONEMAP_PARAM_LONGTEXT, true) \
> > - add_float("tone-mapping-desat",
> > pl_color_map_default_params.tone_mapping_desaturate, \
> > - TONEMAP_DESAT_TEXT, TONEMAP_DESAT_LONGTEXT, false) \
> > add_bool("tone-mapping-warn", false, GAMUT_WARN_TEXT,
> > GAMUT_WARN_LONGTEXT, false) \
> > set_section(N_("Dithering"), NULL) \
> > add_integer("dither-algo", -1, DITHER_TEXT, DITHER_LONGTEXT,
> > false) \
> > diff --git a/modules/video_output/placebo_utils.h
> > b/modules/video_output/placebo_utils.h
> > index 4ecf60e7e9..96a43cdf4b 100644
> > --- a/modules/video_output/placebo_utils.h
> > +++ b/modules/video_output/placebo_utils.h
> > @@ -165,6 +165,18 @@ static const char * const tone_text[] = {
> > #define TONEMAP_DESAT_TEXT "Tone-mapping desaturation coefficient"
> > #define TONEMAP_DESAT_LONGTEXT "How strongly to desaturate bright
> > spectral colors towards white. 0.0 disables this behavior."
> >
> > +#define DESAT_STRENGTH_TEXT "Desaturation strength"
> > +#define DESAT_STRENGTH_LONGTEXT "How strongly to desaturate bright
> > spectral colors towards white. 0.0 disables this behavior, 1.0 enables
> > full desaturation (hollywood-style)"
> > +
> > +#define DESAT_EXPONENT_TEXT "Desaturation exponent"
> > +#define DESAT_EXPONENT_LONGTEXT "Controls the steepness of the
> > desaturation curve. If you set this to 0.0, the curve will be flat,
> > i.e. desaturation always enabled (hollywood-style)."
> > +
> > +#define DESAT_BASE_TEXT "Desaturation base"
> > +#define DESAT_BASE_LONGTEXT "Controls the starting offset of the
> > desaturation curve. Brightness values below this base will always be
> > colorimetrically tone mapped (never desaturated)."
> > +
> > +#define MAX_BOOST_TEXT "Maximum brightness boost"
> > +#define MAX_BOOST_LONGTEXT "Maximum allowed brightness boost to
> > compensate for dark scenes. A value of 1.0 means no brightness boost is
> > allowed."
> > +
> > #define GAMUT_WARN_TEXT "Highlight clipped pixels"
> > #define GAMUT_WARN_LONGTEXT "Debugging tool to indicate which pixels
> > were clipped as part of the tone mapping process."
> >
> > diff --git a/modules/video_output/vulkan/display.c
> > b/modules/video_output/vulkan/display.c
> > index 6250fba3c2..48fa4eafb2 100644
> > --- a/modules/video_output/vulkan/display.c
> > +++ b/modules/video_output/vulkan/display.c
> > @@ -603,8 +603,19 @@ vlc_module_begin () set_shortname ("Vulkan")
> > change_integer_list(tone_values, tone_text)
> > add_float("tone-mapping-param",
> > pl_color_map_default_params.tone_mapping_param,
> > TONEMAP_PARAM_TEXT, TONEMAP_PARAM_LONGTEXT, true)
> > +#if PL_API_VER >= 10
> > + add_float("desat-strength",
> > pl_color_map_default_params.desaturation_strength,
> > + DESAT_STRENGTH_TEXT, DESAT_STRENGTH_LONGTEXT, false)
> > + add_float("desat-exponent",
> > pl_color_map_default_params.desaturation_exponent,
> > + DESAT_EXPONENT_TEXT, DESAT_EXPONENT_LONGTEXT, false)
> > + add_float("desat-base",
> > pl_color_map_default_params.desaturation_base,
> > + DESAT_BASE_TEXT, DESAT_BASE_LONGTEXT, false)
> > + add_float("max-boost", pl_color_map_default_params.max_boost,
> > + MAX_BOOST_TEXT, MAX_BOOST_LONGTEXT, false)
> > +#else
> > add_float("tone-mapping-desat",
> > pl_color_map_default_params.tone_mapping_desaturate,
> > TONEMAP_DESAT_TEXT, TONEMAP_DESAT_LONGTEXT, false)
> > +#endif
> > add_bool("gamut-warning", false, GAMUT_WARN_TEXT,
> > GAMUT_WARN_LONGTEXT, true)
> > add_integer_with_range("peak-frames",
> > pl_color_map_default_params.peak_detect_frames,
> > 0, 255, PEAK_FRAMES_TEXT, PEAK_FRAMES_LONGTEXT, false)
> > @@ -691,7 +702,14 @@ static void UpdateParams(vout_display_t *vd)
> > sys->color_map.intent = var_InheritInteger(vd, "intent");
> > sys->color_map.tone_mapping_algo = var_InheritInteger(vd,
> > "tone-mapping");
> > sys->color_map.tone_mapping_param = var_InheritFloat(vd,
> > "tone-mapping-param");
> > +#if PL_API_VER >= 10
> > + sys->color_map.desaturation_strength = var_InheritFloat(vd,
> > "desat-strength");
> > + sys->color_map.desaturation_exponent = var_InheritFloat(vd,
> > "desat-exponent");
> > + sys->color_map.desaturation_base = var_InheritFloat(vd,
> > "desat-base");
> > + sys->color_map.max_boost = var_InheritFloat(vd, "max-boost");
> > +#else
> > sys->color_map.tone_mapping_desaturate = var_InheritFloat(vd,
> > "tone-mapping-desat");
> > +#endif
> > sys->color_map.gamut_warning = var_InheritBool(vd,
> > "gamut-warning");
> > sys->color_map.peak_detect_frames = var_InheritInteger(vd,
> > "peak-frames");
> > sys->color_map.scene_threshold = var_InheritFloat(vd,
> > "scene-threshold");
> > --
> > 2.20.1
> >
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
--
-
Nicolas (kwizart)
More information about the vlc-devel
mailing list