#include <avir.h>
Public Member Functions | |
void | calcScanlineBias (const fptype *p, 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, const int DstLineIncr, const fptype *const ElBiases, fptype *const ) const |
void | doResize2 (const fptype *SrcLine, fptype *DstLine, const int DstLineIncr, const fptype *const ElBiases, fptype *const ) const |
void | doUpsample (const fptype *const Src, fptype *const Dst) const |
template<class Tin > | |
void | packScanline (const Tin *ip, fptype *const op0, const int l0) const |
void | prepareInBuf (fptype *Src) const |
void | unbiasScanline (fptype *p, int l, const fptype *const ElBiases) const |
Static Public Member Functions | |
static void | applySRGBGamma (fptype *p, int l, const CImageResizerVars &Vars0) |
template<class Tout > | |
static void | unpackScanline (const fptype *ip, Tout *op, int l, const CImageResizerVars &Vars0) |
Additional Inherited Members | |
Public Attributes inherited from avir::CImageResizerFilterStep< fptype, fptypeatom > | |
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 CImageResizerVars * | Vars |
Static Public Attributes inherited from avir::CImageResizerFilterStep< fptype, fptypeatom > | |
static const int | EdgePixelCountDef = 3 |
Interleaved filtering steps implementation class.
This class implements scanline filtering functions in interleaved mode. This means that each pixel is processed independently, not in groups.
fptype | Floating point type to use for storing pixel elements. SIMD types can be used: in this case each element may hold a whole pixel. |
fptypeatom | The atomic type the "fptype" consists of. |
|
static |
Function applies Linear to sRGB gamma correction to the specified scanline.
p | Scanline. |
l | The number of pixels to de-linearize. |
Vars0 | Image resizing-related variables. |
void avir::CImageResizerFilterStepINL< fptype, fptypeatom >::calcScanlineBias | ( | const fptype * | p, |
const int | SrcLen, | ||
fptype *const | ElBiases | ||
) | const |
Function calculates scanline's DC gain for each channel, further used to "unbias" the scanline.
p | Source scanline. | |
SrcLen | Source scanline's length. | |
[out] | ElBiases | Resuling biases. |
void avir::CImageResizerFilterStepINL< fptype, fptypeatom >::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.
ip | Input vertical scanline. |
op | Output buffer (temporary buffer used during resizing). |
SrcLen | The number of pixels in the input scanline, also used to calculate input buffer increment. |
SrcIncr | Input buffer increment to the next vertical pixel. |
void avir::CImageResizerFilterStepINL< fptype, fptypeatom >::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.
Src | Source scanline buffer (length = this -> InLen). Source scanline increment will be equal to ElCount. |
Dst | Destination scanline buffer. |
DstIncr | Destination scanline buffer increment, used for horizontal or vertical scanline stepping. |
void avir::CImageResizerFilterStepINL< fptype, fptypeatom >::doResize | ( | const fptype * | SrcLine, |
fptype * | DstLine, | ||
const int | DstLineIncr, | ||
const fptype *const | ElBiases, | ||
fptype * | const | ||
) | 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 ElCount.
SrcLine | Source scanline buffer. |
DstLine | Destination (resized) scanline buffer. |
DstLineIncr | Destination scanline position increment, used for horizontal or vertical scanline stepping. |
ElBiases | Bias values to add to the resulting scanline. |
xx | Temporary buffer, of size FltBank -> getFilterLen(), must be aligned by fpclass :: fpalign. |
void avir::CImageResizerFilterStepINL< fptype, fptypeatom >::doResize2 | ( | const fptype * | SrcLine, |
fptype * | DstLine, | ||
const int | DstLineIncr, | ||
const fptype *const | ElBiases, | ||
fptype * | const | ||
) | const |
Function performs resizing of a single scanline assuming that the input buffer consists of zero-padded elements (2X upsampling without filtering). Similar to the doResize() function otherwise.
SrcLine | Source scanline buffer. |
DstLine | Destination (resized) scanline buffer. |
DstLineIncr | Destination scanline position increment, used for horizontal or vertical scanline stepping. |
ElBiases | Bias values to add to the resulting scanline. |
xx | Temporary buffer, of size FltBank -> getFilterLen(), must be aligned by fpclass :: fpalign. |
void avir::CImageResizerFilterStepINL< fptype, fptypeatom >::doUpsample | ( | const fptype *const | Src, |
fptype *const | Dst | ||
) | const |
Function peforms scanline upsampling with filtering.
Src | Source scanline buffer (length = this -> InLen). Source scanline increment will be equal to ElCount. |
Dst | Destination scanline buffer. |
void avir::CImageResizerFilterStepINL< fptype, fptypeatom >::packScanline | ( | const Tin * | ip, |
fptype *const | op0, | ||
const int | l0 | ||
) | const |
Function performs "packing" of a scanline, and type conversion. Scanline, depending on the "fptype" can be potentially stored as a packed SIMD values having a certain atomic type. If required, the sRGB gamma correction is applied.
ip | Input scanline. |
op0 | Output scanline. |
l0 | The number of pixels to "pack". |
void avir::CImageResizerFilterStepINL< fptype, fptypeatom >::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.
Src | Source buffer. |
void avir::CImageResizerFilterStepINL< fptype, fptypeatom >::unbiasScanline | ( | fptype * | p, |
int | l, | ||
const fptype *const | ElBiases | ||
) | const |
Function applies "unbiasing" to the scanline, by subtracting the previously calculated bias (DC gain) values.
p | Scanline. |
l | Scanline's length. |
ElBiases | Biases to subtract, for each channel. |
|
static |
Function performs "unpacking" of a scanline and type conversion (truncation is used when floating point is converted to integer). Scanline, depending on the "fptype" can be potentially stored as a packed SIMD values having a certain atomic type. The unpacking function assumes that scanline is stored in the style produced by the packScanline() function.
ip | Input scanline. |
op | Output scanline. |
l | The number of pixels to "unpack". |
Vars0 | Image resizing-related variables. |