Digital Signal Processing Reference
In-Depth Information
% Adaptive speed control
%
dms ¼ (31.0/32.0)*dms; dms ¼ dms þ fitable(abs(ik) þ 1)/32.0;
dml ¼ (127.0/128.0)*dml; dml ¼ dml þ fitable(abs(ik) þ 1)/128.0;
if ap > 1.0
al ¼ 1.0;
else
al
¼
ap;
end
ap
(15.0/16.0)*ap;
if abs(dms-dml) >
¼
¼
dml/8.0
ap
¼
ap
þ
1/8.0;
end
if y < 3
ap ¼ ap þ 1/8.0;
end
if td ¼¼ 1
ap ¼ ap þ 1/8.0;
end
if tr ¼¼ 1
ap ¼ 1.0;
end
y ¼ al*yu þ (1.0-al)*yl;
end
end
iiout ¼ ii;v
Program 11.13. MATLAB function for ADPCM decoding.
function iiout ¼ adpcmdec(ii)
% This function performs ADPCM decoding.
% function iiout ¼ adpcmdec(ii)
% Usage:
%ii
¼
input ADPCM index
% iiout
¼
decoded output value
%
% Quantization tables:
fitable
¼
[000111137];
witable
[-0.75 1.13 2.56 4.00 7.00 12.38 22.19 70.13 ];
qtable ¼ [ -0.98 0.62 1.38 1.91 2.34 2.72 3.12 ];
invqtable ¼ [0.031 1.05 1.66 2.13 2.52 2.91 3.32 ];
lgth ¼ length(ii);
sr ¼ zeros(1,2); pk ¼ zeros(1,2);
a ¼ zeros(1,2); b ¼ zeros(1,6);
dq ¼ zeros(1,6); out ¼ zeros(1,lgth);
y ¼ 0; ap ¼ 0; al ¼ 0; yu ¼ 0; yl ¼ 0; dms ¼ 0; dml ¼ 0; tr ¼ 0; td ¼ 0;
for k ¼ 1:lgth
%
¼
sez ¼ b(1)*dq(1);
Search WWH ::




Custom Search