おーねたさん、ウェーイ!

Fork of UIT_FFT_Real_mod-ohneta by Takehisa Oneta

Committer:
mbed_tw_hoehoe
Date:
Mon Apr 18 15:50:46 2016 +0000
Revision:
4:7d445725a450
Parent:
3:9649d0e2bb4a
????????????;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MikamiUitOpen 0:982a9acf3a07 1 //-------------------------------------------------------------------
MikamiUitOpen 0:982a9acf3a07 2 // FFT class for real data ---- Header
MikamiUitOpen 0:982a9acf3a07 3 // This class can execute FFT and IFFT
MikamiUitOpen 3:9649d0e2bb4a 4 // Copyright (c) 2015 MIKAMI, Naoki, 2015/12/18
MikamiUitOpen 0:982a9acf3a07 5 //-------------------------------------------------------------------
MikamiUitOpen 0:982a9acf3a07 6
MikamiUitOpen 0:982a9acf3a07 7 #ifndef FFT_REAL_HPP
MikamiUitOpen 0:982a9acf3a07 8 #define FFT_REAL_HPP
MikamiUitOpen 0:982a9acf3a07 9
MikamiUitOpen 0:982a9acf3a07 10 #include "mbed.h"
MikamiUitOpen 0:982a9acf3a07 11 #include <complex> // requisite for complex
MikamiUitOpen 0:982a9acf3a07 12
MikamiUitOpen 0:982a9acf3a07 13 namespace Mikami
MikamiUitOpen 0:982a9acf3a07 14 {
MikamiUitOpen 0:982a9acf3a07 15 typedef complex<float> Complex; // define "Complex"
MikamiUitOpen 0:982a9acf3a07 16
MikamiUitOpen 0:982a9acf3a07 17 class FftReal
MikamiUitOpen 0:982a9acf3a07 18 {
MikamiUitOpen 3:9649d0e2bb4a 19 public:
MikamiUitOpen 3:9649d0e2bb4a 20 // Constructor
MikamiUitOpen 3:9649d0e2bb4a 21 explicit FftReal(int16_t n);
MikamiUitOpen 3:9649d0e2bb4a 22 // Destructor
MikamiUitOpen 3:9649d0e2bb4a 23 ~FftReal();
MikamiUitOpen 3:9649d0e2bb4a 24 // Execute FFT
MikamiUitOpen 3:9649d0e2bb4a 25 void Execute(const float x[], Complex y[]);
MikamiUitOpen 3:9649d0e2bb4a 26 // Execute IFFT
MikamiUitOpen 3:9649d0e2bb4a 27 void ExecuteIfft(const Complex y[], float x[]);
MikamiUitOpen 3:9649d0e2bb4a 28
MikamiUitOpen 0:982a9acf3a07 29 private:
MikamiUitOpen 0:982a9acf3a07 30 const int N_FFT_;
MikamiUitOpen 0:982a9acf3a07 31 const float N_INV_;
MikamiUitOpen 0:982a9acf3a07 32
MikamiUitOpen 0:982a9acf3a07 33 Complex* wTable_; // twiddle factor
MikamiUitOpen 0:982a9acf3a07 34 uint16_t* bTable_; // for bit reversal
MikamiUitOpen 0:982a9acf3a07 35 Complex* u_; // working area
MikamiUitOpen 0:982a9acf3a07 36
MikamiUitOpen 0:982a9acf3a07 37 // Processing except for last stage
MikamiUitOpen 2:559a63853f3f 38 void ExcludeLastStage();
MikamiUitOpen 0:982a9acf3a07 39 // Use for reordering of rit reversal in IFFT
MikamiUitOpen 0:982a9acf3a07 40 int Index(int n) { return (N_FFT_-bTable_[n]); }
MikamiUitOpen 0:982a9acf3a07 41
MikamiUitOpen 3:9649d0e2bb4a 42 // disallow copy constructor and assignment operator
MikamiUitOpen 0:982a9acf3a07 43 FftReal(const FftReal& );
MikamiUitOpen 0:982a9acf3a07 44 FftReal& operator=(const FftReal& );
MikamiUitOpen 0:982a9acf3a07 45 };
MikamiUitOpen 0:982a9acf3a07 46 }
MikamiUitOpen 0:982a9acf3a07 47 #endif // FFT_REAL_HPP