utility.h File Reference

Common utility functions. More...


Functions

int wv_log2i (int max_val)
 Integer logarithm base 2 of a given integer.
double wv_mse_to_psnr (const double mse)
 Converts MSE (mean square error) to PSNR (peak signal to noise ration (dB)).
double wv_psnr_to_mse (const double psnr)
 Converts PSNR (peak signal to noise ration (dB)) to MSE (mean square error).
double wv_calc_psnr (const wv_pel *a, const wv_pel *b, const int width, const int height, const int pitch, double *pmse)
 Computes the PSNR (peak signal to noise ratio (dB)) and optionally the mean-square error from two version of an image.
int wv_rgb_to_ycocg (const int Num, wv_pel *R, wv_pel *G, wv_pel *B)
 Converts an array of pixels (given as seperate bitplanes) from the RGB color-space into the YCoCg color-space.
int wv_ycocg_to_rgb (const int Num, wv_pel *Y, wv_pel *Cb, wv_pel *Cr)
 Converts an array of pixels (given as seperate bitplanes) from the YCoCg color-space into the RGB color-space.
int wv_rgb_to_ycocgr (const int Num, wv_pel *R, wv_pel *G, wv_pel *B)
 Converts an array of pixels (given as seperate bitplanes) from the RGB color-space into the YCoCg-R color-space.
int wv_ycocgr_to_rgb (const int Num, wv_pel *Y, wv_pel *Cb, wv_pel *Cr)
 Converts an array of pixels (given as seperate bitplanes) from the YCoCg-R color-space into the RGB color-space.


Detailed Description

Common utility functions.


Function Documentation

double wv_calc_psnr ( const wv_pel a,
const wv_pel b,
const int  width,
const int  height,
const int  pitch,
double *  pmse 
)

Computes the PSNR (peak signal to noise ratio (dB)) and optionally the mean-square error from two version of an image.

Parameters:
[in] a Image A
[in] b Image B
[in] width Width of the image in a and b
[in] height Height of the image in a and b
[in] pitch Pitch in wv_pel units of the image in a and b (usually this is a power of 2)
[out] pmse Address of a double where the mean-square error is written into (if != NULL)
Returns:
PSNR between the two versions of the image

int wv_log2i ( int  v  ) 

Integer logarithm base 2 of a given integer.

This is equal to the number of bits needed to encode that number.

Warning:
Returns 0 for negative numbers!
Parameters:
[in] v number whose log is wanted
Returns:
Integer logarithm (base 2) of v (wv_log2i(0) = 0)

double wv_mse_to_psnr ( const double  mse  ) 

Converts MSE (mean square error) to PSNR (peak signal to noise ration (dB)).

Inverse of wv_psnr_to_mse().

Parameters:
[in] mse Mean square error
Returns:
PSNR (in dB) of given MSE. The result is 0 (instead of "infinity") for non-positive values.

double wv_psnr_to_mse ( const double  psnr  ) 

Converts PSNR (peak signal to noise ration (dB)) to MSE (mean square error).

Inverse of wv_mse_to_psnr().

Parameters:
[in] psnr Peak signal to noise ration (in dB)
Returns:
Mean square error of given PSNR. The result is 1e64 for non-positive values

int wv_rgb_to_ycocg ( const int  Num,
wv_pel R,
wv_pel G,
wv_pel B 
)

Converts an array of pixels (given as seperate bitplanes) from the RGB color-space into the YCoCg color-space.

Inverse of wv_ycocg_to_rgb().

Parameters:
[in] Num Number of pixels to be converted
[in,out] R Red pixels on input, Y pixels on output
[in,out] G Green pixels on input, Co pixels on output
[in,out] B Blue pixels on input, Cg pixels on output
Returns:
Number of pixels converted

int wv_rgb_to_ycocgr ( const int  Num,
wv_pel R,
wv_pel G,
wv_pel B 
)

Converts an array of pixels (given as seperate bitplanes) from the RGB color-space into the YCoCg-R color-space.

Inverse of wv_ycocgr_to_rgb(). This transform is reversible (i.e. lossless).

Parameters:
[in] Num Number of pixels to be converted
[in,out] R Red pixels on input, Y pixels on output
[in,out] G Green pixels on input, Co pixels on output
[in,out] B Blue pixels on input, Cg pixels on output
Returns:
Number of pixels converted

int wv_ycocg_to_rgb ( const int  Num,
wv_pel Y,
wv_pel Co,
wv_pel Cg 
)

Converts an array of pixels (given as seperate bitplanes) from the YCoCg color-space into the RGB color-space.

Inverse of wv_rgb_to_ycocg().

Parameters:
[in] Num Number of pixels to be converted
[in,out] Y Y pixels on input, red pixels on output
[in,out] Co Co pixels on input, green pixels on output
[in,out] Cg Cg pixels on input, blue pixels on output
Returns:
Number of pixels converted

int wv_ycocgr_to_rgb ( const int  Num,
wv_pel Y,
wv_pel Co,
wv_pel Cg 
)

Converts an array of pixels (given as seperate bitplanes) from the YCoCg-R color-space into the RGB color-space.

Inverse of wv_rgb_to_ycocgr(). This transform is reversible (i.e. lossless).

Parameters:
[in] Num Number of pixels to be converted
[in,out] Y Y pixels on input, red pixels on output
[in,out] Co Co pixels on input, green pixels on output
[in,out] Cg Cg pixels on input, blue pixels on output
Returns:
Number of pixels converted


Generated on Tue Jul 10 20:44:34 2007 for wavelet by  doxygen 1.5.2