Code covered by the BSD License
-
PDFFn (PDFType, Arg1, Arg2)
Return pointers to functions to calculate functions of the PDF
-
Quant (x, Xq, QType)
Quantize a vector of samples
-
QuantALawTables()
This routine returns quantization tables for a 256 level segmented A-law
-
QuantEntropy (Xq, Farea)
Calculate the entropy for a quantizer
-
QuantLloyd (Nlev, FPDF, QSym)
Iterate to find the output levels for a minimum mean square error
-
QuantMSE (Yq, Xq, FPDF)
Calculate the mean-square quantization error
-
QuantMuLawTables()
This routine returns quantization tables for a 256 level segmented mu-law
-
QuantOpt (Nlev, FPDF, Sym)
Find a non-uniform minimum mean square error quantizer.
-
QuantRefine (Yq, FPDF, QSym)
Iterate to find the output levels for a MMSE quantizer.
-
QuantSNR (Yq, Xq, FPDF, Scale...
Calculate the SNR (dB) for a quantizer defined by a table for a
-
QuantUnif (Nlev, FPDF, Sym)
Find a uniform minimum mean square error quantizer.
-
TestPDF
Use two different methods to calculate each of the following
-
p=lin2pcma(x,m,s)
-
tLogQuant (enc)
Test Quant for A or mu-law quantizer tables
-
tQuantOpt
-
tQuantUnif
-
x=pcma2lin(p,m,s)
-
View all files
from
Quantizers
by Peter Kabal
Routines to design/evaluate MMSE scalar quantizers, and an efficient quantizer routine.
|
| Quant (x, Xq, QType)
|
function Index = Quant (x, Xq, QType)
% Quantize a vector of samples
%
% x - vector of input samples
% Xq - Quantizer decision levels (Nreg-1 levels, where Nreg is the number
% of quantizer intervals).
% QType - Type of quantizer (optional, default 1). These quantizer types
% differ at the end points of the intervals. For Type 1, if an input
% value is equal to the upper end of an interval, it is considered to
% lie in the interval. For Type 2, if an input value is equal to the
% lower end of an interval, it is consider to lie in the interval.
%
% Index - Output index (0 <= Index < Nreg)
%
% This function returns the index of the quantizer region corresponding to
% a given input value. The quantizer is specified by an array of quantizer
% decision levels. A binary search is used to determine the quantizer
% region.
%
% The index value takes on values from 0 to Nreg-1, where Nreg is the
% number of quantizer regions. If number of regions is equal to one (Xq is
% empty), the index is set to zero. Otherwise, the index is determined as
% shown in the following table. The number of decision levels is one less
% than the number of regions.
% Index Interval QType 1 Interval QType 2
% 0 -Inf < x <= Xq(1) -Inf <= x < Xq(1)
% 1 Xq(1) < x <= Xq(2) Xq(1) <= x < Xq(2)
% k Xq(k) < x <= Xq(k+1) Xq(k) <= x < Xq(k+1)
% Nlev-1 Xq(Nlev-1) < x <= Inf Xq(Nlev-1) <= x < Inf
% For Nlev = 256, this routine is 15 to 20 times faster than quantiz
% (MATLAB Communications Toolbox).
Nreg = length(Xq) + 1;
Index = zeros(size(x));
if (nargin <= 2)
QType = 1;
end
if (QType == 1)
[Temp, Index] = histc(-x, -Xq(end:-1:1));
IU = (x < Xq(1));
Index(IU) = Nreg-1;
Index = Nreg - 1 - Index;
else
[Temp, Index] = histc(x, Xq);
IU = (x > Xq(end));
Index(IU) = Nreg-1;
end
return
|
|
Contact us at files@mathworks.com