Documentation

# dsp.VectorQuantizerDecoder

Vector quantizer codeword for given index value

## Description

The VectorQuantizerDecoder object associates each input index value with a codeword, a column vector of quantized output values defined in the Codebook property. Each column of the Codebook property is a codeword. When you input multiple index values into this object, the object outputs a matrix of quantized output vectors. This matrix is created by horizontally concatenating the codeword vectors that correspond to each index value.

You can select to enter the code book values via the Codebook property or as an input to the object.

To obtain the vector quantizer codeword for a given index value:

1. Create the dsp.VectorQuantizerDecoder object and set its properties.

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

## Creation

### Description

example

vqdec = dsp.VectorQuantizerDecoder creates a vector quantizer decoder System object™, vqdec, that returns a vector quantizer codeword corresponding to a given, zero-based index value.

vqdec = dsp.VectorQuantizerDecoder(Name,Value) returns a vector quantizer decoder, vqdec, 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.

Specify the codebook source as Property or Input port. When you select Property, the object reads the codebook from the Codebook property. When you select Input port, the object reads the codebook from the input argument C.

Specify quantized output values as a k-by-N matrix, where $\text{k}\ge \text{1}$ and $N\ge 1$. Each column of the codebook matrix is a codeword, and each codeword corresponds to an index value. The default is:

The index values are zero based; therefore, the first codeword vector corresponds to an index value of 0, the second codeword vector corresponds to an index value of 1, and so on.

Tunable: Yes

#### Dependencies

This property applies when you set the CodebookSource property 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. If this property is set to Custom, the data type is specified by the CustomOutputDataType property.

#### Dependencies

This property applies only 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

### Description

example

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

Q = vqdec(I,C) uses input C as the codebook values when the CodebookSource property is Input port.

### Input Arguments

expand all

Input indices, specified as a scalar or a row vector.

The input to this object is a vector of index values, where 0 ≤ index < N and N is the number of columns of the codebook matrix. The object sets any index values less than 0 to 0 and any index values greater than or equal to N to N – 1.

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

Codebook values, specified as a scalar, vector, or matrix.

#### Dependencies

This input is enabled only when the CodebookSource property is set to 'Input port'.

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

### Output Arguments

expand all

Quantized output values, returned as a scalar, vector, or matrix. Each column of Q is a codeword whose index in the codebook matches the element specified in the I matrix.

The codebook is zero based. The first codeword vector corresponds to an index value of 0, the second codeword vector corresponds to an index value of 1, and so on.

For example, if the codebook is

and the I vector is [1 0 3 2 1 0], the output Q matrix is

$\left[\begin{array}{cccccc}13.3& 1.5& 6.8& 136.4& 13.3& 1.5\\ 14.3& 2.5& 7.8& 137.4& 14.3& 2.5\\ 15.3& 3.5& 8.8& 138.4& 15.3& 3.5\end{array}\right]$

If the CodebookSource is set to 'Property', the data type of Q is determined by the OutputDataType property.

If the CodebookSource is set to 'Input port', the output Q has the same data type as the codebook input C.

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

 step Run System object algorithm release Release resources and allow changes to System object property values and input characteristics reset Reset internal states of System object

## Examples

expand all

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

Given index values as an input, determine the corresponding vector quantized codewords for a specified codebook.

vqdec = dsp.VectorQuantizerDecoder;
vqdec.Codebook = [1 10 100;2 20 200;3 30 300];
indices = uint8([1 0 2 0]);
qout = vqdec(indices)
qout = 3×4

10     1   100     1
20     2   200     2
30     3   300     3

## Algorithms

This object implements the algorithm, inputs, and outputs described on the Vector 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.