[vlc-devel] [PATCH 2/2] libplacebo: drop versions older than 1.20

Niklas Haas vlc at haasn.xyz
Wed May 13 22:29:23 CEST 2020


From: Niklas Haas <git at haasn.xyz>

This version is over a year old, and by now, packaged pretty much
everywhere. I think it's time to drop the bunch of backwards
compatibility hacks that were in place before this API stabilized.
---
 configure.ac                                  |  8 ++----
 .../video_output/opengl/fragment_shaders.c    |  4 ---
 modules/video_output/opengl/renderer.c        | 10 ++-----
 modules/video_output/opengl/vout_helper.h     |  6 ----
 modules/video_output/vulkan/display.c         | 28 -------------------
 5 files changed, 5 insertions(+), 51 deletions(-)

diff --git a/configure.ac b/configure.ac
index cc682e94c3..580911c916 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3235,10 +3235,8 @@ AC_ARG_ENABLE([libplacebo],
       [disable libplacebo support (default auto)]))
 
 AS_IF([test "$enable_libplacebo" != "no"], [
-  PKG_CHECK_MODULES([LIBPLACEBO], [libplacebo >= 0.5], [
+  PKG_CHECK_MODULES([LIBPLACEBO], [libplacebo >= 1.20], [
     AC_DEFINE([HAVE_LIBPLACEBO], [1], [Define to 1 if libplacebo is enabled.])
-    PKG_CHECK_MODULES([LIBPLACEBO], [libplacebo >= 1.7],
-      [have_libplacebo_vk="yes"], [have_libplacebo_vk="no"])
   ], [
     AS_IF([test -n "${enable_libplacebo}"], [
       AC_MSG_ERROR([${LIBPLACEBO_PKG_ERRORS}.])
@@ -3297,7 +3295,7 @@ AC_ARG_ENABLE(vulkan,
       [disable Vulkan support (default auto)])])
 
 AS_IF([test "$enable_vulkan" != "no"], [
-  AS_IF([test "$have_libplacebo_vk" = "yes"], [
+  AS_IF([test "$enable_libplacebo" != "no"], [
     PKG_CHECK_MODULES([VULKAN], [vulkan >= 1.0.26], [
       AC_DEFINE([HAVE_VULKAN], [1], [Define to 1 if vulkan is enabled.])
     ], [
@@ -3308,7 +3306,7 @@ AS_IF([test "$enable_vulkan" != "no"], [
     ])
   ], [
     AS_IF([test -n "${enable_vulkan}"], [
-      AC_MSG_ERROR([Vulkan support requires libplacebo 1.7 as well. Do not use --disable-libplacebo.])
+      AC_MSG_ERROR([Vulkan support requires libplacebo. Do not use --disable-libplacebo.])
     ])
     enable_vulkan="no"
   ])
diff --git a/modules/video_output/opengl/fragment_shaders.c b/modules/video_output/opengl/fragment_shaders.c
index 117020cbe7..405e957dfc 100644
--- a/modules/video_output/opengl/fragment_shaders.c
+++ b/modules/video_output/opengl/fragment_shaders.c
@@ -492,13 +492,9 @@ opengl_fragment_shader_init(struct vlc_gl_renderer *renderer, GLenum tex_target,
         color_params.intent = var_InheritInteger(renderer->gl, "rendering-intent");
         color_params.tone_mapping_algo = var_InheritInteger(renderer->gl, "tone-mapping");
         color_params.tone_mapping_param = var_InheritFloat(renderer->gl, "tone-mapping-param");
-#    if PL_API_VER >= 10
         color_params.desaturation_strength = var_InheritFloat(renderer->gl, "desat-strength");
         color_params.desaturation_exponent = var_InheritFloat(renderer->gl, "desat-exponent");
         color_params.desaturation_base = var_InheritFloat(renderer->gl, "desat-base");
-#    else
-        color_params.tone_mapping_desaturate = var_InheritFloat(renderer->gl, "tone-mapping-desat");
-#    endif
         color_params.gamut_warning = var_InheritBool(renderer->gl, "tone-mapping-warn");
 
         struct pl_color_space dst_space = pl_color_space_unknown;
diff --git a/modules/video_output/opengl/renderer.c b/modules/video_output/opengl/renderer.c
index 57a8d3ce0e..418a8b9a79 100644
--- a/modules/video_output/opengl/renderer.c
+++ b/modules/video_output/opengl/renderer.c
@@ -463,20 +463,14 @@ vlc_gl_renderer_New(vlc_gl_t *gl, const struct vlc_gl_api *api,
     // Create the main libplacebo context
     renderer->pl_ctx = vlc_placebo_Create(VLC_OBJECT(gl));
     if (renderer->pl_ctx) {
-#   if PL_API_VER >= 20
         renderer->pl_sh = pl_shader_alloc(renderer->pl_ctx, &(struct pl_shader_params) {
             .glsl = {
                 .version = renderer->glsl_version,
-#       ifdef USE_OPENGL_ES2
+#   ifdef USE_OPENGL_ES2
                 .gles = true,
-#       endif
+#   endif
             },
         });
-#   elif PL_API_VER >= 6
-        renderer->pl_sh = pl_shader_alloc(renderer->pl_ctx, NULL, 0);
-#   else
-        renderer->pl_sh = pl_shader_alloc(renderer->pl_ctx, NULL, 0, 0);
-#   endif
     }
 #endif
 
diff --git a/modules/video_output/opengl/vout_helper.h b/modules/video_output/opengl/vout_helper.h
index 482eabb554..9daa40c06c 100644
--- a/modules/video_output/opengl/vout_helper.h
+++ b/modules/video_output/opengl/vout_helper.h
@@ -35,7 +35,6 @@
 #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) \
@@ -44,11 +43,6 @@
     add_float("desat-base", pl_color_map_default_params.desaturation_base, \
               DESAT_BASE_TEXT, DESAT_BASE_LONGTEXT, false) \
     add_obsolete_string("tone-mapping-desat")
-#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) \
diff --git a/modules/video_output/vulkan/display.c b/modules/video_output/vulkan/display.c
index 174627d67d..3257d9e02f 100644
--- a/modules/video_output/vulkan/display.c
+++ b/modules/video_output/vulkan/display.c
@@ -63,9 +63,7 @@ struct vout_display_sys_t
     struct pl_dither_params dither;
     struct pl_render_params params;
     struct pl_color_space target;
-#if PL_API_VER >= 13
     struct pl_peak_detect_params peak_detect;
-#endif
     enum pl_chroma_location yuv_chroma_loc;
     int dither_depth;
 };
@@ -426,7 +424,6 @@ vlc_module_begin ()
             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,
@@ -435,27 +432,14 @@ vlc_module_begin ()
             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)
 
-#if PL_API_VER < 12
-    add_integer_with_range("peak-frames", pl_color_map_default_params.peak_detect_frames,
-            0, 255, PEAK_FRAMES_TEXT, PEAK_FRAMES_LONGTEXT, false)
-    add_float_with_range("scene-threshold", pl_color_map_default_params.scene_threshold,
-            0., 10., SCENE_THRESHOLD_TEXT, SCENE_THRESHOLD_LONGTEXT, false)
-#endif
-
-#if PL_API_VER >= 13
     add_float_with_range("peak-period", pl_peak_detect_default_params.smoothing_period,
             0., 1000., PEAK_PERIOD_TEXT, PEAK_PERIOD_LONGTEXT, false)
     add_float("scene-threshold-low", pl_peak_detect_default_params.scene_threshold_low,
             SCENE_THRESHOLD_LOW_TEXT, SCENE_THRESHOLD_LOW_LONGTEXT, false)
     add_float("scene-threshold-high", pl_peak_detect_default_params.scene_threshold_high,
             SCENE_THRESHOLD_HIGH_TEXT, SCENE_THRESHOLD_HIGH_LONGTEXT, false)
-#endif
 
     add_float_with_range("target-avg", 0.25,
             0.0, 1.0, TARGET_AVG_TEXT, TARGET_AVG_LONGTEXT, false)
@@ -508,9 +492,7 @@ vlc_module_begin ()
     add_bool("overlay-direct", false, OVERLAY_DIRECT_TEXT, OVERLAY_DIRECT_LONGTEXT, false)
     add_bool("disable-linear", false, DISABLE_LINEAR_TEXT, DISABLE_LINEAR_LONGTEXT, false)
     add_bool("force-general", false, FORCE_GENERAL_TEXT, FORCE_GENERAL_LONGTEXT, false)
-#if PL_API_VER >= 13
     add_bool("delayed-peak", false, DELAYED_PEAK_TEXT, DELAYED_PEAK_LONGTEXT, false)
-#endif
 
 vlc_module_end ()
 
@@ -540,19 +522,11 @@ 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");
-#if PL_API_VER < 12
-    sys->color_map.peak_detect_frames = var_InheritInteger(vd, "peak-frames");
-    sys->color_map.scene_threshold = var_InheritFloat(vd, "scene-threshold");
-#endif
 
     sys->dither = pl_dither_default_params;
     int method = var_InheritInteger(vd, "dither");
@@ -574,7 +548,6 @@ static void UpdateParams(vout_display_t *vd)
     sys->params.disable_linear_scaling = var_InheritBool(vd, "disable-linear");
     sys->params.disable_builtin_scalers = var_InheritBool(vd, "force-general");
 
-#if PL_API_VER >= 13
     sys->peak_detect.smoothing_period = var_InheritFloat(vd, "peak-period");
     sys->peak_detect.scene_threshold_low = var_InheritFloat(vd, "scene-threshold-low");
     sys->peak_detect.scene_threshold_high = var_InheritFloat(vd, "scene-threshold-high");
@@ -582,7 +555,6 @@ static void UpdateParams(vout_display_t *vd)
         sys->params.peak_detect_params = &sys->peak_detect;
         sys->params.allow_delayed_peak_detect = var_InheritBool(vd, "delayed-peak");
     }
-#endif
 
     int preset = var_InheritInteger(vd, "upscaler-preset");
     sys->params.upscaler = scale_config[preset];
-- 
2.26.2



More information about the vlc-devel mailing list