diff options
author | Sven Gothel <[email protected]> | 2023-11-28 12:51:46 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-11-28 12:51:46 +0100 |
commit | 1aaf4f070011490bcece50394b9b32dfa593fd9e (patch) | |
tree | 17d68284e401a35eea3d3a574d986d446a60763a /utils/makemhr | |
parent | 6e7cee4fa9a8af03f28ca26cd89f8357390dfc90 (diff) | |
parent | 571b546f35eead77ce109f8d4dd6c3de3199d573 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'utils/makemhr')
-rw-r--r-- | utils/makemhr/loaddef.cpp | 7 | ||||
-rw-r--r-- | utils/makemhr/loadsofa.cpp | 6 | ||||
-rw-r--r-- | utils/makemhr/makemhr.cpp | 5 | ||||
-rw-r--r-- | utils/makemhr/makemhr.h | 4 |
4 files changed, 9 insertions, 13 deletions
diff --git a/utils/makemhr/loaddef.cpp b/utils/makemhr/loaddef.cpp index e8092363..c8a98511 100644 --- a/utils/makemhr/loaddef.cpp +++ b/utils/makemhr/loaddef.cpp @@ -33,11 +33,10 @@ #include <iterator> #include <limits> #include <memory> -#include <cstdarg> +#include <optional> #include <vector> #include "alfstream.h" -#include "aloptional.h" #include "alspan.h" #include "alstring.h" #include "makemhr.h" @@ -1451,7 +1450,7 @@ static int ProcessMetrics(TokenReaderT *tr, const uint fftSize, const uint trunc } if(hData->mChannelType == CT_NONE) hData->mChannelType = CT_MONO; - const auto azs = al::as_span(azCounts).first<MAX_FD_COUNT>(); + const auto azs = al::span{azCounts}.first<MAX_FD_COUNT>(); if(!PrepareHrirData({distances, fdCount}, evCounts, azs, hData)) { fprintf(stderr, "Error: Out of memory.\n"); @@ -1755,7 +1754,7 @@ static int ProcessSources(TokenReaderT *tr, HrirDataT *hData, const uint outRate PPhaseResampler onsetResampler; onsetResampler.init(hData->mIrRate, OnsetRateMultiple*hData->mIrRate); - al::optional<PPhaseResampler> resampler; + std::optional<PPhaseResampler> resampler; if(outRate && outRate != hData->mIrRate) resampler.emplace().init(hData->mIrRate, outRate); const double rateScale{outRate ? static_cast<double>(outRate) / hData->mIrRate : 1.0}; diff --git a/utils/makemhr/loadsofa.cpp b/utils/makemhr/loadsofa.cpp index dcb0a35e..9bcfc38d 100644 --- a/utils/makemhr/loadsofa.cpp +++ b/utils/makemhr/loadsofa.cpp @@ -33,11 +33,11 @@ #include <iterator> #include <memory> #include <numeric> +#include <optional> #include <string> #include <thread> #include <vector> -#include "aloptional.h" #include "alspan.h" #include "makemhr.h" #include "polyphase_resampler.h" @@ -87,7 +87,7 @@ static bool PrepareLayout(const uint m, const float *xyzs, HrirDataT *hData) ++fi; } fprintf(stdout, "Using %u of %u IRs.\n", ir_total, m); - const auto azs = al::as_span(azCounts).first<MAX_FD_COUNT>(); + const auto azs = al::span{azCounts}.first<MAX_FD_COUNT>(); return PrepareHrirData({distances, fi}, evCounts, azs, hData); } @@ -265,7 +265,7 @@ static bool LoadResponses(MYSOFA_HRTF *sofaHrtf, HrirDataT *hData, const DelayTy double *hrirs = hData->mHrirsBase.data(); std::unique_ptr<double[]> restmp; - al::optional<PPhaseResampler> resampler; + std::optional<PPhaseResampler> resampler; if(outRate && outRate != hData->mIrRate) { resampler.emplace().init(hData->mIrRate, outRate); diff --git a/utils/makemhr/makemhr.cpp b/utils/makemhr/makemhr.cpp index ae301dc3..98e1b73f 100644 --- a/utils/makemhr/makemhr.cpp +++ b/utils/makemhr/makemhr.cpp @@ -297,10 +297,7 @@ static void MinimumPhase(const uint n, double *mags, complex_d *out) // Remove any DC offset the filter has. mags[0] = EPSILON; for(i = 0;i < n;i++) - { - auto a = std::exp(complex_d{0.0, out[i].imag()}); - out[i] = a * mags[i]; - } + out[i] = std::polar(mags[i], out[i].imag()); } diff --git a/utils/makemhr/makemhr.h b/utils/makemhr/makemhr.h index 13b5b2d1..aa18134d 100644 --- a/utils/makemhr/makemhr.h +++ b/utils/makemhr/makemhr.h @@ -113,12 +113,12 @@ void MagnitudeResponse(const uint n, const complex_d *in, double *out); // Performs a forward FFT. inline void FftForward(const uint n, complex_d *inout) -{ forward_fft(al::as_span(inout, n)); } +{ forward_fft(al::span{inout, n}); } // Performs an inverse FFT. inline void FftInverse(const uint n, complex_d *inout) { - inverse_fft(al::as_span(inout, n)); + inverse_fft(al::span{inout, n}); double f{1.0 / n}; for(uint i{0};i < n;i++) inout[i] *= f; |