#include <avir.h>
Public Member Functions | |
CImageResizer (const int aResBitDepth=8, const int aSrcBitDepth=0, const CImageResizerParams &aParams=CImageResizerParamsDef()) | |
template<class Tin , class Tout > | |
void | resizeImage (const Tin *const SrcBuf, const int SrcWidth, const int SrcHeight, int SrcScanlineSize, Tout *const NewBuf, const int NewWidth, const int NewHeight, const int ElCountIO, const double k, CImageResizerVars *const aVars=NULL) const |
Image resizer class.
The object of this class can be used to resize 1-4 channel images to any required size. Resizing is performed by utilizing interpolated sinc fractional delay filters plus (if necessary) a cascade of built-in sinc function-based 2X upsampling or 2X downsampling stages, followed by a correction filtering.
Object of this class can be allocated on stack.
fpclass | Floating-point processing definition class to use. See avir::fpclass_def for more details. |
avir::CImageResizer< fpclass >::CImageResizer | ( | const int | aResBitDepth = 8 , |
const int | aSrcBitDepth = 0 , |
||
const CImageResizerParams & | aParams = CImageResizerParamsDef() |
||
) |
Constructor initializes the resizer.
aResBitDepth | Required bit depth of resulting image (1-16). If integer value output is used (e.g. uint8_t), the bit depth also affects rounding: for example, if aResBitDepth=6 and "Tout" is uint8_t, the result will be rounded to 6 most significant bits (2 least significant bits truncated, with dithering applied). |
aSrcBitDepth | Source image's real bit-depth. Set to 0 to use aResBitDepth. |
aParams | Resizing algorithm's parameters to use. Leave out for default values. Can be useful when performing automatic optimization of parameters. |
void avir::CImageResizer< fpclass >::resizeImage | ( | const Tin *const | SrcBuf, |
const int | SrcWidth, | ||
const int | SrcHeight, | ||
int | SrcScanlineSize, | ||
Tout *const | NewBuf, | ||
const int | NewWidth, | ||
const int | NewHeight, | ||
const int | ElCountIO, | ||
const double | k, | ||
CImageResizerVars *const | aVars = NULL |
||
) | const |
Function resizes image.
SrcBuf | Source image buffer. | |
SrcWidth | Source image width. | |
SrcHeight | Source image height. | |
SrcScanlineSize | Physical size of source scanline in elements (not bytes). If this value is below 1, SrcWidth * ElCountIO will be used as the physical source scanline size. | |
[out] | NewBuf | Buffer to accept the resized image. Can be equal to SrcBuf if the size of the resized image is smaller or equal to source image in size. |
NewWidth | New image width. | |
NewHeight | New image height. | |
ElCountIO | The number of elements (channels) used to store each source and destination pixel (1-4). | |
k | Resizing step (one output pixel corresponds to "k" input pixels). A downsizing factor if > 1.0; upsizing factor if <= 1.0. Multiply by -1 if you would like to bypass "ox" and "oy" adjustment which is done by default to produce a centered image. If step value equals 0, the step value will be chosen automatically and independently for horizontal and vertical resizing. | |
[in,out] | aVars | Pointer to variables structure to be passed to the image resizing function. Can be NULL. Only variables that are initialized in default constructor of this structure are accepted by this function. These variables will not be changed by this function. All other variables can be modified by this function. The access to this object is not thread-safe, each concurrent instance of this function should use a separate aVars object. |
Tin | Input buffer element's type. Can be uint8_t (0-255 value range), uint16_t (0-65535 value range), float (0.0-1.0 value range), double (0.0-1.0 value range). Larger integer types are treated as uint16_t. Signed integer types are unsupported. |
Tout | Output buffer element's type. Can be uint8_t (0-255 value range), uint16_t (0-65535 value range), float (0.0-1.0 value range), double (0.0-1.0 value range). Larger integer types are treated as uint16_t. Signed integer types are unsupported. |