aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-10-15 12:22:53 -0700
committerChris Robinson <[email protected]>2023-10-15 12:22:53 -0700
commitfacad2276ddded73797b376a93b56b117ad0b126 (patch)
treea5a86aa0c3af64ec790aca5a94830bb75328ed88
parentaf4f92c3a235c6f99ee9a46399dee976e70e9d4f (diff)
Properly align a buffer given to PFFFT
-rw-r--r--core/uhjfilter.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/uhjfilter.cpp b/core/uhjfilter.cpp
index d33e5079..15dbfb0d 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<float[]>(sFftLength);
+ auto fftTmp = al::vector<float,16>(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<float>((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;
}
}