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

Multichannel overlap-add convolver with one shared kernel FFT. More...

#include <fft.H>

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

Public Member Functions

 OverlapAddBank (const size_t num_channels, const Array< Real > &kernel, const size_t block_size=0)
 
size_t num_channels () const noexcept
 
size_t block_size () const noexcept
 
size_t fft_size () const noexcept
 
size_t overlap_size () const noexcept
 
const Array< Real > & kernel () const noexcept
 
void reset ()
 
Array< Array< Real > > convolve (const Array< Array< Real > > &signals) const
 
Array< Array< Real > > pconvolve (ThreadPool &pool, const Array< Array< Real > > &signals, const size_t chunk_size=0) const
 
Array< Array< Real > > process_block (const Array< Array< Real > > &block)
 
Array< Array< Real > > pprocess_block (ThreadPool &pool, const Array< Array< Real > > &block, const size_t chunk_size=0)
 
Array< Array< Real > > flush ()
 
Array< Array< Real > > pflush (ThreadPool &pool, const size_t chunk_size=0)
 

Private Member Functions

void validate_channel_count (const size_t count, const char *ctx) const
 Rationale: Internal safety guard.
 
Array< Complexbuild_signal_block (const Array< Real > &signal, const size_t offset=0, const size_t length=std::numeric_limits< size_t >::max()) const
 implementation helper for preparing a signal block for FFT.
 
Array< Array< Complex > > build_signal_batch (const Array< Array< Real > > &block) const
 implementation helper for preparing a batch of signal blocks.
 
Array< Array< Complex > > build_signal_batch (const Array< Array< Real > > &source, const Array< size_t > &channels, const Array< size_t > &lengths, const size_t offset=0) const
 implementation helper for preparing a subset of signal blocks.
 
void pointwise_multiply_batch (Array< Array< Complex > > &spectra, ThreadPool *pool, const size_t chunk_size) const
 Rationale: Parallel pointwise multiplication of multiple signal spectra with the shared kernel spectrum.
 
void clear_channel_overlap (const size_t channel)
 Rationale: Resets the overlap buffer for a single channel.
 
void clear_overlaps ()
 
Array< Array< Real > > process_chunk_batch_impl (const Array< Array< Real > > &block, ThreadPool *pool, const size_t chunk_size)
 
Array< Array< Real > > convolve_impl (const Array< Array< Real > > &signals, ThreadPool *pool, const size_t chunk_size) const
 

Static Private Member Functions

static size_t default_block_size (const size_t kernel_size)
 Rationale: Selects a block size that is at least as large as the kernel to ensure efficient FFT processing (defaults to power of two).
 
static size_t max_batch_length (const Array< Array< Real > > &signals) noexcept
 Returns the maximum signal length in a batch.
 
static Array< Realslice_chunk (const Array< Real > &input, const size_t offset, const size_t length)
 Returns a contiguous slice of input.
 

Private Attributes

Array< Realkernel_
 
size_t block_size_ = 0
 
size_t fft_size_ = 0
 
Plan plan_
 
Array< Complexkernel_spectrum_
 
Array< Array< Real > > overlaps_
 
Array< boolhas_pending_tail_
 

Detailed Description

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

Multichannel overlap-add convolver with one shared kernel FFT.

All channels reuse the same transform plan and kernel spectrum. This avoids recomputing the kernel FFT per channel and enables batched FFT execution when many channels share the same FIR kernel.

Definition at line 14063 of file fft.H.

Constructor & Destructor Documentation

◆ OverlapAddBank()

Member Function Documentation

◆ block_size()

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

◆ build_signal_batch() [1/2]

template<std::floating_point Real = double>
Array< Array< Complex > > Aleph::FFT< Real >::OverlapAddBank::build_signal_batch ( const Array< Array< Real > > &  block) const
inlineprivate

◆ build_signal_batch() [2/2]

template<std::floating_point Real = double>
Array< Array< Complex > > Aleph::FFT< Real >::OverlapAddBank::build_signal_batch ( const Array< Array< Real > > &  source,
const Array< size_t > &  channels,
const Array< size_t > &  lengths,
const size_t  offset = 0 
) const
inlineprivate

implementation helper for preparing a subset of signal blocks.

Definition at line 14151 of file fft.H.

References Aleph::FFT< Real >::OverlapAddBank::build_signal_block(), Aleph::divide_and_conquer_partition_dp(), and offset.

◆ build_signal_block()

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

◆ clear_channel_overlap()

template<std::floating_point Real = double>
void Aleph::FFT< Real >::OverlapAddBank::clear_channel_overlap ( const size_t  channel)
inlineprivate

◆ clear_overlaps()

template<std::floating_point Real = double>
void Aleph::FFT< Real >::OverlapAddBank::clear_overlaps ( )
inlineprivate

◆ convolve()

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

◆ convolve_impl()

◆ default_block_size()

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

Rationale: Selects a block size that is at least as large as the kernel to ensure efficient FFT processing (defaults to power of two).

Definition at line 14077 of file fft.H.

References ah_invalid_argument_if, Aleph::divide_and_conquer_partition_dp(), and Aleph::FFT< Real >::next_power_of_two().

Referenced by Aleph::FFT< Real >::OverlapAddBank::OverlapAddBank().

◆ fft_size()

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

Definition at line 14387 of file fft.H.

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

◆ flush()

◆ kernel()

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

Definition at line 14389 of file fft.H.

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

◆ max_batch_length()

template<std::floating_point Real = double>
static size_t Aleph::FFT< Real >::OverlapAddBank::max_batch_length ( const Array< Array< Real > > &  signals)
inlinestaticprivatenoexcept

◆ num_channels()

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

◆ overlap_size()

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

◆ pconvolve()

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

◆ pflush()

◆ pointwise_multiply_batch()

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

◆ pprocess_block()

◆ process_block()

◆ process_chunk_batch_impl()

◆ reset()

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

Definition at line 14391 of file fft.H.

References Aleph::FFT< Real >::OverlapAddBank::clear_overlaps().

◆ slice_chunk()

template<std::floating_point Real = double>
static Array< Real > Aleph::FFT< Real >::OverlapAddBank::slice_chunk ( const Array< Real > &  input,
const size_t  offset,
const size_t  length 
)
inlinestaticprivate

◆ validate_channel_count()

template<std::floating_point Real = double>
void Aleph::FFT< Real >::OverlapAddBank::validate_channel_count ( const size_t  count,
const char ctx 
) const
inlineprivate

Member Data Documentation

◆ block_size_

◆ fft_size_

◆ has_pending_tail_

◆ kernel_

◆ kernel_spectrum_

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

◆ overlaps_

◆ plan_

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

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