|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Reusable overlap-add convolver for long real sequences. More...
#include <fft.H>
Private Member Functions | |
| Array< Complex > | build_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< Real > | process_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< Real > | convolve_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< Real > | kernel_ |
| size_t | block_size_ = 0 |
| size_t | fft_size_ = 0 |
| Plan | plan_ |
| Array< Complex > | kernel_spectrum_ |
| Array< Real > | overlap_ |
| bool | has_pending_tail_ = false |
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.
|
inlineexplicit |
Definition at line 13905 of file fft.H.
References ah_invalid_argument_if, Aleph::FFT< Real >::OverlapAdd::block_size(), Aleph::FFT< Real >::OverlapAdd::block_size_, Aleph::FFT< Real >::OverlapAdd::clear_overlap(), Aleph::Array< T >::create(), Aleph::FFT< Real >::OverlapAdd::default_block_size(), Aleph::divide_and_conquer_partition_dp(), Aleph::FFT< Real >::OverlapAdd::fft_size_, Aleph::Array< T >::is_empty(), Aleph::FFT< Real >::OverlapAdd::kernel_, Aleph::FFT< Real >::OverlapAdd::kernel_spectrum_, Aleph::FFT< Real >::next_power_of_two(), Aleph::FFT< Real >::OverlapAdd::overlap_, Aleph::FFT< Real >::OverlapAdd::plan_, Aleph::Array< T >::size(), and Aleph::FFT< Real >::Plan::transform().
|
inlinenoexcept |
Definition at line 13936 of file fft.H.
References Aleph::FFT< Real >::OverlapAdd::block_size_.
Referenced by Aleph::FFT< Real >::OverlapAdd::OverlapAdd().
|
inlineprivate |
Rationale: Prepares a chunk of signal for FFT by zero-padding it to the internal fft_size().
Definition at line 13763 of file fft.H.
References Aleph::Array< T >::create(), Aleph::divide_and_conquer_partition_dp(), Aleph::FFT< Real >::OverlapAdd::fft_size_, and offset.
Referenced by Aleph::FFT< Real >::OverlapAdd::convolve_impl(), and Aleph::FFT< Real >::OverlapAdd::process_chunk_impl().
|
inlineprivate |
Rationale: Resets the overlap buffer between independent convolution runs.
Definition at line 13799 of file fft.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::FFT< Real >::OverlapAdd::has_pending_tail_, Aleph::FFT< Real >::OverlapAdd::overlap_, and Aleph::Array< T >::size().
Referenced by Aleph::FFT< Real >::OverlapAdd::OverlapAdd(), Aleph::FFT< Real >::OverlapAdd::flush(), and Aleph::FFT< Real >::OverlapAdd::reset().
|
inline |
Definition at line 13947 of file fft.H.
References Aleph::FFT< Real >::OverlapAdd::convolve_impl().
Referenced by Aleph::FFT< Real >::OverlapAdd::convolve(), and Aleph::FFT< Real >::overlap_add_convolution().
|
inline |
Definition at line 14025 of file fft.H.
References Aleph::FFT< Real >::build_real_input(), and Aleph::FFT< Real >::OverlapAdd::convolve().
|
inlineprivate |
implementation of one-shot linear convolution.
Definition at line 13864 of file fft.H.
References ah_invalid_argument_if, Aleph::FFT< Real >::OverlapAdd::block_size_, Aleph::FFT< Real >::OverlapAdd::build_signal_block(), Aleph::Array< T >::create(), Aleph::divide_and_conquer_partition_dp(), Aleph::FFT< Real >::Plan::inverse_transform_real(), Aleph::Array< T >::is_empty(), Aleph::FFT< Real >::OverlapAdd::kernel_, offset, output, Aleph::FFT< Real >::Plan::pinverse_transform_real(), Aleph::FFT< Real >::OverlapAdd::plan_, Aleph::FFT< Real >::OverlapAdd::pointwise_multiply(), Aleph::FFT< Real >::Plan::ptransform(), Aleph::Array< T >::size(), Aleph::FFT< Real >::spectrum(), and Aleph::FFT< Real >::Plan::transform().
Referenced by Aleph::FFT< Real >::OverlapAdd::convolve(), and Aleph::FFT< Real >::OverlapAdd::pconvolve().
|
inlinestaticprivate |
Definition at line 13752 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 >::OverlapAdd::OverlapAdd().
|
inlinenoexcept |
Definition at line 13937 of file fft.H.
References Aleph::FFT< Real >::OverlapAdd::fft_size_.
|
inline |
Definition at line 14009 of file fft.H.
References Aleph::FFT< Real >::OverlapAdd::clear_overlap(), Aleph::divide_and_conquer_partition_dp(), Aleph::FFT< Real >::OverlapAdd::has_pending_tail_, Aleph::Array< T >::is_empty(), and Aleph::FFT< Real >::OverlapAdd::overlap_.
|
inlinenoexcept |
Definition at line 13938 of file fft.H.
References Aleph::FFT< Real >::OverlapAdd::kernel_.
|
inlinenoexcept |
Definition at line 13939 of file fft.H.
References Aleph::FFT< Real >::OverlapAdd::overlap_, and Aleph::Array< T >::size().
|
inline |
Definition at line 13953 of file fft.H.
References Aleph::FFT< Real >::OverlapAdd::convolve_impl().
Referenced by Aleph::FFT< Real >::OverlapAdd::pconvolve(), and Aleph::FFT< Real >::poverlap_add_convolution().
|
inline |
Definition at line 14033 of file fft.H.
References Aleph::FFT< Real >::build_real_input(), and Aleph::FFT< Real >::OverlapAdd::pconvolve().
|
inlineprivate |
Rationale: Applies the precomputed FIR kernel in the frequency domain via element-wise multiplication.
Definition at line 13781 of file fft.H.
References Aleph::and, Aleph::divide_and_conquer_partition_dp(), Aleph::FFT< Real >::OverlapAdd::fft_size_, Aleph::FFT< Real >::OverlapAdd::kernel_spectrum_, Aleph::ThreadPool::num_threads(), Aleph::parallel_for_index(), and Aleph::FFT< Real >::spectrum().
Referenced by Aleph::FFT< Real >::OverlapAdd::convolve_impl(), and Aleph::FFT< Real >::OverlapAdd::process_chunk_impl().
|
inline |
Definition at line 13984 of file fft.H.
References Aleph::Array< T >::append(), Aleph::FFT< Real >::OverlapAdd::block_size_, Aleph::divide_and_conquer_partition_dp(), Aleph::Array< T >::is_empty(), offset, Aleph::FFT< Real >::OverlapAdd::process_chunk_impl(), Aleph::Array< T >::reserve(), and Aleph::Array< T >::size().
Referenced by Aleph::FFT< Real >::OverlapAdd::pprocess_block().
|
inline |
Definition at line 14050 of file fft.H.
References Aleph::FFT< Real >::build_real_input(), and Aleph::FFT< Real >::OverlapAdd::pprocess_block().
|
inline |
Definition at line 13960 of file fft.H.
References Aleph::Array< T >::append(), Aleph::FFT< Real >::OverlapAdd::block_size_, Aleph::divide_and_conquer_partition_dp(), Aleph::Array< T >::is_empty(), offset, Aleph::FFT< Real >::OverlapAdd::process_chunk_impl(), Aleph::Array< T >::reserve(), and Aleph::Array< T >::size().
Referenced by Aleph::FFT< Real >::OverlapAdd::process_block().
|
inline |
Definition at line 14042 of file fft.H.
References Aleph::FFT< Real >::build_real_input(), and Aleph::FFT< Real >::OverlapAdd::process_block().
|
inlineprivate |
Rationale: Implements the core Overlap-Add logic for a single block:
Definition at line 13814 of file fft.H.
References ah_invalid_argument_if, Aleph::FFT< Real >::OverlapAdd::block_size_, Aleph::FFT< Real >::OverlapAdd::build_signal_block(), Aleph::Array< T >::create(), Aleph::divide_and_conquer_partition_dp(), Aleph::FFT< Real >::OverlapAdd::has_pending_tail_, Aleph::FFT< Real >::Plan::inverse_transform_real(), Aleph::Array< T >::is_empty(), Aleph::FFT< Real >::OverlapAdd::overlap_, Aleph::FFT< Real >::Plan::pinverse_transform_real(), Aleph::FFT< Real >::OverlapAdd::plan_, Aleph::FFT< Real >::OverlapAdd::pointwise_multiply(), Aleph::FFT< Real >::Plan::ptransform(), Aleph::Array< T >::size(), Aleph::FFT< Real >::spectrum(), and Aleph::FFT< Real >::Plan::transform().
Referenced by Aleph::FFT< Real >::OverlapAdd::pprocess_block(), and Aleph::FFT< Real >::OverlapAdd::process_block().
|
inline |
Definition at line 13941 of file fft.H.
References Aleph::FFT< Real >::OverlapAdd::clear_overlap().
|
private |
Definition at line 13744 of file fft.H.
Referenced by Aleph::FFT< Real >::OverlapAdd::OverlapAdd(), Aleph::FFT< Real >::OverlapAdd::block_size(), Aleph::FFT< Real >::OverlapAdd::convolve_impl(), Aleph::FFT< Real >::OverlapAdd::pprocess_block(), Aleph::FFT< Real >::OverlapAdd::process_block(), and Aleph::FFT< Real >::OverlapAdd::process_chunk_impl().
|
private |
Definition at line 13745 of file fft.H.
Referenced by Aleph::FFT< Real >::OverlapAdd::OverlapAdd(), Aleph::FFT< Real >::OverlapAdd::build_signal_block(), Aleph::FFT< Real >::OverlapAdd::fft_size(), and Aleph::FFT< Real >::OverlapAdd::pointwise_multiply().
|
private |
Definition at line 13749 of file fft.H.
Referenced by Aleph::FFT< Real >::OverlapAdd::clear_overlap(), Aleph::FFT< Real >::OverlapAdd::flush(), and Aleph::FFT< Real >::OverlapAdd::process_chunk_impl().
|
private |
Definition at line 13743 of file fft.H.
Referenced by Aleph::FFT< Real >::OverlapAdd::OverlapAdd(), Aleph::FFT< Real >::OverlapAdd::convolve_impl(), and Aleph::FFT< Real >::OverlapAdd::kernel().
|
private |
Definition at line 13747 of file fft.H.
Referenced by Aleph::FFT< Real >::OverlapAdd::OverlapAdd(), and Aleph::FFT< Real >::OverlapAdd::pointwise_multiply().
|
private |
|
private |
Definition at line 13746 of file fft.H.
Referenced by Aleph::FFT< Real >::OverlapAdd::OverlapAdd(), Aleph::FFT< Real >::OverlapAdd::convolve_impl(), and Aleph::FFT< Real >::OverlapAdd::process_chunk_impl().