aboutsummaryrefslogtreecommitdiffstats
path: root/utils/makemhr/makemhr.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-11-27 05:53:26 -0800
committerChris Robinson <[email protected]>2022-11-27 05:53:26 -0800
commitf17648411e16d46865472b0c40aff62c2a8e86c6 (patch)
tree099ba90e4de8921d4c5fbe04b10ca2fcc92b1e3a /utils/makemhr/makemhr.h
parent9bf67c75aa78ed3d53e8f31edb7e31707cc1399f (diff)
Use the existing common FFT functions in makemhr
Diffstat (limited to 'utils/makemhr/makemhr.h')
-rw-r--r--utils/makemhr/makemhr.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/utils/makemhr/makemhr.h b/utils/makemhr/makemhr.h
index 89607cc0..82604528 100644
--- a/utils/makemhr/makemhr.h
+++ b/utils/makemhr/makemhr.h
@@ -4,6 +4,7 @@
#include <vector>
#include <complex>
+#include "alcomplex.h"
#include "polyphase_resampler.h"
@@ -109,9 +110,19 @@ struct HrirDataT {
int PrepareHrirData(const uint fdCount, const double (&distances)[MAX_FD_COUNT], const uint (&evCounts)[MAX_FD_COUNT], const uint azCounts[MAX_FD_COUNT * MAX_EV_COUNT], HrirDataT *hData);
void MagnitudeResponse(const uint n, const complex_d *in, double *out);
-void FftForward(const uint n, complex_d *inout);
-void FftInverse(const uint n, complex_d *inout);
+// Performs a forward FFT.
+inline void FftForward(const uint n, complex_d *inout)
+{ forward_fft<double>({inout, n}); }
+
+// Performs an inverse FFT.
+inline void FftInverse(const uint n, complex_d *inout)
+{
+ inverse_fft<double>({inout, n});
+ double f{1.0 / n};
+ for(uint i{0};i < n;i++)
+ inout[i] *= f;
+}
// Performs linear interpolation.
inline double Lerp(const double a, const double b, const double f)