From 1a219839034e9b11a4771fb84c90d4a2667365ce Mon Sep 17 00:00:00 2001 From: Roland Stigge Date: Sat, 16 Feb 2019 23:37:21 +0100 Subject: Added IFFT + AutoCorrelation --- fft.h | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'fft.h') diff --git a/fft.h b/fft.h index f2b7038..8c1e161 100644 --- a/fft.h +++ b/fft.h @@ -3,10 +3,12 @@ #pragma once #include +#include #include namespace RIT { +// Fast Fourier Transform class FFT { private: int mSize; @@ -17,18 +19,42 @@ private: public: FFT(int size, bool halfOnly = false); - std::vector> operator()(const std::vector> &v); + std::vector> operator()(const std::vector> &v) const; FFT& SetHalfOnly(bool enable); private: - int bitreverse(int i); + int bitreverse(int i) const; - void reorder(const std::vector>& src, std::vector>& dst); - void fft_recursive(std::vector>::iterator X, int N); - void fft_half(std::vector>::iterator X, int N); + void reorder(const std::vector>& src, std::vector>& dst) const; + void fft_recursive(std::vector>::iterator X, int N) const; + void fft_half(std::vector>::iterator X, int N) const; }; // class FFT +// Inverse FFT +class IFFT { +public: + IFFT(int size); + IFFT(std::shared_ptr fft); + ~IFFT(); + std::vector> operator()(const std::vector> &v) const; + +private: + struct Impl; + std::unique_ptr mImpl; +}; // class IFFT + +class AutoCorrelation { +public: + AutoCorrelation(int size); + ~AutoCorrelation(); + std::vector> operator()(const std::vector> &v) const; + +private: + struct Impl; + std::unique_ptr mImpl; +}; // class AutoCorrelation + std::vector magnitudes(std::vector>& v); } // namespace RIT -- cgit v1.2.3