[vlc-commits] [Git][videolan/vlc][master] 3 commits: libplacebo: bump minimum dependency to v2.72.0

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Thu Oct 7 09:27:21 UTC 2021



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
38930e8e by Niklas Haas at 2021-10-07T08:03:59+00:00
libplacebo: bump minimum dependency to v2.72.0

This is packaged everywhere relevant, including Debian 11 (stable).
Fedora 33 and Ubuntu 20.10. (Rolling release distros all have v4
anyways)

Motivation behind this is twofold: besides the obvious code
simplification, this is mainly for simpler forward compatibility with
libplacebo v4+.

- - - - -
5be0a1e3 by Niklas Haas at 2021-10-07T08:03:59+00:00
libplacebo: drop backwards compatibility paths

With the bump to the minimum version, all these #ifdefs can (mostly) be
cleaned up.

- - - - -
9c284d79 by Niklas Haas at 2021-10-07T08:03:59+00:00
libplacebo: add forward compatibility with libplacebo v4+

Current libplacebo git master has dropped fields deprecated in
libplacebo v2, but we remain backwards compatible with libplacebo v2 due
to reasons of debian stable / ubuntu LTS.

Rather than bumping up to libplacebo v3 (which would allow us to drop
these deprecated functions entirely), simply add forward compatibility
defines for now. Can be removed whenever there's a new ubuntu/debian
release.

- - - - -


4 changed files:

- configure.ac
- modules/video_output/libplacebo/display.c
- modules/video_output/libplacebo/utils.h
- modules/video_output/opengl/sampler.c


Changes:

