De-interleaved filtering steps implementation class. More...
#include <avir_dil.h>
Public Member Functions | |
void | convertVtoH (const fptype *ip, fptype *op, const int SrcLen, const int SrcIncr) const |
Converts vertical scanline to horizontal scanline. | |
void | doFilter (const fptype *const Src, fptype *Dst, const int DstIncr) const |
Performs scanline filtering with optional downsampling. | |
void | doResize (const fptype *SrcLine, fptype *DstLine, int DstLineIncr, fptype *const xx) const |
Performs resizing of a single scanline. | |
void | doResize2 (const fptype *SrcLine, fptype *DstLine, int DstLineIncr, fptype *const xx) const |
Performs resizing of a single scanline. | |
void | doUpsample (const fptype *Src, fptype *Dst) const |
Peforms scanline upsampling with filtering. | |
template<class Tin> | |
void | packScanline (const Tin *const ip0, fptype *const op0, const int l) const |
Performs "packing" (de-interleaving) of a scanline, and type conversion. If required, the sRGB gamma correction is applied. | |
void | prepareInBuf (fptype *Src) const |
Prepares input scanline buffer for this filtering step. | |
Static Public Member Functions | |
static void | applySRGBGamma (fptype *const p0, const int l, const CImageResizerVars &Vars0) |
Applies Linear to sRGB gamma correction to the specified scanline, in-place. | |
template<class Tout> | |
static void | unpackScanline (const fptype *const ip0, Tout *const op0, const int l, const CImageResizerVars &Vars0) |
Performs "unpacking" of a scanline, and type conversion. | |
Additional Inherited Members | |
![]() | |
double | DCGain |
DC gain which was applied to the filter. Not defined, if ResampleFactor equals 0. | |
int | EdgePixelCount |
The number of edge pixels added. Affects the initial position within the input scanline, used to produce edge pixels. This variable is used and should be defined when IsUpsample equals false and ResampleFactor is greater than 0. When assigning this variable, it is also necessary to update InPrefix , OutLen , and Vars.o variables. | |
CBuffer< fptype > | Flt |
Filter to use at this step. | |
const CDSPFracFilterBankLin< fptype > * | FltBank |
Filter bank in use by this resizing step, may be equal to FltBankDyn . | |
CDSPFracFilterBankLin< fptype > * | FltBankDyn |
Dynamically-allocated filter bank in use by this resizing step. Equals nullptr , if a static FltBank filter bank is in use. | |
int | FltLatency |
Filter's latency (group delay, shift) in pixels. | |
CFltBuffer | FltOrig |
Originally-designed filter. This buffer may not be assigned. Assigned by filters that precede the resizing step if such filter is planned to be embedded into the interpolation filter as "external" filter. If IsUpsample equals true , and this filter buffer is not empty, the upsampling step will not itself apply any filtering over upsampled input scanline. | |
int | InBuf |
Input buffer index, 0 or 1. | |
int | InElIncr |
Pixel element increment within the input buffer, used during de-interleaved processing: in this case each image's channel is stored independently, InElIncr elements apart. | |
int | InLen |
Input scanline's length in pixels. | |
int | InPrefix |
Required input prefix pixels. These prefix pixels will be filled with source scanline's first pixel value. If IsUpsample is true , this is the additional number of times the first pixel will be filtered before processing scanline, this number is also reflected in the OutPrefix . | |
int | InSuffix |
Required input suffix pixels. These suffix pixels will be filled with source scanline's last pixel value. If IsUpsample is true , this is the additional number of times the last pixel will be filtered before processing scanline, this number is also reflected in the OutSuffix . | |
bool | IsUpsample |
true , if this step is an upsampling step; false , if downsampling step. Should be set to false , if ResampleFactor equals 0. | |
int | OutBuf |
Output buffer index. 0 or 1; 2 for the last step. | |
int | OutElIncr |
Pixel element increment within the output buffer, used during de-interleaved processing. Equals to InBufElIncr of the next step. | |
int | OutLen |
Length of the resulting scanline. | |
int | OutPrefix |
Required output prefix pixels. These prefix pixels will not be pre-filled with any values. Value is valid only if IsUpsample equals true . | |
int | OutSuffix |
Required input suffix pixels. These suffix pixels will not be pre-filled with any values. Value is valid only if IsUpsample equals true . | |
CBuffer< fptype > | PrefixDC |
DC component fluctuations added at the start of the resulting scanline, used when IsUpsample equals true . | |
int | ResampleFactor |
Resample factor (greater or equal to 1). If 0, this is a resizing step. This value should be greater than 1, if IsUpsample equals true . | |
CRPosBuf * | RPosBuf |
Resizing positions buffer. Used when ResampleFactor equals 0 (resizing step). | |
CBuffer< fptype > | SuffixDC |
DC component fluctuations added at the end of the resulting scanline, used when IsUpsample equals true . | |
const CImageResizerVars * | Vars |
Image resizing-related variables. | |
![]() | |
static const int | EdgePixelCountDef |
The default number of pixels additionally produced at scanline edges during filtering. This is required to reduce edge artifacts. | |
De-interleaved filtering steps implementation class.
This class implements scanline filtering functions in de-interleaved mode. This means that pixels are processed in groups.
fptype | Floating point type to use for storing pixel elements. SIMD types cannot be used. |
fptypesimd | The SIMD type used to store a pack of fptype values. |
|
static |
Applies Linear to sRGB gamma correction to the specified scanline, in-place.
[in,out] | p0 | Scanline. |
l | The number of pixels to de-linearize. | |
Vars0 | Image resizing-related variables. |
void avir::CImageResizerFilterStepDIL< fptype, fptypesimd >::convertVtoH | ( | const fptype * | ip, |
fptype * | op, | ||
const int | SrcLen, | ||
const int | SrcIncr ) const |
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, pixel elements are grouped, SrcLen elements apart. |
op | Output buffer (temporary buffer used during resizing), pixel elements are grouped, l elements apart. |
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::CImageResizerFilterStepDIL< fptype, fptypesimd >::doFilter | ( | const fptype *const | Src, |
fptype * | Dst, | ||
const int | DstIncr ) const |
Performs 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 1. |
Dst | Destination scanline buffer. |
DstIncr | Destination scanline buffer increment, used for horizontal or vertical scanline stepping. |
void avir::CImageResizerFilterStepDIL< fptype, fptypesimd >::doResize | ( | const fptype * | SrcLine, |
fptype * | DstLine, | ||
int | DstLineIncr, | ||
fptype *const | xx ) const |
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 positive, 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.
SrcLine | Source scanline buffer. |
DstLine | Destination (resized) scanline buffer. |
DstLineIncr | Destination scanline position increment, used for horizontal or vertical scanline stepping. |
xx | Temporary buffer, of size FltBank.getFilterLen(), must be aligned by fpclass :: fpalign. |
void avir::CImageResizerFilterStepDIL< fptype, fptypesimd >::doResize2 | ( | const fptype * | SrcLine, |
fptype * | DstLine, | ||
int | DstLineIncr, | ||
fptype *const | xx ) const |
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 positive, 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.
SrcLine | Source scanline buffer. |
DstLine | Destination (resized) scanline buffer. |
DstLineIncr | Destination scanline position increment, used for horizontal or vertical scanline stepping. |
xx | Temporary buffer, of size FltBank.getFilterLen(), must be aligned by fpclass :: fpalign. |
void avir::CImageResizerFilterStepDIL< fptype, fptypesimd >::doUpsample | ( | const fptype * | Src, |
fptype * | Dst ) const |
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::CImageResizerFilterStepDIL< fptype, fptypesimd >::packScanline | ( | const Tin *const | ip0, |
fptype *const | op0, | ||
const int | l ) const |
Performs "packing" (de-interleaving) of a scanline, and type conversion. If required, the sRGB gamma correction is applied.
ip0 | Input scanline, pixel elements interleaved. |
op0 | Output scanline, pixel elements are grouped, l elements apart. |
l | The number of pixels to "pack". |
void avir::CImageResizerFilterStepDIL< fptype, fptypesimd >::prepareInBuf | ( | fptype * | Src | ) | const |
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. |
|
static |
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.
ip0 | Input scanline, pixel elements are grouped, l elements apart. |
op0 | Output scanline, pixel elements are interleaved. |
l | The number of pixels to "unpack". |
Vars0 | Image resizing-related variables. ElCount is assumed to be equal to ElCountIO . |