[FFmpeg-devel] [PATCH] avfilter, avcodec: Finish gating empty X86ASM-OBJS files for Nasm (PR #21007)
PR #21007 opened by Amyspark (amyspark) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21007 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21007.patch Hi all, This MR comes from the GStreamer Meson port of FFmpeg. The files gated here are empty on all platforms but x86_64; these cause Nasm to panic when generating debug information, and MSVC < 2022 17.6 to hang when attempting to link them. See e.g. - https://bugzilla.nasm.us/show_bug.cgi?id=3392738 - https://developercommunity.visualstudio.com/t/MSVC-Hangs-when-compiling-ffmpeg-When-l/10233953 The original 262e7439c6 only addressed simple_idct*.asm on avcodec, on GStreamer we found a few more that were looked over. All feedback is really appreciated. >From a03c7a560a8c33977ac93022ad64901c7427ce7e Mon Sep 17 00:00:00 2001 From: "L. E. Segovia" Date: Mon, 24 Nov 2025 17:58:08 + Subject: [PATCH 1/2] avcodec/Makefile: Finish gating empty X86ASM-OBJS files for Nasm The files gated here are empty on all platforms but x86_64; these cause Nasm to panic when generating debug information, and MSVC < 2022 17.6 to hang when attempting to link them. See e.g. - https://bugzilla.nasm.us/show_bug.cgi?id=3392738 - https://developercommunity.visualstudio.com/t/MSVC-Hangs-when-compiling-ffmpeg-When-l/10233953 The original 262e7439c6d58564d21b05ade84bac4482ef only addressed simple_idct*.asm, on GStreamer we found a few more that were looked over. --- libavcodec/x86/Makefile | 16 libavcodec/x86/hevc/Makefile | 6 -- libavcodec/x86/vvc/Makefile | 2 ++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile index 1c1e14b4b8..80f1e72ce1 100644 --- a/libavcodec/x86/Makefile +++ b/libavcodec/x86/Makefile @@ -150,9 +150,13 @@ X86ASM-OBJS-$(CONFIG_ADPCM_G722_DECODER) += x86/g722dsp.o X86ASM-OBJS-$(CONFIG_ADPCM_G722_ENCODER) += x86/g722dsp.o X86ASM-OBJS-$(CONFIG_ALAC_DECODER) += x86/alacdsp.o X86ASM-OBJS-$(CONFIG_APNG_DECODER) += x86/pngdsp.o +ifdef ARCH_X86_64 X86ASM-OBJS-$(CONFIG_APV_DECODER) += x86/apv_dsp.o +endif X86ASM-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsidct.o x86/cavs_qpel.o +ifdef ARCH_X86_64 X86ASM-OBJS-$(CONFIG_CFHD_ENCODER) += x86/cfhdencdsp.o +endif X86ASM-OBJS-$(CONFIG_CFHD_DECODER) += x86/cfhddsp.o X86ASM-OBJS-$(CONFIG_DCA_DECODER) += x86/dcadsp.o x86/synth_filter.o X86ASM-OBJS-$(CONFIG_DIRAC_DECODER)+= x86/diracdsp.o\ @@ -165,16 +169,19 @@ X86ASM-OBJS-$(CONFIG_FLAC_ENCODER) += x86/flac_dsp_gpl.o endif X86ASM-OBJS-$(CONFIG_JPEG2000_DECODER) += x86/jpeg2000dsp.o X86ASM-OBJS-$(CONFIG_LSCR_DECODER) += x86/pngdsp.o -X86ASM-OBJS-$(CONFIG_MLP_DECODER) += x86/mlpdsp.o X86ASM-OBJS-$(CONFIG_MPEG4_DECODER)+= x86/xvididct.o X86ASM-OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp.o +ifdef ARCH_X86_64 X86ASM-OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp.o X86ASM-OBJS-$(CONFIG_PRORES_RAW_DECODER) += x86/proresdsp.o +endif X86ASM-OBJS-$(CONFIG_RV40_DECODER) += x86/rv40dsp.o X86ASM-OBJS-$(CONFIG_SBC_ENCODER) += x86/sbcdsp.o X86ASM-OBJS-$(CONFIG_SVQ1_ENCODER) += x86/svq1enc.o X86ASM-OBJS-$(CONFIG_TAK_DECODER) += x86/takdsp.o +ifdef ARCH_X86_64 X86ASM-OBJS-$(CONFIG_TRUEHD_DECODER) += x86/mlpdsp.o +endif X86ASM-OBJS-$(CONFIG_TTA_DECODER) += x86/ttadsp.o X86ASM-OBJS-$(CONFIG_TTA_ENCODER) += x86/ttaencdsp.o X86ASM-OBJS-$(CONFIG_UTVIDEO_DECODER) += x86/utvideodsp.o @@ -185,12 +192,13 @@ X86ASM-OBJS-$(CONFIG_VP6_DECODER) += x86/vp6dsp.o X86ASM-OBJS-$(CONFIG_VP9_DECODER) += x86/vp9intrapred.o\ x86/vp9intrapred_16bpp.o \ x86/vp9itxfm.o\ - x86/vp9itxfm_avx2.o \ - x86/vp9itxfm_avx512.o \ x86/vp9itxfm_16bpp.o \ - x86/vp9itxfm_16bpp_avx512.o \ x86/vp9lpf.o \ x86/vp9lpf_16bpp.o\ x86/vp9mc.o \ x86/vp9mc_16bpp.o +ifdef ARCH_X86_64 +X86ASM-OBJS-$(CONFIG_VP9_DECODER) += x86/vp9itxfm_avx512.o \ + x86/vp9itxfm_16bpp_avx512.o +endif X86ASM-OBJS-$(CONFIG_WEBP_DECODER) += x86/vp8dsp.o diff --git a/libavcodec/x86/hevc/Makefile b/libavcodec/x86/hevc/Makefile index 8f1c88c569..b36715d503 100644 --- a/libavcodec/x86/hevc/Makefile +++ b/libavcodec/x86/hevc/Makefile @@ -8,5 +8,7 @@ X86ASM-OBJS-$(CONFIG_HEVC_DECODER) += x86/hevc/add_res.o \ x86/hevc/idct.o \ x86/hev
[FFmpeg-devel] [PATCH] avfilter/yadif_videotoolbox: Add missing include (PR #21025)
PR #21025 opened by Amyspark (amyspark)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21025
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21025.patch
Hi all,
This PR is to fix a little hidden corner case regarding VideoToolbox support.
The macro `NULL_IF_CONFIG_SMALL` is declared in libavutil/internal.h, which is
not included previously in yadif_videotoolbox.m. This is only revealed when
targeting ISO C99 or later (e.g. `-std=c17` as is used in GStreamer's Meson
port) under Xcode 26, because it causes a hard build error:
```
../libavfilter/vf_yadif_videotoolbox.m:437:23: error: call to undeclared
function 'NULL_IF_CONFIG_SMALL'; ISO C99 and later do not support implicit
function declarations [-Wimplicit-function-declaration]
437 | .p.description = NULL_IF_CONFIG_SMALL("YADIF for VideoToolbox
frames using Metal compute"),
| ^
../libavfilter/vf_yadif_videotoolbox.m:437:23: error: incompatible integer to
pointer conversion initializing 'const char *' with an expression of type 'int'
[-Wint-conversion]
437 | .p.description = NULL_IF_CONFIG_SMALL("YADIF for VideoToolbox
frames using Metal compute"),
|
^
../libavfilter/vf_yadif_videotoolbox.m:437:23: error: initializer element is
not a compile-time constant
437 | .p.description = NULL_IF_CONFIG_SMALL("YADIF for VideoToolbox
frames using Metal compute"),
|
^
```
All feedback is appreciated.
>From ba95d2c1f1e441a01ed668ff3c7e4d4709dc2d38 Mon Sep 17 00:00:00 2001
From: "L. E. Segovia"
Date: Wed, 26 Nov 2025 16:31:54 +
Subject: [PATCH] avfilter/yadif_videotoolbox: Add missing include
NULL_IF_CONFIG_SMALL is declared in libavutil/internal.h, which is not
included previously. When targeting ISO C99 or later (e.g. `-std=c17`
as is used in GStreamer's Meson port) under Xcode 26, this causes a
hard build error:
../libavfilter/vf_yadif_videotoolbox.m:437:23: error: call to undeclared
function 'NULL_IF_CONFIG_SMALL'; ISO C99 and later do not support implicit
function declarations [-Wimplicit-function-declaration]
437 | .p.description = NULL_IF_CONFIG_SMALL("YADIF for VideoToolbox
frames using Metal compute"),
| ^
../libavfilter/vf_yadif_videotoolbox.m:437:23: error: incompatible integer to
pointer conversion initializing 'const char *' with an expression of type 'int'
[-Wint-conversion]
437 | .p.description = NULL_IF_CONFIG_SMALL("YADIF for VideoToolbox
frames using Metal compute"),
|
^
../libavfilter/vf_yadif_videotoolbox.m:437:23: error: initializer element is
not a compile-time constant
437 | .p.description = NULL_IF_CONFIG_SMALL("YADIF for VideoToolbox
frames using Metal compute"),
|
^
---
libavfilter/vf_yadif_videotoolbox.m | 1 +
1 file changed, 1 insertion(+)
diff --git a/libavfilter/vf_yadif_videotoolbox.m
b/libavfilter/vf_yadif_videotoolbox.m
index f8eb0c6bfa..89f0e3b32e 100644
--- a/libavfilter/vf_yadif_videotoolbox.m
+++ b/libavfilter/vf_yadif_videotoolbox.m
@@ -25,6 +25,7 @@
#include "libavutil/avassert.h"
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_videotoolbox.h"
+#include "libavutil/internal.h"
#include "libavutil/objc.h"
#include
--
2.49.1
___
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
[FFmpeg-devel] [PATCH] Replace DCE with macros to guard usage of undefined functions and clauses (PR #21034)
PR #21034 opened by Amyspark (amyspark)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21034
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21034.patch
Hi all,
This is a MR following up on
https://code.ffmpeg.org/FFmpeg/ffmpeg/commit/40b56c6536dc6e181da4025b99a1d6d3c047da3c,
which addressed some DCE issues with MSVC. The commits here address the
remaining cases I found during my tests with FFmpeg 5.x, 7.1 and 8.0.
Please note that there are different approaches based on when I'd written the
code -- for most cases I preferred a single wrapping with `#if HAVE_X86ASM`,
while for the smaller ones I addressed them case-by-case with `#if
HAVE__EXTERNAL`. I'm happy to edit this MR with the correct
approach once reviewed.
All feedback is appreciated.
>From 2353f750ff96d2263c4624e5b42e59861482f780 Mon Sep 17 00:00:00 2001
From: "L. E. Segovia"
Date: Thu, 27 Nov 2025 08:22:27 -0300
Subject: [PATCH 1/7] avcodec/x86: replace DCE with macros to guard usage of
undefined functions
See e.g.
https://github.com/FFmpeg/ffmpeg/commit/40b56c6536dc6e181da4025b99a1d6d3c047da3c
Signed-off-by: L. E. Segovia
---
libavcodec/x86/fdctdsp_init.c| 2 +
libavcodec/x86/flacdsp_init.c| 8 +++-
libavcodec/x86/hevc/dsp_init.c | 72 ++--
libavcodec/x86/idctdsp_init.c| 9 ++--
libavcodec/x86/mlpdsp_init.c | 6 ++-
libavfilter/x86/colorspacedsp_init.c | 4 +-
libavfilter/x86/vf_atadenoise_init.c | 6 ++-
libavfilter/x86/vf_ssim_init.c | 4 +-
libavfilter/x86/vf_w3fdif_init.c | 4 +-
9 files changed, 67 insertions(+), 48 deletions(-)
diff --git a/libavcodec/x86/fdctdsp_init.c b/libavcodec/x86/fdctdsp_init.c
index 107912afc8..9958b32466 100644
--- a/libavcodec/x86/fdctdsp_init.c
+++ b/libavcodec/x86/fdctdsp_init.c
@@ -32,8 +32,10 @@ av_cold void ff_fdctdsp_init_x86(FDCTDSPContext *c,
AVCodecContext *avctx,
if (!high_bit_depth) {
if ((dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX)) {
+#if HAVE_INLINE_SSE2
if (INLINE_SSE2(cpu_flags))
c->fdct = ff_fdct_sse2;
+#endif
}
}
#endif
diff --git a/libavcodec/x86/flacdsp_init.c b/libavcodec/x86/flacdsp_init.c
index fa993d3466..89335bcb70 100644
--- a/libavcodec/x86/flacdsp_init.c
+++ b/libavcodec/x86/flacdsp_init.c
@@ -105,15 +105,19 @@ av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum
AVSampleFormat fmt, int
}
if (EXTERNAL_AVX(cpu_flags)) {
if (fmt == AV_SAMPLE_FMT_S16) {
-if (ARCH_X86_64 && channels == 8)
+#if ARCH_X86_64
+if (channels == 8)
c->decorrelate[0] = ff_flac_decorrelate_indep8_16_avx;
+#endif
} else if (fmt == AV_SAMPLE_FMT_S32) {
if (channels == 4)
c->decorrelate[0] = ff_flac_decorrelate_indep4_32_avx;
else if (channels == 6)
c->decorrelate[0] = ff_flac_decorrelate_indep6_32_avx;
-else if (ARCH_X86_64 && channels == 8)
+#if ARCH_X86_64
+else if (channels == 8)
c->decorrelate[0] = ff_flac_decorrelate_indep8_32_avx;
+#endif
}
}
if (EXTERNAL_XOP(cpu_flags)) {
diff --git a/libavcodec/x86/hevc/dsp_init.c b/libavcodec/x86/hevc/dsp_init.c
index f1558b7e3e..a02a57a9ac 100644
--- a/libavcodec/x86/hevc/dsp_init.c
+++ b/libavcodec/x86/hevc/dsp_init.c
@@ -821,13 +821,13 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int
bit_depth)
if (EXTERNAL_SSE2(cpu_flags)) {
c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_8_sse2;
c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_8_sse2;
-if (ARCH_X86_64) {
-c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_sse2;
-c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_sse2;
+#if ARCH_X86_64
+c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_sse2;
+c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_sse2;
-c->idct[2] = ff_hevc_idct_16x16_8_sse2;
-c->idct[3] = ff_hevc_idct_32x32_8_sse2;
-}
+c->idct[2] = ff_hevc_idct_16x16_8_sse2;
+c->idct[3] = ff_hevc_idct_32x32_8_sse2;
+#endif
SAO_BAND_INIT(8, sse2);
c->idct_dc[0] = ff_hevc_idct_4x4_dc_8_sse2;
@@ -842,13 +842,13 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int
bit_depth)
c->add_residual[2] = ff_hevc_add_residual_16_8_sse2;
c->add_residual[3] = ff_hevc_add_residual_32_8_sse2;
}
+#if HAVE_SSSE3_EXTERNAL && ARCH_X86_64
if (EXTERNAL_SSSE3(cpu_flags)) {
-if(ARCH_X86_64) {
-c->hevc_v_loop_filter_luma =
ff_hevc_v_loop_filter_luma_8_ssse3;
-c->hevc_h_loop_filter_luma =
ff_hevc_h_loop_filter_luma_8_ssse3;
-}
+c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_ssse3;
+c->h
