Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::FFT< Real >::OverlapAdd Class Reference

Reusable overlap-add convolver for long real sequences. More...

#include <fft.H>

Collaboration diagram for Aleph::FFT< Real >::OverlapAdd:
[legend]

Public Member Functions

 OverlapAdd (const Array< Real > &kernel, const size_t block_size=0)
 
size_t block_size () const noexcept
 
size_t fft_size () const noexcept
 
const Array< Real > & kernel () const noexcept
 
size_t overlap_size () const noexcept
 
void reset ()
 
Array< Realconvolve (const Array< Real > &signal) const
 
Array< Realpconvolve (ThreadPool &pool, const Array< Real > &signal, const size_t chunk_size=0) const
 
Array< Realprocess_block (const Array< Real > &block)
 
Array< Realpprocess_block (ThreadPool &pool, const Array< Real > &block, const size_t chunk_size=0)
 
Array< Realflush ()
 
template<typename Container >
requires Is_Real_Container<Container>
Array< Realconvolve (const Container &signal) const
 
template<typename Container >
requires Is_Real_Container<Container>
Array< Realpconvolve (ThreadPool &pool, const Container &signal, const size_t chunk_size=0) const
 
template<typename Container >
requires Is_Real_Container<Container>
Array< Realprocess_block (const Container &block)
 
template<typename Container >
requires Is_Real_Container<Container>
Array< Realpprocess_block (ThreadPool &pool, const Container &block, const size_t chunk_size=0)
 

Private Member Functions

Array< Complexbuild_signal_block (const Array< Real > &signal, const size_t offset, const size_t length) const
 Rationale: Prepares a chunk of signal for FFT by zero-padding it to the internal fft_size().
 
void pointwise_multiply (Array< Complex > &spectrum, ThreadPool *pool, const size_t chunk_size) const
 Rationale: Applies the precomputed FIR kernel in the frequency domain via element-wise multiplication.
 
void clear_overlap ()
 Rationale: Resets the overlap buffer between independent convolution runs.
 
Array< Realprocess_chunk_impl (const Array< Real > &block, ThreadPool *pool, const size_t chunk_size)
 Rationale: Implements the core Overlap-Add logic for a single block:
 
Array< Realconvolve_impl (const Array< Real > &signal, ThreadPool *pool, const size_t chunk_size) const
 implementation of one-shot linear convolution.
 

Static Private Member Functions

static size_t default_block_size (const size_t kernel_size)
 

Private Attributes

Array< Realkernel_
 
size_t block_size_ = 0
 
size_t fft_size_ = 0
 
Plan plan_
 
Array< Complexkernel_spectrum_
 
Array< Realoverlap_
 
bool has_pending_tail_ = false
 

Detailed Description

template<std::floating_point Real = double>
class Aleph::FFT< Real >::OverlapAdd

Reusable overlap-add convolver for long real sequences.

The kernel spectrum is precomputed once. Input signals are processed in blocks of size block_size(), each block transformed with an FFT of size fft_size() and accumulated in the output via overlap-add.

Definition at line 13741 of file fft.H.

Constructor & Destructor Documentation

◆ OverlapAdd()

Member Function Documentation

◆ block_size()

template<std::floating_point Real = double>
size_t Aleph::FFT< Real >::OverlapAdd::block_size ( ) const
inlinenoexcept

◆ build_signal_block()

template<std::floating_point Real = double>
Array< Complex > Aleph::FFT< Real >::OverlapAdd::build_signal_block ( const Array< Real > &  signal,
const size_t  offset,
const size_t  length 
) const
inlineprivate

◆ clear_overlap()

template<std::floating_point Real = double>
void Aleph::FFT< Real >::OverlapAdd::clear_overlap ( )
inlineprivate

◆ convolve() [1/2]

template<std::floating_point Real = double>
Array< Real > Aleph::FFT< Real >::OverlapAdd::convolve ( const Array< Real > &  signal) const
inline

◆ convolve() [2/2]

template<std::floating_point Real = double>
Array< Real > Aleph::FFT< Real >::OverlapAdd::convolve ( const Container signal) const
inline

◆ convolve_impl()

◆ default_block_size()

template<std::floating_point Real = double>
static size_t Aleph::FFT< Real >::OverlapAdd::default_block_size ( const size_t  kernel_size)
inlinestaticprivate

◆ fft_size()

template<std::floating_point Real = double>
size_t Aleph::FFT< Real >::OverlapAdd::fft_size ( ) const
inlinenoexcept

Definition at line 13937 of file fft.H.

References Aleph::FFT< Real >::OverlapAdd::fft_size_.

◆ flush()

◆ kernel()

template<std::floating_point Real = double>
const Array< Real > & Aleph::FFT< Real >::OverlapAdd::kernel ( ) const
inlinenoexcept

Definition at line 13938 of file fft.H.

References Aleph::FFT< Real >::OverlapAdd::kernel_.

◆ overlap_size()

template<std::floating_point Real = double>
size_t Aleph::FFT< Real >::OverlapAdd::overlap_size ( ) const
inlinenoexcept

Definition at line 13939 of file fft.H.

References Aleph::FFT< Real >::OverlapAdd::overlap_, and Aleph::Array< T >::size().

◆ pconvolve() [1/2]

template<std::floating_point Real = double>
Array< Real > Aleph::FFT< Real >::OverlapAdd::pconvolve ( ThreadPool pool,
const Array< Real > &  signal,
const size_t  chunk_size = 0 
) const
inline

◆ pconvolve() [2/2]

template<std::floating_point Real = double>
Array< Real > Aleph::FFT< Real >::OverlapAdd::pconvolve ( ThreadPool pool,
const Container signal,
const size_t  chunk_size = 0 
) const
inline

◆ pointwise_multiply()

template<std::floating_point Real = double>
void Aleph::FFT< Real >::OverlapAdd::pointwise_multiply ( Array< Complex > &  spectrum,
ThreadPool pool,
const size_t  chunk_size 
) const
inlineprivate

◆ pprocess_block() [1/2]

◆ pprocess_block() [2/2]

template<std::floating_point Real = double>
Array< Real > Aleph::FFT< Real >::OverlapAdd::pprocess_block ( ThreadPool pool,
const Container block,
const size_t  chunk_size = 0 
)
inline

◆ process_block() [1/2]

◆ process_block() [2/2]

template<std::floating_point Real = double>
Array< Real > Aleph::FFT< Real >::OverlapAdd::process_block ( const Container block)
inline

◆ process_chunk_impl()

◆ reset()

template<std::floating_point Real = double>
void Aleph::FFT< Real >::OverlapAdd::reset ( )
inline

Definition at line 13941 of file fft.H.

References Aleph::FFT< Real >::OverlapAdd::clear_overlap().

Member Data Documentation

◆ block_size_

◆ fft_size_

template<std::floating_point Real = double>
size_t Aleph::FFT< Real >::OverlapAdd::fft_size_ = 0
private

◆ has_pending_tail_

template<std::floating_point Real = double>
bool Aleph::FFT< Real >::OverlapAdd::has_pending_tail_ = false
private

◆ kernel_

template<std::floating_point Real = double>
Array<Real> Aleph::FFT< Real >::OverlapAdd::kernel_
private

◆ kernel_spectrum_

template<std::floating_point Real = double>
Array<Complex> Aleph::FFT< Real >::OverlapAdd::kernel_spectrum_
private

◆ overlap_

◆ plan_

template<std::floating_point Real = double>
Plan Aleph::FFT< Real >::OverlapAdd::plan_
private

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