[FFmpeg-cvslog] all: Replace if (ARCH_FOO) checks by #if ARCH_FOO

Andreas Rheinhardt git at videolan.org
Wed Jun 15 06:24:28 EEST 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Jun 12 05:51:12 2022 +0200| [40e6575aa3eed64cd32bf28c00ae57edc5acb25a] | committer: Andreas Rheinhardt

all: Replace if (ARCH_FOO) checks by #if ARCH_FOO

This is more spec-compliant because it does not rely
on dead-code elimination by the compiler. Especially
MSVC has problems with this, as can be seen in
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/296373.html
or
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/297022.html

This commit does not eliminate every instance where we rely
on dead code elimination: It only tackles branching to
the initialization of arch-specific dsp code, not e.g. all
uses of CONFIG_ and HAVE_ checks. But maybe it is already
enough to compile FFmpeg with MSVC with whole-programm-optimizations
enabled (if one does not disable too many components).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=40e6575aa3eed64cd32bf28c00ae57edc5acb25a
---

 libavcodec/aacdec_template.c      |  5 ++--
 libavcodec/aacenc.c               | 10 ++++----
 libavcodec/aacpsdsp_template.c    | 17 ++++++-------
 libavcodec/aacsbr_template.c      |  5 ++--
 libavcodec/ac3dsp.c               | 18 +++++++-------
 libavcodec/acelp_filters.c        |  5 ++--
 libavcodec/acelp_vectors.c        |  5 ++--
 libavcodec/alacdsp.c              |  5 ++--
 libavcodec/audiodsp.c             | 13 +++++-----
 libavcodec/blockdsp.c             | 21 ++++++++--------
 libavcodec/bswapdsp.c             |  5 ++--
 libavcodec/cavsdsp.c              |  5 ++--
 libavcodec/celp_filters.c         |  5 ++--
 libavcodec/celp_math.c            |  5 ++--
 libavcodec/cfhddsp.c              |  5 ++--
 libavcodec/cfhdencdsp.c           |  5 ++--
 libavcodec/dcadsp.c               |  5 ++--
 libavcodec/dct.c                  |  5 ++--
 libavcodec/dirac_dwt.c            |  4 +++-
 libavcodec/diracdsp.c             |  5 ++--
 libavcodec/dnxhdenc.c             |  5 ++--
 libavcodec/exrdsp.c               |  5 ++--
 libavcodec/fdctdsp.c              | 11 +++++----
 libavcodec/fft_template.c         | 17 +++++++++----
 libavcodec/flacdsp.c              |  9 +++----
 libavcodec/fmtconvert.c           | 22 +++++++++--------
 libavcodec/g722dsp.c              |  9 +++----
 libavcodec/h263dsp.c              |  9 +++----
 libavcodec/h264chroma.c           | 25 ++++++++++----------
 libavcodec/h264dsp.c              | 19 ++++++++++-----
 libavcodec/h264pred.c             | 21 ++++++++--------
 libavcodec/h264qpel.c             | 25 ++++++++++----------
 libavcodec/hevcdsp.c              | 25 ++++++++++----------
 libavcodec/hevcpred.c             |  5 ++--
 libavcodec/hpeldsp.c              | 29 ++++++++++++-----------
 libavcodec/huffyuvdsp.c           |  5 ++--
 libavcodec/huffyuvencdsp.c        |  5 ++--
 libavcodec/idctdsp.c              | 40 ++++++++++++++++---------------
 libavcodec/iirfilter.c            |  5 ++--
 libavcodec/jpeg2000dsp.c          |  5 ++--
 libavcodec/lossless_audiodsp.c    | 13 +++++-----
 libavcodec/lossless_videodsp.c    |  9 +++----
 libavcodec/lossless_videoencdsp.c |  5 ++--
 libavcodec/lpc.c                  |  5 ++--
 libavcodec/mdct15.c               |  5 ++--
 libavcodec/me_cmp.c               | 21 ++++++++--------
 libavcodec/mlpdsp.c               |  9 +++----
 libavcodec/mpegaudiodsp.c         | 26 +++++++++++++-------
 libavcodec/mpegvideo.c            | 28 ++++++++++++----------
 libavcodec/mpegvideo_enc.c        |  5 ++--
 libavcodec/mpegvideodsp.c         |  9 +++----
 libavcodec/mpegvideoencdsp.c      | 17 ++++++-------
 libavcodec/opus_pvq.c             |  5 ++--
 libavcodec/opusdsp.c              | 10 ++++----
 libavcodec/pixblockdsp.c          | 27 +++++++++++----------
 libavcodec/pngdsp.c               |  5 ++--
 libavcodec/proresdsp.c            |  5 ++--
 libavcodec/qpeldsp.c              |  9 +++----
 libavcodec/rdft.c                 |  4 +++-
 libavcodec/rv34dsp.c              |  9 +++----
 libavcodec/rv40dsp.c              | 13 +++++-----
 libavcodec/sbcdsp.c               |  9 +++----
 libavcodec/sbrdsp_template.c      | 17 ++++++-------
 libavcodec/snow_dwt.c             |  5 ++--
 libavcodec/svq1enc.c              |  9 +++----
 libavcodec/synth_filter.c         | 13 +++++-----
 libavcodec/takdsp.c               |  5 ++--
 libavcodec/ttadsp.c               |  5 ++--
 libavcodec/ttaencdsp.c            |  5 ++--
 libavcodec/utvideodsp.c           |  5 ++--
 libavcodec/v210dec_init.h         |  5 ++--
 libavcodec/v210enc_init.h         |  5 ++--
 libavcodec/vc1dsp.c               | 25 ++++++++++----------
 libavcodec/videodsp.c             | 25 ++++++++++----------
 libavcodec/vorbisdsp.c            | 17 ++++++-------
 libavcodec/vp3dsp.c               | 17 ++++++-------
 libavcodec/vp56dsp.c              |  9 +++----
 libavcodec/vp8dsp.c               | 38 +++++++++++++++--------------
 libavcodec/vp9dsp.c               | 16 +++++++++----
 libavcodec/wmv2dsp.c              |  5 ++--
 libavcodec/x86/mdct15_init.c      |  6 +++--
 libavcodec/xvididct.c             |  9 +++----
 libavfilter/af_afirdsp.h          |  5 ++--
 libavfilter/af_anlmdn.c           |  5 ++--
 libavfilter/af_volume.c           |  5 ++--
 libavfilter/avf_showcqt.c         |  5 ++--
 libavfilter/colorspacedsp.c       |  5 ++--
 libavfilter/scene_sad.c           |  5 ++--
 libavfilter/vf_atadenoise.c       |  5 ++--
 libavfilter/vf_blend_init.h       |  5 ++--
 libavfilter/vf_bwdif.c            |  5 ++--
 libavfilter/vf_eq.h               |  5 ++--
 libavfilter/vf_framerate.c        |  5 ++--
 libavfilter/vf_fspp.c             |  5 ++--
 libavfilter/vf_gblur_init.h       |  5 ++--
 libavfilter/vf_gradfun.c          |  5 ++--
 libavfilter/vf_hflip_init.h       |  5 ++--
 libavfilter/vf_hqdn3d.c           |  5 ++--
 libavfilter/vf_idet.c             | 10 ++++----
 libavfilter/vf_limiter.c          |  5 ++--
 libavfilter/vf_lut3d.c            |  6 ++---
 libavfilter/vf_maskedclamp.c      |  5 ++--
 libavfilter/vf_maskedmerge.c      |  5 ++--
 libavfilter/vf_nlmeans_init.h     | 10 ++++----
 libavfilter/vf_noise.c            |  5 ++--
 libavfilter/vf_overlay.c          |  7 +++---
 libavfilter/vf_pp7.c              |  5 ++--
 libavfilter/vf_psnr.c             |  5 ++--
 libavfilter/vf_pullup.c           |  5 ++--
 libavfilter/vf_removegrain.c      |  5 ++--
 libavfilter/vf_spp.c              |  5 ++--
 libavfilter/vf_ssim.c             |  5 ++--
 libavfilter/vf_stereo3d.c         |  5 ++--
 libavfilter/vf_threshold_init.h   |  5 ++--
 libavfilter/vf_tinterlace.c       | 10 ++++----
 libavfilter/vf_transpose.c        | 10 ++++----
 libavfilter/vf_v360.c             |  5 ++--
 libavfilter/vf_w3fdif.c           |  5 ++--
 libavfilter/vf_yadif.c            |  5 ++--
 libavutil/cpu.c                   | 50 ++++++++++++++++++++-------------------
 libavutil/fixed_dsp.c             |  5 ++--
 libavutil/float_dsp.c             | 21 ++++++++--------
 libavutil/lls.c                   |  5 ++--
 libswresample/audioconvert.c      | 10 +++++---
 libswresample/rematrix.c          |  5 ++--
 libswresample/resample_dsp.c      | 10 +++++---
 libswscale/rgb2rgb.c              |  9 +++----
 libswscale/swscale.c              | 17 ++++++-------
 libswscale/swscale_unscaled.c     | 13 +++++-----
 libswscale/utils.c                |  7 +++---
 libswscale/yuv2rgb.c              |  9 +++----
 131 files changed, 739 insertions(+), 568 deletions(-)

diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index 463bf92fc0..94d694d16b 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -3550,8 +3550,9 @@ static void aacdec_init(AACContext *c)
 #endif
 
 #if !USE_FIXED
-    if(ARCH_MIPS)
-        ff_aacdec_init_mips(c);
+#if ARCH_MIPS
+    ff_aacdec_init_mips(c);
+#endif
 #endif /* !USE_FIXED */
 }
 /**
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index eb091326b1..408c03144c 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -1096,11 +1096,13 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
     s->abs_pow34   = abs_pow34_v;
     s->quant_bands = quantize_bands;
 
-    if (ARCH_X86)
-        ff_aac_dsp_init_x86(s);
+#if ARCH_X86
+    ff_aac_dsp_init_x86(s);
+#endif
 
-    if (HAVE_MIPSDSP)
-        ff_aac_coder_init_mips(s);
+#if HAVE_MIPSDSP
+    ff_aac_coder_init_mips(s);
+#endif
 
     ff_af_queue_init(avctx, &s->afq);
     ff_aac_tableinit();
diff --git a/libavcodec/aacpsdsp_template.c b/libavcodec/aacpsdsp_template.c
index eef8adc7e2..e644037587 100644
--- a/libavcodec/aacpsdsp_template.c
+++ b/libavcodec/aacpsdsp_template.c
@@ -221,13 +221,14 @@ av_cold void AAC_RENAME(ff_psdsp_init)(PSDSPContext *s)
     s->stereo_interpolate[1]  = ps_stereo_interpolate_ipdopd_c;
 
 #if !USE_FIXED
-    if (ARCH_ARM)
-        ff_psdsp_init_arm(s);
-    if (ARCH_AARCH64)
-        ff_psdsp_init_aarch64(s);
-    if (ARCH_MIPS)
-        ff_psdsp_init_mips(s);
-    if (ARCH_X86)
-        ff_psdsp_init_x86(s);
+#if ARCH_ARM
+    ff_psdsp_init_arm(s);
+#elif ARCH_AARCH64
+    ff_psdsp_init_aarch64(s);
+#elif ARCH_MIPS
+    ff_psdsp_init_mips(s);
+#elif ARCH_X86
+    ff_psdsp_init_x86(s);
+#endif
 #endif /* !USE_FIXED */
 }
diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
index 774f12e77a..db9b9becbb 100644
--- a/libavcodec/aacsbr_template.c
+++ b/libavcodec/aacsbr_template.c
@@ -1573,7 +1573,8 @@ static void aacsbr_func_ptr_init(AACSBRContext *c)
     c->sbr_hf_inverse_filter = sbr_hf_inverse_filter;
 
 #if !USE_FIXED
-    if(ARCH_MIPS)
-        ff_aacsbr_func_ptr_init_mips(c);
+#if ARCH_MIPS
+    ff_aacsbr_func_ptr_init_mips(c);
+#endif
 #endif
 }
diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
index b41f436967..afd6b557bf 100644
--- a/libavcodec/ac3dsp.c
+++ b/libavcodec/ac3dsp.c
@@ -363,8 +363,9 @@ void ff_ac3dsp_downmix(AC3DSPContext *c, float **samples, float **matrix,
             c->downmix = ac3_downmix_5_to_1_symmetric_c;
         }
 
-        if (ARCH_X86)
-            ff_ac3dsp_set_downmix_x86(c);
+#if ARCH_X86
+        ff_ac3dsp_set_downmix_x86(c);
+#endif
     }
 
     if (c->downmix)
@@ -388,10 +389,11 @@ av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact)
     c->downmix               = NULL;
     c->downmix_fixed         = NULL;
 
-    if (ARCH_ARM)
-        ff_ac3dsp_init_arm(c, bit_exact);
-    if (ARCH_X86)
-        ff_ac3dsp_init_x86(c, bit_exact);
-    if (ARCH_MIPS)
-        ff_ac3dsp_init_mips(c, bit_exact);
+#if ARCH_ARM
+    ff_ac3dsp_init_arm(c, bit_exact);
+#elif ARCH_X86
+    ff_ac3dsp_init_x86(c, bit_exact);
+#elif ARCH_MIPS
+    ff_ac3dsp_init_mips(c, bit_exact);
+#endif
 }
diff --git a/libavcodec/acelp_filters.c b/libavcodec/acelp_filters.c
index b950ba6cbe..9182579330 100644
--- a/libavcodec/acelp_filters.c
+++ b/libavcodec/acelp_filters.c
@@ -152,6 +152,7 @@ void ff_acelp_filter_init(ACELPFContext *c)
     c->acelp_interpolatef                      = ff_acelp_interpolatef;
     c->acelp_apply_order_2_transfer_function   = ff_acelp_apply_order_2_transfer_function;
 
-    if(HAVE_MIPSFPU)
-        ff_acelp_filter_init_mips(c);
+#if HAVE_MIPSFPU
+    ff_acelp_filter_init_mips(c);
+#endif
 }
diff --git a/libavcodec/acelp_vectors.c b/libavcodec/acelp_vectors.c
index 8adea683c1..b8a2b50dde 100644
--- a/libavcodec/acelp_vectors.c
+++ b/libavcodec/acelp_vectors.c
@@ -259,6 +259,7 @@ void ff_acelp_vectors_init(ACELPVContext *c)
 {
     c->weighted_vector_sumf   = ff_weighted_vector_sumf;
 
-    if(HAVE_MIPSFPU)
-        ff_acelp_vectors_init_mips(c);
+#if HAVE_MIPSFPU
+    ff_acelp_vectors_init_mips(c);
+#endif
 }
diff --git a/libavcodec/alacdsp.c b/libavcodec/alacdsp.c
index 8718d1b6b1..f24c8112dc 100644
--- a/libavcodec/alacdsp.c
+++ b/libavcodec/alacdsp.c
@@ -58,6 +58,7 @@ av_cold void ff_alacdsp_init(ALACDSPContext *c)
     c->append_extra_bits[0] =
     c->append_extra_bits[1] = append_extra_bits;
 
-    if (ARCH_X86)
-        ff_alacdsp_init_x86(c);
+#if ARCH_X86
+    ff_alacdsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/audiodsp.c b/libavcodec/audiodsp.c
index efcb0a8e8a..ff43e87dce 100644
--- a/libavcodec/audiodsp.c
+++ b/libavcodec/audiodsp.c
@@ -109,10 +109,11 @@ av_cold void ff_audiodsp_init(AudioDSPContext *c)
     c->vector_clip_int32   = vector_clip_int32_c;
     c->vector_clipf        = vector_clipf_c;
 
-    if (ARCH_ARM)
-        ff_audiodsp_init_arm(c);
-    if (ARCH_PPC)
-        ff_audiodsp_init_ppc(c);
-    if (ARCH_X86)
-        ff_audiodsp_init_x86(c);
+#if ARCH_ARM
+    ff_audiodsp_init_arm(c);
+#elif ARCH_PPC
+    ff_audiodsp_init_ppc(c);
+#elif ARCH_X86
+    ff_audiodsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/blockdsp.c b/libavcodec/blockdsp.c
index 5fb242ea65..c8f85dd202 100644
--- a/libavcodec/blockdsp.c
+++ b/libavcodec/blockdsp.c
@@ -64,14 +64,15 @@ av_cold void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx)
     c->fill_block_tab[0] = fill_block16_c;
     c->fill_block_tab[1] = fill_block8_c;
 
-    if (ARCH_ALPHA)
-        ff_blockdsp_init_alpha(c);
-    if (ARCH_ARM)
-        ff_blockdsp_init_arm(c);
-    if (ARCH_PPC)
-        ff_blockdsp_init_ppc(c);
-    if (ARCH_X86)
-        ff_blockdsp_init_x86(c, avctx);
-    if (ARCH_MIPS)
-        ff_blockdsp_init_mips(c);
+#if ARCH_ALPHA
+    ff_blockdsp_init_alpha(c);
+#elif ARCH_ARM
+    ff_blockdsp_init_arm(c);
+#elif ARCH_PPC
+    ff_blockdsp_init_ppc(c);
+#elif ARCH_X86
+    ff_blockdsp_init_x86(c, avctx);
+#elif ARCH_MIPS
+    ff_blockdsp_init_mips(c);
+#endif
 }
diff --git a/libavcodec/bswapdsp.c b/libavcodec/bswapdsp.c
index a6e1ec069c..4c4ea10acc 100644
--- a/libavcodec/bswapdsp.c
+++ b/libavcodec/bswapdsp.c
@@ -51,6 +51,7 @@ av_cold void ff_bswapdsp_init(BswapDSPContext *c)
     c->bswap_buf   = bswap_buf;
     c->bswap16_buf = bswap16_buf;
 
-    if (ARCH_X86)
-        ff_bswapdsp_init_x86(c);
+#if ARCH_X86
+    ff_bswapdsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/cavsdsp.c b/libavcodec/cavsdsp.c
index ba92121cc9..b096de452c 100644
--- a/libavcodec/cavsdsp.c
+++ b/libavcodec/cavsdsp.c
@@ -577,6 +577,7 @@ av_cold void ff_cavsdsp_init(CAVSDSPContext* c, AVCodecContext *avctx) {
     c->cavs_idct8_add = cavs_idct8_add_c;
     c->idct_perm = FF_IDCT_PERM_NONE;
 
-    if (ARCH_X86)
-        ff_cavsdsp_init_x86(c, avctx);
+#if ARCH_X86
+    ff_cavsdsp_init_x86(c, avctx);
+#endif
 }
diff --git a/libavcodec/celp_filters.c b/libavcodec/celp_filters.c
index b96ebcebb3..4f627e0092 100644
--- a/libavcodec/celp_filters.c
+++ b/libavcodec/celp_filters.c
@@ -215,6 +215,7 @@ void ff_celp_filter_init(CELPFContext *c)
     c->celp_lp_synthesis_filterf        = ff_celp_lp_synthesis_filterf;
     c->celp_lp_zero_synthesis_filterf   = ff_celp_lp_zero_synthesis_filterf;
 
-    if(HAVE_MIPSFPU)
-        ff_celp_filter_init_mips(c);
+#if HAVE_MIPSFPU
+    ff_celp_filter_init_mips(c);
+#endif
 }
diff --git a/libavcodec/celp_math.c b/libavcodec/celp_math.c
index f4bbd158ab..a5fe7f2ea9 100644
--- a/libavcodec/celp_math.c
+++ b/libavcodec/celp_math.c
@@ -122,6 +122,7 @@ void ff_celp_math_init(CELPMContext *c)
 {
     c->dot_productf   = ff_dot_productf;
 
-    if(HAVE_MIPSFPU)
-        ff_celp_math_init_mips(c);
+#if HAVE_MIPSFPU
+    ff_celp_math_init_mips(c);
+#endif
 }
diff --git a/libavcodec/cfhddsp.c b/libavcodec/cfhddsp.c
index da9254c718..a141db5246 100644
--- a/libavcodec/cfhddsp.c
+++ b/libavcodec/cfhddsp.c
@@ -112,6 +112,7 @@ av_cold void ff_cfhddsp_init(CFHDDSPContext *c, int depth, int bayer)
     else
         c->horiz_filter_clip = horiz_filter_clip;
 
-    if (ARCH_X86)
-        ff_cfhddsp_init_x86(c, depth, bayer);
+#if ARCH_X86
+    ff_cfhddsp_init_x86(c, depth, bayer);
+#endif
 }
diff --git a/libavcodec/cfhdencdsp.c b/libavcodec/cfhdencdsp.c
index 5bd4d1ba0d..3a35522d69 100644
--- a/libavcodec/cfhdencdsp.c
+++ b/libavcodec/cfhdencdsp.c
@@ -73,6 +73,7 @@ av_cold void ff_cfhdencdsp_init(CFHDEncDSPContext *c)
     c->horiz_filter = horiz_filter;
     c->vert_filter = vert_filter;
 
-    if (ARCH_X86)
-        ff_cfhdencdsp_init_x86(c);
+#if ARCH_X86
+    ff_cfhdencdsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c
index e424a7443c..d7e0328c88 100644
--- a/libavcodec/dcadsp.c
+++ b/libavcodec/dcadsp.c
@@ -485,6 +485,7 @@ av_cold void ff_dcadsp_init(DCADSPContext *s)
     s->lbr_bank = lbr_bank_c;
     s->lfe_iir = lfe_iir_c;
 
-    if (ARCH_X86)
-        ff_dcadsp_init_x86(s);
+#if ARCH_X86
+    ff_dcadsp_init_x86(s);
+#endif
 }
diff --git a/libavcodec/dct.c b/libavcodec/dct.c
index 7581b3241f..eeb4d154e0 100644
--- a/libavcodec/dct.c
+++ b/libavcodec/dct.c
@@ -214,8 +214,9 @@ av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse)
     }
 
     s->dct32 = ff_dct32_float;
-    if (ARCH_X86)
-        ff_dct_init_x86(s);
+#if ARCH_X86
+    ff_dct_init_x86(s);
+#endif
 
     return 0;
 }
diff --git a/libavcodec/dirac_dwt.c b/libavcodec/dirac_dwt.c
index fffaf82e23..af29932c6d 100644
--- a/libavcodec/dirac_dwt.c
+++ b/libavcodec/dirac_dwt.c
@@ -58,8 +58,10 @@ int ff_spatial_idwt_init(DWTContext *d, DWTPlane *p, enum dwt_type type,
         return AVERROR_INVALIDDATA;
     }
 
-    if (ARCH_X86 && bit_depth == 8)
+#if ARCH_X86
+    if (bit_depth == 8)
         ff_spatial_idwt_init_x86(d, type);
+#endif
     return 0;
 }
 
diff --git a/libavcodec/diracdsp.c b/libavcodec/diracdsp.c
index a62a218ba6..aafdddcdc3 100644
--- a/libavcodec/diracdsp.c
+++ b/libavcodec/diracdsp.c
@@ -247,6 +247,7 @@ av_cold void ff_diracdsp_init(DiracDSPContext *c)
     PIXFUNC(avg, 16);
     PIXFUNC(avg, 32);
 
-    if (ARCH_X86)
-        ff_diracdsp_init_x86(c);
+#if ARCH_X86
+    ff_diracdsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index c6378f8ecb..481793c158 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -445,8 +445,9 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
         ctx->block_width_l2     = 3;
     }
 
-    if (ARCH_X86)
-        ff_dnxhdenc_init_x86(ctx);
+#if ARCH_X86
+    ff_dnxhdenc_init_x86(ctx);
+#endif
 
     ctx->m.mb_height = (avctx->height + 15) / 16;
     ctx->m.mb_width  = (avctx->width  + 15) / 16;
diff --git a/libavcodec/exrdsp.c b/libavcodec/exrdsp.c
index 42dbf1f54a..8259da4841 100644
--- a/libavcodec/exrdsp.c
+++ b/libavcodec/exrdsp.c
@@ -51,6 +51,7 @@ av_cold void ff_exrdsp_init(ExrDSPContext *c)
     c->reorder_pixels   = reorder_pixels_scalar;
     c->predictor        = predictor_scalar;
 
-    if (ARCH_X86)
-        ff_exrdsp_init_x86(c);
+#if ARCH_X86
+    ff_exrdsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/fdctdsp.c b/libavcodec/fdctdsp.c
index b9c2c86322..5306c9d047 100644
--- a/libavcodec/fdctdsp.c
+++ b/libavcodec/fdctdsp.c
@@ -25,7 +25,7 @@
 
 av_cold void ff_fdctdsp_init(FDCTDSPContext *c, AVCodecContext *avctx)
 {
-    const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;
+    av_unused const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;
 
     if (avctx->bits_per_raw_sample == 10 || avctx->bits_per_raw_sample == 9) {
         c->fdct    = ff_jpeg_fdct_islow_10;
@@ -43,8 +43,9 @@ av_cold void ff_fdctdsp_init(FDCTDSPContext *c, AVCodecContext *avctx)
         c->fdct248 = ff_fdct248_islow_8;
     }
 
-    if (ARCH_PPC)
-        ff_fdctdsp_init_ppc(c, avctx, high_bit_depth);
-    if (ARCH_X86)
-        ff_fdctdsp_init_x86(c, avctx, high_bit_depth);
+#if ARCH_PPC
+    ff_fdctdsp_init_ppc(c, avctx, high_bit_depth);
+#elif ARCH_X86
+    ff_fdctdsp_init_x86(c, avctx, high_bit_depth);
+#endif
 }
diff --git a/libavcodec/fft_template.c b/libavcodec/fft_template.c
index 0bd64192cd..f2742a3ae8 100644
--- a/libavcodec/fft_template.c
+++ b/libavcodec/fft_template.c
@@ -227,11 +227,18 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
 #endif
 
 #if FFT_FLOAT
-    if (ARCH_AARCH64) ff_fft_init_aarch64(s);
-    if (ARCH_ARM)     ff_fft_init_arm(s);
-    if (ARCH_PPC)     ff_fft_init_ppc(s);
-    if (ARCH_X86)     ff_fft_init_x86(s);
-    if (HAVE_MIPSFPU) ff_fft_init_mips(s);
+#if ARCH_AARCH64
+    ff_fft_init_aarch64(s);
+#elif ARCH_ARM
+    ff_fft_init_arm(s);
+#elif ARCH_PPC
+    ff_fft_init_ppc(s);
+#elif ARCH_X86
+    ff_fft_init_x86(s);
+#endif
+#if HAVE_MIPSFPU
+    ff_fft_init_mips(s);
+#endif
     for(j=4; j<=nbits; j++) {
         ff_init_ff_cos_tabs(j);
     }
diff --git a/libavcodec/flacdsp.c b/libavcodec/flacdsp.c
index 6b6d578d64..79002dcac0 100644
--- a/libavcodec/flacdsp.c
+++ b/libavcodec/flacdsp.c
@@ -124,8 +124,9 @@ av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int cha
         break;
     }
 
-    if (ARCH_ARM)
-        ff_flacdsp_init_arm(c, fmt, channels, bps);
-    if (ARCH_X86)
-        ff_flacdsp_init_x86(c, fmt, channels, bps);
+#if ARCH_ARM
+    ff_flacdsp_init_arm(c, fmt, channels, bps);
+#elif ARCH_X86
+    ff_flacdsp_init_x86(c, fmt, channels, bps);
+#endif
 }
diff --git a/libavcodec/fmtconvert.c b/libavcodec/fmtconvert.c
index 3e1f133bf1..fd56a63c77 100644
--- a/libavcodec/fmtconvert.c
+++ b/libavcodec/fmtconvert.c
@@ -56,14 +56,16 @@ av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx)
     c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c;
     c->int32_to_float_fmul_array8 = int32_to_float_fmul_array8_c;
 
-    if (ARCH_AARCH64)
-        ff_fmt_convert_init_aarch64(c, avctx);
-    if (ARCH_ARM)
-        ff_fmt_convert_init_arm(c, avctx);
-    if (ARCH_PPC)
-        ff_fmt_convert_init_ppc(c, avctx);
-    if (ARCH_X86)
-        ff_fmt_convert_init_x86(c, avctx);
-    if (HAVE_MIPSFPU)
-        ff_fmt_convert_init_mips(c);
+#if ARCH_AARCH64
+    ff_fmt_convert_init_aarch64(c, avctx);
+#elif ARCH_ARM
+    ff_fmt_convert_init_arm(c, avctx);
+#elif ARCH_PPC
+    ff_fmt_convert_init_ppc(c, avctx);
+#elif ARCH_X86
+    ff_fmt_convert_init_x86(c, avctx);
+#endif
+#if HAVE_MIPSFPU
+    ff_fmt_convert_init_mips(c);
+#endif
 }
diff --git a/libavcodec/g722dsp.c b/libavcodec/g722dsp.c
index f1480536d0..c770bfbdff 100644
--- a/libavcodec/g722dsp.c
+++ b/libavcodec/g722dsp.c
@@ -69,8 +69,9 @@ av_cold void ff_g722dsp_init(G722DSPContext *c)
 {
     c->apply_qmf = g722_apply_qmf;
 
-    if (ARCH_ARM)
-        ff_g722dsp_init_arm(c);
-    if (ARCH_X86)
-        ff_g722dsp_init_x86(c);
+#if ARCH_ARM
+    ff_g722dsp_init_arm(c);
+#elif ARCH_X86
+    ff_g722dsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/h263dsp.c b/libavcodec/h263dsp.c
index b3c0bcd450..8fa2d3c297 100644
--- a/libavcodec/h263dsp.c
+++ b/libavcodec/h263dsp.c
@@ -119,8 +119,9 @@ av_cold void ff_h263dsp_init(H263DSPContext *ctx)
     ctx->h263_h_loop_filter = h263_h_loop_filter_c;
     ctx->h263_v_loop_filter = h263_v_loop_filter_c;
 
-    if (ARCH_X86)
-        ff_h263dsp_init_x86(ctx);
-    if (ARCH_MIPS)
-        ff_h263dsp_init_mips(ctx);
+#if ARCH_X86
+    ff_h263dsp_init_x86(ctx);
+#elif ARCH_MIPS
+    ff_h263dsp_init_mips(ctx);
+#endif
 }
diff --git a/libavcodec/h264chroma.c b/libavcodec/h264chroma.c
index 0ae6c793e1..60b86b6fba 100644
--- a/libavcodec/h264chroma.c
+++ b/libavcodec/h264chroma.c
@@ -46,16 +46,17 @@ av_cold void ff_h264chroma_init(H264ChromaContext *c, int bit_depth)
         SET_CHROMA(8);
     }
 
