summaryrefslogtreecommitdiff
path: root/libavcodec/fft.c
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2011-02-12 11:48:16 +0000
committerJanne Grunau <janne-ffmpeg@jannau.net>2011-02-13 15:36:39 +0100
commite6b1ed693ae4098e6b9eabf938fc31ec0b09b120 (patch)
tree8afa645b29c35cde5a286b29cbab58fbbed4c1ed /libavcodec/fft.c
parent3c33c0e26325f189dbf7f212f8e9042feb83bfb0 (diff)
FFT: factor a shuffle out of the inner loop and merge it into fft_permute.
6% faster SSE FFT on Conroe, 2.5% on Penryn. Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net>
Diffstat (limited to 'libavcodec/fft.c')
-rw-r--r--libavcodec/fft.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavcodec/fft.c b/libavcodec/fft.c
index 3fd4d279cb..eade76a516 100644
--- a/libavcodec/fft.c
+++ b/libavcodec/fft.c
@@ -97,6 +97,7 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
if (!s->tmp_buf)
goto fail;
s->inverse = inverse;
+ s->fft_permutation = FF_FFT_PERM_DEFAULT;
s->fft_permute = ff_fft_permute_c;
s->fft_calc = ff_fft_calc_c;
@@ -113,8 +114,12 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
for(j=4; j<=nbits; j++) {
ff_init_ff_cos_tabs(j);
}
- for(i=0; i<n; i++)
- s->revtab[-split_radix_permutation(i, n, s->inverse) & (n-1)] = i;
+ for(i=0; i<n; i++) {
+ int j = i;
+ if (s->fft_permutation == FF_FFT_PERM_SWAP_LSBS)
+ j = (j&~3) | ((j>>1)&1) | ((j<<1)&2);
+ s->revtab[-split_radix_permutation(i, n, s->inverse) & (n-1)] = j;
+ }
return 0;
fail: