Browse Source

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@outlook.com>
Andreas Rheinhardt 3 years ago
parent
commit
40e6575aa3
100 changed files with 584 additions and 449 deletions
  1. 3 2
      libavcodec/aacdec_template.c
  2. 6 4
      libavcodec/aacenc.c
  3. 9 8
      libavcodec/aacpsdsp_template.c
  4. 3 2
      libavcodec/aacsbr_template.c
  5. 10 8
      libavcodec/ac3dsp.c
  6. 3 2
      libavcodec/acelp_filters.c
  7. 3 2
      libavcodec/acelp_vectors.c
  8. 3 2
      libavcodec/alacdsp.c
  9. 7 6
      libavcodec/audiodsp.c
  10. 11 10
      libavcodec/blockdsp.c
  11. 3 2
      libavcodec/bswapdsp.c
  12. 3 2
      libavcodec/cavsdsp.c
  13. 3 2
      libavcodec/celp_filters.c
  14. 3 2
      libavcodec/celp_math.c
  15. 3 2
      libavcodec/cfhddsp.c
  16. 3 2
      libavcodec/cfhdencdsp.c
  17. 3 2
      libavcodec/dcadsp.c
  18. 3 2
      libavcodec/dct.c
  19. 3 1
      libavcodec/dirac_dwt.c
  20. 3 2
      libavcodec/diracdsp.c
  21. 3 2
      libavcodec/dnxhdenc.c
  22. 3 2
      libavcodec/exrdsp.c
  23. 6 5
      libavcodec/fdctdsp.c
  24. 12 5
      libavcodec/fft_template.c
  25. 5 4
      libavcodec/flacdsp.c
  26. 12 10
      libavcodec/fmtconvert.c
  27. 5 4
      libavcodec/g722dsp.c
  28. 5 4
      libavcodec/h263dsp.c
  29. 13 12
      libavcodec/h264chroma.c
  30. 13 6
      libavcodec/h264dsp.c
  31. 11 10
      libavcodec/h264pred.c
  32. 13 12
      libavcodec/h264qpel.c
  33. 13 12
      libavcodec/hevcdsp.c
  34. 3 2
      libavcodec/hevcpred.c
  35. 15 14
      libavcodec/hpeldsp.c
  36. 3 2
      libavcodec/huffyuvdsp.c
  37. 3 2
      libavcodec/huffyuvencdsp.c
  38. 21 19
      libavcodec/idctdsp.c
  39. 3 2
      libavcodec/iirfilter.c
  40. 3 2
      libavcodec/jpeg2000dsp.c
  41. 7 6
      libavcodec/lossless_audiodsp.c
  42. 5 4
      libavcodec/lossless_videodsp.c
  43. 3 2
      libavcodec/lossless_videoencdsp.c
  44. 3 2
      libavcodec/lpc.c
  45. 3 2
      libavcodec/mdct15.c
  46. 11 10
      libavcodec/me_cmp.c
  47. 5 4
      libavcodec/mlpdsp.c
  48. 18 8
      libavcodec/mpegaudiodsp.c
  49. 15 13
      libavcodec/mpegvideo.c
  50. 3 2
      libavcodec/mpegvideo_enc.c
  51. 5 4
      libavcodec/mpegvideodsp.c
  52. 9 8
      libavcodec/mpegvideoencdsp.c
  53. 3 2
      libavcodec/opus_pvq.c
  54. 5 5
      libavcodec/opusdsp.c
  55. 14 13
      libavcodec/pixblockdsp.c
  56. 3 2
      libavcodec/pngdsp.c
  57. 3 2
      libavcodec/proresdsp.c
  58. 5 4
      libavcodec/qpeldsp.c
  59. 3 1
      libavcodec/rdft.c
  60. 5 4
      libavcodec/rv34dsp.c
  61. 7 6
      libavcodec/rv40dsp.c
  62. 5 4
      libavcodec/sbcdsp.c
  63. 9 8
      libavcodec/sbrdsp_template.c
  64. 3 2
      libavcodec/snow_dwt.c
  65. 5 4
      libavcodec/svq1enc.c
  66. 7 6
      libavcodec/synth_filter.c
  67. 3 2
      libavcodec/takdsp.c
  68. 3 2
      libavcodec/ttadsp.c
  69. 3 2
      libavcodec/ttaencdsp.c
  70. 3 2
      libavcodec/utvideodsp.c
  71. 3 2
      libavcodec/v210dec_init.h
  72. 3 2
      libavcodec/v210enc_init.h
  73. 13 12
      libavcodec/vc1dsp.c
  74. 13 12
      libavcodec/videodsp.c
  75. 9 8
      libavcodec/vorbisdsp.c
  76. 9 8
      libavcodec/vp3dsp.c
  77. 5 4
      libavcodec/vp56dsp.c
  78. 20 18
      libavcodec/vp8dsp.c
  79. 11 5
      libavcodec/vp9dsp.c
  80. 3 2
      libavcodec/wmv2dsp.c
  81. 4 2
      libavcodec/x86/mdct15_init.c
  82. 5 4
      libavcodec/xvididct.c
  83. 3 2
      libavfilter/af_afirdsp.h
  84. 3 2
      libavfilter/af_anlmdn.c
  85. 3 2
      libavfilter/af_volume.c
  86. 3 2
      libavfilter/avf_showcqt.c
  87. 3 2
      libavfilter/colorspacedsp.c
  88. 3 2
      libavfilter/scene_sad.c
  89. 3 2
      libavfilter/vf_atadenoise.c
  90. 3 2
      libavfilter/vf_blend_init.h
  91. 3 2
      libavfilter/vf_bwdif.c
  92. 3 2
      libavfilter/vf_eq.h
  93. 3 2
      libavfilter/vf_framerate.c
  94. 3 2
      libavfilter/vf_fspp.c
  95. 3 2
      libavfilter/vf_gblur_init.h
  96. 3 2
      libavfilter/vf_gradfun.c
  97. 3 2
      libavfilter/vf_hflip_init.h
  98. 3 2
      libavfilter/vf_hqdn3d.c
  99. 6 4
      libavfilter/vf_idet.c
  100. 3 2
      libavfilter/vf_limiter.c

