DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
dspark::FFTComplex< T > Class Template Reference

In-place Cooley-Tukey radix-2 DIT FFT for complex data. More...

#include <FFT.h>

Public Member Functions

 FFTComplex (size_t size)
 Constructs an FFT processor for the given size.
 
size_t getSize () const noexcept
 Returns the FFT size (number of complex points).
 
void forward (T *data) noexcept
 Performs a forward (time->frequency) FFT in-place.
 
void inverse (T *data) noexcept
 Performs an inverse (frequency->time) FFT in-place.
 

Detailed Description

template<typename T>
class dspark::FFTComplex< T >

In-place Cooley-Tukey radix-2 DIT FFT for complex data.

Data layout: interleaved [re0, im0, re1, im1, ...], total 2*N elements.

Template Parameters
TSample type (float or double).

Definition at line 77 of file FFT.h.

Constructor & Destructor Documentation

◆ FFTComplex()

template<typename T >
dspark::FFTComplex< T >::FFTComplex ( size_t  size)
inlineexplicit

Constructs an FFT processor for the given size.

Parameters
sizeNumber of complex samples. Must be a power of two and >= 2.
Exceptions
std::invalid_argumentif size is invalid (with DSPARK_NO_EXCEPTIONS: asserts and degrades to the minimal valid size instead).

Definition at line 86 of file FFT.h.

Member Function Documentation

◆ forward()

template<typename T >
void dspark::FFTComplex< T >::forward ( T *  data)
inlinenoexcept

Performs a forward (time->frequency) FFT in-place.

Parameters
dataInterleaved complex data [re, im, ...], 2*N elements.

The pointer does not need to be 16-byte aligned: the SIMD path uses unaligned loads/stores (_mm_loadu_ps/_mm_storeu_ps), which on every x86 CPU released in the last decade run at the same throughput as the aligned variants when the data happens to be aligned.

Definition at line 118 of file FFT.h.

◆ getSize()

template<typename T >
size_t dspark::FFTComplex< T >::getSize ( ) const
inlinenoexcept

Returns the FFT size (number of complex points).

Returns
The size provided at construction.

Definition at line 107 of file FFT.h.

◆ inverse()

template<typename T >
void dspark::FFTComplex< T >::inverse ( T *  data)
inlinenoexcept

Performs an inverse (frequency->time) FFT in-place.

Parameters
dataInterleaved complex data, overwritten with time-domain result.
Note
The output is automatically scaled by 1/N. Unaligned-safe.

Definition at line 129 of file FFT.h.


The documentation for this class was generated from the following file: