]> git.pld-linux.org Git - packages/vlc.git/blob - vlc-libplacebo.patch
b1f144e2997a11ed2380f8e5d97dbb748cdb99a2
[packages/vlc.git] / vlc-libplacebo.patch
1 From b579384a239683232f5558216cc03c6ae5a5dc38 Mon Sep 17 00:00:00 2001
2 From: Niklas Haas <git@haasn.xyz>
3 Date: Mon, 6 May 2019 09:56:36 +0200
4 Subject: [PATCH] placebo: update for new tone mapping desaturation algo
5
6 This was introduced in API version 10, and refactors the tone mapping
7 desaturation curve into a new, more tunable algorithm that has some
8 different behavior. In particular, it allows us to simulate exactly the
9 "hollywood" style of tone mapping, so we document those special values
10 specifically.
11
12 Signed-off-by: Thomas Guillem <thomas@gllm.fr>
13 ---
14  .../video_output/opengl/fragment_shaders.c    |  6 ++++++
15  modules/video_output/opengl/vout_helper.h     | 19 +++++++++++++++++--
16  modules/video_output/placebo_utils.h          | 12 ++++++++++++
17  modules/video_output/vulkan/display.c         | 18 ++++++++++++++++++
18  4 files changed, 53 insertions(+), 2 deletions(-)
19
20 diff --git a/modules/video_output/opengl/fragment_shaders.c b/modules/video_output/opengl/fragment_shaders.c
21 index f58b4467b6..79bba13912 100644
22 --- a/modules/video_output/opengl/fragment_shaders.c
23 +++ b/modules/video_output/opengl/fragment_shaders.c
24 @@ -558,7 +558,13 @@ opengl_fragment_shader_init_impl(opengl_tex_converter_t *tc, GLenum tex_target,
25          color_params.intent = var_InheritInteger(tc->gl, "rendering-intent");
26          color_params.tone_mapping_algo = var_InheritInteger(tc->gl, "tone-mapping");
27          color_params.tone_mapping_param = var_InheritFloat(tc->gl, "tone-mapping-param");
28 +#    if PL_API_VER >= 10
29 +        color_params.desaturation_strength = var_InheritFloat(tc->gl, "desat-strength");
30 +        color_params.desaturation_exponent = var_InheritFloat(tc->gl, "desat-exponent");
31 +        color_params.desaturation_base = var_InheritFloat(tc->gl, "desat-base");
32 +#    else
33          color_params.tone_mapping_desaturate = var_InheritFloat(tc->gl, "tone-mapping-desat");
34 +#    endif
35          color_params.gamut_warning = var_InheritBool(tc->gl, "tone-mapping-warn");
36  
37          struct pl_color_space dst_space = pl_color_space_unknown;
38 diff --git a/modules/video_output/opengl/vout_helper.h b/modules/video_output/opengl/vout_helper.h
39 index a13f66c1cc..332f63c79e 100644
40 --- a/modules/video_output/opengl/vout_helper.h
41 +++ b/modules/video_output/opengl/vout_helper.h
42 @@ -148,6 +148,15 @@
43  #define TONEMAP_DESAT_TEXT "Tone-mapping desaturation coefficient"
44  #define TONEMAP_DESAT_LONGTEXT "How strongly to desaturate overbright colors towards white. 0.0 disables this behavior."
45  
46 +#define DESAT_STRENGTH_TEXT "Desaturation strength"
47 +#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)"
48 +
49 +#define DESAT_EXPONENT_TEXT "Desaturation exponent"
50 +#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)."
51 +
52 +#define DESAT_BASE_TEXT "Desaturation base"
53 +#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)."
54 +
55  #define TONEMAP_WARN_TEXT "Highlight clipped pixels"
56  #define TONEMAP_WARN_LONGTEXT "Debugging tool to indicate which pixels were clipped as part of the tone mapping process."
57  
58 @@ -171,6 +180,22 @@
59  #ifdef HAVE_LIBPLACEBO
60  #include "../placebo_utils.h"
61  
62 +
63 +#if PL_API_VER >= 10
64 +#define add_desat_params() \
65 +    add_float("desat-strength", pl_color_map_default_params.desaturation_strength, \
66 +              DESAT_STRENGTH_TEXT, DESAT_STRENGTH_LONGTEXT, false) \
67 +    add_float("desat-exponent", pl_color_map_default_params.desaturation_exponent, \
68 +              DESAT_EXPONENT_TEXT, DESAT_EXPONENT_LONGTEXT, false) \
69 +    add_float("desat-base", pl_color_map_default_params.desaturation_base, \
70 +              DESAT_BASE_TEXT, DESAT_BASE_LONGTEXT, false) \
71 +    add_obsolete_string("tone-mapping-desat")
72 +#else
73 +#define add_desat_params() \
74 +    add_float("tone-mapping-desat", pl_color_map_default_params.tone_mapping_desaturate, \
75 +              TONEMAP_DESAT_TEXT, TONEMAP_DESAT_LONGTEXT, false)
76 +#endif
77 +
78  #define add_glopts_placebo() \
79      set_section(N_("Colorspace conversion"), NULL) \
80      add_integer("rendering-intent", pl_color_map_default_params.intent, \
81 @@ -200,10 +184,9 @@
82      add_integer("tone-mapping", PL_TONE_MAPPING_HABLE, \
83                  TONEMAPPING_TEXT, TONEMAPPING_LONGTEXT, false) \
84              change_integer_list(tone_values, tone_text) \
85 +    add_desat_params() \
86      add_float("tone-mapping-param", pl_color_map_default_params.tone_mapping_param, \
87                TONEMAP_PARAM_TEXT, TONEMAP_PARAM_LONGTEXT, true) \
88 -    add_float("tone-mapping-desat", pl_color_map_default_params.tone_mapping_desaturate, \
89 -              TONEMAP_DESAT_TEXT, TONEMAP_DESAT_LONGTEXT, false) \
90      add_bool("tone-mapping-warn", false, TONEMAP_WARN_TEXT, TONEMAP_WARN_LONGTEXT, false) \
91      set_section("Dithering", NULL) \
92      add_integer("dither-algo", -1, DITHER_TEXT, DITHER_LONGTEXT, false) \
93 -- 
94 2.22.0
95
96 From 24dc03640d3cfd89aa87ce63929aba17911c4b85 Mon Sep 17 00:00:00 2001
97 From: Niklas Haas <git@haasn.xyz>
98 Date: Mon, 6 May 2019 09:56:38 +0200
99 Subject: [PATCH] opengl: update libplacebo call for changed API
100
101 This will be the last time a change to this signature is needed, since
102 we just switched to using a params struct rather than updating the
103 signature constantly.
104
105 Signed-off-by: Thomas Guillem <thomas@gllm.fr>
106 ---
107  modules/video_output/opengl/vout_helper.c | 4 +++-
108  1 file changed, 3 insertions(+), 1 deletion(-)
109
110 diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
111 index f1069ccb1f9..b59343f7b5f 100644
112 --- a/modules/video_output/opengl/vout_helper.c
113 +++ b/modules/video_output/opengl/vout_helper.c
114 @@ -551,7 +551,9 @@ opengl_init_program(vout_display_opengl_t *vgl, vlc_video_context *context,
115      {
116          tc->pl_ctx = vlc_placebo_Create(VLC_OBJECT(tc));
117          if (tc->pl_ctx) {
118 -#   if PL_API_VER >= 6
119 +#   if PL_API_VER >= 20
120 +            tc->pl_sh = pl_shader_alloc(tc->pl_ctx, NULL);
121 +#   elif PL_API_VER >= 6
122              tc->pl_sh = pl_shader_alloc(tc->pl_ctx, NULL, 0);
123  #   else
124              tc->pl_sh = pl_shader_alloc(tc->pl_ctx, NULL, 0, 0);
This page took 0.072807 seconds and 2 git commands to generate.