Quantize and encode floating-point input into integer output
The UniformEncoder 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:
H = dsp.UniformEncoder returns a uniform encoder, H, that quantizes floating-point input samples and encodes them as integers using 2N-level quantization, where N is an integer.
H = dsp.UniformEncoder('PropertyName',PropertyValue,...) returns an uniform encoder, H, with each specified property set to the specified value.
H = dsp.UniformEncoder(peakvalue,numbits,
'PropertyName',PropertyValue,...) returns a uniform encoder, H, with the PeakValue property set to peakvalue, the NumBits property set to numbits, and other specified properties set to the specified values.
Largest input amplitude to be encoded
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. The default is 1.
Number of bits needed to represent output
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. The default is 8.
Data type of output
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.
|clone||Create uniform encoder object with same property values|
|getNumInputs||Number of expected inputs to step method|
|getNumOutputs||Number of outputs of step method|
|isLocked||Locked status for input attributes and nontunable properties|
|release||Allow property value and input characteristics changes|
|step||Quantize and encode input|
Encode a sequence:
hue = dsp.UniformEncoder; hue.PeakValue = 2; hue.NumBits = 4; hue.OutputDataType = 'Signed integer'; x = [-1:0.01:1]'; % Create an input sequence x_encoded = step(hue, x); plot(x, x_encoded,'.'); xlabel('Input'); ylabel('Encoded Output'); grid
This object implements the algorithm, inputs, and outputs described on the Uniform Encoder block reference page. The object properties correspond to the block parameters.