]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/fft.h
remove impossible condition from msrle_decode_pal4()
[ffmpeg] / libavcodec / fft.h
index f3e7d7aa4ed632073c960729f06a45631eacf8f4..eb6714fe959ca45258fdaad9a79f4e6c9a016d16 100644 (file)
 #include <stdint.h>
 #include "config.h"
 #include "libavutil/mem.h"
+#include "avfft.h"
 
 /* FFT computation */
 
-/* NOTE: soon integer code will be added, so you must use the
-   FFTSample type */
-typedef float FFTSample;
-
-typedef struct FFTComplex {
-    FFTSample re, im;
-} FFTComplex;
-
-typedef struct FFTContext {
+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 */
@@ -53,11 +44,10 @@ typedef 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
-} FFTContext;
+};
 
 #if CONFIG_HARDCODED_TABLES
 #define COSTABLE_CONST const
@@ -91,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);
@@ -111,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
  */
@@ -122,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().
@@ -157,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);
 
@@ -194,14 +190,7 @@ void ff_mdct_end(FFTContext *s);
 
 /* Real Discrete Fourier Transform */
 
-enum RDFTransformType {
-    RDFT,
-    IRDFT,
-    RIDFT,
-    IRIDFT,
-};
-
-typedef struct {
+struct RDFTContext {
     int nbits;
     int inverse;
     int sign_convention;
@@ -210,34 +199,45 @@ typedef struct {
     const FFTSample *tcos;
     SINTABLE_CONST FFTSample *tsin;
     FFTContext fft;
-} RDFTContext;
+    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 */
 
-typedef struct {
+struct DCTContext {
     int nbits;
     int inverse;
-    FFTSample *data;
     RDFTContext rdft;
     const float *costab;
     FFTSample *csc2;
-} DCTContext;
+    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);