-    if (ARCH_AARCH64)
-        ff_h264chroma_init_aarch64(c, bit_depth);
-    if (ARCH_ARM)
-        ff_h264chroma_init_arm(c, bit_depth);
-    if (ARCH_PPC)
-        ff_h264chroma_init_ppc(c, bit_depth);
-    if (ARCH_X86)
-        ff_h264chroma_init_x86(c, bit_depth);
-    if (ARCH_MIPS)
-        ff_h264chroma_init_mips(c, bit_depth);
-    if (ARCH_LOONGARCH64)
-        ff_h264chroma_init_loongarch(c, bit_depth);
+#if ARCH_AARCH64
+    ff_h264chroma_init_aarch64(c, bit_depth);
+#elif ARCH_ARM
+    ff_h264chroma_init_arm(c, bit_depth);
+#elif ARCH_PPC
+    ff_h264chroma_init_ppc(c, bit_depth);
+#elif ARCH_X86
+    ff_h264chroma_init_x86(c, bit_depth);
+#elif ARCH_MIPS
+    ff_h264chroma_init_mips(c, bit_depth);
+#elif ARCH_LOONGARCH64
+    ff_h264chroma_init_loongarch(c, bit_depth);
+#endif
 }
diff --git a/libavcodec/h264dsp.c b/libavcodec/h264dsp.c
index f97ac2823c..4d2ee10bab 100644
--- a/libavcodec/h264dsp.c
+++ b/libavcodec/h264dsp.c
@@ -152,10 +152,17 @@ av_cold void ff_h264dsp_init(H264DSPContext *c, const int bit_depth,
     }
     c->startcode_find_candidate = ff_startcode_find_candidate_c;
 
-    if (ARCH_AARCH64) ff_h264dsp_init_aarch64(c, bit_depth, chroma_format_idc);
-    if (ARCH_ARM) ff_h264dsp_init_arm(c, bit_depth, chroma_format_idc);
-    if (ARCH_PPC) ff_h264dsp_init_ppc(c, bit_depth, chroma_format_idc);
-    if (ARCH_X86) ff_h264dsp_init_x86(c, bit_depth, chroma_format_idc);
-    if (ARCH_MIPS) ff_h264dsp_init_mips(c, bit_depth, chroma_format_idc);
-    if (ARCH_LOONGARCH) ff_h264dsp_init_loongarch(c, bit_depth, chroma_format_idc);
+#if ARCH_AARCH64
+    ff_h264dsp_init_aarch64(c, bit_depth, chroma_format_idc);
+#elif ARCH_ARM
+    ff_h264dsp_init_arm(c, bit_depth, chroma_format_idc);
+#elif ARCH_PPC
+    ff_h264dsp_init_ppc(c, bit_depth, chroma_format_idc);
+#elif ARCH_X86
+    ff_h264dsp_init_x86(c, bit_depth, chroma_format_idc);
+#elif ARCH_MIPS
+    ff_h264dsp_init_mips(c, bit_depth, chroma_format_idc);
+#elif ARCH_LOONGARCH
+    ff_h264dsp_init_loongarch(c, bit_depth, chroma_format_idc);
+#endif
 }
diff --git a/libavcodec/h264pred.c b/libavcodec/h264pred.c
index d83ca37a69..25f9995a0b 100644
--- a/libavcodec/h264pred.c
+++ b/libavcodec/h264pred.c
@@ -588,14 +588,15 @@ av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id,
             break;
     }
 
-    if (ARCH_AARCH64)
-        ff_h264_pred_init_aarch64(h, codec_id, bit_depth, chroma_format_idc);
-    if (ARCH_ARM)
-        ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc);
-    if (ARCH_X86)
-        ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc);
-    if (ARCH_MIPS)
-        ff_h264_pred_init_mips(h, codec_id, bit_depth, chroma_format_idc);
-    if (ARCH_LOONGARCH)
-        ff_h264_pred_init_loongarch(h, codec_id, bit_depth, chroma_format_idc);
+#if ARCH_AARCH64
+    ff_h264_pred_init_aarch64(h, codec_id, bit_depth, chroma_format_idc);
+#elif ARCH_ARM
+    ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc);
+#elif ARCH_X86
+    ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc);
+#elif ARCH_MIPS
+    ff_h264_pred_init_mips(h, codec_id, bit_depth, chroma_format_idc);
+#elif ARCH_LOONGARCH
+    ff_h264_pred_init_loongarch(h, codec_id, bit_depth, chroma_format_idc);
+#endif
 }
diff --git a/libavcodec/h264qpel.c b/libavcodec/h264qpel.c
index 535ebd25b4..65fef03304 100644
--- a/libavcodec/h264qpel.c
+++ b/libavcodec/h264qpel.c
@@ -96,16 +96,17 @@ av_cold void ff_h264qpel_init(H264QpelContext *c, int bit_depth)
         break;
     }
 
-    if (ARCH_AARCH64)
-        ff_h264qpel_init_aarch64(c, bit_depth);
-    if (ARCH_ARM)
-        ff_h264qpel_init_arm(c, bit_depth);
-    if (ARCH_PPC)
-        ff_h264qpel_init_ppc(c, bit_depth);
-    if (ARCH_X86)
-        ff_h264qpel_init_x86(c, bit_depth);
-    if (ARCH_MIPS)
-        ff_h264qpel_init_mips(c, bit_depth);
-    if (ARCH_LOONGARCH64)
-        ff_h264qpel_init_loongarch(c, bit_depth);
+#if ARCH_AARCH64
+    ff_h264qpel_init_aarch64(c, bit_depth);
+#elif ARCH_ARM
+    ff_h264qpel_init_arm(c, bit_depth);
+#elif ARCH_PPC
+    ff_h264qpel_init_ppc(c, bit_depth);
+#elif ARCH_X86
+    ff_h264qpel_init_x86(c, bit_depth);
+#elif ARCH_MIPS
+    ff_h264qpel_init_mips(c, bit_depth);
+#elif ARCH_LOONGARCH64
+    ff_h264qpel_init_loongarch(c, bit_depth);
+#endif
 }
diff --git a/libavcodec/hevcdsp.c b/libavcodec/hevcdsp.c
index b6c3f00819..2ca551df1d 100644
--- a/libavcodec/hevcdsp.c
+++ b/libavcodec/hevcdsp.c
@@ -257,16 +257,17 @@ int i = 0;
         break;
     }
 
-    if (ARCH_AARCH64)
-        ff_hevc_dsp_init_aarch64(hevcdsp, bit_depth);
-    if (ARCH_ARM)
-        ff_hevc_dsp_init_arm(hevcdsp, bit_depth);
-    if (ARCH_PPC)
-        ff_hevc_dsp_init_ppc(hevcdsp, bit_depth);
-    if (ARCH_X86)
-        ff_hevc_dsp_init_x86(hevcdsp, bit_depth);
-    if (ARCH_MIPS)
-        ff_hevc_dsp_init_mips(hevcdsp, bit_depth);
-    if (ARCH_LOONGARCH)
-        ff_hevc_dsp_init_loongarch(hevcdsp, bit_depth);
+#if ARCH_AARCH64
+    ff_hevc_dsp_init_aarch64(hevcdsp, bit_depth);
+#elif ARCH_ARM
+    ff_hevc_dsp_init_arm(hevcdsp, bit_depth);
+#elif ARCH_PPC
+    ff_hevc_dsp_init_ppc(hevcdsp, bit_depth);
+#elif ARCH_X86
+    ff_hevc_dsp_init_x86(hevcdsp, bit_depth);
+#elif ARCH_MIPS
+    ff_hevc_dsp_init_mips(hevcdsp, bit_depth);
+#elif ARCH_LOONGARCH
+    ff_hevc_dsp_init_loongarch(hevcdsp, bit_depth);
+#endif
 }
diff --git a/libavcodec/hevcpred.c b/libavcodec/hevcpred.c
index 7a86ed3d31..16b012f46c 100644
--- a/libavcodec/hevcpred.c
+++ b/libavcodec/hevcpred.c
@@ -75,6 +75,7 @@ void ff_hevc_pred_init(HEVCPredContext *hpc, int bit_depth)
         break;
     }
 
-    if (ARCH_MIPS)
-        ff_hevc_pred_init_mips(hpc, bit_depth);
+#if ARCH_MIPS
+    ff_hevc_pred_init_mips(hpc, bit_depth);
+#endif
 }
diff --git a/libavcodec/hpeldsp.c b/libavcodec/hpeldsp.c
index 843ba399c5..1ec76e7a45 100644
--- a/libavcodec/hpeldsp.c
+++ b/libavcodec/hpeldsp.c
@@ -355,18 +355,19 @@ av_cold void ff_hpeldsp_init(HpelDSPContext *c, int flags)
     hpel_funcs(avg, [3],  2);
     hpel_funcs(avg_no_rnd,, 16);
 
-    if (ARCH_AARCH64)
-        ff_hpeldsp_init_aarch64(c, flags);
-    if (ARCH_ALPHA)
-        ff_hpeldsp_init_alpha(c, flags);
-    if (ARCH_ARM)
-        ff_hpeldsp_init_arm(c, flags);
-    if (ARCH_PPC)
-        ff_hpeldsp_init_ppc(c, flags);
-    if (ARCH_X86)
-        ff_hpeldsp_init_x86(c, flags);
-    if (ARCH_MIPS)
-        ff_hpeldsp_init_mips(c, flags);
-    if (ARCH_LOONGARCH64)
-        ff_hpeldsp_init_loongarch(c, flags);
+#if ARCH_AARCH64
+    ff_hpeldsp_init_aarch64(c, flags);
+#elif ARCH_ALPHA
+    ff_hpeldsp_init_alpha(c, flags);
+#elif ARCH_ARM
+    ff_hpeldsp_init_arm(c, flags);
+#elif ARCH_PPC
+    ff_hpeldsp_init_ppc(c, flags);
+#elif ARCH_X86
+    ff_hpeldsp_init_x86(c, flags);
+#elif ARCH_MIPS
+    ff_hpeldsp_init_mips(c, flags);
+#elif ARCH_LOONGARCH64
+    ff_hpeldsp_init_loongarch(c, flags);
+#endif
 }
diff --git a/libavcodec/huffyuvdsp.c b/libavcodec/huffyuvdsp.c
index 7b865fe40c..10723b2fca 100644
--- a/libavcodec/huffyuvdsp.c
+++ b/libavcodec/huffyuvdsp.c
@@ -86,6 +86,7 @@ av_cold void ff_huffyuvdsp_init(HuffYUVDSPContext *c, enum AVPixelFormat pix_fmt
     c->add_hfyu_median_pred_int16 = add_hfyu_median_pred_int16_c;
     c->add_hfyu_left_pred_bgr32 = add_hfyu_left_pred_bgr32_c;
 
-    if (ARCH_X86)
-        ff_huffyuvdsp_init_x86(c, pix_fmt);
+#if ARCH_X86
+    ff_huffyuvdsp_init_x86(c, pix_fmt);
+#endif
 }
diff --git a/libavcodec/huffyuvencdsp.c b/libavcodec/huffyuvencdsp.c
index 427d118be4..ea1ef911b0 100644
--- a/libavcodec/huffyuvencdsp.c
+++ b/libavcodec/huffyuvencdsp.c
@@ -73,6 +73,7 @@ av_cold void ff_huffyuvencdsp_init(HuffYUVEncDSPContext *c, AVCodecContext *avct
     c->diff_int16           = diff_int16_c;
     c->sub_hfyu_median_pred_int16 = sub_hfyu_median_pred_int16_c;
 
-    if (ARCH_X86)
-        ff_huffyuvencdsp_init_x86(c, avctx);
+#if ARCH_X86
+    ff_huffyuvencdsp_init_x86(c, avctx);
+#endif
 }
diff --git a/libavcodec/idctdsp.c b/libavcodec/idctdsp.c
index df3aeb0676..9035003b72 100644
--- a/libavcodec/idctdsp.c
+++ b/libavcodec/idctdsp.c
@@ -53,10 +53,11 @@ av_cold void ff_init_scantable_permutation(uint8_t *idct_permutation,
 {
     int i;
 
-    if (ARCH_X86)
-        if (ff_init_scantable_permutation_x86(idct_permutation,
-                                              perm_type))
-            return;
+#if ARCH_X86
+    if (ff_init_scantable_permutation_x86(idct_permutation,
+                                          perm_type))
+        return;
+#endif
 
     switch (perm_type) {
     case FF_IDCT_PERM_NONE:
@@ -238,7 +239,7 @@ static void ff_jref_idct1_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block
 
 av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
 {
-    const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;
+    av_unused const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;
 
     if (avctx->lowres==1) {
         c->idct_put  = ff_jref_idct4_put;
@@ -303,20 +304,21 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
     if (CONFIG_MPEG4_DECODER && avctx->idct_algo == FF_IDCT_XVID)
         ff_xvid_idct_init(c, avctx);
 
-    if (ARCH_AARCH64)
-        ff_idctdsp_init_aarch64(c, avctx, high_bit_depth);
-    if (ARCH_ALPHA)
-        ff_idctdsp_init_alpha(c, avctx, high_bit_depth);
-    if (ARCH_ARM)
-        ff_idctdsp_init_arm(c, avctx, high_bit_depth);
-    if (ARCH_PPC)
-        ff_idctdsp_init_ppc(c, avctx, high_bit_depth);
-    if (ARCH_X86)
-        ff_idctdsp_init_x86(c, avctx, high_bit_depth);
-    if (ARCH_MIPS)
-        ff_idctdsp_init_mips(c, avctx, high_bit_depth);
-    if (ARCH_LOONGARCH)
-        ff_idctdsp_init_loongarch(c, avctx, high_bit_depth);
+#if ARCH_AARCH64
+    ff_idctdsp_init_aarch64(c, avctx, high_bit_depth);
+#elif ARCH_ALPHA
+    ff_idctdsp_init_alpha(c, avctx, high_bit_depth);
+#elif ARCH_ARM
+    ff_idctdsp_init_arm(c, avctx, high_bit_depth);
+#elif ARCH_PPC
+    ff_idctdsp_init_ppc(c, avctx, high_bit_depth);
+#elif ARCH_X86
+    ff_idctdsp_init_x86(c, avctx, high_bit_depth);
+#elif ARCH_MIPS
+    ff_idctdsp_init_mips(c, avctx, high_bit_depth);
+#elif ARCH_LOONGARCH
+    ff_idctdsp_init_loongarch(c, avctx, high_bit_depth);
+#endif
 
     ff_init_scantable_permutation(c->idct_permutation,
                                   c->perm_type);
diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c
index 900893d2ff..903d64e8d4 100644
--- a/libavcodec/iirfilter.c
+++ b/libavcodec/iirfilter.c
@@ -330,6 +330,7 @@ av_cold void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffsp)
 void ff_iir_filter_init(FFIIRFilterContext *f) {
     f->filter_flt = iir_filter_flt;
 
-    if (HAVE_MIPSFPU)
-        ff_iir_filter_init_mips(f);
+#if HAVE_MIPSFPU
+    ff_iir_filter_init_mips(f);
+#endif
 }
diff --git a/libavcodec/jpeg2000dsp.c b/libavcodec/jpeg2000dsp.c
index 90e73b1e20..b61be3b72f 100644
--- a/libavcodec/jpeg2000dsp.c
+++ b/libavcodec/jpeg2000dsp.c
@@ -96,6 +96,7 @@ av_cold void ff_jpeg2000dsp_init(Jpeg2000DSPContext *c)
     c->mct_decode[FF_DWT53]     = rct_int;
     c->mct_decode[FF_DWT97_INT] = ict_int;
 
-    if (ARCH_X86)
-        ff_jpeg2000dsp_init_x86(c);
+#if ARCH_X86
+    ff_jpeg2000dsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/lossless_audiodsp.c b/libavcodec/lossless_audiodsp.c
index 274ab5a854..1daf2e4c12 100644
--- a/libavcodec/lossless_audiodsp.c
+++ b/libavcodec/lossless_audiodsp.c
@@ -59,10 +59,11 @@ av_cold void ff_llauddsp_init(LLAudDSPContext *c)
     c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c;
     c->scalarproduct_and_madd_int32 = scalarproduct_and_madd_int32_c;
 
-    if (ARCH_ARM)
-        ff_llauddsp_init_arm(c);
-    if (ARCH_PPC)
-        ff_llauddsp_init_ppc(c);
-    if (ARCH_X86)
-        ff_llauddsp_init_x86(c);
+#if ARCH_ARM
+    ff_llauddsp_init_arm(c);
+#elif ARCH_PPC
+    ff_llauddsp_init_ppc(c);
+#elif ARCH_X86
+    ff_llauddsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/lossless_videodsp.c b/libavcodec/lossless_videodsp.c
index fa0869eef9..359606981c 100644
--- a/libavcodec/lossless_videodsp.c
+++ b/libavcodec/lossless_videodsp.c
@@ -119,8 +119,9 @@ void ff_llviddsp_init(LLVidDSPContext *c)
     c->add_left_pred_int16        = add_left_pred_int16_c;
     c->add_gradient_pred          = add_gradient_pred_c;
 
-    if (ARCH_PPC)
-        ff_llviddsp_init_ppc(c);
-    if (ARCH_X86)
-        ff_llviddsp_init_x86(c);
+#if ARCH_PPC
+    ff_llviddsp_init_ppc(c);
+#elif ARCH_X86
+    ff_llviddsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/lossless_videoencdsp.c b/libavcodec/lossless_videoencdsp.c
index ed70329628..e0b78bb3da 100644
--- a/libavcodec/lossless_videoencdsp.c
+++ b/libavcodec/lossless_videoencdsp.c
@@ -94,6 +94,7 @@ av_cold void ff_llvidencdsp_init(LLVidEncDSPContext *c)
     c->sub_median_pred = sub_median_pred_c;
     c->sub_left_predict = sub_left_predict_c;
 
-    if (ARCH_X86)
-        ff_llvidencdsp_init_x86(c);
+#if ARCH_X86
+    ff_llvidencdsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
index 3ed61563ee..3238ad5fc8 100644
--- a/libavcodec/lpc.c
+++ b/libavcodec/lpc.c
@@ -314,8 +314,9 @@ av_cold int ff_lpc_init(LPCContext *s, int blocksize, int max_order,
     s->lpc_apply_welch_window = lpc_apply_welch_window_c;
     s->lpc_compute_autocorr   = lpc_compute_autocorr_c;
 
-    if (ARCH_X86)
-        ff_lpc_init_x86(s);
+#if ARCH_X86
+    ff_lpc_init_x86(s);
+#endif
 
     return 0;
 }
diff --git a/libavcodec/mdct15.c b/libavcodec/mdct15.c
index 3a735c77d4..f8ed74d15e 100644
--- a/libavcodec/mdct15.c
+++ b/libavcodec/mdct15.c
@@ -317,8 +317,9 @@ av_cold int ff_mdct15_init(MDCT15Context **ps, int inverse, int N, double scale)
         s->exptab[20].im *= -1;
     }
 
-    if (ARCH_X86)
-        ff_mdct15_init_x86(s);
+#if ARCH_X86
+    ff_mdct15_init_x86(s);
+#endif
 
     *ps = s;
 
diff --git a/libavcodec/me_cmp.c b/libavcodec/me_cmp.c
index 4c1de44eda..4407d0a7e9 100644
--- a/libavcodec/me_cmp.c
+++ b/libavcodec/me_cmp.c
@@ -1061,16 +1061,17 @@ av_cold void ff_me_cmp_init(MECmpContext *c, AVCodecContext *avctx)
     ff_dsputil_init_dwt(c);
 #endif
 
-    if (ARCH_ALPHA)
-        ff_me_cmp_init_alpha(c, avctx);
-    if (ARCH_ARM)
-        ff_me_cmp_init_arm(c, avctx);
-    if (ARCH_PPC)
-        ff_me_cmp_init_ppc(c, avctx);
-    if (ARCH_X86)
-        ff_me_cmp_init_x86(c, avctx);
-    if (ARCH_MIPS)
-        ff_me_cmp_init_mips(c, avctx);
+#if ARCH_ALPHA
+    ff_me_cmp_init_alpha(c, avctx);
+#elif ARCH_ARM
+    ff_me_cmp_init_arm(c, avctx);
+#elif ARCH_PPC
+    ff_me_cmp_init_ppc(c, avctx);
+#elif ARCH_X86
+    ff_me_cmp_init_x86(c, avctx);
+#elif ARCH_MIPS
+    ff_me_cmp_init_mips(c, avctx);
+#endif
 
     c->median_sad[0] = pix_median_abs16_c;
     c->median_sad[1] = pix_median_abs8_c;
diff --git a/libavcodec/mlpdsp.c b/libavcodec/mlpdsp.c
index 12bef3a721..eaf5de8e1a 100644
--- a/libavcodec/mlpdsp.c
+++ b/libavcodec/mlpdsp.c
@@ -131,8 +131,9 @@ av_cold void ff_mlpdsp_init(MLPDSPContext *c)
     c->mlp_rematrix_channel = ff_mlp_rematrix_channel;
     c->mlp_select_pack_output = mlp_select_pack_output;
     c->mlp_pack_output = ff_mlp_pack_output;
-    if (ARCH_ARM)
-        ff_mlpdsp_init_arm(c);
-    if (ARCH_X86)
-        ff_mlpdsp_init_x86(c);
+#if ARCH_ARM
+    ff_mlpdsp_init_arm(c);
+#elif ARCH_X86
+    ff_mlpdsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/mpegaudiodsp.c b/libavcodec/mpegaudiodsp.c
index f03e244644..5a5a679d91 100644
--- a/libavcodec/mpegaudiodsp.c
+++ b/libavcodec/mpegaudiodsp.c
@@ -74,8 +74,9 @@ static av_cold void mpadsp_init_tabs(void)
         }
     }
 
-    if (ARCH_X86)
-        ff_mpadsp_init_x86_tabs();
+#if ARCH_X86
+    ff_mpadsp_init_x86_tabs();
+#endif
 }
 
 av_cold void ff_mpadsp_init(MPADSPContext *s)
@@ -94,10 +95,19 @@ av_cold void ff_mpadsp_init(MPADSPContext *s)
     s->imdct36_blocks_float = ff_imdct36_blocks_float;
     s->imdct36_blocks_fixed = ff_imdct36_blocks_fixed;
 
-    if (ARCH_AARCH64) ff_mpadsp_init_aarch64(s);
-    if (ARCH_ARM)     ff_mpadsp_init_arm(s);
-    if (ARCH_PPC)     ff_mpadsp_init_ppc(s);
-    if (ARCH_X86)     ff_mpadsp_init_x86(s);
-    if (HAVE_MIPSFPU)   ff_mpadsp_init_mipsfpu(s);
-    if (HAVE_MIPSDSP) ff_mpadsp_init_mipsdsp(s);
+#if ARCH_AARCH64
+    ff_mpadsp_init_aarch64(s);
+#elif ARCH_ARM
+    ff_mpadsp_init_arm(s);
+#elif ARCH_PPC
+    ff_mpadsp_init_ppc(s);
+#elif ARCH_X86
+    ff_mpadsp_init_x86(s);
+#endif
+#if HAVE_MIPSFPU
+    ff_mpadsp_init_mipsfpu(s);
+#endif
+#if HAVE_MIPSDSP
+    ff_mpadsp_init_mipsdsp(s);
+#endif
 }
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 71c1e83fa6..319934a114 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -309,19 +309,21 @@ static av_cold int dct_init(MpegEncContext *s)
         s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_bitexact;
     s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c;
 
-    if (HAVE_INTRINSICS_NEON)
-        ff_mpv_common_init_neon(s);
-
-    if (ARCH_ALPHA)
-        ff_mpv_common_init_axp(s);
-    if (ARCH_ARM)
-        ff_mpv_common_init_arm(s);
-    if (ARCH_PPC)
-        ff_mpv_common_init_ppc(s);
-    if (ARCH_X86)
-        ff_mpv_common_init_x86(s);
-    if (ARCH_MIPS)
-        ff_mpv_common_init_mips(s);
+#if HAVE_INTRINSICS_NEON
+    ff_mpv_common_init_neon(s);
+#endif
+
+#if ARCH_ALPHA
+    ff_mpv_common_init_axp(s);
+#elif ARCH_ARM
+    ff_mpv_common_init_arm(s);
+#elif ARCH_PPC
+    ff_mpv_common_init_ppc(s);
+#elif ARCH_X86
+    ff_mpv_common_init_x86(s);
+#elif ARCH_MIPS
+    ff_mpv_common_init_mips(s);
+#endif
 
     return 0;
 }
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 459bb3989f..d6a85a037a 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -290,8 +290,9 @@ static void mpv_encode_defaults(MpegEncContext *s)
 
 av_cold int ff_dct_encode_init(MpegEncContext *s)
 {
-    if (ARCH_X86)
-        ff_dct_encode_init_x86(s);
+#if ARCH_X86
+    ff_dct_encode_init_x86(s);
+#endif
 
     if (CONFIG_H263_ENCODER)
         ff_h263dsp_init(&s->h263dsp);
diff --git a/libavcodec/mpegvideodsp.c b/libavcodec/mpegvideodsp.c
index a58e45ad43..a8cf7fbe35 100644
--- a/libavcodec/mpegvideodsp.c
+++ b/libavcodec/mpegvideodsp.c
@@ -112,8 +112,9 @@ av_cold void ff_mpegvideodsp_init(MpegVideoDSPContext *c)
     c->gmc1 = gmc1_c;
     c->gmc  = ff_gmc_c;
 
-    if (ARCH_PPC)
-        ff_mpegvideodsp_init_ppc(c);
-    if (ARCH_X86)
-        ff_mpegvideodsp_init_x86(c);
+#if ARCH_PPC
+    ff_mpegvideodsp_init_ppc(c);
+#elif ARCH_X86
+    ff_mpegvideodsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/mpegvideoencdsp.c b/libavcodec/mpegvideoencdsp.c
index a34ab3553e..adf19e69f4 100644
--- a/libavcodec/mpegvideoencdsp.c
+++ b/libavcodec/mpegvideoencdsp.c
@@ -245,12 +245,13 @@ av_cold void ff_mpegvideoencdsp_init(MpegvideoEncDSPContext *c,
 
     c->draw_edges = draw_edges_8_c;
 
-    if (ARCH_ARM)
-        ff_mpegvideoencdsp_init_arm(c, avctx);
-    if (ARCH_PPC)
-        ff_mpegvideoencdsp_init_ppc(c, avctx);
-    if (ARCH_X86)
-        ff_mpegvideoencdsp_init_x86(c, avctx);
-    if (ARCH_MIPS)
-        ff_mpegvideoencdsp_init_mips(c, avctx);
+#if ARCH_ARM
+    ff_mpegvideoencdsp_init_arm(c, avctx);
+#elif ARCH_PPC
+    ff_mpegvideoencdsp_init_ppc(c, avctx);
+#elif ARCH_X86
+    ff_mpegvideoencdsp_init_x86(c, avctx);
+#elif ARCH_MIPS
+    ff_mpegvideoencdsp_init_mips(c, avctx);
+#endif
 }
diff --git a/libavcodec/opus_pvq.c b/libavcodec/opus_pvq.c
index 750360d737..a4e44b7a14 100644
--- a/libavcodec/opus_pvq.c
+++ b/libavcodec/opus_pvq.c
@@ -905,8 +905,9 @@ int av_cold ff_celt_pvq_init(CeltPVQ **pvq, int encode)
     s->pvq_search = ppp_pvq_search_c;
     s->quant_band = encode ? pvq_encode_band : pvq_decode_band;
 
-    if (CONFIG_OPUS_ENCODER && ARCH_X86)
-        ff_celt_pvq_init_x86(s);
+#if CONFIG_OPUS_ENCODER && ARCH_X86
+    ff_celt_pvq_init_x86(s);
+#endif
 
     *pvq = s;
 
diff --git a/libavcodec/opusdsp.c b/libavcodec/opusdsp.c
index 2c46afa839..badcfcc884 100644
--- a/libavcodec/opusdsp.c
+++ b/libavcodec/opusdsp.c
@@ -56,9 +56,9 @@ av_cold void ff_opus_dsp_init(OpusDSP *ctx)
     ctx->postfilter = postfilter_c;
     ctx->deemphasis = deemphasis_c;
 
-    if (ARCH_X86)
-        ff_opus_dsp_init_x86(ctx);
-
-    if (ARCH_AARCH64)
-        ff_opus_dsp_init_aarch64(ctx);
+#if ARCH_AARCH64
+    ff_opus_dsp_init_aarch64(ctx);
+#elif ARCH_X86
+    ff_opus_dsp_init_x86(ctx);
+#endif
 }
diff --git a/libavcodec/pixblockdsp.c b/libavcodec/pixblockdsp.c
index 67393b9593..17c487da1e 100644
--- a/libavcodec/pixblockdsp.c
+++ b/libavcodec/pixblockdsp.c
@@ -80,7 +80,7 @@ static void diff_pixels_c(int16_t *av_restrict block, const uint8_t *s1,
 
 av_cold void ff_pixblockdsp_init(PixblockDSPContext *c, AVCodecContext *avctx)
 {
-    const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;
+    av_unused const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;
 
     c->diff_pixels_unaligned =
     c->diff_pixels = diff_pixels_c;
@@ -101,16 +101,17 @@ av_cold void ff_pixblockdsp_init(PixblockDSPContext *c, AVCodecContext *avctx)
         break;
     }
 
-    if (ARCH_AARCH64)
-        ff_pixblockdsp_init_aarch64(c, avctx, high_bit_depth);
-    if (ARCH_ALPHA)
-        ff_pixblockdsp_init_alpha(c, avctx, high_bit_depth);
-    if (ARCH_ARM)
-        ff_pixblockdsp_init_arm(c, avctx, high_bit_depth);
-    if (ARCH_PPC)
-        ff_pixblockdsp_init_ppc(c, avctx, high_bit_depth);
-    if (ARCH_X86)
-        ff_pixblockdsp_init_x86(c, avctx, high_bit_depth);
-    if (ARCH_MIPS)
-        ff_pixblockdsp_init_mips(c, avctx, high_bit_depth);
+#if ARCH_AARCH64
+    ff_pixblockdsp_init_aarch64(c, avctx, high_bit_depth);
+#elif ARCH_ALPHA
+    ff_pixblockdsp_init_alpha(c, avctx, high_bit_depth);
+#elif ARCH_ARM
+    ff_pixblockdsp_init_arm(c, avctx, high_bit_depth);
+#elif ARCH_PPC
+    ff_pixblockdsp_init_ppc(c, avctx, high_bit_depth);
+#elif ARCH_X86
+    ff_pixblockdsp_init_x86(c, avctx, high_bit_depth);
+#elif ARCH_MIPS
+    ff_pixblockdsp_init_mips(c, avctx, high_bit_depth);
+#endif
 }
diff --git a/libavcodec/pngdsp.c b/libavcodec/pngdsp.c
index f450a4c5ee..65916b1386 100644
--- a/libavcodec/pngdsp.c
+++ b/libavcodec/pngdsp.c
@@ -45,6 +45,7 @@ av_cold void ff_pngdsp_init(PNGDSPContext *dsp)
     dsp->add_bytes_l2         = add_bytes_l2_c;
     dsp->add_paeth_prediction = ff_add_png_paeth_prediction;
 
-    if (ARCH_X86)
-        ff_pngdsp_init_x86(dsp);
+#if ARCH_X86
+    ff_pngdsp_init_x86(dsp);
+#endif
 }
diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c
index a3c618cdd1..6ed01179fe 100644
--- a/libavcodec/proresdsp.c
+++ b/libavcodec/proresdsp.c
@@ -88,8 +88,9 @@ av_cold int ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx)
         return AVERROR_BUG;
     }
 
-    if (ARCH_X86)
-        ff_proresdsp_init_x86(dsp, avctx);
+#if ARCH_X86
+    ff_proresdsp_init_x86(dsp, avctx);
+#endif
 
     ff_init_scantable_permutation(dsp->idct_permutation,
                                   dsp->idct_permutation_type);
diff --git a/libavcodec/qpeldsp.c b/libavcodec/qpeldsp.c
index c1eab6120d..2b9146ceb1 100644
--- a/libavcodec/qpeldsp.c
+++ b/libavcodec/qpeldsp.c
@@ -810,8 +810,9 @@ av_cold void ff_qpeldsp_init(QpelDSPContext *c)
     dspfunc(avg_qpel, 0, 16);
     dspfunc(avg_qpel, 1, 8);
 
-    if (ARCH_X86)
-        ff_qpeldsp_init_x86(c);
-    if (ARCH_MIPS)
-        ff_qpeldsp_init_mips(c);
+#if ARCH_X86
+    ff_qpeldsp_init_x86(c);
+#elif ARCH_MIPS
+    ff_qpeldsp_init_mips(c);
+#endif
 }
diff --git a/libavcodec/rdft.c b/libavcodec/rdft.c
index 8228eb247b..ac6f5d6781 100644
--- a/libavcodec/rdft.c
+++ b/libavcodec/rdft.c
@@ -107,7 +107,9 @@ av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans)
     s->tsin = ff_cos_tabs[nbits] + (n >> 2);
     s->rdft_calc   = rdft_calc_c;
 
-    if (ARCH_ARM) ff_rdft_init_arm(s);
+#if ARCH_ARM
+    ff_rdft_init_arm(s);
+#endif
 
     return 0;
 }
diff --git a/libavcodec/rv34dsp.c b/libavcodec/rv34dsp.c
index c3f245eb85..8f9d88396c 100644
--- a/libavcodec/rv34dsp.c
+++ b/libavcodec/rv34dsp.c
@@ -136,8 +136,9 @@ av_cold void ff_rv34dsp_init(RV34DSPContext *c)
     c->rv34_idct_add    = rv34_idct_add_c;
     c->rv34_idct_dc_add = rv34_idct_dc_add_c;
 
-    if (ARCH_ARM)
-        ff_rv34dsp_init_arm(c);
-    if (ARCH_X86)
-        ff_rv34dsp_init_x86(c);
+#if ARCH_ARM
+    ff_rv34dsp_init_arm(c);
+#elif ARCH_X86
+    ff_rv34dsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/rv40dsp.c b/libavcodec/rv40dsp.c
index 414c4d30b1..a09179ae85 100644
--- a/libavcodec/rv40dsp.c
+++ b/libavcodec/rv40dsp.c
@@ -705,10 +705,11 @@ av_cold void ff_rv40dsp_init(RV34DSPContext *c)
     c->rv40_loop_filter_strength[0] = rv40_h_loop_filter_strength;
     c->rv40_loop_filter_strength[1] = rv40_v_loop_filter_strength;
 
-    if (ARCH_AARCH64)
-        ff_rv40dsp_init_aarch64(c);
-    if (ARCH_ARM)
-        ff_rv40dsp_init_arm(c);
-    if (ARCH_X86)
-        ff_rv40dsp_init_x86(c);
+#if ARCH_AARCH64
+    ff_rv40dsp_init_aarch64(c);
+#elif ARCH_ARM
+    ff_rv40dsp_init_arm(c);
+#elif ARCH_X86
+    ff_rv40dsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/sbcdsp.c b/libavcodec/sbcdsp.c
index e745595da0..400526ce62 100644
--- a/libavcodec/sbcdsp.c
+++ b/libavcodec/sbcdsp.c
@@ -380,8 +380,9 @@ av_cold void ff_sbcdsp_init(SBCDSPContext *s)
     s->sbc_calc_scalefactors = sbc_calc_scalefactors;
     s->sbc_calc_scalefactors_j = sbc_calc_scalefactors_j;
 
-    if (ARCH_ARM)
-        ff_sbcdsp_init_arm(s);
-    if (ARCH_X86)
-        ff_sbcdsp_init_x86(s);
+#if ARCH_ARM
+    ff_sbcdsp_init_arm(s);
+#elif ARCH_X86
+    ff_sbcdsp_init_x86(s);
+#endif
 }
diff --git a/libavcodec/sbrdsp_template.c b/libavcodec/sbrdsp_template.c
index 37a3365b97..b3737c0fd8 100644
--- a/libavcodec/sbrdsp_template.c
+++ b/libavcodec/sbrdsp_template.c
@@ -92,13 +92,14 @@ av_cold void AAC_RENAME(ff_sbrdsp_init)(SBRDSPContext *s)
     s->hf_apply_noise[3] = sbr_hf_apply_noise_3;
 
 #if !USE_FIXED
-    if (ARCH_ARM)
-        ff_sbrdsp_init_arm(s);
-    if (ARCH_AARCH64)
-        ff_sbrdsp_init_aarch64(s);
-    if (ARCH_X86)
-        ff_sbrdsp_init_x86(s);
-    if (ARCH_MIPS)
-        ff_sbrdsp_init_mips(s);
+#if ARCH_ARM
+    ff_sbrdsp_init_arm(s);
+#elif ARCH_AARCH64
+    ff_sbrdsp_init_aarch64(s);
+#elif ARCH_X86
+    ff_sbrdsp_init_x86(s);
+#elif ARCH_MIPS
+    ff_sbrdsp_init_mips(s);
+#endif
 #endif /* !USE_FIXED */
 }
diff --git a/libavcodec/snow_dwt.c b/libavcodec/snow_dwt.c
index c093ebff07..e196fefd24 100644
--- a/libavcodec/snow_dwt.c
+++ b/libavcodec/snow_dwt.c
@@ -853,8 +853,9 @@ av_cold void ff_dwt_init(SnowDWTContext *c)
     c->horizontal_compose97i = snow_horizontal_compose97i;
     c->inner_add_yblock      = ff_snow_inner_add_yblock;
 
-    if (HAVE_MMX)
-        ff_dwt_init_x86(c);
+#if ARCH_X86 && HAVE_MMX
+    ff_dwt_init_x86(c);
+#endif
 }
 
 
diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index b4e61e4517..3c2d594632 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -568,10 +568,11 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx)
         return AVERROR(ENOMEM);
     }
 
-    if (ARCH_PPC)
-        ff_svq1enc_init_ppc(s);
-    if (ARCH_X86)
-        ff_svq1enc_init_x86(s);
+#if ARCH_PPC
+    ff_svq1enc_init_ppc(s);
+#elif ARCH_X86
+    ff_svq1enc_init_x86(s);
+#endif
 
     ff_h263_encode_init(&s->m); // mv_penalty
 
diff --git a/libavcodec/synth_filter.c b/libavcodec/synth_filter.c
index 1c5dab5c5a..f30cf360df 100644
--- a/libavcodec/synth_filter.c
+++ b/libavcodec/synth_filter.c
@@ -175,10 +175,11 @@ av_cold void ff_synth_filter_init(SynthFilterContext *c)
     c->synth_filter_fixed    = synth_filter_fixed;
     c->synth_filter_fixed_64 = synth_filter_fixed_64;
 
-    if (ARCH_AARCH64)
-        ff_synth_filter_init_aarch64(c);
-    if (ARCH_ARM)
-        ff_synth_filter_init_arm(c);
-    if (ARCH_X86)
-        ff_synth_filter_init_x86(c);
+#if ARCH_AARCH64
+    ff_synth_filter_init_aarch64(c);
+#elif ARCH_ARM
+    ff_synth_filter_init_arm(c);
+#elif ARCH_X86
+    ff_synth_filter_init_x86(c);
+#endif
 }
diff --git a/libavcodec/takdsp.c b/libavcodec/takdsp.c
index a8f9dba342..881d7be5f2 100644
--- a/libavcodec/takdsp.c
+++ b/libavcodec/takdsp.c
@@ -77,6 +77,7 @@ av_cold void ff_takdsp_init(TAKDSPContext *c)
     c->decorrelate_sm = decorrelate_sm;
     c->decorrelate_sf = decorrelate_sf;
 
-    if (ARCH_X86)
-        ff_takdsp_init_x86(c);
+#if ARCH_X86
+    ff_takdsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/ttadsp.c b/libavcodec/ttadsp.c
index 99dd66a0c2..fe9e3c69e4 100644
--- a/libavcodec/ttadsp.c
+++ b/libavcodec/ttadsp.c
@@ -56,6 +56,7 @@ av_cold void ff_ttadsp_init(TTADSPContext *c)
 {
     c->filter_process = tta_filter_process_c;
 
-    if (ARCH_X86)
-        ff_ttadsp_init_x86(c);
+#if ARCH_X86
+    ff_ttadsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/ttaencdsp.c b/libavcodec/ttaencdsp.c
index 6ba594e9fa..0efdc109bb 100644
--- a/libavcodec/ttaencdsp.c
+++ b/libavcodec/ttaencdsp.c
@@ -54,6 +54,7 @@ av_cold void ff_ttaencdsp_init(TTAEncDSPContext *c)
 {
     c->filter_process = ttaenc_filter_process_c;
 
-    if (ARCH_X86)
-        ff_ttaencdsp_init_x86(c);
+#if ARCH_X86
+    ff_ttaencdsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/utvideodsp.c b/libavcodec/utvideodsp.c
index 0831a6b97b..6db0abf8da 100644
--- a/libavcodec/utvideodsp.c
+++ b/libavcodec/utvideodsp.c
@@ -77,6 +77,7 @@ av_cold void ff_utvideodsp_init(UTVideoDSPContext *c)
     c->restore_rgb_planes   = restore_rgb_planes_c;
     c->restore_rgb_planes10 = restore_rgb_planes10_c;
 
-    if (ARCH_X86)
-        ff_utvideodsp_init_x86(c);
+#if ARCH_X86
+    ff_utvideodsp_init_x86(c);
+#endif
 }
diff --git a/libavcodec/v210dec_init.h b/libavcodec/v210dec_init.h
index 305ab3911e..c7a232fe8e 100644
--- a/libavcodec/v210dec_init.h
+++ b/libavcodec/v210dec_init.h
@@ -54,8 +54,9 @@ static void v210_planar_unpack_c(const uint32_t *src, uint16_t *y, uint16_t *u,
 static av_unused av_cold void ff_v210dec_init(V210DecContext *s)
 {
     s->unpack_frame = v210_planar_unpack_c;
-    if (ARCH_X86)
-        ff_v210_x86_init(s);
+#if ARCH_X86
+    ff_v210_x86_init(s);
+#endif
 }
 
 #endif /* AVCODEC_V210DEC_INIT_H */
diff --git a/libavcodec/v210enc_init.h b/libavcodec/v210enc_init.h
index 6d81cac319..a0e5622f4f 100644
--- a/libavcodec/v210enc_init.h
+++ b/libavcodec/v210enc_init.h
@@ -83,8 +83,9 @@ static av_cold av_unused void ff_v210enc_init(V210EncContext *s)
     s->sample_factor_8  = 2;
     s->sample_factor_10 = 1;
 
-    if (ARCH_X86)
-        ff_v210enc_init_x86(s);
+#if ARCH_X86
+    ff_v210enc_init_x86(s);
+#endif
 }
 
 #endif /* AVCODEC_V210ENC_INIT_H */
diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c
index f1b7bb2397..62c553bc01 100644
--- a/libavcodec/vc1dsp.c
+++ b/libavcodec/vc1dsp.c
@@ -1033,16 +1033,17 @@ av_cold void ff_vc1dsp_init(VC1DSPContext *dsp)
     dsp->startcode_find_candidate = ff_startcode_find_candidate_c;
     dsp->vc1_unescape_buffer      = vc1_unescape_buffer;
 
-    if (ARCH_AARCH64)
-        ff_vc1dsp_init_aarch64(dsp);
-    if (ARCH_ARM)
-        ff_vc1dsp_init_arm(dsp);
-    if (ARCH_PPC)
-        ff_vc1dsp_init_ppc(dsp);
-    if (ARCH_X86)
-        ff_vc1dsp_init_x86(dsp);
-    if (ARCH_MIPS)
-        ff_vc1dsp_init_mips(dsp);
-    if (ARCH_LOONGARCH)
-        ff_vc1dsp_init_loongarch(dsp);
+#if ARCH_AARCH64
+    ff_vc1dsp_init_aarch64(dsp);
+#elif ARCH_ARM
+    ff_vc1dsp_init_arm(dsp);
+#elif ARCH_PPC
+    ff_vc1dsp_init_ppc(dsp);
+#elif ARCH_X86
+    ff_vc1dsp_init_x86(dsp);
+#elif ARCH_MIPS
+    ff_vc1dsp_init_mips(dsp);
+#elif ARCH_LOONGARCH
+    ff_vc1dsp_init_loongarch(dsp);
+#endif
 }
diff --git a/libavcodec/videodsp.c b/libavcodec/videodsp.c
index 2198d46c15..90dc1aacbd 100644
--- a/libavcodec/videodsp.c
+++ b/libavcodec/videodsp.c
@@ -45,16 +45,17 @@ av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
         ctx->emulated_edge_mc = ff_emulated_edge_mc_16;
     }
 
