summaryrefslogtreecommitdiff
path: root/libavcodec/fft.c
diff options
context:
space:
mode:
authorZuxy Meng <zuxy.meng@gmail.com>2006-03-08 04:13:55 +0000
committerCorey Hickey <bugfood-ml@fatooh.org>2006-03-08 04:13:55 +0000
commit82eb4b0f1bea743f6eaf58c13c475e1e3d045a6a (patch)
tree64212de0c864fdc87d03f66dfc23f1fcdb087679 /libavcodec/fft.c
parent8e32161943efb0486bf83134dc6f695b46ff743c (diff)
3DNow! & Extended 3DNow! versions of FFT
Patch by Zuxy Meng, zuxy <<dot>> meng >>at<< gmail <<dot>> com Minor non-functional diff-related fixes by me. Originally committed as revision 5125 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/fft.c')
-rw-r--r--libavcodec/fft.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/libavcodec/fft.c b/libavcodec/fft.c
index 81b6843e91..1306abd69b 100644
--- a/libavcodec/fft.c
+++ b/libavcodec/fft.c
@@ -57,12 +57,12 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse)
s->exptab1 = NULL;
/* compute constant table for HAVE_SSE version */
-#if (defined(HAVE_MMX) && defined(HAVE_BUILTIN_VECTOR)) || defined(HAVE_ALTIVEC)
+#if (defined(HAVE_MMX) && (defined(HAVE_BUILTIN_VECTOR) || defined(HAVE_MM3DNOW))) || defined(HAVE_ALTIVEC)
{
int has_vectors = 0;
#if defined(HAVE_MMX)
- has_vectors = mm_support() & MM_SSE;
+ has_vectors = mm_support() & (MM_3DNOW | MM_3DNOWEXT | MM_SSE | MM_SSE2);
#endif
#if defined(HAVE_ALTIVEC) && !defined(ALTIVEC_USE_REFERENCE_C_CODE)
has_vectors = mm_support() & MM_ALTIVEC;
@@ -94,8 +94,24 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse)
} while (nblocks != 0);
av_freep(&s->exptab);
#if defined(HAVE_MMX)
- s->fft_calc = ff_fft_calc_sse;
-#else
+#ifdef HAVE_MM3DNOW
+ if (has_vectors & MM_3DNOWEXT)
+ /* 3DNowEx for Athlon(XP) */
+ s->fft_calc = ff_fft_calc_3dn2;
+ else if (has_vectors & MM_3DNOW)
+ /* 3DNow! for K6-2/3 */
+ s->fft_calc = ff_fft_calc_3dn;
+#endif
+#ifdef HAVE_BUILTIN_VECTOR
+ if (has_vectors & MM_SSE2)
+ /* SSE for P4/K8 */
+ s->fft_calc = ff_fft_calc_sse;
+ else if ((has_vectors & MM_SSE) &&
+ s->fft_calc == ff_fft_calc_c)
+ /* SSE for P3 */
+ s->fft_calc = ff_fft_calc_sse;
+#endif
+#else /* HAVE_MMX */
s->fft_calc = ff_fft_calc_altivec;
#endif
}