[FFmpeg-devel] [PATCH 5/5] avcodec/fft_template: Perform some checks at compile-time
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Thu Jan 7 01:13:08 EET 2021
The fixed point FFT never uses the 32bit revtab; this commit adds
some compile-time checks to make sure that dead code doesn't get
compiled in.
Also, while just at it, fix the indentation in ff_fft_init() and make sure
that a do {} while (0) macro does not already swallow the semicolon on its
own.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
libavcodec/fft_template.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavcodec/fft_template.c b/libavcodec/fft_template.c
index ddde63714e..76bda09a07 100644
--- a/libavcodec/fft_template.c
+++ b/libavcodec/fft_template.c
@@ -279,12 +279,12 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
} else {\
PROCESS_FFT_PERM_DEFAULT(num) \
}\
-} while(0);
+} while (0)
- if (s->revtab)
- SPLIT_RADIX_PERMUTATION()
- if (s->revtab32)
- SPLIT_RADIX_PERMUTATION(32)
+ if (MAX_BITS <= 16 || s->revtab)
+ SPLIT_RADIX_PERMUTATION();
+ else
+ SPLIT_RADIX_PERMUTATION(32);
#undef PROCESS_FFT_PERM_DEFAULT
#undef PROCESS_FFT_PERM_SWAP_LSBS
@@ -306,7 +306,7 @@ static void fft_permute_c(FFTContext *s, FFTComplex *z)
const uint32_t *revtab32 = s->revtab32;
np = 1 << s->nbits;
/* TODO: handle split-radix permute in a more optimal way, probably in-place */
- if (revtab) {
+ if (MAX_BITS <= 16 || revtab) {
for(j=0;j<np;j++) s->tmp_buf[revtab[j]] = z[j];
} else
for(j=0;j<np;j++) s->tmp_buf[revtab32[j]] = z[j];
--
2.25.1
More information about the ffmpeg-devel
mailing list