📄 dpcmdeco.m
字号:
function [sig, quant] = dpcmdeco(indx, codebook, predictor)
%DPCMDECO Decodes a DPCM encoded signal.
% SIG = DPCMDECO(INDX, CODEBOOK, PREDICTOR) decodes a differential pulse
% code modulation (CPCM) encoded index INDX signal. The predictive
% transfer function is provided in PREDICTOR. The predictive-error
% quantization codebook is given in CODEBOOK. In general, an M-th
% order transfer function has the form of [0, n1, n2, ... nM]. To
% obtain a correct decode result, the parameters must match the encode
% parameters.
%
% [SIG, QUANT] = DPCMDECO(INDX, CODEBOOK, PREDICTOR) outputs the
% quantized predictive error in QUANT.
%
% The input parameters CODEBOOK and PREDICTOR can be estimated by using
% DPCMOPT.
%
% See also QUANTIZ, DPCMOPT, DPCMENCO.
% Wes Wang 10/13/94, 10/5/95
% Copyright (c) 1995-96 by The MathWorks, Inc.
% $Revision: 1.1 $ $Date: 1996/04/01 17:56:59 $
if nargin < 3
error('Not enough input variable for DPCMENCO.');
end;
% The structure of the DPCM is as follows:
% e quant
% INDX -->------Quantization------+-----------------------|--->sig
% ^ V
% out |<----Predictor<--------| inp
len_predictor = length(predictor) - 1;
predictor = predictor(2:len_predictor+1);
predictor = predictor(:)';
len_sig = length(indx);
quant = indx;
quant = codebook(indx+1);
x = zeros(len_predictor, 1);
for i = 1 : len_sig;
out = predictor * x;
sig(i) = quant(i) + out;
% renew the estimated output
x = [sig(i); x(1:len_predictor-1)];
end;
% -- end of dpcmdeco --
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -