dsp.ScalarQuantizerDecoder System object

Package: dsp

Convert each index value into quantized output value


The ScalarQuantizerDecoder object converts each index value into a quantized output value. The specified codebook defines the set of all possible quantized output values or codewords. Input index values less than 0 are set to 0 and index values greater N – 1 are set to N – 1. N is the length of the codebook vector.

To convert an index value into a quantized output value:

  1. Define and set up your scalar quantizer decoder. See Construction.

  2. Call step to convert the index value according to the properties of dsp.ScalarQuantizerDecoder. The behavior of step is specific to each object in the toolbox.


H = dsp.ScalarQuantizerDecoder returns a scalar quantizer decoder System object™, H, that transforms zero-based input index values into quantized output values.

H = dsp.ScalarQuantizerDecoder('PropertyName',PropertyValue,...) returns a scalar quantizer decoder object, H, with each specified property set to the specified value.



How to specify codebook values

Specify how to determine the codebook values as Property or Input port. The default is Property.



Specify the codebook as a vector of quantized output values that correspond to each index value. The default is 1:10. This property is tunable.


Data type of codebook and quantized output

Specify the data type of the codebook and quantized output values as Same as input, double, single or Custom. The default is double.

 Fixed-Point Properties


cloneCreate scalar quantizer decoder object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs of step method
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
stepDecode using scalar quantization


Given a codebook and index values as inputs, determine the corresponding output quantized values:

 codebook = single([-2.1655 -1.3238 -0.7365 -0.2249 0.2726, ...
 0.7844 1.3610 2.1599]);
 indices = uint8([1 3 5 7 6 4 2 0]);
 hsqdec = dsp.ScalarQuantizerDecoder;
 hsqdec.CodebookSource = 'Input port';
 qout = step(hsqdec, indices, codebook);


This object implements the algorithm, inputs, and outputs described on the Scalar Quantizer Decoder block reference page. The object properties correspond to the block parameters, except:

There is no object property that directly corresponds to the Action for out of range index value block parameter. The object sets any index values less than 0 to 0 and any index values greater than or equal to N to N – 1.

Was this topic helpful?