-    if (ARCH_AARCH64)
-        ff_videodsp_init_aarch64(ctx, bpc);
-    if (ARCH_ARM)
-        ff_videodsp_init_arm(ctx, bpc);
-    if (ARCH_PPC)
-        ff_videodsp_init_ppc(ctx, bpc);
-    if (ARCH_X86)
-        ff_videodsp_init_x86(ctx, bpc);
-    if (ARCH_MIPS)
-        ff_videodsp_init_mips(ctx, bpc);
-    if (ARCH_LOONGARCH64)
-        ff_videodsp_init_loongarch(ctx, bpc);
+#if ARCH_AARCH64
+    ff_videodsp_init_aarch64(ctx, bpc);
+#elif ARCH_ARM
+    ff_videodsp_init_arm(ctx, bpc);
+#elif ARCH_PPC
+    ff_videodsp_init_ppc(ctx, bpc);
+#elif ARCH_X86
+    ff_videodsp_init_x86(ctx, bpc);
+#elif ARCH_MIPS
+    ff_videodsp_init_mips(ctx, bpc);
+#elif ARCH_LOONGARCH64
+    ff_videodsp_init_loongarch(ctx, bpc);
+#endif
 }
diff --git a/libavcodec/vorbisdsp.c b/libavcodec/vorbisdsp.c
index 362a276296..e94b65cb7b 100644
--- a/libavcodec/vorbisdsp.c
+++ b/libavcodec/vorbisdsp.c
@@ -25,12 +25,13 @@ av_cold void ff_vorbisdsp_init(VorbisDSPContext *dsp)
 {
     dsp->vorbis_inverse_coupling = ff_vorbis_inverse_coupling;
 
-    if (ARCH_AARCH64)
-        ff_vorbisdsp_init_aarch64(dsp);
-    if (ARCH_ARM)
-        ff_vorbisdsp_init_arm(dsp);
-    if (ARCH_PPC)
-        ff_vorbisdsp_init_ppc(dsp);
-    if (ARCH_X86)
-        ff_vorbisdsp_init_x86(dsp);
+#if ARCH_AARCH64
+    ff_vorbisdsp_init_aarch64(dsp);
+#elif ARCH_ARM
+    ff_vorbisdsp_init_arm(dsp);
+#elif ARCH_PPC
+    ff_vorbisdsp_init_ppc(dsp);
+#elif ARCH_X86
+    ff_vorbisdsp_init_x86(dsp);
+#endif
 }
diff --git a/libavcodec/vp3dsp.c b/libavcodec/vp3dsp.c
index f06834f42e..b4621f07e7 100644
--- a/libavcodec/vp3dsp.c
+++ b/libavcodec/vp3dsp.c
@@ -455,14 +455,15 @@ av_cold void ff_vp3dsp_init(VP3DSPContext *c, int flags)
     c->v_loop_filter = c->v_loop_filter_unaligned = vp3_v_loop_filter_8_c;
     c->h_loop_filter = c->h_loop_filter_unaligned = vp3_h_loop_filter_8_c;
 
-    if (ARCH_ARM)
-        ff_vp3dsp_init_arm(c, flags);
-    if (ARCH_PPC)
-        ff_vp3dsp_init_ppc(c, flags);
-    if (ARCH_X86)
-        ff_vp3dsp_init_x86(c, flags);
-    if (ARCH_MIPS)
-        ff_vp3dsp_init_mips(c, flags);
+#if ARCH_ARM
+    ff_vp3dsp_init_arm(c, flags);
+#elif ARCH_PPC
+    ff_vp3dsp_init_ppc(c, flags);
+#elif ARCH_X86
+    ff_vp3dsp_init_x86(c, flags);
+#elif ARCH_MIPS
+    ff_vp3dsp_init_mips(c, flags);
+#endif
 }
 
 /*
diff --git a/libavcodec/vp56dsp.c b/libavcodec/vp56dsp.c
index d368e3292d..a668712384 100644
--- a/libavcodec/vp56dsp.c
+++ b/libavcodec/vp56dsp.c
@@ -77,9 +77,10 @@ av_cold void ff_vp6dsp_init(VP56DSPContext *s)
 {
     s->vp6_filter_diag4 = ff_vp6_filter_diag4_c;
 
-    if (ARCH_ARM)
-        ff_vp6dsp_init_arm(s);
-    if (ARCH_X86)
-        ff_vp6dsp_init_x86(s);
+#if ARCH_ARM
+    ff_vp6dsp_init_arm(s);
+#elif ARCH_X86
+    ff_vp6dsp_init_x86(s);
+#endif
 }
 #endif /* CONFIG_VP6_DECODER */
diff --git a/libavcodec/vp8dsp.c b/libavcodec/vp8dsp.c
index 23f49b2c25..a92774ed5e 100644
--- a/libavcodec/vp8dsp.c
+++ b/libavcodec/vp8dsp.c
@@ -675,14 +675,15 @@ av_cold void ff_vp78dsp_init(VP8DSPContext *dsp)
     VP78_BILINEAR_MC_FUNC(1, 8);
     VP78_BILINEAR_MC_FUNC(2, 4);
 
-    if (ARCH_AARCH64)
-        ff_vp78dsp_init_aarch64(dsp);
-    if (ARCH_ARM)
-        ff_vp78dsp_init_arm(dsp);
-    if (ARCH_PPC)
-        ff_vp78dsp_init_ppc(dsp);
-    if (ARCH_X86)
-        ff_vp78dsp_init_x86(dsp);
+#if ARCH_AARCH64
+    ff_vp78dsp_init_aarch64(dsp);
+#elif ARCH_ARM
+    ff_vp78dsp_init_arm(dsp);
+#elif ARCH_PPC
+    ff_vp78dsp_init_ppc(dsp);
+#elif ARCH_X86
+    ff_vp78dsp_init_x86(dsp);
+#endif
 }
 
 #if CONFIG_VP7_DECODER
@@ -737,15 +738,16 @@ av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
     dsp->vp8_v_loop_filter_simple = vp8_v_loop_filter_simple_c;
     dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c;
 
-    if (ARCH_AARCH64)
-        ff_vp8dsp_init_aarch64(dsp);
-    if (ARCH_ARM)
-        ff_vp8dsp_init_arm(dsp);
-    if (ARCH_X86)
-        ff_vp8dsp_init_x86(dsp);
-    if (ARCH_MIPS)
-        ff_vp8dsp_init_mips(dsp);
-    if (ARCH_LOONGARCH)
-        ff_vp8dsp_init_loongarch(dsp);
+#if ARCH_AARCH64
+    ff_vp8dsp_init_aarch64(dsp);
+#elif ARCH_ARM
+    ff_vp8dsp_init_arm(dsp);
+#elif ARCH_X86
+    ff_vp8dsp_init_x86(dsp);
+#elif ARCH_MIPS
+    ff_vp8dsp_init_mips(dsp);
+#elif ARCH_LOONGARCH
+    ff_vp8dsp_init_loongarch(dsp);
+#endif
 }
 #endif /* CONFIG_VP8_DECODER */
diff --git a/libavcodec/vp9dsp.c b/libavcodec/vp9dsp.c
index 3441419e2d..d8ddf74d4f 100644
--- a/libavcodec/vp9dsp.c
+++ b/libavcodec/vp9dsp.c
@@ -96,9 +96,15 @@ av_cold void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp, int bitexact)
         ff_vp9dsp_init_12(dsp);
     }
 
-    if (ARCH_AARCH64) ff_vp9dsp_init_aarch64(dsp, bpp);
-    if (ARCH_ARM) ff_vp9dsp_init_arm(dsp, bpp);
-    if (ARCH_X86) ff_vp9dsp_init_x86(dsp, bpp, bitexact);
-    if (ARCH_MIPS) ff_vp9dsp_init_mips(dsp, bpp);
-    if (ARCH_LOONGARCH) ff_vp9dsp_init_loongarch(dsp, bpp);
+#if ARCH_AARCH64
+    ff_vp9dsp_init_aarch64(dsp, bpp);
+#elif ARCH_ARM
+    ff_vp9dsp_init_arm(dsp, bpp);
+#elif ARCH_X86
+    ff_vp9dsp_init_x86(dsp, bpp, bitexact);
+#elif ARCH_MIPS
+    ff_vp9dsp_init_mips(dsp, bpp);
+#elif ARCH_LOONGARCH
+    ff_vp9dsp_init_loongarch(dsp, bpp);
+#endif
 }
diff --git a/libavcodec/wmv2dsp.c b/libavcodec/wmv2dsp.c
index 3bd482176a..4ad8a596b8 100644
--- a/libavcodec/wmv2dsp.c
+++ b/libavcodec/wmv2dsp.c
@@ -264,6 +264,7 @@ av_cold void ff_wmv2dsp_init(WMV2DSPContext *c)
     c->put_mspel_pixels_tab[6] = put_mspel8_mc22_c;
     c->put_mspel_pixels_tab[7] = put_mspel8_mc32_c;
 
-    if (ARCH_MIPS)
-        ff_wmv2dsp_init_mips(c);
+#if ARCH_MIPS
+    ff_wmv2dsp_init_mips(c);
+#endif
 }
diff --git a/libavcodec/x86/mdct15_init.c b/libavcodec/x86/mdct15_init.c
index 31ce19d31c..ea7301e1e7 100644
--- a/libavcodec/x86/mdct15_init.c
+++ b/libavcodec/x86/mdct15_init.c
@@ -89,13 +89,15 @@ av_cold void ff_mdct15_init_x86(MDCT15Context *s)
     if (EXTERNAL_SSE3(cpu_flags))
         s->postreindex = ff_mdct15_postreindex_sse3;
 
-    if (ARCH_X86_64 && EXTERNAL_AVX(cpu_flags)) {
+#if ARCH_X86_64
+    if (EXTERNAL_AVX(cpu_flags)) {
         s->fft15 = ff_fft15_avx;
         adjust_twiddles = 1;
     }
 
-    if (ARCH_X86_64 && EXTERNAL_AVX2_FAST(cpu_flags))
+    if (EXTERNAL_AVX2_FAST(cpu_flags))
         s->postreindex = ff_mdct15_postreindex_avx2;
+#endif
 
     if (adjust_twiddles)
         perm_twiddles(s);
diff --git a/libavcodec/xvididct.c b/libavcodec/xvididct.c
index 360deb3244..f338901ab2 100644
--- a/libavcodec/xvididct.c
+++ b/libavcodec/xvididct.c
@@ -346,10 +346,11 @@ av_cold void ff_xvid_idct_init(IDCTDSPContext *c, AVCodecContext *avctx)
         c->perm_type = FF_IDCT_PERM_NONE;
     }
 
-    if (ARCH_X86)
-        ff_xvid_idct_init_x86(c, avctx, high_bit_depth);
-    if (ARCH_MIPS)
-        ff_xvid_idct_init_mips(c, avctx, high_bit_depth);
+#if ARCH_X86
+    ff_xvid_idct_init_x86(c, avctx, high_bit_depth);
+#elif ARCH_MIPS
+    ff_xvid_idct_init_mips(c, avctx, high_bit_depth);
+#endif
 
     ff_init_scantable_permutation(c->idct_permutation, c->perm_type);
 }
diff --git a/libavfilter/af_afirdsp.h b/libavfilter/af_afirdsp.h
index bf7d1d6f0f..4208501393 100644
--- a/libavfilter/af_afirdsp.h
+++ b/libavfilter/af_afirdsp.h
@@ -74,8 +74,9 @@ static av_unused void ff_afir_init(AudioFIRDSPContext *dsp)
     dsp->fcmul_add = fcmul_add_c;
     dsp->dcmul_add = dcmul_add_c;
 
-    if (ARCH_X86)
-        ff_afir_init_x86(dsp);
+#if ARCH_X86
+    ff_afir_init_x86(dsp);
+#endif
 }
 
 #endif /* AVFILTER_AFIRDSP_H */
diff --git a/libavfilter/af_anlmdn.c b/libavfilter/af_anlmdn.c
index c82be33e7c..8f01c5f8a2 100644
--- a/libavfilter/af_anlmdn.c
+++ b/libavfilter/af_anlmdn.c
@@ -118,8 +118,9 @@ void ff_anlmdn_init(AudioNLMDNDSPContext *dsp)
     dsp->compute_distance_ssd = compute_distance_ssd_c;
     dsp->compute_cache        = compute_cache_c;
 
-    if (ARCH_X86)
-        ff_anlmdn_init_x86(dsp);
+#if ARCH_X86
+    ff_anlmdn_init_x86(dsp);
+#endif
 }
 
 static int config_filter(AVFilterContext *ctx)
diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c
index 4c9b96f17e..f6e183df8d 100644
--- a/libavfilter/af_volume.c
+++ b/libavfilter/af_volume.c
@@ -238,8 +238,9 @@ static av_cold void volume_init(VolumeContext *vol)
         break;
     }
 
-    if (ARCH_X86)
-        ff_volume_init_x86(vol);
+#if ARCH_X86
+    ff_volume_init_x86(vol);
+#endif
 }
 
 static int set_volume(AVFilterContext *ctx)
diff --git a/libavfilter/avf_showcqt.c b/libavfilter/avf_showcqt.c
index c738e6f993..33c482bd42 100644
--- a/libavfilter/avf_showcqt.c
+++ b/libavfilter/avf_showcqt.c
@@ -1418,8 +1418,9 @@ static int config_output(AVFilterLink *outlink)
         s->update_sono = update_sono_yuv;
     }
 
-    if (ARCH_X86)
-        ff_showcqt_init_x86(s);
+#if ARCH_X86
+    ff_showcqt_init_x86(s);
+#endif
 
     if ((ret = init_cqt(s)) < 0)
         return ret;
diff --git a/libavfilter/colorspacedsp.c b/libavfilter/colorspacedsp.c
index 65ea74c584..72207ffaf3 100644
--- a/libavfilter/colorspacedsp.c
+++ b/libavfilter/colorspacedsp.c
@@ -143,6 +143,7 @@ void ff_colorspacedsp_init(ColorSpaceDSPContext *dsp)
 
     dsp->multiply3x3 = multiply3x3_c;
 
-    if (ARCH_X86)
-        ff_colorspacedsp_x86_init(dsp);
+#if ARCH_X86
+    ff_colorspacedsp_x86_init(dsp);
+#endif
 }
diff --git a/libavfilter/scene_sad.c b/libavfilter/scene_sad.c
index 73d3eacbfa..caf911eb5d 100644
--- a/libavfilter/scene_sad.c
+++ b/libavfilter/scene_sad.c
@@ -59,8 +59,9 @@ void ff_scene_sad_c(SCENE_SAD_PARAMS)
 ff_scene_sad_fn ff_scene_sad_get_fn(int depth)
 {
     ff_scene_sad_fn sad = NULL;
-    if (ARCH_X86)
-        sad = ff_scene_sad_get_fn_x86(depth);
+#if ARCH_X86
+    sad = ff_scene_sad_get_fn_x86(depth);
+#endif
     if (!sad) {
         if (depth == 8)
             sad = ff_scene_sad_c;
diff --git a/libavfilter/vf_atadenoise.c b/libavfilter/vf_atadenoise.c
index 8dc51b460d..54cde782f6 100644
--- a/libavfilter/vf_atadenoise.c
+++ b/libavfilter/vf_atadenoise.c
@@ -433,8 +433,9 @@ static int config_input(AVFilterLink *inlink)
         }
     }
 
-    if (ARCH_X86)
-        ff_atadenoise_init_x86(&s->dsp, depth, s->algorithm, s->sigma);
+#if ARCH_X86
+    ff_atadenoise_init_x86(&s->dsp, depth, s->algorithm, s->sigma);
+#endif
 
     return 0;
 }
