Main Content

dsp.UniformEncoder

(Removed) Quantize and encode floating-point input into integer output

dsp.UniformEncoder has been removed. Use uencode instead. For more information, see Compatibility Considerations.

Description

The dsp.UniformEncoder System object™ quantizes floating-point input, using the precision you specify in the NumBits property, and encodes the quantized input into integer output. The operations of the uniform encoder adhere to the definition for uniform encoding specified in ITU-T Recommendation G.701.

To quantize and encode a floating-point input into an integer output:

  1. Create the dsp.UniformEncoder 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?

Creation

Description

example

ue = dsp.UniformEncoder returns a uniform encoder, ue, that quantizes floating-point input samples and encodes them as integers using 2N-level quantization, where N is an integer.

ue = dsp.UniformEncoder(peakvalue,numbits) returns a uniform encoder, ue, with the PeakValue property set to peakvalue and the NumBits property set to numbits.

ue = dsp.UniformEncoder(___,Name,Value) returns a uniform encoder, ue, with the PeakValue property set to peakvalue, the NumBits property set to numbits, and other specified properties set to the specified values.

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.

Specify the largest input amplitude to be encoded, as a nonnegative numeric scalar. If the real or imaginary input are outside of the interval [–P, (1 – 2(1 – B))P], where P is the peak value and B is the value of the NumBits property, the uniform encoder saturates (independently for complex inputs) at those limits.

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

Specify the number of bits needed to represent the integer output as an integer value between 2 and 32. The number of levels at which the uniform encoder quantizes the floating-point input is 2B, where B is the number of bits.

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

Specify the data type of the output as 'Unsigned integer' or 'Signed integer'. Unsigned outputs are uint8, uint16, or uint32, and signed outputs are int8, int16, or int32. The quantized inputs are linearly (uniformly) mapped to the intermediate integers in the interval [0, 2(B – 1)] when you set this property to 'Unsigned integer', and in the interval [–2(B – 1), 2(B – 1) – 1] when you set this property to 'Signed integer'. The variable B in both expressions corresponds to the value of the NumBits property.

Usage

Syntax

Description

example

Y = ue(X) quantizes and encodes the input X to output Y.

Input Arguments

expand all

Data input, specified as a vector or a matrix. The input X can be real or complex and double-, or single-precision values.

Data Types: single | double
Complex Number Support: Yes

Output Arguments

expand all

Quantized and encoded output, returned as a vector or a matrix.

The uniform encoder chooses the output data type according to the table.

Number of BitsUnsigned IntegerSigned Integer
2 to 8uint8int8
9 to 16uint16int16
17 to 32uint32int32

The row in the table corresponds to the value of the NumBits property, and the column in the table corresponds to the value of the OutputDataType property.

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

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

collapse all

ue = dsp.UniformEncoder;
ue.PeakValue = 2;
ue.NumBits = 4;
ue.OutputDataType = 'Signed integer';
x = (-1:0.01:1)'; % Create an input sequence
x_encoded = ue(x);
plot(x, x_encoded,'.')
xlabel('Input')
ylabel('Encoded Output')
grid

Algorithms

This object implements the algorithm, inputs, and outputs described on the Uniform Encoder block reference page. The object properties correspond to the block parameters.

Version History

Introduced in R2012a

expand all

R2023a: dsp.UniformEncoder System object has been removed

The dsp.UniformEncoder System object has been removed. Use the uencode function instead.

Update Code

This table shows how to update existing code to use the uencode function.

Discouraged UsageRecommended Replacement

Encode a sequence

ue = dsp.UniformEncoder(PeakValue=2,NumBits=4,...
                        OutputDataType='Signed integer');
x = (0:0.25:2)';
x_encoded = ue(x);

Decode the encoded sequence

ud = dsp.UniformDecoder(PeakValue=2,NumBits=4);
x_decoded = ud(x_encoded);

Encode a sequence

% Number of bits is 4, and peak value is 2.
x_encodedFn = uencode(x,4,2,'signed');

Decode the encoded sequence

x_decodedFn = udecode(x_encodedFn,4,2);

See Also