summaryrefslogtreecommitdiffhomepage
path: root/fft.cpp
diff options
context:
space:
mode:
authorRoland Stigge <stigge@antcom.de>2019-02-17 14:53:33 +0100
committerRoland Stigge <stigge@antcom.de>2019-02-17 14:53:33 +0100
commit308a53c389cdc2631860f434989cd57efbf91145 (patch)
tree2eadba9413a881045caedd589cc9aec7fda40134 /fft.cpp
parentfef594c82518a8fe4c96794852c1fc849c0ed3b3 (diff)
Implemented Tuner
Diffstat (limited to 'fft.cpp')
-rw-r--r--fft.cpp27
1 files changed, 3 insertions, 24 deletions
diff --git a/fft.cpp b/fft.cpp
index a8009ad..12aeece 100644
--- a/fft.cpp
+++ b/fft.cpp
@@ -2,6 +2,8 @@
#include "fft.h"
+#include "util.h"
+
#include <algorithm>
#include <chrono>
#include <cmath>
@@ -15,15 +17,6 @@
namespace { // Helper functions
- bool is_power_of_two(unsigned int n) {
- return n != 0 && (n & (n - 1)) == 0;
- }
-}
-
-std::vector<double> RIT::magnitudes(std::vector<std::complex<double>>& v) {
- std::vector<double> result(v.size());
- std::transform(std::begin(v), std::end(v), std::begin(result), std::abs<double>);
- return result;
}
RIT::FFT::FFT(int size, bool halfOnly): mSize(size), order(size), expLUT(size/2), mFlagHalfOnly(halfOnly) {
@@ -33,7 +26,7 @@ RIT::FFT::FFT(int size, bool halfOnly): mSize(size), order(size), expLUT(size/2)
// reorder LUT
for (int i = 0; i < size; ++i) {
- order[i] = bitreverse(i);
+ order[i] = RIT::bitreverse(i, size);
}
// exp LUT
@@ -63,20 +56,6 @@ RIT::FFT& RIT::FFT::SetHalfOnly(bool enable) {
return *this;
}
-int RIT::FFT::bitreverse(int i) const {
- int size{mSize};
- int result{0};
-
- while (size > 1) {
- result <<= 1;
- result |= i & 1;
- i >>= 1;
- size >>= 1;
- }
-
- return result;
-}
-
void RIT::FFT::reorder(const std::vector<std::complex<double>>& src, std::vector<std::complex<double>>& dst) const {
int size = src.size();