From facad2276ddded73797b376a93b56b117ad0b126 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 15 Oct 2023 12:22:53 -0700 Subject: [PATCH] Properly align a buffer given to PFFFT --- core/uhjfilter.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/uhjfilter.cpp b/core/uhjfilter.cpp index d33e5079d2..15dbfb0d7c 100644 --- a/core/uhjfilter.cpp +++ b/core/uhjfilter.cpp @@ -11,6 +11,7 @@ #include "opthelpers.h" #include "pffft.h" #include "phase_shifter.h" +#include "vector.h" UhjQualityType UhjDecodeQuality{UhjQualityType::Default}; @@ -96,8 +97,8 @@ struct SplitFilter { fftBuffer[i] = std::conj(fftBuffer[fft_size - i]); inverse_fft(al::span{fftBuffer.get(), fft_size}); - /* Store the first segment of the buffer to apply as a time-domain - * filter (backwards for more efficient processing). + /* Store the first segment of the filter to apply in the time-domain + * (backwards for more efficient processing). */ auto fftiter = fftBuffer.get() + sSampleLength - 1; for(float &coeff : mPShift.mCoeffs) @@ -109,7 +110,7 @@ struct SplitFilter { /* The remaining segments of the filter are converted back to the * frequency domain, each on their own (0 stuffed). */ - auto fftTmp = std::make_unique(sFftLength); + auto fftTmp = al::vector(sFftLength); float *filter{mFilterData.data()}; for(size_t s{0};s < sNumSegments;++s) { @@ -127,7 +128,7 @@ struct SplitFilter { fftTmp[i*2 + 1] = static_cast((i == 0) ? fftBuffer[sSampleLength].real() : fftBuffer[i].imag()) / float{sFftLength}; } - pffft_zreorder(mFft.get(), fftTmp.get(), filter, PFFFT_BACKWARD); + pffft_zreorder(mFft.get(), fftTmp.data(), filter, PFFFT_BACKWARD); filter += sFftLength; } }