diff options
author | Diego Biurrun <diego@biurrun.de> | 2012-08-29 21:01:05 +0400 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2012-09-08 20:18:34 +0400 |
commit | e0c6cce44729d94e2a5507a4b6d031f23e8bd7b6 (patch) | |
tree | 5118ee396e1879c3f90dfc1898e9bbd868e4b583 /libavcodec/x86/fft_init.c | |
parent | 6a0200f24de51eeb94a3a1f75ee105786a6e088d (diff) |
x86: Replace checks for CPU extensions and flags by convenience macros
This separates code relying on inline from that relying on external
assembly and fixes instances where the coalesced check was incorrect.
Diffstat (limited to 'libavcodec/x86/fft_init.c')
-rw-r--r-- | libavcodec/x86/fft_init.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/libavcodec/x86/fft_init.c b/libavcodec/x86/fft_init.c index fcde3fa797..9ee3f9c86e 100644 --- a/libavcodec/x86/fft_init.c +++ b/libavcodec/x86/fft_init.c @@ -17,29 +17,29 @@ */ #include "libavutil/cpu.h" +#include "libavutil/x86/cpu.h" #include "libavcodec/dsputil.h" #include "libavcodec/dct.h" #include "fft.h" av_cold void ff_fft_init_mmx(FFTContext *s) { -#if HAVE_YASM int has_vectors = av_get_cpu_flags(); #if ARCH_X86_32 - if (has_vectors & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) { + if (EXTERNAL_AMD3DNOW(has_vectors)) { /* 3DNow! for K6-2/3 */ s->imdct_calc = ff_imdct_calc_3dnow; s->imdct_half = ff_imdct_half_3dnow; s->fft_calc = ff_fft_calc_3dnow; } - if (has_vectors & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT) { + if (EXTERNAL_AMD3DNOWEXT(has_vectors)) { /* 3DNowEx for K7 */ s->imdct_calc = ff_imdct_calc_3dnowext; s->imdct_half = ff_imdct_half_3dnowext; s->fft_calc = ff_fft_calc_3dnowext; } #endif - if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) { + if (EXTERNAL_SSE(has_vectors)) { /* SSE for P3/P4/K8 */ s->imdct_calc = ff_imdct_calc_sse; s->imdct_half = ff_imdct_half_sse; @@ -47,26 +47,23 @@ av_cold void ff_fft_init_mmx(FFTContext *s) s->fft_calc = ff_fft_calc_sse; s->fft_permutation = FF_FFT_PERM_SWAP_LSBS; } - if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX && s->nbits >= 5) { + if (EXTERNAL_AVX(has_vectors) && s->nbits >= 5) { /* AVX for SB */ s->imdct_half = ff_imdct_half_avx; s->fft_calc = ff_fft_calc_avx; s->fft_permutation = FF_FFT_PERM_AVX; } -#endif } #if CONFIG_DCT av_cold void ff_dct_init_mmx(DCTContext *s) { -#if HAVE_YASM int has_vectors = av_get_cpu_flags(); - if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) + if (EXTERNAL_SSE(has_vectors)) s->dct32 = ff_dct32_float_sse; - if (has_vectors & AV_CPU_FLAG_SSE2 && HAVE_SSE) + if (EXTERNAL_SSE2(has_vectors)) s->dct32 = ff_dct32_float_sse2; - if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX) + if (EXTERNAL_AVX(has_vectors)) s->dct32 = ff_dct32_float_avx; -#endif } #endif |