diff --git a/libavfilter/vf_blend_init.h b/libavfilter/vf_blend_init.h
index 5fb2599490..f531338a54 100644
--- a/libavfilter/vf_blend_init.h
+++ b/libavfilter/vf_blend_init.h
@@ -194,8 +194,9 @@ static av_unused void ff_blend_init(FilterParams *param, int depth)
             param->blend = depth > 8 ? depth > 16 ? blend_copybottom_32 : blend_copybottom_16 : blend_copybottom_8;
     }
 
-    if (ARCH_X86)
-        ff_blend_init_x86(param, depth);
+#if ARCH_X86
+    ff_blend_init_x86(param, depth);
+#endif
 }
 
 #endif /* AVFILTER_BLEND_INIT_H */
diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c
index c3b7abc1b9..65c617ebb3 100644
--- a/libavfilter/vf_bwdif.c
+++ b/libavfilter/vf_bwdif.c
@@ -350,8 +350,9 @@ static int config_props(AVFilterLink *link)
         s->filter_edge  = filter_edge;
     }
 
-    if (ARCH_X86)
-        ff_bwdif_init_x86(s);
+#if ARCH_X86
+    ff_bwdif_init_x86(s);
+#endif
 
     return 0;
 }
diff --git a/libavfilter/vf_eq.h b/libavfilter/vf_eq.h
index a5756977d2..fc8d4a711a 100644
--- a/libavfilter/vf_eq.h
+++ b/libavfilter/vf_eq.h
@@ -123,8 +123,9 @@ void ff_eq_init_x86(EQContext *eq);
 static av_unused void ff_eq_init(EQContext *eq)
 {
     eq->process = process_c;
-    if (ARCH_X86)
-        ff_eq_init_x86(eq);
+#if ARCH_X86
+    ff_eq_init_x86(eq);
+#endif
 }
 
 #endif /* AVFILTER_EQ_H */
diff --git a/libavfilter/vf_framerate.c b/libavfilter/vf_framerate.c
index f116147751..49bf6cdfff 100644
--- a/libavfilter/vf_framerate.c
+++ b/libavfilter/vf_framerate.c
@@ -264,8 +264,9 @@ void ff_framerate_init(FrameRateContext *s)
         s->blend_factor_max = 1 << BLEND_FACTOR_DEPTH(16);
         s->blend = blend_frames16_c;
     }
-    if (ARCH_X86)
-        ff_framerate_init_x86(s);
+#if ARCH_X86
+    ff_framerate_init_x86(s);
+#endif
 }
 
 static int config_input(AVFilterLink *inlink)
diff --git a/libavfilter/vf_fspp.c b/libavfilter/vf_fspp.c
index 46ed514503..3e04fd01b9 100644
--- a/libavfilter/vf_fspp.c
+++ b/libavfilter/vf_fspp.c
@@ -525,8 +525,9 @@ static int config_input(AVFilterLink *inlink)
     fspp->row_idct     = row_idct_c;
     fspp->row_fdct     = row_fdct_c;
 
-    if (ARCH_X86)
-        ff_fspp_init_x86(fspp);
+#if ARCH_X86
+    ff_fspp_init_x86(fspp);
+#endif
 
     return 0;
 }
diff --git a/libavfilter/vf_gblur_init.h b/libavfilter/vf_gblur_init.h
index 0fee64bc98..212db9f7a0 100644
--- a/libavfilter/vf_gblur_init.h
+++ b/libavfilter/vf_gblur_init.h
@@ -115,8 +115,9 @@ static av_unused void ff_gblur_init(GBlurContext *s)
     s->horiz_slice = horiz_slice_c;
     s->verti_slice = verti_slice_c;
     s->postscale_slice = postscale_c;
-    if (ARCH_X86)
-        ff_gblur_init_x86(s);
+#if ARCH_X86
+    ff_gblur_init_x86(s);
+#endif
 }
 
 #endif /* AVFILTER_GBLUR_INIT_H */
diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c
index 1ea65823c3..71a5f9c787 100644
--- a/libavfilter/vf_gradfun.c
+++ b/libavfilter/vf_gradfun.c
@@ -131,8 +131,9 @@ static av_cold int init(AVFilterContext *ctx)
     s->blur_line   = ff_gradfun_blur_line_c;
     s->filter_line = ff_gradfun_filter_line_c;
 
-    if (ARCH_X86)
-        ff_gradfun_init_x86(s);
+#if ARCH_X86
+    ff_gradfun_init_x86(s);
+#endif
 
     av_log(ctx, AV_LOG_VERBOSE, "threshold:%.2f radius:%d\n", s->strength, s->radius);
 
diff --git a/libavfilter/vf_hflip_init.h b/libavfilter/vf_hflip_init.h
index b58cfec901..d0319f463d 100644
--- a/libavfilter/vf_hflip_init.h
+++ b/libavfilter/vf_hflip_init.h
@@ -101,8 +101,9 @@ static av_unused int ff_hflip_init(FlipContext *s, int step[4], int nb_planes)
             return AVERROR_BUG;
         }
     }
-    if (ARCH_X86)
-        ff_hflip_init_x86(s, step, nb_planes);
+#if ARCH_X86
+    ff_hflip_init_x86(s, step, nb_planes);
+#endif
 
     return 0;
 }
diff --git a/libavfilter/vf_hqdn3d.c b/libavfilter/vf_hqdn3d.c
index 6078bb260f..ce2b9a2974 100644
--- a/libavfilter/vf_hqdn3d.c
+++ b/libavfilter/vf_hqdn3d.c
@@ -278,8 +278,9 @@ static int config_input(AVFilterLink *inlink)
 
     calc_coefs(ctx);
 
-    if (ARCH_X86)
-        ff_hqdn3d_init_x86(s);
+#if ARCH_X86
+    ff_hqdn3d_init_x86(s);
+#endif
 
     return 0;
 }
diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c
index 9320b485d8..83d992add1 100644
--- a/libavfilter/vf_idet.c
+++ b/libavfilter/vf_idet.c
@@ -276,8 +276,9 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
         idet->csp = av_pix_fmt_desc_get(link->format);
     if (idet->csp->comp[0].depth > 8){
         idet->filter_line = (ff_idet_filter_func)ff_idet_filter_line_c_16bit;
-        if (ARCH_X86)
-            ff_idet_init_x86(idet, 1);
+#if ARCH_X86
+        ff_idet_init_x86(idet, 1);
+#endif
     }
 
     if (idet->analyze_interlaced_flag) {
@@ -408,8 +409,9 @@ static av_cold int init(AVFilterContext *ctx)
 
     idet->filter_line = ff_idet_filter_line_c;
 
-    if (ARCH_X86)
-        ff_idet_init_x86(idet, 0);
+#if ARCH_X86
+    ff_idet_init_x86(idet, 0);
+#endif
 
     return 0;
 }
diff --git a/libavfilter/vf_limiter.c b/libavfilter/vf_limiter.c
index f7d06fec48..67b734229f 100644
--- a/libavfilter/vf_limiter.c
+++ b/libavfilter/vf_limiter.c
@@ -141,8 +141,9 @@ static int config_input(AVFilterLink *inlink)
         s->dsp.limiter = limiter16;
     }
 
-    if (ARCH_X86)
-        ff_limiter_init_x86(&s->dsp, desc->comp[0].depth);
+#if ARCH_X86
+    ff_limiter_init_x86(&s->dsp, desc->comp[0].depth);
+#endif
 
     return 0;
 }
diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c
index c7ecb7018e..358fe13e09 100644
--- a/libavfilter/vf_lut3d.c
+++ b/libavfilter/vf_lut3d.c
@@ -1150,9 +1150,9 @@ static int config_input(AVFilterLink *inlink)
         av_assert0(0);
     }
 
-    if (ARCH_X86) {
-        ff_lut3d_init_x86(lut3d, desc);
-    }
+#if ARCH_X86
+    ff_lut3d_init_x86(lut3d, desc);
+#endif
 
     return 0;
 }
diff --git a/libavfilter/vf_maskedclamp.c b/libavfilter/vf_maskedclamp.c
index de97669877..72f98703a5 100644
--- a/libavfilter/vf_maskedclamp.c
+++ b/libavfilter/vf_maskedclamp.c
@@ -209,8 +209,9 @@ static int config_input(AVFilterLink *inlink)
     else
         s->dsp.maskedclamp = maskedclamp16;
 
-    if (ARCH_X86)
-        ff_maskedclamp_init_x86(&s->dsp, s->depth);
+#if ARCH_X86
+    ff_maskedclamp_init_x86(&s->dsp, s->depth);
+#endif
 
     return 0;
 }
diff --git a/libavfilter/vf_maskedmerge.c b/libavfilter/vf_maskedmerge.c
index db0c516938..7adb809760 100644
--- a/libavfilter/vf_maskedmerge.c
+++ b/libavfilter/vf_maskedmerge.c
@@ -202,8 +202,9 @@ static int config_input(AVFilterLink *inlink)
     else
         s->maskedmerge = maskedmerge32;
 
-    if (ARCH_X86)
-        ff_maskedmerge_init_x86(s);
+#if ARCH_X86
+    ff_maskedmerge_init_x86(s);
+#endif
 
     return 0;
 }
diff --git a/libavfilter/vf_nlmeans_init.h b/libavfilter/vf_nlmeans_init.h
index 04ad8801b6..06e932936b 100644
--- a/libavfilter/vf_nlmeans_init.h
+++ b/libavfilter/vf_nlmeans_init.h
@@ -129,11 +129,11 @@ static av_unused void ff_nlmeans_init(NLMeansDSPContext *dsp)
     dsp->compute_safe_ssd_integral_image = compute_safe_ssd_integral_image_c;
     dsp->compute_weights_line = compute_weights_line_c;
 
-    if (ARCH_AARCH64)
-        ff_nlmeans_init_aarch64(dsp);
-
-    if (ARCH_X86)
-        ff_nlmeans_init_x86(dsp);
+#if ARCH_AARCH64
+    ff_nlmeans_init_aarch64(dsp);
+#elif ARCH_X86
+    ff_nlmeans_init_x86(dsp);
+#endif
 }
 
 #endif /* AVFILTER_NLMEANS_INIT_H */
diff --git a/libavfilter/vf_noise.c b/libavfilter/vf_noise.c
index 0e3e72b6b5..8ed12f7409 100644
--- a/libavfilter/vf_noise.c
+++ b/libavfilter/vf_noise.c
@@ -305,8 +305,9 @@ static av_cold int init(AVFilterContext *ctx)
     n->line_noise     = ff_line_noise_c;
     n->line_noise_avg = ff_line_noise_avg_c;
 
-    if (ARCH_X86)
-        ff_noise_init_x86(n);
+#if ARCH_X86
+    ff_noise_init_x86(n);
+#endif
 
     return 0;
 }
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index f560d54dae..e201e07c15 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -984,9 +984,10 @@ static int config_input_main(AVFilterLink *inlink)
     }
 
 end:
-    if (ARCH_X86)
-        ff_overlay_init_x86(s, s->format, inlink->format,
-                            s->alpha_format, s->main_has_alpha);
+#if ARCH_X86
+    ff_overlay_init_x86(s, s->format, inlink->format,
+                        s->alpha_format, s->main_has_alpha);
+#endif
 
     return 0;
 }
diff --git a/libavfilter/vf_pp7.c b/libavfilter/vf_pp7.c
index 2faa4d2c8a..b7c7cf9dde 100644
--- a/libavfilter/vf_pp7.c
+++ b/libavfilter/vf_pp7.c
@@ -301,8 +301,9 @@ static int config_input(AVFilterLink *inlink)
 
     pp7->dctB = dctB_c;
 
-    if (ARCH_X86)
-        ff_pp7_init_x86(pp7);
+#if ARCH_X86
+    ff_pp7_init_x86(pp7);
+#endif
 
     return 0;
 }
diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
index fdfd211401..fa2e887e9b 100644
--- a/libavfilter/vf_psnr.c
+++ b/libavfilter/vf_psnr.c
@@ -354,8 +354,9 @@ static int config_input_ref(AVFilterLink *inlink)
     s->average_max = lrint(average_max);
 
     s->dsp.sse_line = desc->comp[0].depth > 8 ? sse_line_16bit : sse_line_8bit;
-    if (ARCH_X86)
-        ff_psnr_init_x86(&s->dsp, desc->comp[0].depth);
+#if ARCH_X86
+    ff_psnr_init_x86(&s->dsp, desc->comp[0].depth);
+#endif
 
     s->score = av_calloc(s->nb_threads, sizeof(*s->score));
     if (!s->score)
diff --git a/libavfilter/vf_pullup.c b/libavfilter/vf_pullup.c
index 1ee5eb00da..054e3f90a9 100644
--- a/libavfilter/vf_pullup.c
+++ b/libavfilter/vf_pullup.c
@@ -207,8 +207,9 @@ static int config_input(AVFilterLink *inlink)
     s->comb = comb_c;
     s->var  = var_c;
 
-    if (ARCH_X86)
-        ff_pullup_init_x86(s);
+#if ARCH_X86
+    ff_pullup_init_x86(s);
+#endif
     return 0;
 }
 
diff --git a/libavfilter/vf_removegrain.c b/libavfilter/vf_removegrain.c
index 16140bf8b6..0d4b070cd5 100644
--- a/libavfilter/vf_removegrain.c
+++ b/libavfilter/vf_removegrain.c
@@ -501,8 +501,9 @@ static int config_input(AVFilterLink *inlink)
         }
     }
 
-    if (ARCH_X86)
-        ff_removegrain_init_x86(s);
+#if ARCH_X86
+    ff_removegrain_init_x86(s);
+#endif
 
     return 0;
 }
diff --git a/libavfilter/vf_spp.c b/libavfilter/vf_spp.c
index 0192676909..8442bcc597 100644
--- a/libavfilter/vf_spp.c
+++ b/libavfilter/vf_spp.c
@@ -343,8 +343,9 @@ static int config_input(AVFilterLink *inlink)
     av_opt_set_int(s->dct, "bits_per_sample", bps, 0);
     avcodec_dct_init(s->dct);
 
-    if (ARCH_X86)
-        ff_spp_init_x86(s);
+#if ARCH_X86
+    ff_spp_init_x86(s);
+#endif
 
     s->hsub = desc->log2_chroma_w;
     s->vsub = desc->log2_chroma_h;
diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c
index bceb3288ef..37094b23f9 100644
--- a/libavfilter/vf_ssim.c
+++ b/libavfilter/vf_ssim.c
@@ -478,8 +478,9 @@ static int config_input_ref(AVFilterLink *inlink)
     s->ssim_plane = desc->comp[0].depth > 8 ? ssim_plane_16bit : ssim_plane;
     s->dsp.ssim_4x4_line = ssim_4x4xn_8bit;
     s->dsp.ssim_end_line = ssim_endn_8bit;
-    if (ARCH_X86)
-        ff_ssim_init_x86(&s->dsp);
+#if ARCH_X86
+    ff_ssim_init_x86(&s->dsp);
+#endif
 
     s->score = av_calloc(s->nb_threads, sizeof(*s->score));
     if (!s->score)
diff --git a/libavfilter/vf_stereo3d.c b/libavfilter/vf_stereo3d.c
index 0ba18861af..71041d2fee 100644
--- a/libavfilter/vf_stereo3d.c
+++ b/libavfilter/vf_stereo3d.c
@@ -591,8 +591,9 @@ static int config_output(AVFilterLink *outlink)
     s->vsub = desc->log2_chroma_h;
 
     s->dsp.anaglyph = anaglyph;
