diff options
author | Chris Robinson <[email protected]> | 2022-11-27 05:53:26 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-11-27 05:53:26 -0800 |
commit | f17648411e16d46865472b0c40aff62c2a8e86c6 (patch) | |
tree | 099ba90e4de8921d4c5fbe04b10ca2fcc92b1e3a /utils/makemhr/makemhr.h | |
parent | 9bf67c75aa78ed3d53e8f31edb7e31707cc1399f (diff) |
Use the existing common FFT functions in makemhr
Diffstat (limited to 'utils/makemhr/makemhr.h')
-rw-r--r-- | utils/makemhr/makemhr.h | 15 |
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) |