Routines to design/evaluate MMSE scalar quantizers, and an efficient quantizer routine.


Updated 19 Jun 2009

View License


Quantizer Design
This group of routines designs and evaluates scalar quantizers. A scalar quantizer is defined by a set of decision values and a set of output values. The Lloyd-Max algorithms are used to design minimum-mean-square error scalar quantizers based on a given probability density functions.
There are two basic design routines: QuantOpt to design general non-uniformly spaced quantizers, and QuantUnif to design uniformly spaced quantizers. For each, the quantizer can additionally be constrained to have symmetrically spaced levels. A number of different probability density functions are supported.
1. Uniform: Uniform pdf leading to a uniform quantizer
2. Gaussian: Gaussian pdf
3. Laplace: Two-sided laplace pdf
4. Sine: pdf for a sinusoid with random phase
5. Gamma: Gamma pdf (generalized gamma distribution with parameter 1/2)
6. Generalized Gamma: Generalized gamma pdf specified with an additional parameter
7. Tabulated: A pdf specified by a set of points. The points are (x,p) pairs. The pdf is assumed to be linear between the given points and zero outside the points. For sufficiently smooth pdf’s, the tabulated option can be used to design minimum mean-square error quantizers for arbitrary pdf’s by supplying samples of the pdf.

Design Strategy
The initial search for a quantizer which satisfies the necessary conditions for minimum mean-square error is done using a one-dimensional search (Lloyd algorithm). A refinement step using the Lloyd-Max iteration is then carried out.

Quantizer Evaluation
The quantizer is evaluated by calculating the resulting mean-square error (and SNR in dB), and the quantizer entropy. The evaluation routines QuantSNR can be used for any quantizer (whether designed by the design routines described above or not).

Log-PCM Quantizers
The routines QuantALawTables and QuantMuLawTables generate quantizer tables for log-PCM quantization as per ITU-T Recommendation G.711.

The routine Quant efficiently carries out quantization. Internally it uses the Matlab routine histc. This routine is more efficient than the Matlab function quantiz (Communications Toolbox). Quant has an option for having input values which lie exactly at the decision boundaries round up or round down.

Cite As

Peter Kabal (2023). Quantizers (https://www.mathworks.com/matlabcentral/fileexchange/24333-quantizers), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Elementary Polygons in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Update BSD license - no file changes