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

#include <avir_dil.h>

Inheritance diagram for avir::CImageResizerFilterStepDIL< fptype, fptypesimd >:
avir::CImageResizerFilterStep< fptype, fptype >

Public Member Functions

void calcScanlineBias (const fptype *const p0, const int SrcLen, fptype *const ElBiases) const
 
void convertVtoH (const fptype *ip, fptype *op, const int SrcLen, const int SrcIncr) const
 
void doFilter (const fptype *const Src, fptype *Dst, const int DstIncr) const
 
void doResize (const fptype *SrcLine, fptype *DstLine, int DstLineIncr, const fptype *const ElBiases, fptype *const xx) const
 
void doResize2 (const fptype *SrcLine, fptype *DstLine, int DstLineIncr, const fptype *const ElBiases, fptype *const xx) const
 
void doUpsample (const fptype *Src, fptype *Dst) const
 
template<class Tin >
void packScanline (const Tin *const ip0, fptype *const op0, const int l) const
 
void prepareInBuf (fptype *Src) const
 
void unbiasScanline (fptype *const p0, const int l, const fptype *const ElBiases) const
 

Static Public Member Functions

static void applySRGBGamma (fptype *const p0, const int l, const CImageResizerVars &Vars0)
 
template<class Tout >
static void unpackScanline (const fptype *const ip0, Tout *const op0, const int l, const CImageResizerVars &Vars0)
 

Additional Inherited Members

- Public Attributes inherited from avir::CImageResizerFilterStep< fptype, fptype >
double DCGain
 
int EdgePixelCount
 
CBuffer< fptype > Flt
 
CDSPFracFilterBankLin< fptype > * FltBank
 
int FltLatency
 
CFltBuffer FltOrig
 
int InBuf
 
int InElIncr
 
int InLen
 
int InPrefix
 
int InSuffix
 
bool IsUpsample
 
int OutBuf
 
int OutElIncr
 
int OutLen
 
int OutPrefix
 
int OutSuffix
 
CBuffer< fptype > PrefixDC
 
int ResampleFactor
 
CRPosBuf * RPosBuf
 
CBuffer< fptype > SuffixDC
 
const CImageResizerVarsVars
 
- Static Public Attributes inherited from avir::CImageResizerFilterStep< fptype, fptype >
static const int EdgePixelCountDef
 

Detailed Description

template<class fptype, class fptypesimd>
class avir::CImageResizerFilterStepDIL< fptype, fptypesimd >

De-interleaved filtering steps implementation class.

This class implements scanline filtering functions in de-interleaved mode. This means that pixels are processed in groups.

Template Parameters
fptypeFloating point type to use for storing pixel elements. SIMD types cannot be used.
fptypesimdThe SIMD type used to store a pack of "fptype" values.

Member Function Documentation

template<class fptype , class fptypesimd >
static void avir::CImageResizerFilterStepDIL< fptype, fptypesimd >::applySRGBGamma ( fptype *const  p0,
const int  l,
const CImageResizerVars Vars0 
)
static

Function applies Linear to sRGB gamma correction to the specified scanline.

Parameters
pScanline.
lThe number of pixels to de-linearize.
Vars0Image resizing-related variables.
template<class fptype , class fptypesimd >
void avir::CImageResizerFilterStepDIL< fptype, fptypesimd >::calcScanlineBias ( const fptype *const  p0,
const int  SrcLen,
fptype *const  ElBiases 
) const

Function calculates scanline's DC gain for each channel, further used to "unbias" the scanline.

Parameters
p0Source scanline.
SrcLenSource scanline's length.
[out]ElBiasesResuling biases.
template<class fptype , class fptypesimd >
void avir::CImageResizerFilterStepDIL< fptype, fptypesimd >::convertVtoH ( const fptype *  ip,
fptype *  op,
const int  SrcLen,
const int  SrcIncr 
) const

Function converts vertical scanline to horizontal scanline. This function is called by the image resizer when image is resized vertically. This means that the vertical scanline is stored in the same format produced by the packScanline() and maintained by other filtering functions.

Parameters
ipInput vertical scanline, pixel elements are grouped, SrcLen elements apart.
opOutput buffer (temporary buffer used during resizing), pixel elements are grouped, "l" elements apart.
SrcLenThe number of pixels in the input scanline, also used to calculate input buffer increment.
SrcIncrInput buffer increment to the next vertical pixel.
template<class fptype , class fptypesimd >
void avir::CImageResizerFilterStepDIL< fptype, fptypesimd >::doFilter ( const fptype *const  Src,
fptype *  Dst,
const int  DstIncr 
) const

Function peforms scanline filtering with optional downsampling. Function makes use of the symmetry of the filter.

Parameters
SrcSource scanline buffer (length = this -> InLen). Source scanline increment will be equal to 1.
DstDestination scanline buffer.
DstIncrDestination scanline buffer increment, used for horizontal or vertical scanline stepping.
template<class fptype , class fptypesimd >
void avir::CImageResizerFilterStepDIL< fptype, fptypesimd >::doResize ( const fptype *  SrcLine,
fptype *  DstLine,
int  DstLineIncr,
const fptype *const  ElBiases,
fptype *const  xx 
) const

Function performs resizing of a single scanline. This function does not "know" about the length of the source scanline buffer. This buffer should be padded with enough pixels so that ( SrcPos - FilterLenD2 ) is always >= 0 and ( SrcPos + ( DstLineLen - 1 ) * k + FilterLenD2 + 1 ) does not exceed source scanline's buffer length. SrcLine's increment is assumed to be equal to 1.

Parameters
SrcLineSource scanline buffer.
DstLineDestination (resized) scanline buffer.
DstLineIncrDestination scanline position increment, used for horizontal or vertical scanline stepping.
ElBiasesBias values to add to the resulting scanline.
xxTemporary buffer, of size FltBank -> getFilterLen(), must be aligned by fpclass :: fpalign.
template<class fptype , class fptypesimd >
void avir::CImageResizerFilterStepDIL< fptype, fptypesimd >::doResize2 ( const fptype *  SrcLine,
fptype *  DstLine,
int  DstLineIncr,
const fptype *const  ElBiases,
fptype *const  xx 
) const

Same as doResize(). No specific 2x filter-less upsampling optimization.

template<class fptype , class fptypesimd >
void avir::CImageResizerFilterStepDIL< fptype, fptypesimd >::doUpsample ( const fptype *  Src,
fptype *  Dst 
) const

Function peforms scanline upsampling with filtering.

Parameters
SrcSource scanline buffer (length = this -> InLen). Source scanline increment will be equal to ElCount.
DstDestination scanline buffer.
template<class fptype , class fptypesimd >
template<class Tin >
void avir::CImageResizerFilterStepDIL< fptype, fptypesimd >::packScanline ( const Tin *const  ip0,
fptype *const  op0,
const int  l 
) const

Function performs "packing" (de-interleaving) of a scanline and type conversion. If required, the sRGB gamma correction is applied.

Parameters
ip0Input scanline, pixel elements interleaved.
op0Output scanline, pixel elements are grouped, "l" elements apart.
lThe number of pixels to "pack".
template<class fptype , class fptypesimd >
void avir::CImageResizerFilterStepDIL< fptype, fptypesimd >::prepareInBuf ( fptype *  Src) const

Function prepares input scanline buffer for *this filtering step. Left- and right-most pixels are replicated to make sure no buffer overrun happens. Such approach also allows to bypass any pointer range checks.

Parameters
SrcSource buffer.
template<class fptype , class fptypesimd >
void avir::CImageResizerFilterStepDIL< fptype, fptypesimd >::unbiasScanline ( fptype *const  p0,
const int  l,
const fptype *const  ElBiases 
) const

Function applies "unbiasing" to the scanline, by subtracting the previously calculated bias (DC gain) values.

Parameters
p0Scanline.
lScanline's length.
ElBiasesBiases to subtract, for each channel.
template<class fptype , class fptypesimd >
template<class Tout >
static void avir::CImageResizerFilterStepDIL< fptype, fptypesimd >::unpackScanline ( const fptype *const  ip0,
Tout *const  op0,
const int  l,
const CImageResizerVars Vars0 
)
static

Function performs "unpacking" of a scanline and type conversion (truncation is used when floating point is converted to integer). The unpacking function assumes that scanline is stored in the style produced by the packScanline() function.

Parameters
ip0Input scanline, pixel elements are grouped, "l" elements apart.
op0Output scanline, pixel elements are interleaved.
lThe number of pixels to "unpack".
Vars0Image resizing-related variables. ElCount is assumed to be equal to ElCountIO.