[FFmpeg-cvslog] avcodec: Remove the FFT_FIXED_32 define

Andreas Rheinhardt git at videolan.org
Thu Aug 5 21:41:02 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sat Jul 31 22:20:47 2021 +0200| [211619ad7f43b99a0c1100398f157544b5724460] | committer: Andreas Rheinhardt

avcodec: Remove the FFT_FIXED_32 define

Since the removal of the 16-bit FFT said define is unnecessary as
FFT_FIXED_32 is always !FFT_FLOAT. But one wouldn't believe it when
looking at the code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=211619ad7f43b99a0c1100398f157544b5724460
---

 libavcodec/aac_defines.h       |  2 --
 libavcodec/aacdec.c            |  1 -
 libavcodec/aacdec_fixed.c      |  1 -
 libavcodec/ac3dec_fixed.c      |  1 -
 libavcodec/ac3enc_fixed.c      |  1 -
 libavcodec/dcaenc.c            |  1 -
 libavcodec/fft-internal.h      |  4 ----
 libavcodec/fft.h               |  8 --------
 libavcodec/fft_fixed_32.c      |  1 -
 libavcodec/fft_float.c         |  1 -
 libavcodec/fft_template.c      | 20 +++++++++-----------
 libavcodec/mdct_fixed_32.c     |  1 -
 libavcodec/mdct_float.c        |  1 -
 libavcodec/mdct_template.c     |  6 +-----
 libavcodec/tests/fft-fixed32.c |  1 -
 libavcodec/tests/fft.c         |  6 +-----
 16 files changed, 11 insertions(+), 45 deletions(-)

diff --git a/libavcodec/aac_defines.h b/libavcodec/aac_defines.h
index e94475ac54..a3c680b65c 100644
--- a/libavcodec/aac_defines.h
+++ b/libavcodec/aac_defines.h
@@ -30,7 +30,6 @@
 #include "libavutil/softfloat.h"
 
 #define FFT_FLOAT    0
-#define FFT_FIXED_32 1
 
 #define AAC_RENAME(x)       x ## _fixed
 #define AAC_RENAME_32(x)    x ## _fixed_32
@@ -80,7 +79,6 @@ typedef int                 AAC_SIGNE;
 #else
 
 #define FFT_FLOAT    1
-#define FFT_FIXED_32 0
 
 #define AAC_RENAME(x)       x
 #define AAC_RENAME_32(x)    x
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 3ce5330c06..4dfb38ac83 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -33,7 +33,6 @@
  */
 
 #define FFT_FLOAT 1
-#define FFT_FIXED_32 0
 #define USE_FIXED 0
 
 #include "libavutil/float_dsp.h"
diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c
index 00257a5478..cad2fd6adc 100644
--- a/libavcodec/aacdec_fixed.c
+++ b/libavcodec/aacdec_fixed.c
@@ -59,7 +59,6 @@
  */
 
 #define FFT_FLOAT 0
-#define FFT_FIXED_32 1
 #define USE_FIXED 1
 
 #include "libavutil/fixed_dsp.h"
diff --git a/libavcodec/ac3dec_fixed.c b/libavcodec/ac3dec_fixed.c
index f6c2810ce5..8645952621 100644
--- a/libavcodec/ac3dec_fixed.c
+++ b/libavcodec/ac3dec_fixed.c
@@ -49,7 +49,6 @@
 
 #define FFT_FLOAT 0
 #define USE_FIXED 1
-#define FFT_FIXED_32 1
 #include "ac3dec.h"
 
 
diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c
index c7632d78e1..80aa98c691 100644
--- a/libavcodec/ac3enc_fixed.c
+++ b/libavcodec/ac3enc_fixed.c
@@ -28,7 +28,6 @@
 
 #define AC3ENC_FLOAT 0
 #define FFT_FLOAT 0
-#define FFT_FIXED_32 1
 #include "internal.h"
 #include "audiodsp.h"
 #include "ac3enc.h"
diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
index 71a76bc356..884ac896d3 100644
--- a/libavcodec/dcaenc.c
+++ b/libavcodec/dcaenc.c
@@ -22,7 +22,6 @@
  */
 
 #define FFT_FLOAT 0
-#define FFT_FIXED_32 1
 
 #include "libavutil/avassert.h"
 #include "libavutil/channel_layout.h"
