Commit 844ea46a authored by Måns Rullgård's avatar Måns Rullgård

clean up FFT SIMD selection

Originally committed as revision 12477 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 53620bba
...@@ -34,6 +34,8 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse) ...@@ -34,6 +34,8 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse)
{ {
int i, j, m, n; int i, j, m, n;
float alpha, c1, s1, s2; float alpha, c1, s1, s2;
int shuffle = 0;
int av_unused has_vectors;
s->nbits = nbits; s->nbits = nbits;
n = 1 << nbits; n = 1 << nbits;
...@@ -59,32 +61,33 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse) ...@@ -59,32 +61,33 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse)
s->imdct_calc = ff_imdct_calc; s->imdct_calc = ff_imdct_calc;
s->exptab1 = NULL; s->exptab1 = NULL;
/* compute constant table for HAVE_SSE version */ #ifdef HAVE_MMX
#if defined(HAVE_MMX) \ has_vectors = mm_support();
|| (defined(HAVE_ALTIVEC) && !defined(ALTIVEC_USE_REFERENCE_C_CODE)) shuffle = 1;
{ if (has_vectors & MM_3DNOWEXT) {
int has_vectors = mm_support(); /* 3DNowEx for K7/K8 */
s->imdct_calc = ff_imdct_calc_3dn2;
if (has_vectors) { s->fft_calc = ff_fft_calc_3dn2;
#if defined(HAVE_MMX) } else if (has_vectors & MM_3DNOW) {
if (has_vectors & MM_3DNOWEXT) { /* 3DNow! for K6-2/3 */
/* 3DNowEx for K7/K8 */ s->fft_calc = ff_fft_calc_3dn;
s->imdct_calc = ff_imdct_calc_3dn2; } else if (has_vectors & MM_SSE) {
s->fft_calc = ff_fft_calc_3dn2; /* SSE for P3/P4 */
} else if (has_vectors & MM_3DNOW) { s->imdct_calc = ff_imdct_calc_sse;
/* 3DNow! for K6-2/3 */ s->fft_calc = ff_fft_calc_sse;
s->fft_calc = ff_fft_calc_3dn; } else {
} else if (has_vectors & MM_SSE) { shuffle = 0;
/* SSE for P3/P4 */ }
s->imdct_calc = ff_imdct_calc_sse; #elif defined HAVE_ALTIVEC && !defined ALTIVEC_USE_REFERENCE_C_CODE
s->fft_calc = ff_fft_calc_sse; has_vectors = mm_support();
} if (has_vectors & MM_ALTIVEC) {
#else /* HAVE_MMX */ s->fft_calc = ff_fft_calc_altivec;
if (has_vectors & MM_ALTIVEC) shuffle = 1;
s->fft_calc = ff_fft_calc_altivec; }
#endif #endif
}
if (s->fft_calc != ff_fft_calc_c) { /* compute constant table for HAVE_SSE version */
if (shuffle) {
int np, nblocks, np2, l; int np, nblocks, np2, l;
FFTComplex *q; FFTComplex *q;
...@@ -111,8 +114,6 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse) ...@@ -111,8 +114,6 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse)
} while (nblocks != 0); } while (nblocks != 0);
av_freep(&s->exptab); av_freep(&s->exptab);
} }
}
#endif
/* compute bit reverse table */ /* compute bit reverse table */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment