comparison dsp/transforms/FFT.h @ 358:7a225d665ed2

Merge from branch kissfft
author Chris Cannam <c.cannam@qmul.ac.uk>
date Wed, 16 Oct 2013 12:52:44 +0100
parents 650bbacf8288
children 857ca50ca25f
comparison
equal deleted inserted replaced
352:5ff562f5b521 358:7a225d665ed2
12 class FFT 12 class FFT
13 { 13 {
14 public: 14 public:
15 /** 15 /**
16 * Construct an FFT object to carry out complex-to-complex 16 * Construct an FFT object to carry out complex-to-complex
17 * transforms of size nsamples. nsamples must be a power of two in 17 * transforms of size nsamples. nsamples does not have to be a
18 * this implementation. 18 * power of two.
19 */ 19 */
20 FFT(int nsamples); 20 FFT(int nsamples);
21 ~FFT(); 21 ~FFT();
22 22
23 /** 23 /**
37 void process(bool inverse, 37 void process(bool inverse,
38 const double *realIn, const double *imagIn, 38 const double *realIn, const double *imagIn,
39 double *realOut, double *imagOut); 39 double *realOut, double *imagOut);
40 40
41 private: 41 private:
42 int m_n; 42 class D;
43 D *m_d;
43 }; 44 };
44 45
45 class FFTReal 46 class FFTReal
46 { 47 {
47 public: 48 public:
48 /** 49 /**
49 * Construct an FFT object to carry out real-to-complex transforms 50 * Construct an FFT object to carry out real-to-complex transforms
50 * of size nsamples. nsamples must be a power of two in this 51 * of size nsamples. nsamples does not have to be a power of two,
51 * implementation. 52 * but it does have to be even. (Use the complex-complex FFT above
53 * if you need an odd FFT size. This constructor will throw
54 * std::invalid_argument if nsamples is odd.)
52 */ 55 */
53 FFTReal(int nsamples); 56 FFTReal(int nsamples);
54 ~FFTReal(); 57 ~FFTReal();
55 58
56 /** 59 /**
62 * compatibility with existing code, the conjugate half of the 65 * compatibility with existing code, the conjugate half of the
63 * output is returned even though it is redundant. 66 * output is returned even though it is redundant.
64 */ 67 */
65 void forward(const double *realIn, 68 void forward(const double *realIn,
66 double *realOut, double *imagOut); 69 double *realOut, double *imagOut);
70
71 /**
72 * Carry out a forward real-to-complex transform of size nsamples,
73 * where nsamples is the value provided to the constructor
74 * above. Return only the magnitudes of the complex output values.
75 *
76 * realIn and magOut must point to (enough space for) nsamples
77 * values. For consistency with the FFT class above, and
78 * compatibility with existing code, the conjugate half of the
79 * output is returned even though it is redundant.
80 */
81 void forwardMagnitude(const double *realIn, double *magOut);
67 82
68 /** 83 /**
69 * Carry out an inverse real transform (i.e. complex-to-real) of 84 * Carry out an inverse real transform (i.e. complex-to-real) of
70 * size nsamples, where nsamples is the value provided to the 85 * size nsamples, where nsamples is the value provided to the
71 * constructor above. 86 * constructor above.
81 */ 96 */
82 void inverse(const double *realIn, const double *imagIn, 97 void inverse(const double *realIn, const double *imagIn,
83 double *realOut); 98 double *realOut);
84 99
85 private: 100 private:
86 int m_n; 101 class D;
87 FFT *m_fft; 102 D *m_d;
88 double *m_r;
89 double *m_i;
90 double *m_discard;
91 }; 103 };
92 104
93 #endif 105 #endif