Final version.
Fork of UIT_FFT_Real by
fftReal.hpp@3:7e761912ef10, 2017-08-16 (annotated)
- Committer:
- mladjo1993
- Date:
- Wed Aug 16 10:06:13 2017 +0000
- Revision:
- 3:7e761912ef10
- Parent:
- 2:9649d0e2bb4a
- Child:
- 4:2e5de15ed0c2
Comments changed to english.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mladjo1993 | 3:7e761912ef10 | 1 | /******************************************************** |
mladjo1993 | 3:7e761912ef10 | 2 | * FFT class for real data ---- Header |
mladjo1993 | 3:7e761912ef10 | 3 | * This class can execute FFT and IFFT |
mladjo1993 | 3:7e761912ef10 | 4 | * |
mladjo1993 | 3:7e761912ef10 | 5 | * Mladen Adamovic, 3326/2016 |
mladjo1993 | 3:7e761912ef10 | 6 | ********************************************************/ |
MikamiUitOpen | 0:982a9acf3a07 | 7 | |
MikamiUitOpen | 0:982a9acf3a07 | 8 | #ifndef FFT_REAL_HPP |
MikamiUitOpen | 0:982a9acf3a07 | 9 | #define FFT_REAL_HPP |
MikamiUitOpen | 0:982a9acf3a07 | 10 | |
MikamiUitOpen | 0:982a9acf3a07 | 11 | #include "mbed.h" |
MikamiUitOpen | 0:982a9acf3a07 | 12 | #include <complex> // requisite for complex |
MikamiUitOpen | 0:982a9acf3a07 | 13 | |
MikamiUitOpen | 0:982a9acf3a07 | 14 | namespace Mikami |
MikamiUitOpen | 0:982a9acf3a07 | 15 | { |
MikamiUitOpen | 0:982a9acf3a07 | 16 | typedef complex<float> Complex; // define "Complex" |
MikamiUitOpen | 0:982a9acf3a07 | 17 | |
MikamiUitOpen | 0:982a9acf3a07 | 18 | class FftReal |
MikamiUitOpen | 0:982a9acf3a07 | 19 | { |
MikamiUitOpen | 2:9649d0e2bb4a | 20 | public: |
MikamiUitOpen | 2:9649d0e2bb4a | 21 | // Constructor |
MikamiUitOpen | 2:9649d0e2bb4a | 22 | explicit FftReal(int16_t n); |
MikamiUitOpen | 2:9649d0e2bb4a | 23 | // Destructor |
MikamiUitOpen | 2:9649d0e2bb4a | 24 | ~FftReal(); |
MikamiUitOpen | 2:9649d0e2bb4a | 25 | // Execute FFT |
MikamiUitOpen | 2:9649d0e2bb4a | 26 | void Execute(const float x[], Complex y[]); |
MikamiUitOpen | 2:9649d0e2bb4a | 27 | // Execute IFFT |
MikamiUitOpen | 2:9649d0e2bb4a | 28 | void ExecuteIfft(const Complex y[], float x[]); |
MikamiUitOpen | 2:9649d0e2bb4a | 29 | |
MikamiUitOpen | 0:982a9acf3a07 | 30 | private: |
MikamiUitOpen | 0:982a9acf3a07 | 31 | const int N_FFT_; |
MikamiUitOpen | 0:982a9acf3a07 | 32 | const float N_INV_; |
MikamiUitOpen | 0:982a9acf3a07 | 33 | |
MikamiUitOpen | 0:982a9acf3a07 | 34 | Complex* wTable_; // twiddle factor |
MikamiUitOpen | 0:982a9acf3a07 | 35 | uint16_t* bTable_; // for bit reversal |
MikamiUitOpen | 0:982a9acf3a07 | 36 | Complex* u_; // working area |
MikamiUitOpen | 0:982a9acf3a07 | 37 | |
MikamiUitOpen | 0:982a9acf3a07 | 38 | // Processing except for last stage |
MikamiUitOpen | 1:559a63853f3f | 39 | void ExcludeLastStage(); |
MikamiUitOpen | 0:982a9acf3a07 | 40 | // Use for reordering of rit reversal in IFFT |
MikamiUitOpen | 0:982a9acf3a07 | 41 | int Index(int n) { return (N_FFT_-bTable_[n]); } |
MikamiUitOpen | 0:982a9acf3a07 | 42 | |
MikamiUitOpen | 2:9649d0e2bb4a | 43 | // disallow copy constructor and assignment operator |
MikamiUitOpen | 0:982a9acf3a07 | 44 | FftReal(const FftReal& ); |
MikamiUitOpen | 0:982a9acf3a07 | 45 | FftReal& operator=(const FftReal& ); |
MikamiUitOpen | 0:982a9acf3a07 | 46 | }; |
MikamiUitOpen | 0:982a9acf3a07 | 47 | } |
MikamiUitOpen | 0:982a9acf3a07 | 48 | #endif // FFT_REAL_HPP |