|
| | FFTReal (size_t size) |
| | Constructs a real FFT processor.
|
| |
| size_t | getSize () const noexcept |
| | Returns the number of real input samples (N).
|
| |
| size_t | getFrequencyDomainSize () const noexcept |
| | Returns the frequency-domain buffer size in elements (N + 2).
|
| |
| size_t | getNumBins () const noexcept |
| | Returns the number of frequency bins (N/2 + 1) including DC and Nyquist.
|
| |
| void | forward (const T *timeData, T *freqData) noexcept |
| | Forward transform: real time-domain -> complex frequency-domain.
|
| |
| void | inverse (const T *freqData, T *timeData) noexcept |
| | Inverse transform: complex frequency-domain -> real time-domain.
|
| |
| int | getInverseStepCount () const noexcept |
| | Returns the number of steps inverseStep() splits inverse() into (the same for the life of the object).
|
| |
| void | inverseStep (int step, const T *freqData, T *timeData) noexcept |
| | Runs one step of inverse(), for callers that spread a large transform over several calls (a real-time thread that must not spend the whole transform in one callback).
|
| |
| void | computeMagnitudes (const T *freqData, T *magnitudes) const noexcept |
| | Computes the magnitude of each frequency bin.
|
| |
| void | computePhases (const T *freqData, T *phases) const noexcept |
| | Computes the phase angle of each frequency bin.
|
| |
| void | computePowerSpectrum (const T *freqData, T *power) const noexcept |
| | Computes the power spectrum (magnitude squared) of each bin.
|
| |
|
| static size_t | allocationBytes (size_t size) noexcept |
| | Upper bound of the heap bytes a constructor of this size requests, excluding the object itself, with up to 64 bytes per allocation for standard-library bookkeeping. Allocates nothing; use it to budget memory before constructing. The count depends on the build's kernel sets.
|
| |
| static T | binToFrequency (size_t binIndex, double sampleRate, size_t fftSize) noexcept |
| | Returns the frequency in Hz corresponding to a given bin index.
|
| |
| static size_t | frequencyToBin (double frequency, double sampleRate, size_t fftSize) noexcept |
| | Returns the bin index closest to a given frequency.
|
| |
template<typename T>
class dspark::FFTReal< T >
FFT optimised for real-valued input signals (the common audio case).
Transforms the samples as W interleaved sequences, one in each lane of a vector, with real radix-4 passes, and joins their spectra in one last step (see the file comment): about half the work of a complex transform of the same length. The shortest sizes run a half-size complex FFT on the (even, odd) sample pairs and split its spectrum with a post-pass.
Frequency domain layout: N+2 elements (interleaved complex).
- Bins 0 to N/2 inclusive -> (N/2 + 1) complex values -> (N + 2) floats.
data[2*k] = real part of bin k.
data[2*k+1] = imaginary part of bin k.
- Bin 0 = DC, bin N/2 = Nyquist.
In-place use is supported: timeData and freqData may point to the same buffer as long as it holds getFrequencyDomainSize() = N+2 elements.
- Template Parameters
-
| T | Sample type (float or double). |
Definition at line 1196 of file FFT.h.
template<typename T >
| void dspark::FFTReal< T >::inverseStep |
( |
int |
step, |
|
|
const T * |
freqData, |
|
|
T * |
timeData |
|
) |
| |
|
inlinenoexcept |
Runs one step of inverse(), for callers that spread a large transform over several calls (a real-time thread that must not spend the whole transform in one callback).
Step 0 reads the spectrum and each later step is at most one pass over the data: the count is the same for every kernel set of the build, and a set whose transform has fewer passes does nothing in the steps right after the first. Running steps 0 .. getInverseStepCount() - 1 in order, with no other transform on this instance in between, writes exactly what inverse() writes, bit for bit.
- Parameters
-
| step | Step index, 0 .. getInverseStepCount() - 1. |
| freqData | Input spectrum, N+2 elements (read by step 0 only). |
| timeData | Output: N real samples (written by the last step only). |
Definition at line 1345 of file FFT.h.