Dependencies: DMSupport DMemWin
embedded/fft.h@0:08606a13a816, 2016-06-02 (annotated)
- Committer:
- destinyXfate
- Date:
- Thu Jun 02 05:04:57 2016 +0000
- Revision:
- 0:08606a13a816
;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
destinyXfate | 0:08606a13a816 | 1 | #ifndef _FFT_H_ |
destinyXfate | 0:08606a13a816 | 2 | #define _FFT_H_ |
destinyXfate | 0:08606a13a816 | 3 | |
destinyXfate | 0:08606a13a816 | 4 | // Include complex numbers header |
destinyXfate | 0:08606a13a816 | 5 | #include "complex.h" |
destinyXfate | 0:08606a13a816 | 6 | #include "mbed.h" |
destinyXfate | 0:08606a13a816 | 7 | |
destinyXfate | 0:08606a13a816 | 8 | class CFFT |
destinyXfate | 0:08606a13a816 | 9 | { |
destinyXfate | 0:08606a13a816 | 10 | public: |
destinyXfate | 0:08606a13a816 | 11 | // FORWARD FOURIER TRANSFORM |
destinyXfate | 0:08606a13a816 | 12 | // Input - input data |
destinyXfate | 0:08606a13a816 | 13 | // Output - transform result |
destinyXfate | 0:08606a13a816 | 14 | // N - length of both input data and result |
destinyXfate | 0:08606a13a816 | 15 | static bool Forward(const complex *const Input, complex *const Output, const unsigned int N); |
destinyXfate | 0:08606a13a816 | 16 | |
destinyXfate | 0:08606a13a816 | 17 | // FORWARD FOURIER TRANSFORM, INPLACE VERSION |
destinyXfate | 0:08606a13a816 | 18 | // Data - both input data and output |
destinyXfate | 0:08606a13a816 | 19 | // N - length of input data |
destinyXfate | 0:08606a13a816 | 20 | static bool Forward(complex *const Data, const unsigned int N); |
destinyXfate | 0:08606a13a816 | 21 | |
destinyXfate | 0:08606a13a816 | 22 | // INVERSE FOURIER TRANSFORM |
destinyXfate | 0:08606a13a816 | 23 | // Input - input data |
destinyXfate | 0:08606a13a816 | 24 | // Output - transform result |
destinyXfate | 0:08606a13a816 | 25 | // N - length of both input data and result |
destinyXfate | 0:08606a13a816 | 26 | // Scale - if to scale result |
destinyXfate | 0:08606a13a816 | 27 | static bool Inverse(const complex *const Input, complex *const Output, const unsigned int N, const bool Scale = true); |
destinyXfate | 0:08606a13a816 | 28 | |
destinyXfate | 0:08606a13a816 | 29 | // INVERSE FOURIER TRANSFORM, INPLACE VERSION |
destinyXfate | 0:08606a13a816 | 30 | // Data - both input data and output |
destinyXfate | 0:08606a13a816 | 31 | // N - length of both input data and result |
destinyXfate | 0:08606a13a816 | 32 | // Scale - if to scale result |
destinyXfate | 0:08606a13a816 | 33 | static bool Inverse(complex *const Data, const unsigned int N, const bool Scale = true); |
destinyXfate | 0:08606a13a816 | 34 | |
destinyXfate | 0:08606a13a816 | 35 | protected: |
destinyXfate | 0:08606a13a816 | 36 | // Rearrange function and its inplace version |
destinyXfate | 0:08606a13a816 | 37 | static void Rearrange(const complex *const Input, complex *const Output, const unsigned int N); |
destinyXfate | 0:08606a13a816 | 38 | static void Rearrange(complex *const Data, const unsigned int N); |
destinyXfate | 0:08606a13a816 | 39 | |
destinyXfate | 0:08606a13a816 | 40 | // FFT implementation |
destinyXfate | 0:08606a13a816 | 41 | static void Perform(complex *const Data, const unsigned int N, const bool Inverse = false); |
destinyXfate | 0:08606a13a816 | 42 | |
destinyXfate | 0:08606a13a816 | 43 | // Scaling of inverse FFT result |
destinyXfate | 0:08606a13a816 | 44 | static void Scale(complex *const Data, const unsigned int N); |
destinyXfate | 0:08606a13a816 | 45 | }; |
destinyXfate | 0:08606a13a816 | 46 | |
destinyXfate | 0:08606a13a816 | 47 | #endif |
destinyXfate | 0:08606a13a816 | 48 |