+ 3 - 2
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 */
 }
 /**

+ 6 - 4
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();

+ 9 - 8
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 */
 }

+ 3 - 2
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
 }

+ 10 - 8
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
 }

+ 3 - 2
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
 }

+ 3 - 2
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
 }

+ 3 - 2
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
 }

+ 7 - 6
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
 }

+ 11 - 10
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
 }

+ 3 - 2
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
 }

+ 3 - 2
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
 }

+ 3 - 2
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
 }

+ 3 - 2
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
 }

+ 3 - 2
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
 }

+ 3 - 2
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
 }

+ 3 - 2
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
 }

+ 3 - 2
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;
 }

+ 3 - 1
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;
 }
 

+ 3 - 2
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
 }

+ 3 - 2
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;

+ 3 - 2
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
 }

+ 6 - 5
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
 }

+ 12 - 5
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);
     }

+ 5 - 4
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
 }

+ 12 - 10
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
 }

+ 5 - 4
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
 }

+ 5 - 4
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
 }

+ 13 - 12
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
 }

+ 13 - 6
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
 }

+ 11 - 10
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
 }

+ 13 - 12
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
 }

+ 13 - 12
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
 }

+ 3 - 2
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
 }

+ 15 - 14
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
 }

+ 3 - 2
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
 }

+ 3 - 2
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
 }

+ 21 - 19
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);

+ 3 - 2
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
 }

+ 3 - 2
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
 }

+ 7 - 6
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
 }

+ 5 - 4
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
 }

+ 3 - 2
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
 }

+ 3 - 2
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;
 }

+ 3 - 2
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;
 

+ 11 - 10
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;

+ 5 - 4
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
 }

+ 18 - 8
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
 }

+ 15 - 13
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;
 }

+ 3 - 2
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);

+ 5 - 4
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
 }

+ 9 - 8
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
 }

+ 3 - 2
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;
 

+ 5 - 5
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
 }

+ 14 - 13
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
 }

+ 3 - 2
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
 }

+ 3 - 2
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);

+ 5 - 4
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
 }

+ 3 - 1
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;
 }

+ 5 - 4
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
 }

+ 7 - 6
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
 }

+ 5 - 4
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
 }

+ 9 - 8
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 */
 }

+ 3 - 2
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
 }
 
 

+ 5 - 4
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
 

+ 7 - 6
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
 }

+ 3 - 2
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
 }

+ 3 - 2
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
 }

+ 3 - 2
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
 }

+ 3 - 2
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
 }

+ 3 - 2
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 */

+ 3 - 2
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 */

+ 13 - 12
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
 }

+ 13 - 12
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
 }

+ 9 - 8
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
 }

+ 9 - 8
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
 }
 
 /*

+ 5 - 4
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 */

+ 20 - 18
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 */

+ 11 - 5
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
 }

+ 3 - 2
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
 }

+ 4 - 2
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);

+ 5 - 4
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);
 }

+ 3 - 2
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 */

+ 3 - 2
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)

+ 3 - 2
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)

+ 3 - 2
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;

+ 3 - 2
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
 }

+ 3 - 2
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;

+ 3 - 2
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;
 }

+ 3 - 2
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 */

+ 3 - 2
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;
 }

+ 3 - 2
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 */

+ 3 - 2
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)

+ 3 - 2
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;
 }

+ 3 - 2
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 */

+ 3 - 2
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);
 

+ 3 - 2
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;
 }

+ 3 - 2
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;
 }

+ 6 - 4
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;
 }

+ 3 - 2
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;
 }

Some files were not shown because too many files changed in this diff