diff --git a/libavcodec/fft-internal.h b/libavcodec/fft-internal.h
index cd809578ce..b0d8d80efd 100644
--- a/libavcodec/fft-internal.h
+++ b/libavcodec/fft-internal.h
@@ -36,8 +36,6 @@
 
 #else /* FFT_FLOAT */
 
-#if FFT_FIXED_32
-
 #define CMUL(dre, dim, are, aim, bre, bim) do {             \
         int64_t accu;                                     \
         (accu)  = (int64_t)(bre) * (are);                 \
@@ -48,8 +46,6 @@
         (dim)   = (int)(((accu) + 0x40000000) >> 31);       \
     } while (0)
 
-#endif /* FFT_FIXED_32 */
-
 #endif /* FFT_FLOAT */
 
 #define ff_imdct_calc_c FFT_NAME(ff_imdct_calc_c)
diff --git a/libavcodec/fft.h b/libavcodec/fft.h
index e03ca01abf..706c9d07f5 100644
--- a/libavcodec/fft.h
+++ b/libavcodec/fft.h
@@ -26,10 +26,6 @@
 #define FFT_FLOAT 1
 #endif
 
-#ifndef FFT_FIXED_32
-#define FFT_FIXED_32 0
-#endif
-
 #include <stdint.h>
 #include "config.h"
 
@@ -45,15 +41,11 @@ typedef float FFTDouble;
 
 #else
 
-#if FFT_FIXED_32
-
 #define Q31(x) (int)((x)*2147483648.0 + 0.5)
 #define FFT_NAME(x) x ## _fixed_32
 
 typedef int32_t FFTSample;
 
-#endif /* FFT_FIXED_32 */
-
 typedef struct FFTComplex {
     FFTSample re, im;
 } FFTComplex;
diff --git a/libavcodec/fft_fixed_32.c b/libavcodec/fft_fixed_32.c
index fbdbf847e2..e18dc83891 100644
--- a/libavcodec/fft_fixed_32.c
+++ b/libavcodec/fft_fixed_32.c
@@ -48,5 +48,4 @@
  */
 
 #define FFT_FLOAT 0
-#define FFT_FIXED_32 1
 #include "fft_template.c"
diff --git a/libavcodec/fft_float.c b/libavcodec/fft_float.c
index 73cc98d0d4..a9fd01978d 100644
--- a/libavcodec/fft_float.c
+++ b/libavcodec/fft_float.c
@@ -17,5 +17,4 @@
  */
 
 #define FFT_FLOAT 1
-#define FFT_FIXED_32 0
 #include "fft_template.c"
diff --git a/libavcodec/fft_template.c b/libavcodec/fft_template.c
index 3012372a74..0bd64192cd 100644
--- a/libavcodec/fft_template.c
+++ b/libavcodec/fft_template.c
@@ -33,9 +33,9 @@
 #include "fft.h"
 #include "fft-internal.h"
 
-#if FFT_FIXED_32
+#if !FFT_FLOAT
 #include "fft_table.h"
-#else /* FFT_FIXED_32 */
+#else /* !FFT_FLOAT */
 
 /* cos(2*pi*x/n) for 0<=x<=n/4, followed by its reverse */
 #if !CONFIG_HARDCODED_TABLES
@@ -136,7 +136,7 @@ COSTABLE_CONST FFTSample * const FFT_NAME(ff_cos_tabs)[] = {
     FFT_NAME(ff_cos_131072),
 };
 
-#endif /* FFT_FIXED_32 */
+#endif /* FFT_FLOAT */
 
 static void fft_permute_c(FFTContext *s, FFTComplex *z);
 static void fft_calc_c(FFTContext *s, FFTComplex *z);
@@ -226,20 +226,18 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
     s->mdct_calc   = ff_mdct_calc_c;
 #endif
 
-#if FFT_FIXED_32
-    ff_fft_lut_init();
-#else /* FFT_FIXED_32 */
 #if FFT_FLOAT
     if (ARCH_AARCH64) ff_fft_init_aarch64(s);
     if (ARCH_ARM)     ff_fft_init_arm(s);
     if (ARCH_PPC)     ff_fft_init_ppc(s);
     if (ARCH_X86)     ff_fft_init_x86(s);
     if (HAVE_MIPSFPU) ff_fft_init_mips(s);
-#endif
     for(j=4; j<=nbits; j++) {
         ff_init_ff_cos_tabs(j);
     }
