AVIR
High-quality pro image resizing library
 All Classes Files Functions Variables Typedefs Macros
Public Member Functions | List of all members
avir::CDSPFracFilterBankLin< fptype > Class Template Reference

#include <avir.h>

Public Member Functions

int calcInitComplexity (const CBuffer< uint8_t > &FracUseMap) const
 
void copyInitParams (const CDSPFracFilterBankLin &s)
 
void createAllFilters ()
 
const fptype * getFilter (const int i)
 
int getFilterLen () const
 
int getFracCount () const
 
int getOrder () const
 
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)
 
bool operator== (const CDSPFracFilterBankLin &s) const
 

Detailed Description

template<class 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

template<class fptype>
int avir::CDSPFracFilterBankLin< fptype >::calcInitComplexity ( const CBuffer< uint8_t > &  FracUseMap) const

Function 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.
template<class fptype>
void avir::CDSPFracFilterBankLin< fptype >::copyInitParams ( const CDSPFracFilterBankLin< fptype > &  s)

Copy constructor 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.
template<class fptype>
void avir::CDSPFracFilterBankLin< fptype >::createAllFilters ( )

Function makes sure all fractional delay filters were created.

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

Function returns the pointer to the specified interpolation table filter.

Parameters
iFilter (fractional delay) index, in the range 0 to ReqFracCount - 1, inclusive.
Returns
Pointer to filter. Higher order polynomial coefficients are stored after after previous order coefficients, separated by FilterLen elements.
template<class fptype>
int avir::CDSPFracFilterBankLin< fptype >::getFilterLen ( ) const
Returns
The length of each fractional delay filter, in samples (taps). Always an even value.
template<class fptype>
int avir::CDSPFracFilterBankLin< fptype >::getFracCount ( ) const
Returns
The number of fractional filters in use by *this bank.
template<class fptype>
int avir::CDSPFracFilterBankLin< fptype >::getOrder ( ) const
Returns
The order of the interpolation polynomial.
template<class 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 
)

Function 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.
template<class fptype>
bool avir::CDSPFracFilterBankLin< fptype >::operator== ( const CDSPFracFilterBankLin< fptype > &  s) const

Operator 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.