Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: nikitalita via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: nikitalita <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avfilter/vf_libplacebo: replace preproc directive in function-like macros (PR #21247)
Date: Fri, 19 Dec 2025 19:20:44 -0000
Message-ID: <176617204535.60.16496829032412283367@2cb04c0e5124> (raw)

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

                 reply	other threads:[~2025-12-19 19:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176617204535.60.16496829032412283367@2cb04c0e5124 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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