18 pffft_destroy_setup(p);
23 return pffft_aligned_malloc(nb_bytes);
28 pffft_aligned_free(p);
42 : mFftSize { fftSize }
43 , mSetup { pffft_new_setup(fftSize, PFFFT_REAL) }
55 const auto buffer = alignedBuffer.
get();
56 const auto output = alignedOutput.
get();
57 pffft_transform_ordered(
mSetup.get(),
58 buffer, buffer,
mWork.data(), PFFFT_FORWARD);
59 output[0] = buffer[0] * buffer[0];
60 for (
auto i = 1; i <
mFftSize / 2; ++i)
62 buffer[i * 2] * buffer[i * 2] + buffer[i * 2 + 1] * buffer[i * 2 + 1];
63 output[
mFftSize / 2] = buffer[1] * buffer[1];
PowerSpectrumGetter(int fftSize)
void operator()(PffftFloats alignedBuffer, PffftFloats alignedOutput)
Computes the power spectrum of buffer into output.
static void Pffft_aligned_free(void *)
static void * Pffft_aligned_malloc(size_t nb_bytes)
A read-only pointer to an aligned range of floats.
PffftFloats aligned(PffftAlignedCount c={})
A pointer to an aligned range of floats.
float * get() const noexcept
void Pffft_destroy_setup(PFFFT_Setup *)