]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/x86/fft.c
x86: Add appropriate ifdefs around certain AVX functions.
[ffmpeg] / libavcodec / x86 / fft.c
index 2426a3df0f8a70b72ce3ff80e69dab6417ff1af3..899f0f7ad54bb5414271f2cf6e467424af202b81 100644 (file)
@@ -25,7 +25,14 @@ av_cold void ff_fft_init_mmx(FFTContext *s)
 {
 #if HAVE_YASM
     int has_vectors = av_get_cpu_flags();
-    if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) {
+    if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX && s->nbits >= 5) {
+        /* AVX for SB */
+        s->imdct_calc      = ff_imdct_calc_sse;
+        s->imdct_half      = ff_imdct_half_avx;
+        s->fft_permute     = ff_fft_permute_sse;
+        s->fft_calc        = ff_fft_calc_avx;
+        s->fft_permutation = FF_FFT_PERM_AVX;
+    } else if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) {
         /* SSE for P3/P4/K8 */
         s->imdct_calc  = ff_imdct_calc_sse;
         s->imdct_half  = ff_imdct_half_sse;
@@ -49,9 +56,13 @@ av_cold void ff_fft_init_mmx(FFTContext *s)
 #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 (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX)
+        s->dct32 = ff_dct32_float_avx;
+    else if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE)
         s->dct32 = ff_dct32_float_sse;
+#endif
 }
 #endif