From d68c05380cebf563915412182643a8be04ef890b Mon Sep 17 00:00:00 2001 From: James Almer Date: Tue, 26 May 2015 14:29:08 -0300 Subject: [PATCH] x86: check for AV_CPU_FLAG_AVXSLOW where useful Signed-off-by: James Almer Signed-off-by: Luca Barbato --- libavcodec/x86/dcadsp_init.c | 4 ++-- libavcodec/x86/dct_init.c | 2 +- libavcodec/x86/fft_init.c | 2 +- libavfilter/x86/af_volume_init.c | 2 +- libavresample/x86/audio_convert_init.c | 4 +++- libavresample/x86/audio_mix_init.c | 4 +++- libavresample/x86/dither_init.c | 4 ++-- libavutil/x86/float_dsp_init.c | 2 +- libavutil/x86/lls_init.c | 2 +- 9 files changed, 15 insertions(+), 11 deletions(-) diff --git a/libavcodec/x86/dcadsp_init.c b/libavcodec/x86/dcadsp_init.c index 9acb818c94..7c2bec1f9b 100644 --- a/libavcodec/x86/dcadsp_init.c +++ b/libavcodec/x86/dcadsp_init.c @@ -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 */ diff --git a/libavcodec/x86/dct_init.c b/libavcodec/x86/dct_init.c index 7bda5e81b6..ca9fbc7a68 100644 --- a/libavcodec/x86/dct_init.c +++ b/libavcodec/x86/dct_init.c @@ -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; } diff --git a/libavcodec/x86/fft_init.c b/libavcodec/x86/fft_init.c index 7ca72c54a4..5c0273de9d 100644 --- a/libavcodec/x86/fft_init.c +++ b/libavcodec/x86/fft_init.c @@ -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; diff --git a/libavfilter/x86/af_volume_init.c b/libavfilter/x86/af_volume_init.c index c59e0eda8e..26605fb2ce 100644 --- a/libavfilter/x86/af_volume_init.c +++ b/libavfilter/x86/af_volume_init.c @@ -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; } diff --git a/libavresample/x86/audio_convert_init.c b/libavresample/x86/audio_convert_init.c index d85ca8405f..ae6c3191d1 100644 --- a/libavresample/x86/audio_convert_init.c +++ b/libavresample/x86/audio_convert_init.c @@ -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, diff --git a/libavresample/x86/audio_mix_init.c b/libavresample/x86/audio_mix_init.c index 7fc530ebc4..e14a54066d 100644 --- a/libavresample/x86/audio_mix_init.c +++ b/libavresample/x86/audio_mix_init.c @@ -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); } diff --git a/libavresample/x86/dither_init.c b/libavresample/x86/dither_init.c index 8349d5efc8..2a351c5f0d 100644 --- a/libavresample/x86/dither_init.c +++ b/libavresample/x86/dither_init.c @@ -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; } } diff --git a/libavutil/x86/float_dsp_init.c b/libavutil/x86/float_dsp_init.c index a04d91c923..b70433031a 100644 --- a/libavutil/x86/float_dsp_init.c +++ b/libavutil/x86/float_dsp_init.c @@ -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; diff --git a/libavutil/x86/lls_init.c b/libavutil/x86/lls_init.c index 888bc54a39..80cda29139 100644 --- a/libavutil/x86/lls_init.c +++ b/libavutil/x86/lls_init.c @@ -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; } }