Main Content

Uniform Decoder

Decode integer input into floating-point output

  • Uniform Decoder block

Libraries:
DSP System Toolbox / Quantizers

Description

The Uniform Decoder block performs the inverse operation of the Uniform Encoder block, and reconstructs quantized floating-point values from encoded integer input. The block adheres to the definition for uniform decoding specified in ITU-T Recommendation G.701.

For more information on how the block computes the decoded floating-point output, see Algorithms.

Examples

expand all

Decode integer input into floating-point output using the Uniform Decoder block.

Open the ex_uniform_decoder model.

In this example, the input to the block is the uint8 output of a Uniform Encoder block. This block has comparable settings: Peak = 2, Bits = 3, and Output type = Unsigned. These settings ensure that inputs to the Uniform Decoder block do not saturate or wrap. See the example on the Uniform Encoder block reference page for more about these settings.

The block maps the real and complex components of each input independently to one of $2^3$ distinct levels in the range [-2.0,1.5]. The block maps:

  • 0 to -2.0

  • 1 to -1.5

  • 2 to -1.0

  • 3 to -0.5

  • 4 to 0.0

  • 5 to 0.5

  • 6 to 1.0

  • 7 to 1.5

Ports

Input

expand all

Specify the integer input to be decoded as a vector or a matrix.

The real and imaginary components of complex inputs wrap independently.

Data Types: int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
Complex Number Support: Yes

Output

expand all

Decoded floating-point output, returned as a vector or a matrix.

For more information on how the block computes the output, see Algorithms.

Data Types: single | double
Complex Number Support: Yes

Parameters

expand all

Specify the largest amplitude represented in the encoded input as a nonnegative scalar. To correctly decode values encoded with the Uniform Encoder block, set the Peak parameter in both blocks to the same value.

Specify the number of input bits B used to encode the data. The number of bits B can be any integer value between 2 and 32, inclusive. This value can be less than the total number of bits supplied by the input data type. To correctly decode values encoded with the Uniform Encoder block, set the Bits parameters in both blocks to the same value.

Specify the block behavior when the integer input is outside the range representable by B bits. Out-of-range inputs can either saturate at the extreme value, or wrap back into range.

When you select Saturate, unsigned input values greater than 2B−1 saturate at 2B−1 and signed input values greater than 2B−1−1 or less than −2B−1 saturate at those limits. The real and imaginary components of complex inputs saturate independently.

When you select Wrap, unsigned input values, u, greater than 2B−1 wrap back into the range [0, 2B−1] using mod-2B arithmetic.

u = mod(u,2^B)

Signed input values, u, greater than 2B−1−1 or less than −2B−1 wrap back into that range using mod-2B arithmetic.

u = (mod(u+2^B/2,2^B)-(2^B/2))	

The real and imaginary components of complex inputs wrap independently.

Specify the precision of the decoded floating-point output as single or double. You can use either level of output precision with any of the six integer input data types.

Block Characteristics

Data Types

integer

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

Algorithms

The Uniform Decoder block first casts the integer input values to floating-point values, and then uniquely maps (decodes) them to one of 2B uniformly spaced floating-point values in the range [−V, (1−21−B)V], where you specify B in the Bits parameter (as an integer between 2 and 32) and V is a floating-point value specified by the Peak parameter. The block maps the smallest input value representable by B bits (0 for an unsigned input data type and −2B−1 for a signed input data type) to the value −V. It maps the largest input value representable by B bits (2B−1 for an unsigned input data type and 2B−1−1 for a signed input data type) to the value (1−21−B)V. It linearly maps the intermediate input values to the intermediate values in the range [−V, (1−21−B)V].

To correctly decode values encoded by the Uniform Encoder block, the Bits and Peak parameters of the Uniform Decoder block should be set to the same values as the Bits and Peak parameters of the Uniform Encoder block.

References

[1] General Aspects of Digital Transmission Systems: Vocabulary of Digital Transmission and Multiplexing, and Pulse Code Modulation (PCM) Terms, International Telecommunication Union, ITU-T Recommendation G.701, March, 1993

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced before R2006a

See Also

Functions

Blocks