[vlc-commits] [Git][videolan/vlc][master] 12 commits: configure: bump libplacebo minimum version to v4.192

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Jul 13 16:41:42 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
6781d5a3 by Niklas Haas at 2023-07-13T14:14:24+00:00
configure: bump libplacebo minimum version to v4.192

Ubuntu LTS (jammy) is on 4.192, debian stable (bookworm) is on 4.208.

- - - - -
1234a8ac by Niklas Haas at 2023-07-13T14:14:24+00:00
configure: simplify HAVE_LIBPLACEBO_SCALE check

No longer need to check the version. Rename it to HAVE_LIBPLACEBO_GL
because it is now 1 iff <libplacebo/opengl.h> is available.

It's worth pointing out that, starting with libplacebo v5.228, these
header checks will become redundant also, as the platform-specific
headers will always be available.

- - - - -
1fe0a9f7 by Niklas Haas at 2023-07-13T14:14:24+00:00
pl_scale: drop redundant PL_API_VER checks

- - - - -
0d0b84de by Niklas Haas at 2023-07-13T14:14:24+00:00
libplacebo/display: drop redundant PL_API_VER checks

- - - - -
e559393e by Niklas Haas at 2023-07-13T14:14:24+00:00
libplacebo/utils: drop redundant PL_API_VER checks

- - - - -
12610e9a by Niklas Haas at 2023-07-13T14:14:24+00:00
opengl/utils: merge redundant submacro

- - - - -
85a04a2e by Niklas Haas at 2023-07-13T14:14:24+00:00
libplacebo/utils: update for new pl_color_space struct

This entire struct was substantially refactored in recent versions of
libplacebo, to correspond more closely to the "source" values.

This allows us to map this information much more faithfully, and
coincidentally also fixes a bug where the old max_luminance value was
calculated very incorrectly.

- - - - -
10694d95 by Niklas Haas at 2023-07-13T14:14:24+00:00
libplacebo/display: update for PL_API_VER 254

`allow_delayed_peak_detect` was grouped with the other peak detection
params.

- - - - -
4a067967 by Niklas Haas at 2023-07-13T14:14:24+00:00
libplacebo/utils: remove deprecated tone_mapping_mode

Removed upstream, non-functional now.

- - - - -
bae7d7e5 by Niklas Haas at 2023-07-13T14:14:24+00:00
libplacebo/utils: remove crosstalk param

Now hard-coded to 0.04 upstream.

- - - - -
d9eca774 by Niklas Haas at 2023-07-13T14:14:24+00:00
libplacebo/utils: add new gamut mapping settings

The gamut mapping settings were substantially refactored upstream. Add
support for the new modes, while retaining backwards compatibility for
the older configuration API.

- - - - -
728eb8ae by Niklas Haas at 2023-07-13T14:14:24+00:00
libplacebo/display: add HDR contrast recovery

Disabled by default (via pl_color_map_params).

- - - - -


7 changed files:

- configure.ac
- contrib/src/libplacebo/rules.mak
- modules/video_output/libplacebo/display.c
- modules/video_output/libplacebo/utils.c
- modules/video_output/libplacebo/utils.h
- modules/video_output/opengl/Makefile.am
- modules/video_output/opengl/pl_scale.c


Changes:

=====================================
configure.ac
=====================================
@@ -3191,19 +3191,16 @@ AC_ARG_ENABLE([libplacebo],
   AS_HELP_STRING([--disable-libplacebo],
       [disable libplacebo support (default auto)]))
 