-#endif /* FFT_FIXED_32 */
+#else /* FFT_FLOAT */
+    ff_fft_lut_init();
+#endif
 
 
     if (ARCH_X86 && FFT_FLOAT && s->fft_permutation == FF_FFT_PERM_AVX) {
@@ -312,7 +310,7 @@ av_cold void ff_fft_end(FFTContext *s)
     av_freep(&s->tmp_buf);
 }
 
-#if FFT_FIXED_32
+#if !FFT_FLOAT
 
 static void fft_calc_c(FFTContext *s, FFTComplex *z) {
 
@@ -470,7 +468,7 @@ static void fft_calc_c(FFTContext *s, FFTComplex *z) {
     }
 }
 
-#else /* FFT_FIXED_32 */
+#else /* !FFT_FLOAT */
 
 #define BUTTERFLIES(a0,a1,a2,a3) {\
     BF(t3, t5, t5, t1);\
@@ -620,4 +618,4 @@ static void fft_calc_c(FFTContext *s, FFTComplex *z)
 {
     fft_dispatch[s->nbits-2](z);
 }
-#endif /* FFT_FIXED_32 */
+#endif /* !FFT_FLOAT */
diff --git a/libavcodec/mdct_fixed_32.c b/libavcodec/mdct_fixed_32.c
index 5a34dfe760..eaa6355e67 100644
--- a/libavcodec/mdct_fixed_32.c
+++ b/libavcodec/mdct_fixed_32.c
@@ -48,5 +48,4 @@
  */
 
 #define FFT_FLOAT 0
-#define FFT_FIXED_32 1
 #include "mdct_template.c"
diff --git a/libavcodec/mdct_float.c b/libavcodec/mdct_float.c
index cff2d211c4..3d3d3a5548 100644
--- a/libavcodec/mdct_float.c
+++ b/libavcodec/mdct_float.c
@@ -17,5 +17,4 @@
  */
 
 #define FFT_FLOAT 1
-#define FFT_FIXED_32 0
 #include "mdct_template.c"
diff --git a/libavcodec/mdct_template.c b/libavcodec/mdct_template.c
index e0ad9f1e53..a854ad2700 100644
--- a/libavcodec/mdct_template.c
+++ b/libavcodec/mdct_template.c
@@ -35,11 +35,7 @@
 #if FFT_FLOAT
 #   define RSCALE(x, y) ((x) + (y))
 #else
-#if FFT_FIXED_32
 #   define RSCALE(x, y) ((int)((x) + (unsigned)(y) + 32) >> 6)
-#else /* FFT_FIXED_32 */
-#   define RSCALE(x, y) ((int)((x) + (unsigned)(y)) >> 1)
-#endif /* FFT_FIXED_32 */
 #endif
 
 /**
@@ -82,7 +78,7 @@ av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale)
     scale = sqrt(fabs(scale));
     for(i=0;i<n4;i++) {
         alpha = 2 * M_PI * (i + theta) / n;
-#if FFT_FIXED_32
+#if !FFT_FLOAT
         s->tcos[i*tstep] = lrint(-cos(alpha) * 2147483648.0);
         s->tsin[i*tstep] = lrint(-sin(alpha) * 2147483648.0);
 #else
diff --git a/libavcodec/tests/fft-fixed32.c b/libavcodec/tests/fft-fixed32.c
index 9fadd8a59c..3c50bf1dc1 100644
--- a/libavcodec/tests/fft-fixed32.c
+++ b/libavcodec/tests/fft-fixed32.c
@@ -17,6 +17,5 @@
  */
 
 #define FFT_FLOAT 0
-#define FFT_FIXED_32 1
 #define AVFFT 0
 #include "fft.c"
diff --git a/libavcodec/tests/fft.c b/libavcodec/tests/fft.c
index 83f2ff2a08..9a5e5bd1c0 100644
--- a/libavcodec/tests/fft.c
+++ b/libavcodec/tests/fft.c
@@ -68,14 +68,10 @@
 #define RANGE 1.0
 #define REF_SCALE(x, bits)  (x)
 #define FMT "%10.6f"
-#elif FFT_FIXED_32
+#else
 #define RANGE 8388608
 #define REF_SCALE(x, bits) (x)
 #define FMT "%6d"
-#else
-#define RANGE 16384
-#define REF_SCALE(x, bits) ((x) / (1 << (bits)))
-#define FMT "%6d"
 #endif
 
 static struct {



More information about the ffmpeg-cvslog mailing list