This class provides default implementation for most of the methods (wherever it makes sense), under the assumption that the image, component dimensions, and the tiles, are not modifed by the quantizer. If it is not the case for a particular implementation, then the methods should be overriden.
Sign magnitude representation is used (instead of two's complement) for the output data. The most significant bit is used for the sign (0 if positive, 1 if negative). Then the magnitude of the quantized coefficient is stored in the next M most significat bits. The rest of the bits (least significant bits) can contain a fractional value of the quantized coefficient. This fractional value is not to be coded by the entropy coder. However, it can be used to compute rate-distortion measures with greater precision.
The value of M is determined for each subband as the sum of the number of guard bits G and the nominal range of quantized wavelet coefficients in the corresponding subband (Rq), minus 1:
M = G + Rq -1
The value of G should be the same for all subbands. The value of Rq depends on the quantization step size, the nominal range of the component before the wavelet transform and the analysis gain of the subband (see Subband).
The blocks of data that are requested should not cross subband boundaries.
NOTE: At the moment only quantizers that implement the 'CBlkQuantDataSrcEnc' interface are supported.
@see SubbandProduce an output token on each firing with a value that is a quantized version of the input. The input and output types are both double.
The levels parameter contains an array of doubles specifying the quantization levels. The elements must be in an increasing order, or an exception will be thrown. The default value of levels is {-1.0, 1.0}.
Suppose u is the input, and levels = {a, b, c}, where a < b < c, then the output of the actor will be:
y = a, for u <= (b+a)/2;
y = b, for (b+a)/2 <
u <= (c+b)/2;
y = c, for u > (c+b)/2;
Thus, for the default levels, the output is (almost) the signum function of the input, or +1.0 if the input is positive, and -1.0 otherwise. This is almost the signum function because it outputs -1.0 if the input is zero.
This actor does not require that the quantization intervals be equal, i.e. we allow that (c-b) != (b-a).
@author Jie Liu @version $Id: Quantizer.java,v 1.45 2007/03/26 03:45:06 celaine Exp $ @since Ptolemy II 0.3 @Pt.ProposedRating Yellow (liuj) @Pt.AcceptedRating Yellow (yuhong)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|