-have_libplacebo_glscale="no"
+have_libplacebo_gl="no"
 AS_IF([test "$enable_libplacebo" != "no"], [
-  PKG_CHECK_MODULES([LIBPLACEBO], [libplacebo >= 4.157], [
+  PKG_CHECK_MODULES([LIBPLACEBO], [libplacebo >= 4.192], [
     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], [
         AC_DEFINE([HAVE_LIBPLACEBO_GL], [1], [Define to 1 if <libplacebo/opengl.h> is available.])
         VLC_ADD_PLUGIN([placebo_gl])
         VLC_ADD_PLUGIN([placebo_gles2])
-        dnl Minimum version that the OpenGL filter pl_scale is compatible with
-        PKG_CHECK_MODULES([LIBPLACEBO], [libplacebo >= 4.167],
-            [have_libplacebo_glscale="yes"],
-            [have_libplacebo_glscale="no"])
+        have_libplacebo_gl="yes"
     ])
   ], [
     AS_IF([test -n "${enable_libplacebo}"], [
@@ -3213,7 +3210,7 @@ AS_IF([test "$enable_libplacebo" != "no"], [
   ])
 ])
 AM_CONDITIONAL([HAVE_LIBPLACEBO], [test "$enable_libplacebo" != "no"])
-AM_CONDITIONAL([HAVE_LIBPLACEBO_SCALE], [test "$have_libplacebo_glscale" = "yes"])
+AM_CONDITIONAL([HAVE_LIBPLACEBO_GL], [test "$have_libplacebo_gl" = "yes"])
 
 dnl
 dnl  OpenGL


=====================================
contrib/src/libplacebo/rules.mak
=====================================
@@ -16,7 +16,7 @@ DEPS_libplacebo = glad $(DEPS_glad) jinja $(DEPS_jinja) glslang $(DEPS_glslang)
 ifndef HAVE_WINSTORE
 PKGS += libplacebo
 endif
-ifeq ($(call need_pkg,"libplacebo >= 4.157"),)
+ifeq ($(call need_pkg,"libplacebo >= 4.192"),)
 PKGS_FOUND += libplacebo
 endif
 


=====================================
modules/video_output/libplacebo/display.c
=====================================
@@ -73,9 +73,7 @@ typedef struct vout_display_sys_t
     const struct pl_hook *hook;
     char *hook_path;
 
-#if PL_API_VER >= 185
     struct pl_dovi_metadata dovi_metadata;
-#endif
 } vout_display_sys_t;
 
 // Display callbacks
@@ -246,9 +244,7 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
         },
     };
 
-#if PL_API_VER >= 185
     vlc_placebo_frame_DoviMetadata(&img, pic, &sys->dovi_metadata);
-#endif
 
     struct vlc_ancillary *iccp = picture_GetAncillary(pic, VLC_ANCILLARY_ID_ICC);
     if (iccp) {
@@ -316,7 +312,6 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
         place.height = -place.height;
     }
 
-#if PL_API_VER >= 162
 #define SWAP(a, b) { float _tmp = (a); (a) = (b); (b) = _tmp; }
     switch (vd->fmt->orientation) {
     case ORIENT_HFLIPPED:
@@ -344,7 +339,6 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
     default:
         break;
     }
-#endif
 
     target.crop = (struct pl_rect2df) {
         place.x, place.y, place.x + place.width, place.y + place.height,
@@ -353,12 +347,8 @@ static void PictureRender(vout_display_t *vd, picture_t *pic,
     // Override the target colorimetry only if the user requests it
     if (sys->target.primaries)
         target.color.primaries = sys->target.primaries;
-    if (sys->target.transfer) {
+    if (sys->target.transfer)
         target.color.transfer = sys->target.transfer;
-#if PL_API_VER < 189
-        target.color.light = PL_COLOR_LIGHT_UNKNOWN; // re-infer
-#endif
-    }
     if (sys->dither_depth > 0) {
         // override the sample depth without affecting the color encoding
         struct pl_bit_encoding *bits = &target.repr.bits;
@@ -735,6 +725,13 @@ vlc_module_begin ()
     add_float("pl-scene-threshold-high", pl_peak_detect_default_params.scene_threshold_high,
             SCENE_THRESHOLD_HIGH_TEXT, SCENE_THRESHOLD_HIGH_LONGTEXT)
 
+#if PL_API_VER >= 285
+    add_float_with_range("pl-contrast-recovery", pl_color_map_default_params.contrast_recovery,
+            0., 3., CONTRAST_RECOVERY_TEXT, CONTRAST_RECOVERY_LONGTEXT)
+    add_float_with_range("pl-contrast-smoothness", pl_color_map_default_params.contrast_smoothness,
+            0., 10., CONTRAST_SMOOTHNESS_TEXT, CONTRAST_SMOOTHNESS_LONGTEXT)
+#endif
+
     set_section("Dithering", NULL)
     add_integer("pl-dither", -1,
             DITHER_TEXT, DITHER_LONGTEXT)
@@ -832,10 +829,18 @@ static void UpdateParams(vout_display_t *vd)
     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");
-    if (sys->peak_detect.smoothing_period > 0.0) {
+#if PL_API_VER >= 254
+    sys->peak_detect.allow_delayed = var_InheritBool(vd, "pl-delayed-peak");
+#else
+    sys->params.allow_delayed_peak_detect = var_InheritBool(vd, "pl-delayed-peak");
+#endif
+    if (sys->peak_detect.smoothing_period > 0.0)
         sys->params.peak_detect_params = &sys->peak_detect;
-        sys->params.allow_delayed_peak_detect = var_InheritBool(vd, "pl-delayed-peak");
-    }
+
+#if PL_API_VER >= 285
+    sys->color_map.contrast_recovery = var_InheritFloat(vd, "pl-contrast-recovery");
+    sys->color_map.contrast_smoothness = var_InheritFloat(vd, "pl-contrast-smoothness");
+#endif
 
     int preset = var_InheritInteger(vd, "pl-upscaler-preset");
     sys->params.upscaler = scale_config[preset];


=====================================
modules/video_output/libplacebo/utils.c
=====================================
@@ -391,26 +391,25 @@ struct pl_color_space vlc_placebo_ColorSpace(const video_format_t *fmt)
         [TRANSFER_FUNC_SMPTE_240]   = PL_COLOR_TRC_BT_1886,
     };
 
-    // Derive the signal peak/avg from the color light level metadata
-    float sig_peak = fmt->lighting.MaxCLL / PL_COLOR_REF_WHITE;
-    float sig_avg = fmt->lighting.MaxFALL / PL_COLOR_REF_WHITE;
-
-    // As a fallback value for the signal peak, we can also use the mastering
-    // metadata's luminance information
-    if (!sig_peak)
-        sig_peak = fmt->mastering.max_luminance / (10000.0 * PL_COLOR_REF_WHITE);
-
-    // Sanitize the sig_peak/sig_avg, because of buggy or low quality tagging
-    // that's sadly common in lots of typical sources
-    sig_peak = (sig_peak > 1.0 && sig_peak <= 100.0) ? sig_peak : 0.0;
-    sig_avg  = (sig_avg >= 0.0 && sig_avg <= 1.0) ? sig_avg : 0.0;
-
     return (struct pl_color_space) {
         .primaries = primaries[fmt->primaries],
         .transfer  = transfers[fmt->transfer],
-        .light     = PL_COLOR_LIGHT_UNKNOWN,
-        .sig_peak  = sig_peak,
-        .sig_avg   = sig_avg,
+        .hdr = {
+            .prim = {
+                .green.x = fmt->mastering.primaries[0],
+                .green.y = fmt->mastering.primaries[1],
+                .blue.x  = fmt->mastering.primaries[2],
+                .blue.y  = fmt->mastering.primaries[3],
+                .red.x   = fmt->mastering.primaries[4],
+                .red.y   = fmt->mastering.primaries[5],
+                .white.x = fmt->mastering.white_point[0],
+                .white.y = fmt->mastering.white_point[1],
+            },
+            .min_luma = fmt->mastering.min_luminance,
+            .max_luma = fmt->mastering.max_luminance,
+            .max_cll = fmt->lighting.MaxCLL,
+            .max_fall = fmt->lighting.MaxFALL,
+        },
     };
 }
 
@@ -473,7 +472,6 @@ void vlc_placebo_HdrMetadata(const vlc_video_hdr_dynamic_metadata_t *src,
 #endif
 }
 
-#if PL_API_VER >= 185
 void vlc_placebo_DoviMetadata(const vlc_video_dovi_metadata_t *src,
                               struct pl_dovi_metadata *dst)
 {
@@ -542,7 +540,6 @@ void vlc_placebo_frame_DoviMetadata(struct pl_frame *frame, const picture_t *pic
     frame->color.hdr.max_luma = pl_hdr_rescale(PL_HDR_PQ, PL_HDR_NITS,
                                                scale * src->source_max_pq);
 }
-#endif
 
 enum pl_chroma_location vlc_placebo_ChromaLoc(const video_format_t *fmt)
 {
@@ -583,12 +580,34 @@ void vlc_placebo_ColorMapParams(vlc_object_t *obj, const char *prefix,
     char opt[64];
 
     *params = pl_color_map_default_params;
-    params->intent = var_InheritInteger(obj, PREFIX("rendering-intent"));
-    params->tone_mapping_param = var_InheritFloat(obj, PREFIX("tone-mapping-param"));
+
+    switch (var_InheritInteger(obj, PREFIX("gamut-mapping"))) {
+    case GAMUT_AUTO:        break;
+#if PL_API_VER >= 269
+    case GAMUT_CLIP:        params->gamut_mapping = &pl_gamut_map_clip; break;
+    case GAMUT_PERCEPTUAL:  params->gamut_mapping = &pl_gamut_map_perceptual; break;
+    case GAMUT_RELATIVE:    params->gamut_mapping = &pl_gamut_map_relative; break;
+    case GAMUT_SATURATION:  params->gamut_mapping = &pl_gamut_map_saturation; break;
+    case GAMUT_ABSOLUTE:    params->gamut_mapping = &pl_gamut_map_absolute; break;
+    case GAMUT_DESATURATE:  params->gamut_mapping = &pl_gamut_map_desaturate; break;
+    case GAMUT_DARKEN:      params->gamut_mapping = &pl_gamut_map_darken; break;
+    case GAMUT_WARN:        params->gamut_mapping = &pl_gamut_map_highlight; break;
+    case GAMUT_LINEAR:      params->gamut_mapping = &pl_gamut_map_linear; break;
+#else
+    case GAMUT_CLIP:        params->gamut_mode = PL_GAMUT_CLIP; break;
+    case GAMUT_PERCEPTUAL:  break; // unsupported
+    case GAMUT_RELATIVE:    params->intent = PL_INTENT_RELATIVE_COLORIMETRIC; break;
+    case GAMUT_SATURATION:  params->intent = PL_INTENT_SATURATION; break;
+    case GAMUT_ABSOLUTE:    params->intent = PL_INTENT_ABSOLUTE_COLORIMETRIC; break;
+    case GAMUT_DESATURATE:  params->gamut_mode = PL_GAMUT_DESATURATE;
+    case GAMUT_DARKEN:      params->gamut_mode = PL_GAMUT_DARKEN;
+    case GAMUT_WARN:        params->gamut_mode = PL_GAMUT_WARN;
+    case GAMUT_LINEAR:      break; // unsupported
+#endif
+    }
 
     switch (var_InheritInteger(obj, PREFIX("tone-mapping-function"))) {
     case TONEMAP_AUTO:      break;
-#if PL_API_VER >= 188
     case TONEMAP_CLIP:      params->tone_mapping_function = &pl_tone_map_clip; break;
     case TONEMAP_BT2390:    params->tone_mapping_function = &pl_tone_map_bt2390; break;
     case TONEMAP_REINHARD:  params->tone_mapping_function = &pl_tone_map_reinhard; break;
@@ -598,53 +617,8 @@ void vlc_placebo_ColorMapParams(vlc_object_t *obj, const char *prefix,
     case TONEMAP_LINEAR:    params->tone_mapping_function = &pl_tone_map_linear; break;
     case TONEMAP_BT2446A:   params->tone_mapping_function = &pl_tone_map_bt2446a; break;
     case TONEMAP_SPLINE:    params->tone_mapping_function = &pl_tone_map_spline; break;
-#else
-    case TONEMAP_CLIP:      params->tone_mapping_algo = PL_TONE_MAPPING_CLIP; break;
-    case TONEMAP_BT2390:    params->tone_mapping_algo = PL_TONE_MAPPING_BT_2390; break;
-    case TONEMAP_REINHARD:  params->tone_mapping_algo = PL_TONE_MAPPING_REINHARD; break;
-    case TONEMAP_MOBIUS:    params->tone_mapping_algo = PL_TONE_MAPPING_MOBIUS; break;
-    case TONEMAP_HABLE:     params->tone_mapping_algo = PL_TONE_MAPPING_HABLE; break;
-    case TONEMAP_GAMMA:     params->tone_mapping_algo = PL_TONE_MAPPING_GAMMA; break;
-    case TONEMAP_LINEAR:    params->tone_mapping_algo = PL_TONE_MAPPING_LINEAR; break;
-#endif
     }
 
-    switch (var_InheritInteger(obj, PREFIX("tone-mapping-mode"))) {
-    case TONEMAP_MODE_AUTO: break;
-#if PL_API_VER >= 188
-    case TONEMAP_MODE_RGB:      params->tone_mapping_mode = PL_TONE_MAP_RGB; break;
-    case TONEMAP_MODE_MAX:      params->tone_mapping_mode = PL_TONE_MAP_MAX; break;
-    case TONEMAP_MODE_HYBRID:   params->tone_mapping_mode = PL_TONE_MAP_HYBRID; break;
-    case TONEMAP_MODE_LUMA:     params->tone_mapping_mode = PL_TONE_MAP_LUMA; break;
-#else
-    case TONEMAP_MODE_RGB:
-        params->desaturation_strength = 1.0f;
-        params->desaturation_exponent = 0.0f;
-        break;
-    case TONEMAP_MODE_HYBRID:
-        // Use default values
-        break;
-    case TONEMAP_MODE_MAX:
-        params->desaturation_strength = 0.0f;
-        break;
-#endif
-    }
-
-    switch (var_InheritInteger(obj, PREFIX("gamut-mode"))) {
-#if PL_API_VER >= 190
-    case GAMUT_MODE_CLIP:   params->gamut_mode = PL_GAMUT_CLIP; break;
-    case GAMUT_MODE_WARN:   params->gamut_mode = PL_GAMUT_WARN; break;
-    case GAMUT_MODE_DESAT:  params->gamut_mode = PL_GAMUT_DESATURATE; break;
-    case GAMUT_MODE_DARKEN: params->gamut_mode = PL_GAMUT_DARKEN; break;
-#else
-    case GAMUT_MODE_CLIP:   break;
-    case GAMUT_MODE_WARN:   params->gamut_warning = true; break;
-    case GAMUT_MODE_DESAT:  params->gamut_clipping = true; break;
-#endif
-    }
-
-#if PL_API_VER >= 188
+    params->tone_mapping_param = var_InheritFloat(obj, PREFIX("tone-mapping-param"));
     params->inverse_tone_mapping = var_InheritBool(obj, PREFIX("inverse-tone-mapping"));
-    params->tone_mapping_crosstalk = var_InheritFloat(obj, PREFIX("crosstalk"));
-#endif
 }


=====================================
modules/video_output/libplacebo/utils.h
=====================================
@@ -43,7 +43,6 @@ enum pl_chroma_location vlc_placebo_ChromaLoc(const video_format_t *);
 void vlc_placebo_HdrMetadata(const vlc_video_hdr_dynamic_metadata_t *src,
                              struct pl_hdr_metadata *dst);
 
-#if PL_API_VER >= 185
 // Map raw dolby vision metadata struct
 void vlc_placebo_DoviMetadata(const vlc_video_dovi_metadata_t *src,
                               struct pl_dovi_metadata *dst);
@@ -51,7 +50,6 @@ void vlc_placebo_DoviMetadata(const vlc_video_dovi_metadata_t *src,
 // Map metadata from frame if present, using `data` as storage
 void vlc_placebo_frame_DoviMetadata(struct pl_frame *frame, const picture_t *pic,
                                     struct pl_dovi_metadata *data);
-#endif
 
 int vlc_placebo_PlaneComponents(const video_format_t *, struct pl_plane[4]);
 
@@ -69,52 +67,24 @@ bool vlc_placebo_FormatSupported(pl_gpu, vlc_fourcc_t);
 void vlc_placebo_ColorMapParams(vlc_object_t *obj, const char *prefix,
                                 struct pl_color_map_params *out_params);
 
-#if PL_API_VER >= 188
-# define add_placebo_extra_color_map_opts(prefix) \
-    add_bool(prefix"-inverse-tone-mapping", false, \
-            INVERSE_TONEMAPPING_TEXT, INVERSE_TONEMAPPING_LONGTEXT) \
-    add_float(prefix"-crosstalk", pl_color_map_default_params.tone_mapping_crosstalk, \
-            CROSSTALK_TEXT, CROSSTALK_LONGTEXT)
-#else
-# define add_placebo_extra_color_map_opts(prefix)
-#endif
-
 #define add_placebo_color_map_opts(prefix) \
-    add_integer(prefix"-rendering-intent", pl_color_map_default_params.intent, \
-            RENDER_INTENT_TEXT, RENDER_INTENT_LONGTEXT) \
-            change_integer_list(intent_values, intent_text) \
+    add_integer(prefix"-gamut-mapping", GAMUT_AUTO, \
+            GAMUT_MAPPING_TEXT, GAMUT_MAPPING_LONGTEXT) \
+            change_integer_list(gamut_values, gamut_text) \
+    add_obsolete_integer(prefix"-gamut-mode") /* since 4.0.0 */ \
+    add_obsolete_integer(prefix"-rendering-intent") /* since 4.0.0 */ \
     add_integer(prefix"-tone-mapping-function", TONEMAP_AUTO, \
             TONEMAP_FUNC_TEXT, TONEMAP_FUNC_LONGTEXT) \
             change_integer_list(tone_values, tone_text) \
     add_float(prefix"-tone-mapping-param", pl_color_map_default_params.tone_mapping_param, \
             TONEMAP_PARAM_TEXT, TONEMAP_PARAM_LONGTEXT) \
-    add_integer(prefix"-tone-mapping-mode", TONEMAP_MODE_AUTO, \
-            TONEMAP_MODE_TEXT, TONEMAP_MODE_LONGTEXT) \
-            change_integer_list(tone_mode_values, tone_mode_text) \
-    add_integer(prefix"-gamut-mode", GAMUT_MODE_CLIP, \
-            GAMUT_MODE_TEXT, GAMUT_MODE_LONGTEXT) \
-            change_integer_list(gamut_mode_values, gamut_mode_text) \
-    add_placebo_extra_color_map_opts(prefix)
+    add_obsolete_integer(prefix"-tone-mapping-mode") /* since 4.0.0 */ \
+    add_bool(prefix"-inverse-tone-mapping", false, \
+            INVERSE_TONEMAPPING_TEXT, INVERSE_TONEMAPPING_LONGTEXT) \
+    add_obsolete_integer(prefix"-crosstalk") /* since 4.0.0 */
 
 // Shared options strings/structs for libplacebo options
 
-#define RENDER_INTENT_TEXT "Rendering intent for color conversion"
-#define RENDER_INTENT_LONGTEXT "The mapping type used to convert between color spaces."
-
-static const int intent_values[] = {
-    PL_INTENT_PERCEPTUAL,
-    PL_INTENT_RELATIVE_COLORIMETRIC,
-    PL_INTENT_SATURATION,
-    PL_INTENT_ABSOLUTE_COLORIMETRIC,
-};
-
-static const char * const intent_text[] = {
-    "Perceptual",
-    "Relative colorimetric",
-    "Absolute colorimetric",
-    "Saturation",
-};
-
 #define PRIM_TEXT "Override detected display primaries"
 #define PRIM_LONGTEXT "Override the auto-detected display primaries."
 
@@ -260,10 +230,8 @@ enum {
     TONEMAP_HABLE,
     TONEMAP_GAMMA,
     TONEMAP_LINEAR,
-#if PL_API_VER >= 188
     TONEMAP_BT2446A,
     TONEMAP_SPLINE,
-#endif
 };
 
 static const int tone_values[] = {
@@ -275,10 +243,8 @@ static const int tone_values[] = {
     TONEMAP_HABLE,
     TONEMAP_GAMMA,
     TONEMAP_LINEAR,
-#if PL_API_VER >= 188
     TONEMAP_BT2446A,
     TONEMAP_SPLINE,
-#endif
 };
 
 static const char * const tone_text[] = {
@@ -290,10 +256,8 @@ static const char * const tone_text[] = {
     "Hable (filmic mapping)",
     "Gamma-Power law",
     "Perceptually linear stretch",
-#if PL_API_VER >= 188
     "ITU-R BT.2446 method A",
     "Single-pivot spline",
-#endif
 };
 
 #define TONEMAP_FUNC_TEXT "Tone-mapping function"
@@ -303,74 +267,50 @@ static const char * const tone_text[] = {
 #define TONEMAP_PARAM_LONGTEXT "This parameter can be used to tune the tone-mapping curve. Specifics depend on the curve used. If left as 0, the curve's preferred default is used."
 
 enum {
-    TONEMAP_MODE_AUTO,
-    TONEMAP_MODE_RGB,
-    TONEMAP_MODE_MAX,
-    TONEMAP_MODE_HYBRID,
-#if PL_API_VER >= 188
-    TONEMAP_MODE_LUMA,
-#endif
-};
-
-static const int tone_mode_values[] = {
-    TONEMAP_MODE_AUTO,
-    TONEMAP_MODE_RGB,
-    TONEMAP_MODE_MAX,
-    TONEMAP_MODE_HYBRID,
-#if PL_API_VER >= 188
-    TONEMAP_MODE_LUMA,
-#endif
-};
-
-static const char * const tone_mode_text[] = {
-    "Automatic selection (recommended)",
-    "Per-channel (RGB)",
-    "Maximum component",
-    "Hybrid luminance",
-#if PL_API_VER >= 188
-    "ITU-R BT.2446a luminance",
-#endif
-};
-
-#define TONEMAP_MODE_TEXT "Tone-mapping mode"
-#define TONEMAP_MODE_LONGTEXT "Determines what colorspace/component to apply the chosen tone-mapping curve to."
-
-enum {
-    GAMUT_MODE_CLIP,
-    GAMUT_MODE_WARN,
-    GAMUT_MODE_DESAT,
-#if PL_API_VER >= 190
-    GAMUT_MODE_DARKEN,
-#endif
-};
-
-static const int gamut_mode_values[] = {
-    GAMUT_MODE_CLIP,
-    GAMUT_MODE_WARN,
-    GAMUT_MODE_DESAT,
-#if PL_API_VER >= 190
-    GAMUT_MODE_DARKEN,
-#endif
-};
-
-static const char * const gamut_mode_text[] = {
+    GAMUT_AUTO,
+    GAMUT_CLIP,
+    GAMUT_PERCEPTUAL,
+    GAMUT_RELATIVE,
+    GAMUT_SATURATION,
+    GAMUT_ABSOLUTE,
+    GAMUT_DESATURATE,
+    GAMUT_DARKEN,
+    GAMUT_WARN,
+    GAMUT_LINEAR,
+};
+
+static const int gamut_values[] = {
+    GAMUT_AUTO,
+    GAMUT_CLIP,
+    GAMUT_PERCEPTUAL,
+    GAMUT_RELATIVE,
+    GAMUT_SATURATION,
+    GAMUT_ABSOLUTE,
+    GAMUT_DESATURATE,
+    GAMUT_DARKEN,
+    GAMUT_WARN,
+    GAMUT_LINEAR,
+};
+
+static const char * const gamut_text[] = {
+    "Automatic selection",
     "Hard clip",
-    "Highlight invalid pixels",
+    "Perceptual soft-clip",
+    "Relative colorimetric",
+    "Saturation mapping",
+    "Absolute colorimetric",
     "Colorimetrically desaturate",
-#if PL_API_VER >= 190
-    "Darken image",
-#endif
+    "Darken and clip",
+    "Highlight invalid pixels",
+    "Linear desaturate",
 };
 
-#define GAMUT_MODE_TEXT "Out-of-gamut handling"
-#define GAMUT_MODE_LONGTEXT "How to handle out-of-gamut colors while tone mapping."
+#define GAMUT_MAPPING_TEXT "Out-of-gamut handling"
+#define GAMUT_MAPPING_LONGTEXT "How to handle out-of-gamut colors while tone mapping."
 
 #define INVERSE_TONEMAPPING_TEXT "Inverse tone-mapping"
 #define INVERSE_TONEMAPPING_LONGTEXT "Expand SDR signals to HDR (only works for certain curves)."
 
-#define CROSSTALK_TEXT "Channel crosstalk"
-#define CROSSTALK_LONGTEXT "Extra channel crosstalk coefficient to apply while tone-mapping."
-
 #define PEAK_FRAMES_TEXT "HDR peak detection buffer size"
 #define PEAK_FRAMES_LONGTEXT "How many input frames to consider when determining the brightness of HDR signals. Higher values result in a slower/smoother response to brightness level changes. Setting this to 0 disables peak detection entirely."
 
@@ -386,6 +326,12 @@ static const char * const gamut_mode_text[] = {
 #define SCENE_THRESHOLD_HIGH_TEXT "Scene change upper threshold"
 #define SCENE_THRESHOLD_HIGH_LONGTEXT "This sets the upper boundary of a brightness change indicating a scene change. Brightness changes that exceed this value will instantly replace the detected peak, bypassing all smoothing. Setting this to a negative number disables this logic."
 
+#define CONTRAST_RECOVERY_TEXT "HDR contrast recovery strength"
+#define CONTRAST_RECOVERY_LONGTEXT "This sets the strength of the HDR contrast recovery algorithms. Higher values indicate more contrast boosting."
+
+#define CONTRAST_SMOOTHNESS_TEXT "HDR contrast recovery smoothness"
+#define CONTRAST_SMOOTHNESS_LONGTEXT "This sets the smoothness (lowpass frequency) of the HDR contrast recovery algorithm."
+
 #define DITHER_TEXT "Dithering algorithm"
 #define DITHER_LONGTEXT "The algorithm to use when dithering to a lower bit depth."
 


=====================================
modules/video_output/opengl/Makefile.am
=====================================
@@ -160,7 +160,7 @@ noinst_LTLIBRARIES += libglfilter_mock_plugin.la
 endif
 
 if HAVE_LIBPLACEBO
-if HAVE_LIBPLACEBO_SCALE
+if HAVE_LIBPLACEBO_GL
 
 libpl_scale_plugin_la_SOURCES = video_output/opengl/pl_scale.c
 libpl_scale_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBPLACEBO_CFLAGS)


=====================================
modules/video_output/opengl/pl_scale.c
=====================================
@@ -45,11 +45,6 @@
 #include "video_output/opengl/sampler.h"
 #include "video_output/libplacebo/utils.h"
 
-// Without this commit, libplacebo as used by this filter makes VLC
-// assert/crash by closing file descriptors:
-// https://github.com/haasn/libplacebo/commit/39fc39d31d65968709b4a05c571a0d85c918058d
-static_assert(PL_API_VER >= 167, "pl_scale requires libplacebo >= 4.167");
-
 #define CFG_PREFIX "plscale-"
 
 static const char *const filter_options[] = {
@@ -69,10 +64,7 @@ struct sys
     struct pl_frame frame_in;
     struct pl_frame frame_out;
     struct pl_render_params render_params;
-
-#if PL_API_VER >= 185
     struct pl_dovi_metadata dovi_metadata;
-#endif
 
     unsigned out_width;
     unsigned out_height;
@@ -178,7 +170,6 @@ Draw(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic,
         r->y1 = coords[3] * h;
     }
 
-#if PL_API_VER >= 185
     if (frame_in->repr.dovi && meta->dovi_rpu) {
         vlc_placebo_DoviMetadata(meta->dovi_rpu, &sys->dovi_metadata);
         struct pl_hdr_metadata *hdr = &frame_in->color.hdr;
@@ -188,7 +179,6 @@ Draw(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic,
         hdr->max_luma = pl_hdr_rescale(PL_HDR_PQ, PL_HDR_NITS,
                                        scale * meta->dovi_rpu->source_max_pq);
     }
-#endif
 
     GLint value;
     vt->GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &value);
@@ -310,14 +300,12 @@ Open(struct vlc_gl_filter *filter, const config_chain_t *config,
         .color = vlc_placebo_ColorSpace(&glfmt->fmt),
     };
 
-#if PL_API_VER >= 185
     if (glfmt->fmt.dovi.rpu_present && !glfmt->fmt.dovi.el_present) {
         sys->frame_in.color.primaries = PL_COLOR_PRIM_BT_2020;
         sys->frame_in.color.transfer = PL_COLOR_TRC_PQ;
         sys->frame_in.repr.sys = PL_COLOR_SYSTEM_DOLBYVISION;
         sys->frame_in.repr.dovi = &sys->dovi_metadata; /* to be filled later */
     }
-#endif
 
     /* Initialize frame_in.planes */
     int plane_count =



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e80595b5f5f0727645123b9c6c67713949045ea4...728eb8aeea16a1aaa95674b12e40d6d07871c84e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e80595b5f5f0727645123b9c6c67713949045ea4...728eb8aeea16a1aaa95674b12e40d6d07871c84e
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list