This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

dsp.ScalarQuantizerDecoder

Convert each index value into quantized output value

Description

The dsp.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. Create the dsp.ScalarQuantizerDecoder object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects? (MATLAB).

Creation

Syntax

sqdec = dsp.ScalarQuantizerDecoder
sqdec = dsp.ScalarQuantizerDecoder(Name,Value)

Description

example

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

sqdec = dsp.ScalarQuantizerDecoder(Name,Value) returns a scalar quantizer decoder object, sqdec, with each specified property set to the specified value.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects (MATLAB).

Specify how to determine the codebook values as 'Property' or 'Input port'.

Specify the codebook as a vector of quantized output values that correspond to each index value.

Tunable: Yes

Dependencies

This property applies when you set CodebookSource to 'Property'.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

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

Dependencies

This property applies when you set CodebookSource to 'Property'.

Fixed-Point Properties

Specify the output fixed-point type as a signed or unsigned numerictype object.

Dependencies

This property applies only when you set the OutputDataType property to Custom.

Usage

For versions earlier than R2016b, use the step function to run the System object algorithm. The arguments to step are the object you created, followed by the arguments shown in this section.

For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

Syntax

Q = sqdec(I)
Q = sqdec(I,C)

Description

Q = sqdec(I) returns the quantized output values Q corresponding to the input indices I.

example

Q = sqdec(I,C) uses input C as the codebook values when you set the CodebookSource property to Input port. The data type of C can be double, single, or fixed-point. The output Q has the same data type as the codebook input C.

Input Arguments

expand all

Input indices, specified as a vector or a matrix.

Data Types: int8 | int16 | int32 | uint8 | uint16 | uint32

Codebook, specified as a vector of quantized output values that correspond to each index value.

Dependencies

This property applies when you set CodebookSource to 'Input port'.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Output Arguments

expand all

Quantized output values, returned as a vector or a matrix of the same size as the input, I. When codebook is specified as a property, the output data type is determined by the OutputDataType property. When the codebook is specified as an input, the output data type is same as the data type of the codebook input.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fi

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

expand all

Note: If you are using R2016a or an earlier release, replace each call to the object with the equivalent step syntax. For example, obj(x) becomes step(obj,x).

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]);
sqdec = dsp.ScalarQuantizerDecoder;
sqdec.CodebookSource = 'Input port';
qout = sqdec(indices,codebook)
qout = 1x8 single row vector

   -1.3238   -0.2249    0.7844    2.1599    1.3610    0.2726   -0.7365   -2.1655

Algorithms

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.

Extended Capabilities

Introduced in R2012a