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,14 +61,9 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse) ...@@ -59,14 +61,9 @@ 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;
{
int has_vectors = mm_support();
if (has_vectors) {
#if defined(HAVE_MMX)
if (has_vectors & MM_3DNOWEXT) { if (has_vectors & MM_3DNOWEXT) {
/* 3DNowEx for K7/K8 */ /* 3DNowEx for K7/K8 */
s->imdct_calc = ff_imdct_calc_3dn2; s->imdct_calc = ff_imdct_calc_3dn2;
...@@ -78,13 +75,19 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse) ...@@ -78,13 +75,19 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse)
/* SSE for P3/P4 */ /* SSE for P3/P4 */
s->imdct_calc = ff_imdct_calc_sse; s->imdct_calc = ff_imdct_calc_sse;
s->fft_calc = ff_fft_calc_sse; s->fft_calc = ff_fft_calc_sse;
} else {
shuffle = 0;
} }
#else /* HAVE_MMX */ #elif defined HAVE_ALTIVEC && !defined ALTIVEC_USE_REFERENCE_C_CODE
if (has_vectors & MM_ALTIVEC) has_vectors = mm_support();
if (has_vectors & MM_ALTIVEC) {
s->fft_calc = ff_fft_calc_altivec; s->fft_calc = ff_fft_calc_altivec;
#endif shuffle = 1;
} }
if (s->fft_calc != ff_fft_calc_c) { #endif
/* 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