=====================================
configure.ac
=====================================
@@ -3174,7 +3174,7 @@ AC_ARG_ENABLE([libplacebo],
       [disable libplacebo support (default auto)]))
 
 AS_IF([test "$enable_libplacebo" != "no"], [
-  PKG_CHECK_MODULES([LIBPLACEBO], [libplacebo >= 1.7], [
+  PKG_CHECK_MODULES([LIBPLACEBO], [libplacebo >= 2.72], [
     AC_DEFINE([HAVE_LIBPLACEBO], [1], [Define to 1 if libplacebo is enabled.])
     AC_CHECK_HEADER([libplacebo/vulkan.h], [VLC_ADD_PLUGIN([placebo_vk])])
     AC_CHECK_HEADER([libplacebo/opengl.h], [


=====================================
modules/video_output/libplacebo/display.c
=====================================
@@ -43,6 +43,15 @@
 # include <libplacebo/shaders/lut.h>
 #endif
 
+#if PL_API_VER >= 159
+// Forward compatibility with libplacebo v4+
+#define pl_image pl_frame
+#define pl_render_target pl_frame
+#define pl_render_target_from_swapchain pl_frame_from_swapchain
+#define src_rect crop
+#define dst_rect crop
+#endif
+
 typedef struct vout_display_sys_t
 {
     vlc_placebo_t *pl;
@@ -63,9 +72,7 @@ typedef 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;
 
@@ -75,10 +82,8 @@ typedef struct vout_display_sys_t
     int lut_mode;
 #endif
 
-#if PL_API_VER >= 58
     const struct pl_hook *hook;
     char *hook_path;
-#endif
 } vout_display_sys_t;
 
 // Display callbacks
@@ -199,10 +204,8 @@ static void Close(vout_display_t *vd)
     free(sys->lut_path);
 #endif
 
-#if PL_API_VER >= 58
     pl_mpv_user_shader_destroy(&sys->hook);
     free(sys->hook_path);
-#endif
 
     vlc_placebo_Release(sys->pl);
 }
@@ -226,8 +229,6 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
 
     struct pl_image img = {
         .num_planes = pic->i_planes,
-        .width      = pic->format.i_visible_width,
-        .height     = pic->format.i_visible_height,
         .color      = vlc_placebo_ColorSpace(vd->fmt),
         .repr       = vlc_placebo_ColorRepr(vd->fmt),
         .src_rect = {
@@ -432,7 +433,6 @@ static int Control(vout_display_t *vd, int query)
          * In addition, platforms like Wayland need the call as the size of the
          * window is defined by the size of the content, and not the opposite.
          * The swapchain creation won't be done twice with this call. */
-#if PL_API_VER >= 18
         if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
         {
             int width = (int) vd->cfg->display.width;
@@ -451,7 +451,6 @@ static int Control(vout_display_t *vd, int query)
                 return VLC_EGENERIC;
             */
         }
-#endif
         return VLC_SUCCESS;
     }
 
@@ -512,7 +511,6 @@ error:
 }
 #endif
 
-#if PL_API_VER >= 58
 static void LoadUserShader(vout_display_sys_t *sys, const char *filepath)
 {
     if (!filepath || !*filepath) {
@@ -558,7 +556,6 @@ error:
         fclose(fs);
     return;
 }
-#endif
 
 // Options
 
@@ -575,10 +572,8 @@ vlc_module_begin ()
     add_shortcut ("libplacebo", "pl")
     add_module ("pl-gpu", "libplacebo gpu", NULL, PROVIDER_TEXT, PROVIDER_LONGTEXT)
 
-#if PL_API_VER >= 58
     set_section("Custom shaders", NULL)
     add_loadfile("pl-user-shader", NULL, USER_SHADER_FILE_TEXT, USER_SHADER_FILE_LONGTEXT)
-#endif
 
     set_section("Scaling", NULL)
     add_integer("pl-upscaler-preset", SCALE_BUILTIN,
@@ -632,7 +627,6 @@ vlc_module_begin ()
             change_integer_list(tone_values, tone_text)
     add_float("pl-tone-mapping-param", pl_color_map_default_params.tone_mapping_param,
             TONEMAP_PARAM_TEXT, TONEMAP_PARAM_LONGTEXT)
-#if PL_API_VER >= 10
     add_float("pl-desat-strength", pl_color_map_default_params.desaturation_strength,
             DESAT_STRENGTH_TEXT, DESAT_STRENGTH_LONGTEXT)
     add_float("pl-desat-exponent", pl_color_map_default_params.desaturation_exponent,
@@ -641,30 +635,17 @@ vlc_module_begin ()
             DESAT_BASE_TEXT, DESAT_BASE_LONGTEXT)
     add_float("pl-max-boost", pl_color_map_default_params.max_boost,
             MAX_BOOST_TEXT, MAX_BOOST_LONGTEXT)
-#else
-    add_float("pl-tone-mapping-desat", pl_color_map_default_params.tone_mapping_desaturate,
-            TONEMAP_DESAT_TEXT, TONEMAP_DESAT_LONGTEXT)
-#endif
 #if PL_API_VER >= 80
     add_bool("pl-gamut-clipping", false, GAMUT_CLIPPING_TEXT, GAMUT_CLIPPING_LONGTEXT)
 #endif
     add_bool("pl-gamut-warning", false, GAMUT_WARN_TEXT, GAMUT_WARN_LONGTEXT)
 
-#if PL_API_VER < 12
-    add_integer_with_range("pl-peak-frames", pl_color_map_default_params.peak_detect_frames,
-            0, 255, PEAK_FRAMES_TEXT, PEAK_FRAMES_LONGTEXT)
-    add_float_with_range("pl-scene-threshold", pl_color_map_default_params.scene_threshold,
-            0., 10., SCENE_THRESHOLD_TEXT, SCENE_THRESHOLD_LONGTEXT)
-#endif
-
-#if PL_API_VER >= 13
     add_float_with_range("pl-peak-period", pl_peak_detect_default_params.smoothing_period,
             0., 1000., PEAK_PERIOD_TEXT, PEAK_PERIOD_LONGTEXT)
     add_float("pl-scene-threshold-low", pl_peak_detect_default_params.scene_threshold_low,
             SCENE_THRESHOLD_LOW_TEXT, SCENE_THRESHOLD_LOW_LONGTEXT)
     add_float("pl-scene-threshold-high", pl_peak_detect_default_params.scene_threshold_high,
             SCENE_THRESHOLD_HIGH_TEXT, SCENE_THRESHOLD_HIGH_LONGTEXT)
-#endif
 
     add_float_with_range("pl-target-avg", 0.25,
             0.0, 1.0, TARGET_AVG_TEXT, TARGET_AVG_LONGTEXT)
@@ -717,9 +698,7 @@ vlc_module_begin ()
     add_bool("pl-overlay-direct", false, OVERLAY_DIRECT_TEXT, OVERLAY_DIRECT_LONGTEXT)
     add_bool("pl-disable-linear", false, DISABLE_LINEAR_TEXT, DISABLE_LINEAR_LONGTEXT)
     add_bool("pl-force-general", false, FORCE_GENERAL_TEXT, FORCE_GENERAL_LONGTEXT)
-#if PL_API_VER >= 13
     add_bool("pl-delayed-peak", false, DELAYED_PEAK_TEXT, DELAYED_PEAK_LONGTEXT)
-#endif
 
 vlc_module_end ()
 
@@ -749,22 +728,14 @@ static void UpdateParams(vout_display_t *vd)
     sys->color_map.intent = var_InheritInteger(vd, "pl-intent");
     sys->color_map.tone_mapping_algo = var_InheritInteger(vd, "pl-tone-mapping");
     sys->color_map.tone_mapping_param = var_InheritFloat(vd, "pl-tone-mapping-param");
-#if PL_API_VER >= 10
     sys->color_map.desaturation_strength = var_InheritFloat(vd, "pl-desat-strength");
     sys->color_map.desaturation_exponent = var_InheritFloat(vd, "pl-desat-exponent");
     sys->color_map.desaturation_base = var_InheritFloat(vd, "pl-desat-base");
     sys->color_map.max_boost = var_InheritFloat(vd, "pl-max-boost");
-#else
-    sys->color_map.tone_mapping_desaturate = var_InheritFloat(vd, "pl-tone-mapping-desat");
-#endif
 #if PL_API_VER >= 80
     sys->color_map.gamut_clipping = var_InheritBool(vd, "pl-gamut-clipping");
 #endif
     sys->color_map.gamut_warning = var_InheritBool(vd, "pl-gamut-warning");
-#if PL_API_VER < 12
-    sys->color_map.peak_detect_frames = var_InheritInteger(vd, "pl-peak-frames");
-    sys->color_map.scene_threshold = var_InheritFloat(vd, "pl-scene-threshold");
-#endif
 
     sys->dither = pl_dither_default_params;
     int method = var_InheritInteger(vd, "pl-dither");
@@ -786,7 +757,6 @@ static void UpdateParams(vout_display_t *vd)
     sys->params.disable_linear_scaling = var_InheritBool(vd, "pl-disable-linear");
     sys->params.disable_builtin_scalers = var_InheritBool(vd, "pl-force-general");
 
-#if PL_API_VER >= 13
     sys->peak_detect.smoothing_period = var_InheritFloat(vd, "pl-peak-period");
     sys->peak_detect.scene_threshold_low = var_InheritFloat(vd, "pl-scene-threshold-low");
     sys->peak_detect.scene_threshold_high = var_InheritFloat(vd, "pl-scene-threshold-high");
@@ -794,7 +764,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, "pl-delayed-peak");
     }
-#endif
 
     int preset = var_InheritInteger(vd, "pl-upscaler-preset");
     sys->params.upscaler = scale_config[preset];
@@ -859,7 +828,6 @@ static void UpdateParams(vout_display_t *vd)
     }
 #endif
 
-#if PL_API_VER >= 58
     char *shader_file = var_InheritString(vd, "pl-user-shader");
     LoadUserShader(sys, shader_file);
     free(shader_file);
@@ -869,5 +837,4 @@ static void UpdateParams(vout_display_t *vd)
     } else {
         sys->params.num_hooks = 0;
     }
-#endif
 }


=====================================
modules/video_output/libplacebo/utils.h
=====================================
@@ -185,9 +185,7 @@ static const char * const lut_mode_text[] = {
 #define TONEMAPPING_LONGTEXT "Algorithm to use when converting from wide gamut to standard gamut, or from HDR to SDR."
 
 static const int tone_values[] = {
-#if PL_API_VER >= 68
     PL_TONE_MAPPING_BT_2390,
-#endif
     PL_TONE_MAPPING_HABLE,
     PL_TONE_MAPPING_MOBIUS,
     PL_TONE_MAPPING_REINHARD,
@@ -197,9 +195,7 @@ static const int tone_values[] = {
 };
 
 static const char * const tone_text[] = {
-#if PL_API_VER >= 68
     "ITU-R BT.2390 EETF (recommended)",
-#endif
     "Hable (filmic mapping)",
     "Mobius (linear + knee)",
     "Reinhard (simple non-linear)",


=====================================
modules/video_output/opengl/sampler.c
=====================================
@@ -937,13 +937,9 @@ opengl_fragment_shader_init(struct vlc_gl_sampler *sampler, GLenum tex_target,
         color_params.intent = var_InheritInteger(priv->gl, "rendering-intent");
         color_params.tone_mapping_algo = var_InheritInteger(priv->gl, "tone-mapping");
         color_params.tone_mapping_param = var_InheritFloat(priv->gl, "tone-mapping-param");
-#    if PL_API_VER >= 10
         color_params.desaturation_strength = var_InheritFloat(priv->gl, "desat-strength");
         color_params.desaturation_exponent = var_InheritFloat(priv->gl, "desat-exponent");
         color_params.desaturation_base = var_InheritFloat(priv->gl, "desat-base");
-#    else
-        color_params.tone_mapping_desaturate = var_InheritFloat(priv->gl, "tone-mapping-desat");
-#    endif
         color_params.gamut_warning = var_InheritBool(priv->gl, "tone-mapping-warn");
 
         struct pl_color_space dst_space = pl_color_space_unknown;
@@ -1126,20 +1122,16 @@ CreateSampler(struct vlc_gl_interop *interop, struct vlc_gl_t *gl,
     // Create the main libplacebo context
     priv->pl_ctx = vlc_placebo_CreateContext(VLC_OBJECT(gl));
     if (priv->pl_ctx) {
-#   if PL_API_VER >= 20
         priv->pl_sh = pl_shader_alloc(priv->pl_ctx, &(struct pl_shader_params) {
             .glsl = {
-#       ifdef USE_OPENGL_ES2
+#   ifdef USE_OPENGL_ES2
                 .version = 100,
                 .gles = true,
-#       else
+#   else
                 .version = 120,
-#       endif
+#   endif
             },
         });
-#   else
-        priv->pl_sh = pl_shader_alloc(priv->pl_ctx, NULL, 0);
-#   endif
     }
 #endif
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/167f1af49c1861bb2a36bb8360fb636ebf878367...9c284d796644bcef8257aa2916b94f36f2591c2a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/167f1af49c1861bb2a36bb8360fb636ebf878367...9c284d796644bcef8257aa2916b94f36f2591c2a
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list