AVIR
High-quality pro image resizing library
 
Loading...
Searching...
No Matches
avir::CLancIR::CResizeFilters Class Reference

Class for fractional delay filter bank storage and calculation. More...

#include <lancir.h>

Classes

class  CSineGen
 Sine-wave signal generator class. More...
 

Public Member Functions

const float * getFilter (const double x)
 Filter acquisition function.
 
bool update (const double la0, const double k0, const int ElCount0)
 Function updates the filter bank.
 

Public Attributes

int KernelLen
 Resampling filter kernel's length, taps. Available after the update() function call. Always an even value, should not be lesser than 4.
 

Protected Member Functions

void makeFilterNorm (float *op, const double FracDelay) const
 Filter calculation function.
 
void setBuf (const int bi)
 Current buffer (filter batch) repositioning function.
 

Static Protected Member Functions

static void replicateFilter (float *const p, const int kl, const int erp)
 Filter tap replication function, for SIMD operations.
 

Protected Attributes

float * Bufs [BufCount]
 Address-aligned Bufs0.
 
float * Bufs0 [BufCount]
 Buffers that hold all filters, original.
 
int Bufs0Len [BufCount]
 Allocated lengthes in Bufs0, in float elements.
 
int CurBuf
 Filter buffer currently being filled.
 
int CurBufFill
 The number of fractional positions filled in the current filter buffer.
 
int ElCount
 Current ElCount.
 
int ElRepl
 The number of repetitions of each filter tap.
 
float ** Filters
 Fractional delay filters for all positions. A particular pointer equals NULL if a filter for such position has not been created yet.
 
int FiltersLen
 Allocated length of Filters, in elements.
 
int fl2
 Half resampling filter's length, integer.
 
int FracCount
 The number of fractional positions for which filters can be created.
 
double Freq
 Circular frequency of the filter.
 
double FreqA
 Circular frequency of the window function.
 
double k
 Current k.
 
int KernelLenA
 SIMD-aligned and replicated filter kernel's length.
 
double la
 Current la.
 
double Len2
 Half resampling filter's length, unrounded.
 

Static Protected Attributes

static const int BufCount = 4
 The maximal number of buffers (filter batches) that can be in use.
 
static const int BufLen = 256
 The number of fractional filters a single buffer (filter batch) may contain. Both the BufLen and BufCount should correspond to the FracCount used.
 

Friends

class CResizeScanline
 

Detailed Description

Class for fractional delay filter bank storage and calculation.

Member Function Documentation

◆ getFilter()

const float * avir::CLancIR::CResizeFilters::getFilter ( const double x)

Filter acquisition function.

Function returns filter at the specified fractional offset. This function can only be called after a prior update() function call.

Parameters
xFractional offset, [0; 1].
Returns
Pointer to a previously-calculated or a new filter.

◆ makeFilterNorm()

void avir::CLancIR::CResizeFilters::makeFilterNorm ( float * op,
const double FracDelay ) const
protected

Filter calculation function.

Function creates a filter for the specified fractional delay. The update() function should be called prior to calling this function. The created filter is normalized (DC gain=1).

Parameters
[out]opOutput filter buffer.
FracDelayFractional delay, 0 to 1, inclusive.

◆ replicateFilter()

static void avir::CLancIR::CResizeFilters::replicateFilter ( float *const p,
const int kl,
const int erp )
staticprotected

Filter tap replication function, for SIMD operations.

Function replicates taps of the specified filter so that it can be used with SIMD loading instructions. This function works "in-place".

Parameters
[in,out]pFilter buffer pointer, should be sized to contain kl * erp elements.
klFilter kernel's length, in taps.
erpThe number of repetitions to apply.

◆ setBuf()

void avir::CLancIR::CResizeFilters::setBuf ( const int bi)
protected

Current buffer (filter batch) repositioning function.

Function changes the buffer currently being filled, checks its size and reallocates it, if necessary, then resets its fill counter.

Parameters
biA new current buffer index.

◆ update()

bool avir::CLancIR::CResizeFilters::update ( const double la0,
const double k0,
const int ElCount0 )

Function updates the filter bank.

Parameters
la0Lanczos a parameter value (greater or equal to 2.0), can be fractional.
k0Resizing step.
ElCount0Image's element count, may be used for SIMD filter tap replication.
Returns
true if an update occured and scanline resizing positions should be updated unconditionally.