blob: f2b7038ca20d27791b6ff0450f59c64e6ba34c49 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
// FFT
#pragma once
#include <complex>
#include <vector>
namespace RIT {
class FFT {
private:
int mSize;
std::vector<int> order;
std::vector<std::complex<double>> expLUT;
bool mFlagHalfOnly;
public:
FFT(int size, bool halfOnly = false);
std::vector<std::complex<double>> operator()(const std::vector<std::complex<double>> &v);
FFT& SetHalfOnly(bool enable);
private:
int bitreverse(int i);
void reorder(const std::vector<std::complex<double>>& src, std::vector<std::complex<double>>& dst);
void fft_recursive(std::vector<std::complex<double>>::iterator X, int N);
void fft_half(std::vector<std::complex<double>>::iterator X, int N);
}; // class FFT
std::vector<double> magnitudes(std::vector<std::complex<double>>& v);
} // namespace RIT
|