AVIR
High-quality pro image resizing library
 
Loading...
Searching...
No Matches
avir::CDSPFracFilterBankLin< fptype > Class Template Reference

Sinc function-based fractional delay filter bank. More...

#include <avir.h>

Public Member Functions

int calcInitComplexity (const CBuffer< char > &FracUseMap) const
 Returns an approximate initialization complexity, expressed in the number of multiply-add operations.
 
void copyInitParams (const CDSPFracFilterBankLin &s)
 Copies a limited set of parameters of the source filter bank.
 
void createAllFilters ()
 Makes sure all fractional delay filters were created.
 
const fptype * getFilter (const int i)
 Returns the pointer to the specified interpolation table filter.
 
const fptype * getFilterConst (const int i) const
 Returns the pointer to the specified interpolation table filter.
 
int getFilterLen () const
 Returns the length of each fractional delay filter, in samples (taps). Always an even value.
 
int getFracCount () const
 Returns the number of fractional filters in use by this bank.
 
int getOrder () const
 Returns the order of the interpolation polynomial.
 
void init (const int ReqFracCount, const int ReqOrder, const double BaseLen, const double Cutoff, const double aWFAlpha, const CFltBuffer &aExtFilter, const int aAlignment=0, const int FltLenAlign=1)
 Initializes (builds) the filter bank based on the supplied parameters.
 
bool operator== (const CDSPFracFilterBankLin &s) const
 Compares this filter bank and another filter bank, and returns true, if their parameters are equal. Alignment is not taken into account.
 

Detailed Description

template<typename fptype>
class avir::CDSPFracFilterBankLin< fptype >

Sinc function-based fractional delay filter bank.

Class implements storage and initialization of a bank of sinc function-based fractional delay filters, expressed as 1st order polynomial interpolation coefficients. The filters are produced from a single "long" windowed low-pass filter. Also supports 0th-order ("nearest neighbor") interpolation.

This class also supports multiplication of each fractional delay filter by an external filter (usually a low-pass filter).

Template Parameters
fptypeSpecifies storage type of the filter coefficients bank. The filters are initially calculated using the "double" precision.

Member Function Documentation

◆ calcInitComplexity()

template<typename fptype>
int avir::CDSPFracFilterBankLin< fptype >::calcInitComplexity ( const CBuffer< char > & FracUseMap) const

Returns an approximate initialization complexity, expressed in the number of multiply-add operations.

This includes fractional delay filters calculation and multiplication by an external filter. This function can only be called after the init() function.

Parameters
FracUseMapFractional delays use map, each element corresponds to a single fractional delay, will be compared to the internal table fill flags. This map should include 0 and 1 values only.
Returns
The complexity of the initialization, expressed in the number of multiply-add operations.

◆ copyInitParams()

template<typename fptype>
void avir::CDSPFracFilterBankLin< fptype >::copyInitParams ( const CDSPFracFilterBankLin< fptype > & s)

Copies a limited set of parameters of the source filter bank.

The actual filters are not copied. Such copying is used during filtering steps "modeling" stage. A further init() function call is required.

Parameters
sSource filter bank.

◆ getFilter()

template<typename fptype>
const fptype * avir::CDSPFracFilterBankLin< fptype >::getFilter ( const int i)

Returns the pointer to the specified interpolation table filter.

The filter will be created if it is not yet created.

Parameters
iFilter (fractional delay) index, in the range 0 to ReqFracCount - 1, inclusive.
Returns
Pointer to filter. Higher order polynomial coefficients are stored after previous order coefficients, separated by FilterLen elements.

◆ getFilterConst()

template<typename fptype>
const fptype * avir::CDSPFracFilterBankLin< fptype >::getFilterConst ( const int i) const

Returns the pointer to the specified interpolation table filter.

This function can be only used if the createAllFilters() function was called.

Parameters
iFilter (fractional delay) index, in the range 0 to ReqFracCount - 1, inclusive.
Returns
Pointer to filter. Higher order polynomial coefficients are stored after previous order coefficients, separated by FilterLen elements.

◆ init()

template<typename fptype>
void avir::CDSPFracFilterBankLin< fptype >::init ( const int ReqFracCount,
const int ReqOrder,
const double BaseLen,
const double Cutoff,
const double aWFAlpha,
const CFltBuffer & aExtFilter,
const int aAlignment = 0,
const int FltLenAlign = 1 )

Initializes (builds) the filter bank based on the supplied parameters.

If the supplied parameters are equal to previously defined parameters, function does nothing (alignment is assumed to be never changing between the init() function calls).

Parameters
ReqFracCountRequired number of fractional delays in the filter bank. The minimal value is 2.
ReqOrderRequired order of the interpolation polynomial (0 or 1).
BaseLenLow-pass filter's base length, in samples (taps). Affects the actual length of the filter and its overall steepness.
CutoffLow-pass filter's normalized cutoff frequency, [0; 1].
aWFAlphaPeaked Cosine window function's Alpha parameter.
aExtFilterExternal filter to apply to each fractional delay filter.
aAlignmentMemory alignment of the filter bank, power-of-2 value. 0 - use default stdlib alignment.
FltLenAlignFilter's length alignment, power-of-2 value.

◆ operator==()

template<typename fptype>
bool avir::CDSPFracFilterBankLin< fptype >::operator== ( const CDSPFracFilterBankLin< fptype > & s) const

Compares this filter bank and another filter bank, and returns true, if their parameters are equal. Alignment is not taken into account.

Parameters
sFilter bank to compare to.
Returns
true, if compared banks have equal parameters.