diff options
author | Roland Stigge <stigge@antcom.de> | 2019-01-27 13:32:40 +0100 |
---|---|---|
committer | Roland Stigge <stigge@antcom.de> | 2019-01-27 13:32:40 +0100 |
commit | ba9179c7991eeaf1b8d59a0db3975f049b2735b7 (patch) | |
tree | ec07f6f8144b95f92f57ed076da215cca964a77a /fft.h | |
parent | db0d20a6c322211593fecf209898f2435468e813 (diff) |
Added half FFT and magnitudes
Diffstat (limited to 'fft.h')
-rw-r--r-- | fft.h | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -0,0 +1,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 |