]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/fft.h
Fix the fixed-point MDCT and FFT tests so that they actually compile and work.
[ffmpeg] / libavcodec / fft.h
index 636f76b824341cc0fed6e89066378845a1f11ef1..eb6714fe959ca45258fdaad9a79f4e6c9a016d16 100644 (file)
@@ -33,8 +33,6 @@ struct FFTContext {
     int nbits;
     int inverse;
     uint16_t *revtab;
-    FFTComplex *exptab;
-    FFTComplex *exptab1; /* only used by SSE code */
     FFTComplex *tmp_buf;
     int mdct_size; /* size of MDCT (i.e. number of input data * 2) */
     int mdct_bits; /* n = 2^nbits */
@@ -46,7 +44,6 @@ struct FFTContext {
     void (*imdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
     void (*imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
     void (*mdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
-    int split_radix;
     int permutation;
 #define FF_MDCT_PERM_NONE       0
 #define FF_MDCT_PERM_INTERLEAVE 1
@@ -84,7 +81,7 @@ extern COSTABLE(65536);
 extern COSTABLE_CONST FFTSample* const ff_cos_tabs[17];
 
 /**
- * Initializes the cosine table in ff_cos_tabs[index]
+ * Initialize the cosine table in ff_cos_tabs[index]
  * \param index index in ff_cos_tabs array of the table to initialize
  */
 void ff_init_ff_cos_tabs(int index);
@@ -104,7 +101,7 @@ extern SINTABLE(32768);
 extern SINTABLE(65536);
 
 /**
- * Sets up a complex FFT.
+ * Set up a complex FFT.
  * @param nbits           log2 of the length of the input array
  * @param inverse         if 0 perform the forward transform, if 1 perform the inverse
  */
@@ -115,6 +112,7 @@ void ff_fft_calc_c(FFTContext *s, FFTComplex *z);
 void ff_fft_init_altivec(FFTContext *s);
 void ff_fft_init_mmx(FFTContext *s);
 void ff_fft_init_arm(FFTContext *s);
+void ff_dct_init_mmx(DCTContext *s);
 
 /**
  * Do the permutation needed BEFORE calling ff_fft_calc().
@@ -150,11 +148,16 @@ static inline void ff_mdct_calc(FFTContext *s, FFTSample *output,
     s->mdct_calc(s, output, input);
 }
 
+/**
+ * Maximum window size for ff_kbd_window_init.
+ */
+#define FF_KBD_WINDOW_MAX 1024
+
 /**
  * Generate a Kaiser-Bessel Derived Window.
  * @param   window  pointer to half window
  * @param   alpha   determines window shape
- * @param   n       size of half window
+ * @param   n       size of half window, max FF_KBD_WINDOW_MAX
  */
 void ff_kbd_window_init(float *window, float alpha, int n);
 
@@ -196,34 +199,45 @@ struct RDFTContext {
     const FFTSample *tcos;
     SINTABLE_CONST FFTSample *tsin;
     FFTContext fft;
+    void (*rdft_calc)(struct RDFTContext *s, FFTSample *z);
 };
 
 /**
- * Sets up a real FFT.
+ * Set up a real FFT.
  * @param nbits           log2 of the length of the input array
  * @param trans           the type of transform
  */
 int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans);
-void ff_rdft_calc(RDFTContext *s, FFTSample *data);
 void ff_rdft_end(RDFTContext *s);
 
+void ff_rdft_init_arm(RDFTContext *s);
+
+static av_always_inline void ff_rdft_calc(RDFTContext *s, FFTSample *data)
+{
+    s->rdft_calc(s, data);
+}
+
 /* Discrete Cosine Transform */
 
 struct DCTContext {
     int nbits;
     int inverse;
-    FFTSample *data;
     RDFTContext rdft;
     const float *costab;
     FFTSample *csc2;
+    void (*dct_calc)(struct DCTContext *s, FFTSample *data);
+    void (*dct32)(FFTSample *out, const FFTSample *in);
 };
 
 /**
- * Sets up (Inverse)DCT.
- * @param nbits           log2 of the length of the input array
- * @param inverse         >0 forward transform, <0 inverse transform
+ * Set up DCT.
+ * @param nbits           size of the input array:
+ *                        (1 << nbits)     for DCT-II, DCT-III and DST-I
+ *                        (1 << nbits) + 1 for DCT-I
+ *
+ * @note the first element of the input of DST-I is ignored
  */
-int  ff_dct_init(DCTContext *s, int nbits, int inverse);
+int  ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType type);
 void ff_dct_calc(DCTContext *s, FFTSample *data);
 void ff_dct_end (DCTContext *s);