FFT-1D (Fast Fourier Transform, One-Dimensional)
fft1dfunction
File:
/src/signal.hppLines 688–809Performs a 1D N-point FFT on a given signal. Note: N must to be a power of two.
We map N-point FFT using the Cooley–Tukey FFT algorithm. Similar to the explanation found here: https://www.cs.cmu.edu/afs/andrew/scs/cs/15-463/2001/pub/www/notes/fourier/fourier.pdf.
For an inverse FFT, the imaginary part is negated before and after the forward FFT, also before the output, both are divided by numInputPoints.
Reference: https://www.dsprelated.com/showarticle/800.php, method 4
template <bool complexInput = true,
typename DdrInOutSignalTensorShape,
typename qvarElemType = typename DdrInOutSignalTensorShape::elemType>
void fft1d(DdrInOutSignalTensorShape& ddrIn,
DdrInOutSignalTensorShape& ddrOut,
MemAllocator& ocmMemAlloc)Template Parameters
| Name | Type | Default | Description |
|---|---|---|---|
complexInput | bool | true | Set to `True` if the input is complex, `False` if input is real. |
DdrInOutSignalTensorShape | typename | DDR input tensor. Expected to be of the form `<1, complexCount, 1, inputPoints>`. `ComplexCount` = 1 if only real or 2 if complex. | |
qvarElemType | typename | typename DdrInOutSignalTensorShape::elemType | Default is `DdrInOutSignalTensorShape::elemType` . |
Parameters
| Name | Type | Description |
|---|---|---|
ddrIn | DdrInOutSignalTensorShape& | OCM allocator to be used locally in FFT to allocate ocm memory space. |
ddrOut | DdrInOutSignalTensorShape& | OCM allocator to be used locally in FFT to allocate ocm memory space. |
ocmMemAlloc | MemAllocator& | OCM allocator to be used locally in FFT to allocate ocm memory space. / // clang-format on |
Returns
void
rfft1dfunction
File:
/src/signal.hppLines 823–941Computes FFT with pre-computed weights for real-valued, multi-channel input.
template <typename OcmInputShape,
typename OcmFftShape,
typename qvarElemType = typename OcmInputShape::elemType>
void rfft1d(MemAllocator& ocmMem, OcmInputShape& ocmIn, OcmFftShape& ocmOut)Template Parameters
| Name | Type | Default | Description |
|---|---|---|---|
OcmInputShape | typename | Expected to be of the form `<1, 1, numChannels, inputPoints>` . | |
OcmFftShape | typename | Expected to be of the form `<1, 2, numChannels, numRfftFrequencies>` . | |
qvarElemType | typename | typename OcmInputShape::elemType | Default is `OcmInputShape::elemType` . |
Parameters
| Name | Type | Description |
|---|---|---|
ocmMem | MemAllocator& | OCM allocator used internally for RAU. |
ocmIn | OcmInputShape& | Input 1D signal stored in OCM. |
ocmOut | OcmFftShape& | The real-FFT output for all channels. / // clang-format on |
Returns
void
FFT-2D (Fast Fourier Transform, Two-Dimensional)
fft2dfunction
File:
/src/signal.hppLines 963–1076Performs a 2D N-point FFT on a given signal.
template <typename DdrInOutSignalTensorShape,
FftScaling scaling = FftScaling::Unscaled,
typename qvarElemType = typename DdrInOutSignalTensorShape::elemType>
void fft2d(DdrInOutSignalTensorShape& ddrIn,
DdrInOutSignalTensorShape& ddrOut,
MemAllocator& ocmMemAlloc)Template Parameters
| Name | Type | Default | Description |
|---|---|---|---|
DdrInOutSignalTensorShape | typename | Input/output tensor shape. Expected form `<1, 2, NR, NC>` — complex (2 channels), and `NR`, `NC` independent powers of 2. `NR == NC` is the common square case; non-square shapes (e.g. radar range × Doppler) are also supported. | |
scaling | FftScaling | FftScaling::Unscaled | Output scaling policy. `FftScaling::Unscaled` (default) returns the literal forward DFT `out[k] = sum_n x[n] * exp(-j 2 pi k n / N)`; `FftScaling::BlockFp` right-shifts the data path by 1 bit per butterfly stage so the output equals `DFT2(x) / (NR*NC)` exactly, reclaiming the full input Q-format dynamic range. See `FftScaling` for details. |
qvarElemType | typename | typename DdrInOutSignalTensorShape::elemType | Default is `DdrInOutSignalTensorShape::elemType` . |
Parameters
| Name | Type | Description |
|---|---|---|
ddrIn | DdrInOutSignalTensorShape& | Input 2D signal stored in external memory. |
ddrOut | DdrInOutSignalTensorShape& | Output tensor where calculated 2D FFT will be stored. |
ocmMemAlloc | MemAllocator& | OCM allocator to be used locally in FFT to allocate OCM space. / // clang-format on |
Returns
void
