aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2006-08-10 18:49:47 +0000
committerLoren Merritt <lorenm@u.washington.edu>2006-08-10 18:49:47 +0000
commit60ae06e77e6e654b19529e89f8f067abd9a3d71a (patch)
treeddbf2799ddbbf03144375c9a6a4225c732c79bdf
parentffad4ed154fc5afafbf872a92031749f840a2855 (diff)
downloadffmpeg-60ae06e77e6e654b19529e89f8f067abd9a3d71a.tar.gz
r5954 broke fft on cpus with 3dnow but without mm3dnow.h
Originally committed as revision 5974 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/fft.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/libavcodec/fft.c b/libavcodec/fft.c
index 3d5c221ebf..6fd87167bd 100644
--- a/libavcodec/fft.c
+++ b/libavcodec/fft.c
@@ -58,17 +58,38 @@ 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_MM3DNOW))) || defined(HAVE_ALTIVEC)
+#if (defined(HAVE_MMX) && (defined(HAVE_BUILTIN_VECTOR) || defined(HAVE_MM3DNOW))) \
+ || (defined(HAVE_ALTIVEC) && !defined(ALTIVEC_USE_REFERENCE_C_CODE))
{
- int has_vectors = 0;
+ int has_vectors = mm_support();
+ if (has_vectors) {
#if defined(HAVE_MMX)
- has_vectors = mm_support() & (MM_3DNOW | MM_3DNOWEXT | MM_SSE | MM_SSE2);
+ if (has_vectors & MM_3DNOWEXT)
+ s->imdct_calc = ff_imdct_calc_3dn2;
+#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
-#if defined(HAVE_ALTIVEC) && !defined(ALTIVEC_USE_REFERENCE_C_CODE)
- has_vectors = mm_support() & MM_ALTIVEC;
+#else /* HAVE_MMX */
+ if (has_vectors & MM_ALTIVEC)
+ s->fft_calc = ff_fft_calc_altivec;
#endif
- if (has_vectors) {
+ }
+ if (s->fft_calc != ff_fft_calc_c) {
int np, nblocks, np2, l;
FFTComplex *q;
@@ -94,29 +115,6 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse)
nblocks = nblocks >> 1;
} while (nblocks != 0);
av_freep(&s->exptab);
-#if defined(HAVE_MMX)
- if (has_vectors & MM_3DNOWEXT)
- s->imdct_calc = ff_imdct_calc_3dn2;
-#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
}
}
#endif