Flan
Public Member Functions | List of all members
r8b::CDSPBlockConvolver Class Reference

Single-block overlap-save convolution processing class. More...

#include <CDSPBlockConvolver.h>

Inheritance diagram for r8b::CDSPBlockConvolver:
Inheritance graph
[legend]
Collaboration diagram for r8b::CDSPBlockConvolver:
Collaboration graph
[legend]

Public Member Functions

 CDSPBlockConvolver (CDSPFIRFilter &aFilter, const int aUpFactor, const int aDownFactor, const double PrevLatency=0.0, const bool aDoConsumeLatency=true)
 Constructor initializes internal variables and constants of *this object. More...
 
virtual int getLatency () const
 
virtual double getLatencyFrac () const
 
virtual int getMaxOutLen (const int MaxInLen) const
 
virtual void clear ()
 Function clears (resets) the state of *this object and returns it to the state after construction. More...
 
virtual int process (double *ip, int l0, double *&op0)
 Function performs DSP processing. More...
 

Detailed Description

Single-block overlap-save convolution processing class.

Class that implements single-block overlap-save convolution processing. The length of a single FFT block used depends on the length of the filter kernel.

The rationale behind "single-block" processing is that increasing the FFT block length by 2 is more efficient than performing convolution at the same FFT block length but using two blocks.

This class also implements a built-in resampling by any whole-number factor, which simplifies the overall resampling objects topology.

Constructor & Destructor Documentation

◆ CDSPBlockConvolver()

r8b::CDSPBlockConvolver::CDSPBlockConvolver ( CDSPFIRFilter aFilter,
const int  aUpFactor,
const int  aDownFactor,
const double  PrevLatency = 0.0,
const bool  aDoConsumeLatency = true 
)
inline

Constructor initializes internal variables and constants of *this object.

Parameters
aFilterPre-calculated filter data. Reference to this object is inhertied by *this object, and the object will be released when *this object is destroyed. If upsampling is used, filter's gain should be equal to the upsampling factor.
aUpFactorThe upsampling factor, positive value. E.g. value of 2 means 2x upsampling should be performed over the input data.
aDownFactorThe downsampling factor, positive value. E.g. value of 2 means 2x downsampling should be performed over the output data.
PrevLatencyLatency, in samples (any value >=0), which was left in the output signal by a previous process. This value is usually non-zero if the minimum-phase filters are in use. This value is always zero if the linear-phase filters are in use.
aDoConsumeLatency"True" if the output latency should be consumed. Does not apply to the fractional part of the latency (if such part is available).

Member Function Documentation

◆ clear()

virtual void r8b::CDSPBlockConvolver::clear ( )
inlinevirtual

Function clears (resets) the state of *this object and returns it to the state after construction.

All input data accumulated in the internal buffer so far will be discarded.

Implements r8b::CDSPProcessor.

◆ getLatency()

virtual int r8b::CDSPBlockConvolver::getLatency ( ) const
inlinevirtual
Returns
The latency, in samples, which is present in the output signal. This value is usually zero if the DSP processor "consumes" the latency automatically.

Implements r8b::CDSPProcessor.

◆ getLatencyFrac()

virtual double r8b::CDSPBlockConvolver::getLatencyFrac ( ) const
inlinevirtual
Returns
Fractional latency, in samples, which is present in the output signal. This value is usually zero if a linear-phase filtering is used. With minimum-phase filters in use, this value can be non-zero even if the getLatency() function returns zero.

Implements r8b::CDSPProcessor.

◆ getMaxOutLen()

virtual int r8b::CDSPBlockConvolver::getMaxOutLen ( const int  MaxInLen) const
inlinevirtual
Parameters
MaxInLenThe number of samples planned to process at once, at most.
Returns
The maximal length of the output buffer required when processing the "MaxInLen" number of input samples.

Implements r8b::CDSPProcessor.

◆ process()

virtual int r8b::CDSPBlockConvolver::process ( double *  ip,
int  l0,
double *&  op0 
)
inlinevirtual

Function performs DSP processing.

Parameters
ipInput data pointer.
l0How many samples to process.
[out]op0Output data pointer. The capacity of this buffer should be equal to the value returned by the getMaxOutLen() function for the given "l0". This buffer can be equal to "ip" only if the getMaxOutLen( l0 ) function returned a value lesser than "l0". This pointer can be incremented on function's return if latency compensation was performed by the processor. Note that on function's return, this pointer may point to some internal buffers, including the "ip" buffer, ignoring the originally passed value.
Returns
The number of output samples written to the "op0" buffer and available after processing. This value can be smaller or larger in comparison to the original "l0" value due to processing and filter's latency compensation that took place, and due to resampling if it was performed.

Implements r8b::CDSPProcessor.


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