[FFmpeg-devel] [PATCH 4/4] all: Guard if (EXTERNAL*) checks with #if HAVE_X86ASM

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Nov 2 02:26:48 EET 2022


L. E. Segovia:
> Continuation of 40e6575aa3eed64cd32bf28c00ae57edc5acb25a
> 
> Signed-off-by: L. E. Segovia <amy at amyspark.me>
> ---
>  libavcodec/x86/aacencdsp_init.c            | 2 ++
>  libavcodec/x86/aacpsdsp_init.c             | 2 ++
>  libavcodec/x86/ac3dsp_init.c               | 4 ++++
>  libavcodec/x86/audiodsp_init.c             | 2 ++
>  libavcodec/x86/bswapdsp_init.c             | 2 ++
>  libavcodec/x86/cavsdsp.c                   | 2 ++
>  libavcodec/x86/celt_pvq_init.c             | 2 ++
>  libavcodec/x86/cfhddsp_init.c              | 2 ++
>  libavcodec/x86/cfhdencdsp_init.c           | 2 ++
>  libavcodec/x86/dcadsp_init.c               | 2 ++
>  libavcodec/x86/dct_init.c                  | 2 ++
>  libavcodec/x86/dnxhdenc_init.c             | 2 ++
>  libavcodec/x86/exrdsp_init.c               | 2 ++
>  libavcodec/x86/fft_init.c                  | 2 ++
>  libavcodec/x86/g722dsp_init.c              | 2 ++
>  libavcodec/x86/h263dsp_init.c              | 2 ++
>  libavcodec/x86/h264_intrapred_init.c       | 2 ++
>  libavcodec/x86/h264chroma_init.c           | 2 ++
>  libavcodec/x86/hevcdsp_init.c              | 2 ++
>  libavcodec/x86/hpeldsp_init.c              | 2 ++
>  libavcodec/x86/hpeldsp_vp3_init.c          | 2 ++
>  libavcodec/x86/huffyuvdsp_init.c           | 2 ++
>  libavcodec/x86/huffyuvencdsp_init.c        | 2 ++
>  libavcodec/x86/idctdsp_init.c              | 2 ++
>  libavcodec/x86/jpeg2000dsp_init.c          | 2 ++
>  libavcodec/x86/lossless_videodsp_init.c    | 2 ++
>  libavcodec/x86/lossless_videoencdsp_init.c | 2 ++
>  libavcodec/x86/mdct15_init.c               | 2 ++
>  libavcodec/x86/me_cmp_init.c               | 2 ++
>  libavcodec/x86/mlpdsp_init.c               | 2 ++
>  libavcodec/x86/mpegvideoencdsp_init.c      | 2 ++
>  libavcodec/x86/opusdsp_init.c              | 2 ++
>  libavcodec/x86/pixblockdsp_init.c          | 2 ++
>  libavcodec/x86/pngdsp_init.c               | 2 ++
>  libavcodec/x86/proresdsp_init.c            | 2 ++
>  libavcodec/x86/rv34dsp_init.c              | 2 ++
>  libavcodec/x86/sbcdsp_init.c               | 2 ++
>  libavcodec/x86/sbrdsp_init.c               | 2 ++
>  libavcodec/x86/svq1enc_init.c              | 2 ++
>  libavcodec/x86/utvideodsp_init.c           | 2 ++
>  libavcodec/x86/v210enc_init.c              | 2 ++
>  libavcodec/x86/vorbisdsp_init.c            | 2 ++
>  libavcodec/x86/vp3dsp_init.c               | 2 ++
>  libavcodec/x86/vp6dsp_init.c               | 2 ++
>  libavfilter/x86/af_afir_init.c             | 2 ++
>  libavfilter/x86/af_anlmdn_init.c           | 2 ++
>  libavfilter/x86/af_volume_init.c           | 2 ++
>  libavfilter/x86/avf_showcqt_init.c         | 2 ++
>  libavfilter/x86/colorspacedsp_init.c       | 2 ++
>  libavfilter/x86/vf_atadenoise_init.c       | 2 ++
>  libavfilter/x86/vf_blend_init.c            | 2 ++
>  libavfilter/x86/vf_bwdif_init.c            | 2 ++
>  libavfilter/x86/vf_convolution_init.c      | 2 ++
>  libavfilter/x86/vf_framerate_init.c        | 2 ++
>  libavfilter/x86/vf_fspp_init.c             | 2 ++
>  libavfilter/x86/vf_gblur_init.c            | 2 ++
>  libavfilter/x86/vf_hflip_init.c            | 2 ++
>  libavfilter/x86/vf_limiter_init.c          | 2 ++
>  libavfilter/x86/vf_maskedclamp_init.c      | 2 ++
>  libavfilter/x86/vf_maskedmerge_init.c      | 2 ++
>  libavfilter/x86/vf_overlay_init.c          | 2 ++
>  libavfilter/x86/vf_pp7_init.c              | 2 ++
>  libavfilter/x86/vf_psnr_init.c             | 2 ++
>  libavfilter/x86/vf_removegrain_init.c      | 2 ++
>  libavfilter/x86/vf_ssim_init.c             | 2 ++
>  libavfilter/x86/vf_stereo3d_init.c         | 2 ++
>  libavfilter/x86/vf_threshold_init.c        | 2 ++
>  libavfilter/x86/vf_tinterlace_init.c       | 2 ++
>  libavfilter/x86/vf_transpose_init.c        | 2 ++
>  libavfilter/x86/vf_v360_init.c             | 2 ++
>  libavfilter/x86/vf_w3fdif_init.c           | 2 ++
>  libavfilter/x86/vf_yadif_init.c            | 2 ++
>  libavutil/x86/fixed_dsp_init.c             | 2 ++
>  libavutil/x86/float_dsp_init.c             | 2 ++
>  libavutil/x86/imgutils_init.c              | 2 ++
>  libavutil/x86/lls_init.c                   | 2 ++
>  libavutil/x86/pixelutils_init.c            | 2 ++
>  libswresample/x86/audio_convert_init.c     | 2 ++
>  libswresample/x86/resample_init.c          | 6 ++++++
>  libswscale/x86/rgb2rgb.c                   | 2 ++
>  libswscale/x86/swscale.c                   | 2 ++
>  81 files changed, 168 insertions(+)
> 


> diff --git a/libavcodec/x86/hpeldsp_init.c b/libavcodec/x86/hpeldsp_init.c
> index 09c48c341e..d8f4e45849 100644
> --- a/libavcodec/x86/hpeldsp_init.c
> +++ b/libavcodec/x86/hpeldsp_init.c
> @@ -224,6 +224,7 @@ av_cold void ff_hpeldsp_init_x86(HpelDSPContext *c, int flags)
>  {
>      int cpu_flags = av_get_cpu_flags();
>  
> +#if HAVE_X86ASM
>      if (INLINE_MMX(cpu_flags))
>          hpeldsp_init_mmx(c, flags);

Here you are including an INLINE-check inside your #if HAVE_X86ASM.

>  
> @@ -235,6 +236,7 @@ av_cold void ff_hpeldsp_init_x86(HpelDSPContext *c, int flags)
>  
>      if (EXTERNAL_SSSE3(cpu_flags))
>          hpeldsp_init_ssse3(c, flags);
> +#endif
>  
>      if (CONFIG_VP3_DECODER)
>          ff_hpeldsp_vp3_init_x86(c, cpu_flags, flags);

> diff --git a/libavcodec/x86/me_cmp_init.c b/libavcodec/x86/me_cmp_init.c
> index bc1051c27e..527fdff4a9 100644
> --- a/libavcodec/x86/me_cmp_init.c
> +++ b/libavcodec/x86/me_cmp_init.c
> @@ -242,6 +242,7 @@ av_cold void ff_me_cmp_init_x86(MECmpContext *c, AVCodecContext *avctx)
>  
>  #endif /* HAVE_INLINE_ASM */
>  
> +#if HAVE_X86ASM
>      if (EXTERNAL_MMX(cpu_flags)) {
>          c->sse[1]            = ff_sse8_mmx;
>  #if HAVE_X86ASM

You can remove this.

> @@ -307,4 +308,5 @@ av_cold void ff_me_cmp_init_x86(MECmpContext *c, AVCodecContext *avctx)
>          c->hadamard8_diff[1] = ff_hadamard8_diff_ssse3;
>  #endif
>      }
> +#endif /* HAVE_X86ASM */
>  }
> diff --git a/libavcodec/x86/mlpdsp_init.c b/libavcodec/x86/mlpdsp_init.c
> index 333a685f47..f7eca8cb76 100644
> --- a/libavcodec/x86/mlpdsp_init.c
> +++ b/libavcodec/x86/mlpdsp_init.c
> @@ -200,10 +200,12 @@ av_cold void ff_mlpdsp_init_x86(MLPDSPContext *c)
>      if (INLINE_MMX(cpu_flags))
>          c->mlp_filter_channel = mlp_filter_channel_x86;
>  #endif
> +#if HAVE_X86ASM

You can combine this with the ARCH_X86_64 check.

>  #if ARCH_X86_64
>      if (EXTERNAL_SSE4(cpu_flags))
>          c->mlp_rematrix_channel = ff_mlp_rematrix_channel_sse4;
>      if (EXTERNAL_AVX2_FAST(cpu_flags) && cpu_flags & AV_CPU_FLAG_BMI2)
>          c->mlp_rematrix_channel = ff_mlp_rematrix_channel_avx2_bmi2;
>  #endif
> +#endif /* HAVE_X86ASM */
>  }
> diff --git a/libavfilter/x86/vf_convolution_init.c b/libavfilter/x86/vf_convolution_init.c
> index b78a47d02b..fc9cd49de7 100644
> --- a/libavfilter/x86/vf_convolution_init.c
> +++ b/libavfilter/x86/vf_convolution_init.c
> @@ -31,6 +31,7 @@ void ff_filter_3x3_sse4(uint8_t *dst, int width,
>  
>  av_cold void ff_convolution_init_x86(ConvolutionContext *s)
>  {
> +#if HAVE_X86ASM
>  #if ARCH_X86_64

You can combine the two checks.

>      int i;
>      int cpu_flags = av_get_cpu_flags();
> @@ -43,4 +44,5 @@ av_cold void ff_convolution_init_x86(ConvolutionContext *s)
>          }
>      }
>  #endif
> +#endif /* HAVE_X86ASM */
>  }



More information about the ffmpeg-devel mailing list