diff dsp/transforms/FFT.h @ 357:650bbacf8288

Add forwardMagnitude
author Chris Cannam <c.cannam@qmul.ac.uk>
date Tue, 15 Oct 2013 18:26:38 +0100
parents 3c7338aff6a8
children 857ca50ca25f
line wrap: on
line diff
--- a/dsp/transforms/FFT.h	Tue Oct 15 11:52:00 2013 +0100
+++ b/dsp/transforms/FFT.h	Tue Oct 15 18:26:38 2013 +0100
@@ -49,8 +49,9 @@
     /**
      * Construct an FFT object to carry out real-to-complex transforms
      * of size nsamples. nsamples does not have to be a power of two,
-     * but it does have to be even. (A std::invalid_argument exception
-     * will be thrown if nsamples is odd.)
+     * 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();
@@ -68,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.