Optimizing DPCM Parameters
Section Overview
The section Optimizing Quantization Parameters describes how to use training
data with the lloyds function to help find quantization
parameters that will minimize signal distortion.
This section describes similar procedures for using the dpcmopt function
in conjunction with the two functions dpcmenco and dpcmdeco,
which first appear in the previous section.
Note
The training data you use with dpcmopt should
be typical of the kinds of signals you will actually be quantizing
with dpcmenco. |
Back to Top
Example: Comparing Optimized and Nonoptimized DPCM Parameters
This example is similar to the one in the last section. However,
where the last example created predictor, partition,
and codebook in a straightforward but haphazard
way, this example uses the same codebook (now called initcodebook)
as an initial guess for a new optimized codebook
parameter. This example also uses the predictive order, 1, as the
desired order of the new optimized predictor. The dpcmopt function
creates these optimized parameters, using the sawtooth signal x as
training data. The example goes on to quantize the training data itself;
in theory, the optimized parameters are suitable for quantizing other
data that is similar to x. Notice that the mean
square distortion here is much less than the distortion in the previous
example.
t = [0:pi/50:2*pi];
x = sawtooth(3*t); % Original signal
initcodebook = [-1:.1:1]; % Initial guess at codebook
% Optimize parameters, using initial codebook and order 1.
[predictor,codebook,partition] = dpcmopt(x,1,initcodebook);
% Quantize x using DPCM.
encodedx = dpcmenco(x,codebook,partition,predictor);
% Try to recover x from the modulated signal.
decodedx = dpcmdeco(encodedx,codebook,predictor);
distor = sum((x-decodedx).^2)/length(x) % Mean square error
The output is
distor =
0.0063
Back to Top
 | Differential Pulse Code Modulation | | Companding a Signal |  |
How much time do you spend on testing to ensure implementation meets system-level requirements?
Learn more