move the two if condition out of the loop, that can less n-1 times than condition in loop.
Signed-off-by: Steven Liu <l...@chinaffmpeg.org> --- libavcodec/fft_template.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libavcodec/fft_template.c b/libavcodec/fft_template.c index 762c014bc8..2d97534505 100644 --- a/libavcodec/fft_template.c +++ b/libavcodec/fft_template.c @@ -261,17 +261,26 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) if (s->fft_permutation == FF_FFT_PERM_AVX) { fft_perm_avx(s); } else { + if (s->revtab) { for(i=0; i<n; i++) { int k; j = i; if (s->fft_permutation == FF_FFT_PERM_SWAP_LSBS) j = (j&~3) | ((j>>1)&1) | ((j<<1)&2); k = -split_radix_permutation(i, n, s->inverse) & (n-1); - if (s->revtab) s->revtab[k] = j; - if (s->revtab32) - s->revtab32[k] = j; } + } + if (s->revtab32) { + for(i=0; i<n; i++) { + int k; + j = i; + if (s->fft_permutation == FF_FFT_PERM_SWAP_LSBS) + j = (j&~3) | ((j>>1)&1) | ((j<<1)&2); + k = -split_radix_permutation(i, n, s->inverse) & (n-1); + s->revtab32[k] = j; + } + } } return 0; -- 2.15.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel