x86: check for AV_CPU_FLAG_AVXSLOW where useful
authorJames Almer <jamrial@gmail.com>
Tue, 26 May 2015 17:29:08 +0000 (14:29 -0300)
committerLuca Barbato <lu_zero@gentoo.org>
Sun, 31 May 2015 10:07:11 +0000 (12:07 +0200)
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
libavcodec/x86/dcadsp_init.c
libavcodec/x86/dct_init.c
libavcodec/x86/fft_init.c
libavfilter/x86/af_volume_init.c
libavresample/x86/audio_convert_init.c
libavresample/x86/audio_mix_init.c
libavresample/x86/dither_init.c
libavutil/x86/float_dsp_init.c
libavutil/x86/lls_init.c

index 9acb818..7c2bec1 100644 (file)
@@ -98,10 +98,10 @@ av_cold void ff_synth_filter_init_x86(SynthFilterContext *s)
     if (EXTERNAL_SSE2(cpu_flags)) {
         s->synth_filter_float = synth_filter_sse2;
     }
-    if (EXTERNAL_AVX(cpu_flags)) {
+    if (EXTERNAL_AVX_FAST(cpu_flags)) {
         s->synth_filter_float = synth_filter_avx;
     }
-    if (EXTERNAL_FMA3(cpu_flags)) {
+    if (EXTERNAL_FMA3(cpu_flags) && !(cpu_flags & AV_CPU_FLAG_AVXSLOW)) {
         s->synth_filter_float = synth_filter_fma3;
     }
 #endif /* HAVE_YASM */
index 7bda5e8..ca9fbc7 100644 (file)
@@ -34,6 +34,6 @@ av_cold void ff_dct_init_x86(DCTContext *s)
         s->dct32 = ff_dct32_float_sse;
     if (EXTERNAL_SSE2(cpu_flags))
         s->dct32 = ff_dct32_float_sse2;
-    if (EXTERNAL_AVX(cpu_flags))
+    if (EXTERNAL_AVX_FAST(cpu_flags))
         s->dct32 = ff_dct32_float_avx;
 }
index 7ca72c5..5c0273d 100644 (file)
@@ -48,7 +48,7 @@ av_cold void ff_fft_init_x86(FFTContext *s)
         s->fft_calc    = ff_fft_calc_sse;
         s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
     }
-    if (EXTERNAL_AVX(cpu_flags) && s->nbits >= 5) {
+    if (EXTERNAL_AVX_FAST(cpu_flags) && s->nbits >= 5) {
         /* AVX for SB */
         s->imdct_half      = ff_imdct_half_avx;
         s->fft_calc        = ff_fft_calc_avx;
index c59e0ed..26605fb 100644 (file)
@@ -52,7 +52,7 @@ av_cold void ff_volume_init_x86(VolumeContext *vol)
             vol->scale_samples = ff_scale_samples_s32_ssse3_atom;
             vol->samples_align = 4;
         }
-        if (EXTERNAL_AVX(cpu_flags)) {
+        if (EXTERNAL_AVX_FAST(cpu_flags)) {
             vol->scale_samples = ff_scale_samples_s32_avx;
             vol->samples_align = 8;
         }
index d85ca84..ae6c319 100644 (file)
@@ -226,11 +226,13 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
         ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
                                   6, 16, 4, "SSE4", ff_conv_fltp_to_flt_6ch_sse4);
     }
-    if (EXTERNAL_AVX(cpu_flags)) {
+    if (EXTERNAL_AVX_FAST(cpu_flags)) {
         ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32,
                                   0, 32, 16, "AVX", ff_conv_s32_to_flt_avx);
         ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT,
                                   0, 32, 32, "AVX", ff_conv_flt_to_s32_avx);
+    }
+    if (EXTERNAL_AVX(cpu_flags)) {
         ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
                                   2, 16, 16, "AVX", ff_conv_s16p_to_s16_2ch_avx);
         ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
index 7fc530e..e14a540 100644 (file)
@@ -195,11 +195,13 @@ av_cold void ff_audio_mix_init_x86(AudioMix *am)
         ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,
                               1, 2, 16, 8, "SSE4", ff_mix_1_to_2_s16p_flt_sse4);
     }
-    if (EXTERNAL_AVX(cpu_flags)) {
+    if (EXTERNAL_AVX_FAST(cpu_flags)) {
         ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
                               2, 1, 32, 16, "AVX", ff_mix_2_to_1_fltp_flt_avx);
         ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
                               1, 2, 32, 8, "AVX", ff_mix_1_to_2_fltp_flt_avx);
+    }
+    if (EXTERNAL_AVX(cpu_flags)) {
         ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,
                               1, 2, 16, 8, "AVX", ff_mix_1_to_2_s16p_flt_avx);
     }
index 8349d5e..2a351c5 100644 (file)
@@ -46,14 +46,14 @@ av_cold void ff_dither_init_x86(DitherDSPContext *ddsp,
         if (EXTERNAL_SSE2(cpu_flags)) {
             ddsp->dither_int_to_float = ff_dither_int_to_float_rectangular_sse2;
         }
-        if (EXTERNAL_AVX(cpu_flags)) {
+        if (EXTERNAL_AVX_FAST(cpu_flags)) {
             ddsp->dither_int_to_float = ff_dither_int_to_float_rectangular_avx;
         }
     } else {
         if (EXTERNAL_SSE2(cpu_flags)) {
             ddsp->dither_int_to_float = ff_dither_int_to_float_triangular_sse2;
         }
-        if (EXTERNAL_AVX(cpu_flags)) {
+        if (EXTERNAL_AVX_FAST(cpu_flags)) {
             ddsp->dither_int_to_float = ff_dither_int_to_float_triangular_avx;
         }
     }
index a04d91c..b704330 100644 (file)
@@ -146,7 +146,7 @@ av_cold void ff_float_dsp_init_x86(AVFloatDSPContext *fdsp)
     if (EXTERNAL_SSE2(cpu_flags)) {
         fdsp->vector_dmul_scalar = ff_vector_dmul_scalar_sse2;
     }
-    if (EXTERNAL_AVX(cpu_flags)) {
+    if (EXTERNAL_AVX_FAST(cpu_flags)) {
         fdsp->vector_fmul = ff_vector_fmul_avx;
         fdsp->vector_fmac_scalar = ff_vector_fmac_scalar_avx;
         fdsp->vector_dmul_scalar = ff_vector_dmul_scalar_avx;
index 888bc54..80cda29 100644 (file)
@@ -35,7 +35,7 @@ av_cold void ff_init_lls_x86(LLSModel *m)
         if (m->indep_count >= 4)
             m->evaluate_lls = ff_evaluate_lls_sse2;
     }
-    if (EXTERNAL_AVX(cpu_flags)) {
+    if (EXTERNAL_AVX_FAST(cpu_flags)) {
         m->update_lls = ff_update_lls_avx;
     }
 }