diff mbox series

[FFmpeg-devel,5/5] avcodec/fft_template: Perform some checks at compile-time

Message ID 20210106231308.2952217-5-andreas.rheinhardt@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,1/5] avcodec/tableprint: Don't include mem_internal.h
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Jan. 6, 2021, 11:13 p.m. UTC
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@gmail.com>
---
 libavcodec/fft_template.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Lynne Jan. 7, 2021, 4:01 p.m. UTC | #1
Jan 7, 2021, 00:13 by andreas.rheinhardt@gmail.com:

> 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@gmail.com>
>

Okay.
diff mbox series

Patch

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];