The "main" inclusion file with all required classes and functions. More...
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
Go to the source code of this file.
Classes | |
class | avir::CBuffer< T, capint > |
Memory buffer class for element array storage, with capacity tracking. More... | |
class | avir::CDSPFIREQ |
FIR filter-based equalizer generator. More... | |
class | avir::CDSPFracFilterBankLin< fptype > |
Sinc function-based fractional delay filter bank. More... | |
class | avir::CDSPPeakedCosineLPF |
Low-pass filter windowed by Peaked Cosine window function. More... | |
class | avir::CDSPWindowGenPeakedCosine |
Peaked Cosine window function generator class. More... | |
class | avir::CFltBuffer |
Buffer class for parametrized low-pass filter. More... | |
class | avir::CImageResizer< fpclass > |
Image resizer class. More... | |
class | avir::CImageResizerDithererDefINL< fptype > |
Image resizer's default dithering class. More... | |
class | avir::CImageResizerDithererErrdINL< fptype > |
Image resizer's error-diffusion dithering class, interleaved mode. More... | |
class | avir::CImageResizerFilterStep< fptype, fptypeatom > |
Image resizer's filtering step class. More... | |
class | avir::CImageResizerFilterStepINL< fptype, fptypeatom > |
Interleaved filtering steps implementation class. More... | |
struct | avir::CImageResizerParams |
Resizing algorithm parameters structure. More... | |
struct | avir::CImageResizerParamsDef |
The default set of resizing algorithm parameters (10.06/1.88/1.029(256064.90)/0.000039). More... | |
struct | avir::CImageResizerParamsHigh |
Set of resizing algorithm parameters for low-aliasing resizing (11.59/1.84/1.015(73054.59)/0.000159). More... | |
struct | avir::CImageResizerParamsLow |
Set of resizing algorithm parameters for lower-ringing performance (9.21/1.91/1.040(391960.71)/0.000023). More... | |
struct | avir::CImageResizerParamsLR |
Set of resizing algorithm parameters for low-ringing performance (7.91/1.96/1.065(1980857.66)/0.000004). More... | |
struct | avir::CImageResizerParamsULR |
Set of resizing algorithm parameters for ultra-low-ringing performance (7.50/2.01/1.083(11568559.86)/0.000001). More... | |
struct | avir::CImageResizerParamsUltra |
Set of resizing algorithm parameters for ultra low-aliasing resizing (13.68/1.79/1.000(521792.07)/0.000026). More... | |
class | avir::CImageResizerThreadPool |
Thread pool for multi-threaded image resizing operation. More... | |
class | avir::CImageResizerVars |
Image resizing variables class. More... | |
struct | avir::CImageResizerFilterStep< fptype, fptypeatom >::CResizePos |
Resizing position structure. More... | |
class | avir::CImageResizerFilterStep< fptype, fptypeatom >::CRPosBuf |
Resizing positions buffer class. More... | |
class | avir::CImageResizerFilterStep< fptype, fptypeatom >::CRPosBufArray |
Resizing positions buffer array class. More... | |
class | avir::CSineGen |
Sine signal generator class. More... | |
class | avir::CStructArray< T > |
Array of structured objects. More... | |
class | avir::CImageResizerThreadPool::CWorkload |
Thread pool's workload object class. More... | |
class | avir::fpclass_def< afptype, afptypeatom, adith > |
Floating-point processing definition and abstraction class. More... | |
Macros | |
#define | AVIR_NOCTOR(ClassName) |
#define | AVIR_PI 3.1415926535897932 |
#define | AVIR_PId2 1.5707963267948966 |
#define | AVIR_RESIZE_PART1 |
#define | AVIR_RESIZE_PART1 |
#define | AVIR_RESIZE_PART1nx |
#define | AVIR_RESIZE_PART1nx |
#define | AVIR_RESIZE_PART2 |
#define | AVIR_RESIZE_PART2 |
#define | AVIR_VERSION "3.0" |
Functions | |
template<class T1, class T2> | |
void | avir::addArray (const T1 *ip, T2 *op, int l, const int ipinc=1, const int opinc=1) |
template<class T> | |
void | avir::calcFIRFilterResponse (const T *flt, int fltlen, const double th, double &re0, double &im0, const int fltlat=0) |
template<class T> | |
T | avir::clamp (const T &Value, const T minv, const T maxv) |
template<class T> | |
T | avir::convertLin2SRGB (const T s) |
template<class T> | |
T | avir::convertSRGB2Lin (const T s) |
template<class T1, class T2> | |
void | avir::copyArray (const T1 *ip, T2 *op, int l, const int ipinc=1, const int opinc=1) |
template<class T> | |
void | avir::normalizeFIRFilter (T *const p, const int l, const double DCGain, const int pstep=1) |
template<class T> | |
T | avir::pow24_sRGB (const T x) |
template<class T> | |
T | avir::pow24i_sRGB (const T x) |
template<class T1, class T2> | |
void | avir::replicateArray (const T1 *const ip, const int ipl, T2 *op, int l, const int opinc) |
template<class T> | |
T | avir::round (const T d) |
The "main" inclusion file with all required classes and functions.
This is the "main" inclusion file for the "AVIR" image resizer. This inclusion file contains implementation of the AVIR image resizing algorithm in its entirety. Also includes several classes and functions that can be useful elsewhere.
AVIR Copyright (c) 2015-2021 Aleksey Vaneev
#define AVIR_NOCTOR | ( | ClassName | ) |
A special macro that defines empty copy-constructor and copy operator with the "private:" prefix. This macro should be used in classes that cannot be copied in a standard C++ way.
#define AVIR_PI 3.1415926535897932 |
The macro equals to "pi" constant, fills 53-bit floating point mantissa. Undefined at the end of file.
#define AVIR_PId2 1.5707963267948966 |
The macro equals to "pi divided by 2" constant, fills 53-bit floating point mantissa. Undefined at the end of file.
#define AVIR_RESIZE_PART1 |
#define AVIR_RESIZE_PART1 |
#define AVIR_RESIZE_PART1nx |
#define AVIR_RESIZE_PART1nx |
#define AVIR_RESIZE_PART2 |
#define AVIR_RESIZE_PART2 |
#define AVIR_VERSION "3.0" |
The macro defines AVIR version string.
void avir::addArray | ( | const T1 * | ip, |
T2 * | op, | ||
int | l, | ||
const int | ipinc = 1, | ||
const int | opinc = 1 ) |
Function adds values located in array "ip" to array "op".
ip | Input buffer. | |
[out] | op | Output buffer. |
l | The number of elements to add. | |
ip | Input buffer pointer increment. | |
op | Output buffer pointer increment. |
void avir::calcFIRFilterResponse | ( | const T * | flt, |
int | fltlen, | ||
const double | th, | ||
double & | re0, | ||
double & | im0, | ||
const int | fltlat = 0 ) |
Function calculates frequency response of the specified FIR filter at the specified circular frequency. Phase can be calculated as atan2( im, re ). Function uses computationally-efficient oscillators instead of "cos" and "sin" functions.
flt | FIR filter's coefficients. | |
fltlen | Number of coefficients (taps) in the filter. | |
th | Circular frequency [0; pi]. | |
[out] | re0 | Resulting real part of the complex frequency response. |
[out] | im0 | Resulting imaginary part of the complex frequency response. |
fltlat | Filter's latency in samples (taps). |
T avir::clamp | ( | const T & | Value, |
const T | minv, | ||
const T | maxv ) |
Template function "clamps" (clips) the specified value so that it is not lesser than "minv", and not greater than "maxv".
Value | Value to clamp. |
minv | Minimal allowed value. |
maxv | Maximal allowed value. |
T avir::convertLin2SRGB | ( | const T | s | ) |
Function approximately de-linearizes the linear gamma value.
s | Linear gamma value, in the range 0 to 1. |
T avir::convertSRGB2Lin | ( | const T | s | ) |
Function approximately linearizes the sRGB gamma value.
s | sRGB gamma value, in the range 0 to 1. |
void avir::copyArray | ( | const T1 * | ip, |
T2 * | op, | ||
int | l, | ||
const int | ipinc = 1, | ||
const int | opinc = 1 ) |
Function converts (via typecast) specified array of type T1 values of length l into array of type T2 values. If T1 is the same as T2, copy operation is performed. When copying data at overlapping address spaces, "op" should be lower than "ip".
ip | Input buffer. | |
[out] | op | Output buffer. |
l | The number of elements to copy. | |
ip | Input buffer pointer increment. | |
op | Output buffer pointer increment. |
void avir::normalizeFIRFilter | ( | T *const | p, |
const int | l, | ||
const double | DCGain, | ||
const int | pstep = 1 ) |
Function normalizes FIR filter so that its frequency response at DC is equal to DCGain.
[in,out] | p | Filter coefficients. |
l | Filter length. | |
DCGain | Filter's gain at DC. | |
pstep | "p" array step. |
T avir::pow24_sRGB | ( | const T | x | ) |
Power 2.4 approximation function, designed for sRGB gamma correction.
x | Argument, in the range 0.09 to 1. |
T avir::pow24i_sRGB | ( | const T | x | ) |
Power 1/2.4 approximation function, designed for sRGB gamma correction.
x | Argument, in the range 0.003 to 1. |
void avir::replicateArray | ( | const T1 *const | ip, |
const int | ipl, | ||
T2 * | op, | ||
int | l, | ||
const int | opinc ) |
Function that replicates a set of adjacent elements several times in a row. This operation is usually used to replicate pixels at the start or end of image's scanline.
ip | Source array. | |
ipl | Source array length (usually 1..4, but can be any number). | |
[out] | op | Destination buffer. |
l | Number of times the source array should be replicated (the destination buffer should be able to hold ipl * l number of elements). | |
opinc | Destination buffer position increment after replicating the source array. This value should be equal to at least ipl. |
T avir::round | ( | const T | d | ) |
Rounding function, based on the (int) typecast. Biased result. Not suitable for numbers >= 2^31.
d | Value to round. |