Audio Processing Framework (APF) version 0.5.0
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
apf::conv::TransformBase Class Reference

Forward-FFT-related functions. More...

#include <apf/convolver.h>

Inheritance diagram for apf::conv::TransformBase:
Inheritance graph
[legend]

Public Member Functions

template<typename In >
void prepare_filter (In first, In last, Filter &filter) const
 Transform time-domain samples. More...
 
size_t block_size () const
 
size_t partition_size () const
 
template<typename In >
In prepare_partition (In first, In last, fft_node &partition) const
 FFT of one block. More...
 

Protected Types

using scoped_plan = fftw< float >::scoped_plan
 
using plan_ptr = std::unique_ptr< scoped_plan >
 

Protected Member Functions

 TransformBase (size_t block_size_)
 
 TransformBase (TransformBase &&)=default
 
plan_ptr _create_plan (float *array) const
 Create in-place FFT plan for halfcomplex data format. More...
 
void _fft (float *first) const
 In-place FFT. More...
 

Protected Attributes

plan_ptr _fft_plan
 

Detailed Description

Forward-FFT-related functions.

Definition at line 126 of file convolver.h.

Member Typedef Documentation

◆ scoped_plan

using apf::conv::TransformBase::scoped_plan = fftw<float>::scoped_plan
protected

Definition at line 144 of file convolver.h.

◆ plan_ptr

using apf::conv::TransformBase::plan_ptr = std::unique_ptr<scoped_plan>
protected

Definition at line 145 of file convolver.h.

Constructor & Destructor Documentation

◆ TransformBase()

apf::conv::TransformBase::TransformBase ( size_t  block_size_)
explicitprotected

Definition at line 165 of file convolver.h.

Member Function Documentation

◆ prepare_filter()

template<typename In >
void apf::conv::TransformBase::prepare_filter ( In  first,
In  last,
Filter filter 
) const

Transform time-domain samples.

If there are too few input samples, the rest is zero-padded, if there are too few blocks in the container c, the rest of the samples is ignored.

Parameters
firstIterator to first time-domain sample
lastPast-the-end iterator
[out]filterTarget container

Definition at line 198 of file convolver.h.

References prepare_partition().

Referenced by apf::conv::Filter::Filter().

◆ block_size()

size_t apf::conv::TransformBase::block_size ( ) const
inline

Definition at line 132 of file convolver.h.

◆ partition_size()

size_t apf::conv::TransformBase::partition_size ( ) const
inline

Definition at line 133 of file convolver.h.

◆ prepare_partition()

template<typename In >
In apf::conv::TransformBase::prepare_partition ( In  first,
In  last,
fft_node partition 
) const

FFT of one block.

If there are too few coefficients, the rest is zero-padded.

Parameters
firstIterator to first coefficient
lastPast-the-end iterator
[out]partitionTarget partition
Template Parameters
InForward iterator
Returns
Iterator to the first coefficient of the next block (for the next iteration, if needed)

Definition at line 217 of file convolver.h.

References _fft(), apf::math::has_only_zeros(), and apf::conv::fft_node::zero.

Referenced by prepare_filter().

◆ _create_plan()

TransformBase::plan_ptr apf::conv::TransformBase::_create_plan ( float *  array) const
protected

Create in-place FFT plan for halfcomplex data format.

Note
FFT plans are not re-entrant except when using FFTW_THREADSAFE!
Once a plan of a certain size exists, creating further plans is very fast because "wisdom" is shared (and therefore the creation of plans is not thread-safe). It is not necessary to re-use plans in other convolver instances.

Definition at line 183 of file convolver.h.

Referenced by apf::conv::Input::Input().

◆ _fft()

void apf::conv::TransformBase::_fft ( float *  first) const
inlineprotected

In-place FFT.

Definition at line 150 of file convolver.h.

Referenced by apf::conv::Input::add_block(), and prepare_partition().

Member Data Documentation

◆ _fft_plan

plan_ptr apf::conv::TransformBase::_fft_plan
protected

Definition at line 156 of file convolver.h.


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