Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::FftT< SampleType > Class Template Reference

#include <fft.hpp>

Public Member Functions

 FftT ()=default
 FftT (const FftT &)=delete
FftT & operator= (const FftT &)=delete
 FftT (FftT &&other) noexcept
FftT & operator= (FftT &&other) noexcept
 FftT (int size)
 ~FftT ()
int size () const
bool ready () const noexcept
 True when every backend resource required by forward()/inverse() is available.
int vdsp_split_plane_gap_floats (bool real_transform) const noexcept
 Floats between the end of the real half and the start of the imaginary half the vDSP transforms use (64 for every ready float transform; see the placement note on the split storage), or -1 when this transform does not use vDSP.
int vdsp_split_offset_bytes (bool real_transform) const noexcept
 Byte offset past a 64-byte boundary of the real and imaginary halves the vDSP transforms use, or -1 when this transform does not use vDSP.
void forward (std::complex< SampleType > *data) const
void inverse (std::complex< SampleType > *data) const
void forward_real (const SampleType *input, std::complex< SampleType > *output) const
int real_bins () const
 Independent bins of a real transform of size(): DC through Nyquist.
void forward_real_half (const SampleType *input, std::complex< SampleType > *output, SampleType scale) const
 Real-input forward transform.
void forward_real_half (const SampleType *input, std::complex< SampleType > *output) const
void inverse_real_half (const std::complex< SampleType > *input, SampleType *output, SampleType scale) const
 Inverse of forward_real_half().
void inverse_real_half (const std::complex< SampleType > *input, SampleType *output) const
void magnitude_db (const std::complex< SampleType > *freq, SampleType *out, int num_bins) const
void magnitude (const std::complex< SampleType > *freq, SampleType *out, int num_bins) const

Static Public Attributes

static constexpr int kMinRealSize = 2
 Smallest size() forward_real_half() / inverse_real_half() accept.

Friends

struct detail::FftRealSplit

Constructor & Destructor Documentation

◆ FftT() [1/4]

template<typename SampleType = float>
pulp::signal::FftT< SampleType >::FftT ( )
default

◆ FftT() [2/4]

template<typename SampleType = float>
pulp::signal::FftT< SampleType >::FftT ( const FftT< SampleType > & )
delete

◆ FftT() [3/4]

template<typename SampleType = float>
pulp::signal::FftT< SampleType >::FftT ( FftT< SampleType > && other)
inlinenoexcept

◆ FftT() [4/4]

template<typename SampleType = float>
pulp::signal::FftT< SampleType >::FftT ( int size)
inlineexplicit

◆ ~FftT()

template<typename SampleType = float>
pulp::signal::FftT< SampleType >::~FftT ( )
inline

Member Function Documentation

◆ forward()

template<typename SampleType = float>
void pulp::signal::FftT< SampleType >::forward ( std::complex< SampleType > * data) const
inline

◆ forward_real()

template<typename SampleType = float>
void pulp::signal::FftT< SampleType >::forward_real ( const SampleType * input,
std::complex< SampleType > * output ) const
inline

◆ forward_real_half() [1/2]

template<typename SampleType = float>
void pulp::signal::FftT< SampleType >::forward_real_half ( const SampleType * input,
std::complex< SampleType > * output ) const
inline

◆ forward_real_half() [2/2]

template<typename SampleType = float>
void pulp::signal::FftT< SampleType >::forward_real_half ( const SampleType * input,
std::complex< SampleType > * output,
SampleType scale ) const
inline

Real-input forward transform.

Reads size() real samples and writes real_bins() bins, X[k] = scale * sum_n x[n] e^(-2 pi i k n / N) for k = 0..N/2. DC and Nyquist are written with zero imaginary part and nothing past the Nyquist bin is touched. output must not overlap input. Requires size() >= kMinRealSize. The two-argument overload uses scale 1.

◆ inverse()

template<typename SampleType = float>
void pulp::signal::FftT< SampleType >::inverse ( std::complex< SampleType > * data) const
inline

◆ inverse_real_half() [1/2]

template<typename SampleType = float>
void pulp::signal::FftT< SampleType >::inverse_real_half ( const std::complex< SampleType > * input,
SampleType * output ) const
inline

◆ inverse_real_half() [2/2]

template<typename SampleType = float>
void pulp::signal::FftT< SampleType >::inverse_real_half ( const std::complex< SampleType > * input,
SampleType * output,
SampleType scale ) const
inline

Inverse of forward_real_half().

Reads real_bins() bins (the imaginary parts of DC and Nyquist are ignored, as a real signal cannot carry them) and writes size() real samples equal to scale times the unnormalised inverse DFT of the Hermitian spectrum they define; the default scale 1/N recovers the forward transform's input. output may occupy the same storage as input (a complex buffer reinterpreted as real samples), which lets a caller transform a spectrum in place. Requires size() >= kMinRealSize. The two-argument overload uses scale 1/N.

◆ magnitude()

template<typename SampleType = float>
void pulp::signal::FftT< SampleType >::magnitude ( const std::complex< SampleType > * freq,
SampleType * out,
int num_bins ) const
inline

◆ magnitude_db()

template<typename SampleType = float>
void pulp::signal::FftT< SampleType >::magnitude_db ( const std::complex< SampleType > * freq,
SampleType * out,
int num_bins ) const
inline

◆ operator=() [1/2]

template<typename SampleType = float>
FftT & pulp::signal::FftT< SampleType >::operator= ( const FftT< SampleType > & )
delete

◆ operator=() [2/2]

template<typename SampleType = float>
FftT & pulp::signal::FftT< SampleType >::operator= ( FftT< SampleType > && other)
inlinenoexcept

◆ ready()

template<typename SampleType = float>
bool pulp::signal::FftT< SampleType >::ready ( ) const
inlinenodiscardnoexcept

True when every backend resource required by forward()/inverse() is available.

Construction can produce a non-ready float FFT if Apple's vDSP setup allocation returns null without throwing.

◆ real_bins()

template<typename SampleType = float>
int pulp::signal::FftT< SampleType >::real_bins ( ) const
inline

Independent bins of a real transform of size(): DC through Nyquist.

◆ size()

template<typename SampleType = float>
int pulp::signal::FftT< SampleType >::size ( ) const
inline

◆ vdsp_split_offset_bytes()

template<typename SampleType = float>
int pulp::signal::FftT< SampleType >::vdsp_split_offset_bytes ( bool real_transform) const
inlinenodiscardnoexcept

Byte offset past a 64-byte boundary of the real and imaginary halves the vDSP transforms use, or -1 when this transform does not use vDSP.

Always 16 for a ready float transform of 32 points or more (see the placement note on the split storage); exposed so that contract can be tested rather than assumed.

◆ vdsp_split_plane_gap_floats()

template<typename SampleType = float>
int pulp::signal::FftT< SampleType >::vdsp_split_plane_gap_floats ( bool real_transform) const
inlinenodiscardnoexcept

Floats between the end of the real half and the start of the imaginary half the vDSP transforms use (64 for every ready float transform; see the placement note on the split storage), or -1 when this transform does not use vDSP.

◆ detail::FftRealSplit

template<typename SampleType = float>
friend struct detail::FftRealSplit
friend

Member Data Documentation

◆ kMinRealSize

template<typename SampleType = float>
int pulp::signal::FftT< SampleType >::kMinRealSize = 2
staticconstexpr

The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/signal/include/pulp/signal/fft.hpp