AVIR
High-quality pro image resizing library
 
Loading...
Searching...
No Matches
avir::CImageResizerParams Struct Reference

Resizing algorithm parameters structure. More...

#include <avir.h>

Inheritance diagram for avir::CImageResizerParams:
avir::CImageResizerParamsDef avir::CImageResizerParamsHigh avir::CImageResizerParamsLR avir::CImageResizerParamsLow avir::CImageResizerParamsULR avir::CImageResizerParamsUltra

Public Attributes

double CorrFltAlpha
 Alpha parameter of the Peaked Cosine window function used on the correction filter. The "usable" values are in the narrow range 1.0 to 1.5.
 
double CorrFltLen
 Correction filter's length in samples (taps). The "usable" range is narrow, 5.5 to 8, as to minimize the "overcorrection" which is mathematically precise, but visually unacceptable.
 
double HBFltAlpha
 Half-band filter's Alpha. Assigned internally.
 
double HBFltCutoff
 Half-band filter's cutoff point [0; 1]. Assigned internally.
 
double HBFltLen
 Length of the half-band low-pass filter. Assigned internally. Internally used to perform 2X or higher downsampling. These filter parameters should be treated as "technical" and do not require adjustment as they were tuned to suit all combinations of other parameters. This half-band filter provides a wide transition band (for minimal ringing artifacts) and a high stop-band attenuation (for minimal aliasing).
 
double IntFltAlpha
 Alpha parameter of the Peaked Cosine window function used on the interpolation low-pass filter. The "usable" values are in the range 1.5 to 2.5.
 
double IntFltCutoff
 Interpolation low-pass filter's cutoff frequency (normalized, [0; 1]). The "usable" range is 0.6 to 0.8.
 
double IntFltLen
 Interpolation low-pass filter's length in samples (taps). The length value should be at least 18 or otherwise a "dark grid" artifact will be introduced if a further sharpening is applied. IntFltLen together with other IntFlt parameters should be tuned in a way that produces the flattest frequency response in 0-0.5 normalized frequency range (this range is due to 2X upsampling).
 
double LPFltAlpha
 Alpha parameter of the Peaked Cosine window function used on the low-pass filter. The "usable" values are in the range 1.5 to 6.5.
 
double LPFltBaseLen
 Base length of the low-pass (aka anti-aliasing or reconstruction) filter, in samples (taps), further adjusted by the actual cutoff frequency, upsampling and downsampling factors. The "usable" range is between 6 and 9.
 
double LPFltCutoffMult
 Low-pass filter's cutoff frequency multiplier. This value can be both below and above 1.0 as low-pass filters are inserted on downsampling and upsampling steps and always have corner frequency equal to or below 0.5pi. This multiplier shifts low-pass filter's corner frequency towards lower (if below 1.0) or higher (if above 1.0) frequencies. This multiplier can be way below 1.0 since any additional high-frequency damping will be partially corrected by the correction filter. The "usable" range is 0.3 to 1.0.
 

Detailed Description

Resizing algorithm parameters structure.

This structure holds all selectable parameters used by the resizing algorithm at various stages, for both downsizing and upsizing. There are no other parameters exist that can optimize the performance of the resizing algorithm. Filter length parameters can take fractional values.

Beside quality, these parameters (except Alpha parameters) directly affect the computative cost of the resizing algorithm. It is possible to trade the visual quality for computative cost.

Anti-alias filtering during downsizing can be defined as a considerable reduction of contrast of smallest features of an image. Unfortunately, such de-contrasting partially affects features of all sizes thus producing a non-linearity of frequency response. All pre-defined parameter sets are described by 3 values separated by slashes. The first value is the de-contrasting factor of small features (which are being removed) while the second value is the de-contrasting factor of large features (which should remain intact), with value of 1 equating to "no contrast change". The third value is the optimization score (see below), with value of 0 equating to the "perfect" linearity of frequency response.

The pre-defined parameter sets offered by this library were auto-optimized for the given LPFltBaseLen, IntFltLen and CorrFltAlpha values. The optimization goal was to minimize the score: the sum of squares of the difference between original and processed images (which was not actually resized, k=1). The original image was a 0.5 megapixel uniformly-distributed white-noise image with pixel intensities in the 0-1 range. Such goal converges very well and produces filtering system with the flattest frequency response possible for the given constraints. With this goal, increasing the LPFltBaseLen value reduces the general amount of aliasing artifacts.