diff dsp/transforms/FFT.h @ 133:ef42b60d0100

Merge from branch kissfft
author Chris Cannam
date Wed, 16 Oct 2013 12:52:44 +0100
parents a586888bc06c
children 857ca50ca25f
line wrap: on
line diff
--- a/dsp/transforms/FFT.h	Wed Oct 16 12:52:37 2013 +0100
+++ b/dsp/transforms/FFT.h	Wed Oct 16 12:52:44 2013 +0100
@@ -14,8 +14,8 @@
 public:
     /**
      * Construct an FFT object to carry out complex-to-complex
-     * transforms of size nsamples. nsamples must be a power of two in
-     * this implementation.
+     * transforms of size nsamples. nsamples does not have to be a
+     * power of two.
      */
     FFT(int nsamples);
     ~FFT();
@@ -39,7 +39,8 @@
                  double *realOut, double *imagOut);
     
 private:
-    int m_n;
+    class D;
+    D *m_d;
 };
 
 class FFTReal
@@ -47,8 +48,10 @@
 public:
     /**
      * Construct an FFT object to carry out real-to-complex transforms
-     * of size nsamples. nsamples must be a power of two in this
-     * implementation.
+     * of size nsamples. nsamples does not have to be a power of two,
+     * but it does have to be even. (Use the complex-complex FFT above
+     * if you need an odd FFT size. This constructor will throw
+     * std::invalid_argument if nsamples is odd.)
      */
     FFTReal(int nsamples);
     ~FFTReal();
@@ -66,6 +69,18 @@
                  double *realOut, double *imagOut);
 
     /**
+     * Carry out a forward real-to-complex transform of size nsamples,
+     * where nsamples is the value provided to the constructor
+     * above. Return only the magnitudes of the complex output values.
+     *
+     * realIn and magOut must point to (enough space for) nsamples
+     * values. For consistency with the FFT class above, and
+     * compatibility with existing code, the conjugate half of the
+     * output is returned even though it is redundant.
+     */
+    void forwardMagnitude(const double *realIn, double *magOut);
+
+    /**
      * Carry out an inverse real transform (i.e. complex-to-real) of
      * size nsamples, where nsamples is the value provided to the
      * constructor above.
@@ -83,11 +98,8 @@
                  double *realOut);
 
 private:
-    int m_n;
-    FFT *m_fft;
-    double *m_r;
-    double *m_i;
-    double *m_discard;
+    class D;
+    D *m_d;
 };    
 
 #endif