#include <wv/bas_normal.h>
void wvBasisQuantize(WVbasis basis, WVdata level);
void wvBasisUnquantize(WVbasis basis, WVdata level);
void wvBasisQuantizeLp(WVbasis basis, WVdata level, WVmetric p);
void wvBasisUnquantizeLp(WVbasis basis, WVdata level, WVmetric p);
wvBasisQuantize quantizes the coefficients of basis by
units of level. The (real-valued) coefficients are replaced with
integers. Each coefficient c is recomputed as follows:
[ c / e ]
Where e is the level value
and [ x ] denotes the closest integer to the real number x.
Note that all coefficients whose absolute value is smaller than
level / 2 are set to zero by this procedure.
wvBasisUnquantize reverses the quantization process by replacing
each integer with a real-valued coefficient from the set of
values that map to that integer by the qauntization process (i.e.,
it multiplies each integer by level).
wvBasisQuantizeLp and wvBasisUnquantizeLp perform the
same operations as the pair of functions above, but they scale the
level value appropriately for each of the submatrices of the
basis to match the metric specified by p as follows:
e *
22nk(1/p - 1/2)
Where e is the level value
specified in the function call, n is the dimensionality of the
data, k is an integer corresponding to the submatrix (k=1
is the coarsest submatrix, higher values represent finer submatrices),
and p is the metric specified in the function call.
Calling wvBasisQuantizeLp with p=2 has the same result as
calling wvBasisQuantize. The value of p should be in the
range [ 1 , inf ). Infinity can be specified using the special value
WVMETRIC_L_INFINITY.