PR #21247 opened by nikitalita URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21247 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21247.patch
Fixes #21246 MSVC build was failing due to preprocessor directives being used within function-like macro argument lists, which is undefined behavior according to the C11 spec. Fixed by replacing the directive blocks with macro definitions outside of the macro invocations. >From e5dc07cc8eef02ba388c7518e19058997a501edc Mon Sep 17 00:00:00 2001 From: nikitalita <[email protected]> Date: Fri, 19 Dec 2025 11:10:55 -0800 Subject: [PATCH] avfilter/vf_libplacebo: replace preproc directive in function-like macros MSVC build was failing due to preprocessor directives being used within function-like macro argument lists, which is undefined behavior according to the C11 spec. Fixed by replacing the directive blocks with macro definitions outside of the macro invocations. --- libavfilter/vf_libplacebo.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index c8015a9641..d42a20cf71 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -451,24 +451,31 @@ static int update_settings(AVFilterContext *ctx) .temperature = (s->temperature - 6500.0) / 3500.0, }; +#if PL_API_VER >= 263 +#define pl_peak_detect_params_extra .percentile = s->percentile, +#else +#define pl_peak_detect_params_extra +#endif + opts->peak_detect_params = *pl_peak_detect_params( .smoothing_period = s->smoothing, .scene_threshold_low = s->scene_low, .scene_threshold_high = s->scene_high, -#if PL_API_VER >= 263 - .percentile = s->percentile, -#endif + pl_peak_detect_params_extra ); +#if PL_API_VER >= 285 +#define pl_color_map_params_extra .contrast_recovery = s->contrast_recovery, .contrast_smoothness = s->contrast_smoothness, +#else +#define pl_color_map_params_extra +#endif + opts->color_map_params = *pl_color_map_params( .tone_mapping_function = get_tonemapping_func(s->tonemapping), .tone_mapping_param = s->tonemapping_param, .inverse_tone_mapping = s->inverse_tonemapping, .lut_size = s->tonemapping_lut_size, -#if PL_API_VER >= 285 - .contrast_recovery = s->contrast_recovery, - .contrast_smoothness = s->contrast_smoothness, -#endif + pl_color_map_params_extra ); set_gamut_mode(&opts->color_map_params, gamut_mode); @@ -484,6 +491,12 @@ static int update_settings(AVFilterContext *ctx) .strength = s->cone_str, ); +#if PL_API_VER >= 277 +#define pl_render_params_extra .corner_rounding = s->corner_rounding, +#else +#define pl_render_params_extra +#endif + opts->params = *pl_render_params( .antiringing_strength = s->antiringing, .background_transparency = 1.0f - (float) s->fillcolor[3] / UINT8_MAX, @@ -492,9 +505,7 @@ static int update_settings(AVFilterContext *ctx) (float) s->fillcolor[1] / UINT8_MAX, (float) s->fillcolor[2] / UINT8_MAX, }, -#if PL_API_VER >= 277 - .corner_rounding = s->corner_rounding, -#endif + pl_render_params_extra .deinterlace_params = &opts->deinterlace_params, .deband_params = s->deband ? &opts->deband_params : NULL, -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
