Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avfilter/vf_libplacebo: replace preproc directive in function-like macros (PR #21247)
@ 2025-12-19 19:20 nikitalita via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: nikitalita via ffmpeg-devel @ 2025-12-19 19:20 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: nikitalita

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 <69168929+nikitalita@users.noreply.github.com>
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 -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-12-19 19:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-19 19:20 [FFmpeg-devel] [PATCH] avfilter/vf_libplacebo: replace preproc directive in function-like macros (PR #21247) nikitalita via ffmpeg-devel

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git