-    if (ARCH_X86)
-        ff_stereo3d_init_x86(&s->dsp);
+#if ARCH_X86
+    ff_stereo3d_init_x86(&s->dsp);
+#endif
 
     return 0;
 }
diff --git a/libavfilter/vf_threshold_init.h b/libavfilter/vf_threshold_init.h
index e79d2bb63d..7d160ddbb9 100644
--- a/libavfilter/vf_threshold_init.h
+++ b/libavfilter/vf_threshold_init.h
@@ -84,8 +84,9 @@ static av_unused void ff_threshold_init(ThresholdContext *s)
         s->bpc = 2;
     }
 
-    if (ARCH_X86)
-        ff_threshold_init_x86(s);
+#if ARCH_X86
+    ff_threshold_init_x86(s);
+#endif
 }
 
 #endif /* AVFILTER_THRESHOLD_INIT_H */
diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c
index cda55a8c73..399adc102d 100644
--- a/libavfilter/vf_tinterlace.c
+++ b/libavfilter/vf_tinterlace.c
@@ -269,15 +269,17 @@ static int config_out_props(AVFilterLink *outlink)
             tinterlace->lowpass_line = lowpass_line_complex_c_16;
         else
             tinterlace->lowpass_line = lowpass_line_complex_c;
-        if (ARCH_X86)
-            ff_tinterlace_init_x86(tinterlace);
+#if ARCH_X86
+        ff_tinterlace_init_x86(tinterlace);
+#endif
     } else if (tinterlace->flags & TINTERLACE_FLAG_VLPF) {
         if (tinterlace->csp->comp[0].depth > 8)
             tinterlace->lowpass_line = lowpass_line_c_16;
         else
             tinterlace->lowpass_line = lowpass_line_c;
-        if (ARCH_X86)
-            ff_tinterlace_init_x86(tinterlace);
+#if ARCH_X86
+        ff_tinterlace_init_x86(tinterlace);
+#endif
     }
 
     av_log(ctx, AV_LOG_VERBOSE, "mode:%d filter:%s h:%d -> h:%d\n", tinterlace->mode,
diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c
index b964daeee3..469e66729f 100644
--- a/libavfilter/vf_transpose.c
+++ b/libavfilter/vf_transpose.c
@@ -235,13 +235,13 @@ static int config_props_output(AVFilterLink *outlink)
         }
     }
 
-    if (ARCH_X86) {
-        for (int i = 0; i < 4; i++) {
-            TransVtable *v = &s->vtables[i];
+#if ARCH_X86
+    for (int i = 0; i < 4; i++) {
+        TransVtable *v = &s->vtables[i];
 
-            ff_transpose_init_x86(v, s->pixsteps[i]);
-        }
+        ff_transpose_init_x86(v, s->pixsteps[i]);
     }
+#endif
 
     av_log(ctx, AV_LOG_VERBOSE,
            "w:%d h:%d dir:%d -> w:%d h:%d rotation:%s vflip:%d\n",
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 55aa05c35c..2ac9b688dc 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -389,8 +389,9 @@ void ff_v360_init(V360Context *s, int depth)
         break;
     }
 
-    if (ARCH_X86)
-        ff_v360_init_x86(s, depth);
+#if ARCH_X86
+    ff_v360_init_x86(s, depth);
+#endif
 }
 
 /**
diff --git a/libavfilter/vf_w3fdif.c b/libavfilter/vf_w3fdif.c
index 53631fd15b..512c8070c7 100644
--- a/libavfilter/vf_w3fdif.c
+++ b/libavfilter/vf_w3fdif.c
@@ -317,8 +317,9 @@ static int config_input(AVFilterLink *inlink)
         s->dsp.filter_scale        = filter16_scale;
     }
 
-    if (ARCH_X86)
-        ff_w3fdif_init_x86(&s->dsp, depth);
+#if ARCH_X86
+    ff_w3fdif_init_x86(&s->dsp, depth);
+#endif
 
     return 0;
 }
diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index 21f6c8544d..afa4d1d53d 100644
--- a/libavfilter/vf_yadif.c
+++ b/libavfilter/vf_yadif.c
@@ -311,8 +311,9 @@ static int config_output(AVFilterLink *outlink)
         s->filter_edges = filter_edges;
     }
 
-    if (ARCH_X86)
-        ff_yadif_init_x86(s);
+#if ARCH_X86
+    ff_yadif_init_x86(s);
+#endif
 
     return 0;
 }
diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index 24b99d2554..0035e927a5 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -54,18 +54,19 @@ static atomic_int cpu_count = ATOMIC_VAR_INIT(-1);
 
 static int get_cpu_flags(void)
 {
-    if (ARCH_MIPS)
-        return ff_get_cpu_flags_mips();
-    if (ARCH_AARCH64)
-        return ff_get_cpu_flags_aarch64();
-    if (ARCH_ARM)
-        return ff_get_cpu_flags_arm();
-    if (ARCH_PPC)
-        return ff_get_cpu_flags_ppc();
-    if (ARCH_X86)
-        return ff_get_cpu_flags_x86();
-    if (ARCH_LOONGARCH)
-        return ff_get_cpu_flags_loongarch();
+#if ARCH_MIPS
+    return ff_get_cpu_flags_mips();
+#elif ARCH_AARCH64
+    return ff_get_cpu_flags_aarch64();
+#elif ARCH_ARM
+    return ff_get_cpu_flags_arm();
+#elif ARCH_PPC
+    return ff_get_cpu_flags_ppc();
+#elif ARCH_X86
+    return ff_get_cpu_flags_x86();
+#elif ARCH_LOONGARCH
+    return ff_get_cpu_flags_loongarch();
+#endif
     return 0;
 }
 
@@ -252,18 +253,19 @@ void av_cpu_force_count(int count)
 
 size_t av_cpu_max_align(void)
 {
-    if (ARCH_MIPS)
-        return ff_get_cpu_max_align_mips();
-    if (ARCH_AARCH64)
-        return ff_get_cpu_max_align_aarch64();
-    if (ARCH_ARM)
-        return ff_get_cpu_max_align_arm();
-    if (ARCH_PPC)
-        return ff_get_cpu_max_align_ppc();
-    if (ARCH_X86)
-        return ff_get_cpu_max_align_x86();
-    if (ARCH_LOONGARCH)
-        return ff_get_cpu_max_align_loongarch();
+#if ARCH_MIPS
+    return ff_get_cpu_max_align_mips();
+#elif ARCH_AARCH64
+    return ff_get_cpu_max_align_aarch64();
+#elif ARCH_ARM
+    return ff_get_cpu_max_align_arm();
+#elif ARCH_PPC
+    return ff_get_cpu_max_align_ppc();
+#elif ARCH_X86
+    return ff_get_cpu_max_align_x86();
+#elif ARCH_LOONGARCH
+    return ff_get_cpu_max_align_loongarch();
+#endif
 
     return 8;
 }
diff --git a/libavutil/fixed_dsp.c b/libavutil/fixed_dsp.c
index 098ef9c061..154f3bc2d3 100644
--- a/libavutil/fixed_dsp.c
+++ b/libavutil/fixed_dsp.c
@@ -162,8 +162,9 @@ AVFixedDSPContext * avpriv_alloc_fixed_dsp(int bit_exact)
     fdsp->butterflies_fixed = butterflies_fixed_c;
     fdsp->scalarproduct_fixed = scalarproduct_fixed_c;
 
-    if (ARCH_X86)
-        ff_fixed_dsp_init_x86(fdsp);
+#if ARCH_X86
+    ff_fixed_dsp_init_x86(fdsp);
+#endif
 
     return fdsp;
 }
diff --git a/libavutil/float_dsp.c b/libavutil/float_dsp.c
index 6e28d71b57..8676c8b0f8 100644
--- a/libavutil/float_dsp.c
+++ b/libavutil/float_dsp.c
@@ -150,15 +150,16 @@ av_cold AVFloatDSPContext *avpriv_float_dsp_alloc(int bit_exact)
     fdsp->butterflies_float = butterflies_float_c;
     fdsp->scalarproduct_float = avpriv_scalarproduct_float_c;
 
-    if (ARCH_AARCH64)
-        ff_float_dsp_init_aarch64(fdsp);
-    if (ARCH_ARM)
-        ff_float_dsp_init_arm(fdsp);
-    if (ARCH_PPC)
-        ff_float_dsp_init_ppc(fdsp, bit_exact);
-    if (ARCH_X86)
-        ff_float_dsp_init_x86(fdsp);
-    if (ARCH_MIPS)
-        ff_float_dsp_init_mips(fdsp);
+#if ARCH_AARCH64
+    ff_float_dsp_init_aarch64(fdsp);
+#elif ARCH_ARM
+    ff_float_dsp_init_arm(fdsp);
+#elif ARCH_PPC
+    ff_float_dsp_init_ppc(fdsp, bit_exact);
+#elif ARCH_X86
+    ff_float_dsp_init_x86(fdsp);
+#elif ARCH_MIPS
+    ff_float_dsp_init_mips(fdsp);
+#endif
     return fdsp;
 }
diff --git a/libavutil/lls.c b/libavutil/lls.c
index ea2d80e662..c1e038daf1 100644
--- a/libavutil/lls.c
+++ b/libavutil/lls.c
@@ -117,6 +117,7 @@ av_cold void avpriv_init_lls(LLSModel *m, int indep_count)
     m->indep_count = indep_count;
     m->update_lls = update_lls;
     m->evaluate_lls = evaluate_lls;
-    if (ARCH_X86)
-        ff_init_lls_x86(m);
+#if ARCH_X86
+    ff_init_lls_x86(m);
+#endif
 }
diff --git a/libswresample/audioconvert.c b/libswresample/audioconvert.c
index 500aa0e5c5..1d75ba1495 100644
--- a/libswresample/audioconvert.c
+++ b/libswresample/audioconvert.c
@@ -176,9 +176,13 @@ AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt,
         }
     }
 
-    if(HAVE_X86ASM && HAVE_MMX) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);
-    if(ARCH_ARM)              swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);
-    if(ARCH_AARCH64)          swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);
+#if ARCH_X86 && HAVE_X86ASM && HAVE_MMX
+    swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);
+#elif ARCH_ARM
+    swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);
+#elif ARCH_AARCH64
+    swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);
+#endif
 
     return ctx;
 }
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index 5e89b878dd..fe823dc575 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -565,8 +565,9 @@ av_cold int swri_rematrix_init(SwrContext *s){
         s->matrix_ch[i][0]= ch_in;
     }
 
-    if(HAVE_X86ASM && HAVE_MMX)
-        return swri_rematrix_init_x86(s);
+#if ARCH_X86 && HAVE_X86ASM && HAVE_MMX
+    return swri_rematrix_init_x86(s);
+#endif
 
     return 0;
 }
diff --git a/libswresample/resample_dsp.c b/libswresample/resample_dsp.c
index b2424eb6f7..611f44373f 100644
--- a/libswresample/resample_dsp.c
+++ b/libswresample/resample_dsp.c
@@ -68,7 +68,11 @@ void swri_resample_dsp_init(ResampleContext *c)
         break;
     }
 
-    if (ARCH_X86) swri_resample_dsp_x86_init(c);
-    else if (ARCH_ARM) swri_resample_dsp_arm_init(c);
-    else if (ARCH_AARCH64) swri_resample_dsp_aarch64_init(c);
+#if ARCH_X86
+    swri_resample_dsp_x86_init(c);
+#elif ARCH_ARM
+    swri_resample_dsp_arm_init(c);
+#elif ARCH_AARCH64
+    swri_resample_dsp_aarch64_init(c);
+#endif
 }
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
index a7300f3ba4..b8be76913b 100644
--- a/libswscale/rgb2rgb.c
+++ b/libswscale/rgb2rgb.c
@@ -137,10 +137,11 @@ void (*yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
 av_cold void ff_sws_rgb2rgb_init(void)
 {
     rgb2rgb_init_c();
-    if (ARCH_AARCH64)
-        rgb2rgb_init_aarch64();
-    if (ARCH_X86)
-        rgb2rgb_init_x86();
+#if ARCH_AARCH64
+    rgb2rgb_init_aarch64();
+#elif ARCH_X86
+    rgb2rgb_init_x86();
+#endif
 }
 
 void rgb32to24(const uint8_t *src, uint8_t *dst, int src_size)
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 3ed547d526..7b40f49da4 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -590,14 +590,15 @@ void ff_sws_init_scale(SwsContext *c)
 {
     sws_init_swscale(c);
 
-    if (ARCH_PPC)
-        ff_sws_init_swscale_ppc(c);
-    if (ARCH_X86)
-        ff_sws_init_swscale_x86(c);
-    if (ARCH_AARCH64)
-        ff_sws_init_swscale_aarch64(c);
-    if (ARCH_ARM)
-        ff_sws_init_swscale_arm(c);
+#if ARCH_PPC
+    ff_sws_init_swscale_ppc(c);
+#elif ARCH_X86
+    ff_sws_init_swscale_x86(c);
+#elif ARCH_AARCH64
+    ff_sws_init_swscale_aarch64(c);
+#elif ARCH_ARM
+    ff_sws_init_swscale_arm(c);
+#endif
 }
 
 static void reset_ptr(const uint8_t *src[], enum AVPixelFormat format)
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 7cb2a62f07..8838cc8b53 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -2222,12 +2222,13 @@ void ff_get_unscaled_swscale(SwsContext *c)
             c->convert_unscaled = planarCopyWrapper;
     }
 
-    if (ARCH_PPC)
-        ff_get_unscaled_swscale_ppc(c);
-     if (ARCH_ARM)
-         ff_get_unscaled_swscale_arm(c);
-    if (ARCH_AARCH64)
-        ff_get_unscaled_swscale_aarch64(c);
+#if ARCH_PPC
+    ff_get_unscaled_swscale_ppc(c);
+#elif ARCH_ARM
+    ff_get_unscaled_swscale_arm(c);
+#elif ARCH_AARCH64
+    ff_get_unscaled_swscale_aarch64(c);
+#endif
 }
 
 /* Convert the palette to the same packed 32-bit format as the palette */
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 105781c4f4..cb4f5b521c 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1044,9 +1044,10 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
                                  contrast, saturation);
         // FIXME factorize
 
-        if (ARCH_PPC)
-            ff_yuv2rgb_init_tables_ppc(c, inv_table, brightness,
-                                       contrast, saturation);
+#if ARCH_PPC
+        ff_yuv2rgb_init_tables_ppc(c, inv_table, brightness,
+                                   contrast, saturation);
+#endif
     }
 
     fill_rgb2yuv_table(c, table, dstRange);
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index 76232cb364..6ee483d12a 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -679,10 +679,11 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
 {
     SwsFunc t = NULL;
 
-    if (ARCH_PPC)
-        t = ff_yuv2rgb_init_ppc(c);
-    if (ARCH_X86)
-        t = ff_yuv2rgb_init_x86(c);
+#if ARCH_PPC
+    t = ff_yuv2rgb_init_ppc(c);
+#elif ARCH_X86
+    t = ff_yuv2rgb_init_x86(c);
+#endif
 
     if (t)
         return t;




More information about the ffmpeg-cvslog mailing list