Digital Signal Processing Reference
In-Depth Information
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
¼
out;
Program 11.14. W-MDCT function.
function [ tdac_coef ]
¼
wmdct(ipsig)
%
% This function transforms the signal vector using the W-MDCT.
% Usage:
% ipsig: input signal block of N samples (N
¼
even number)
% tdac_coe: W-MDCT coefficents (N/2 coefficients)
%
N
¼
length(ipsig);
NN
¼
N;
for i
¼
1:NN
h(i)
¼
sin((pi/NN)*(i-1
þ
0.5));
end
for k
¼
1:N/2
tdac_coef(k)
¼
0.0;
for n
¼
1:N
tdac_coef(k)
þ .
h(n)*ipsig(n)*cos((2*pi/N)*(k-1
¼
tdac_coef(k)
þ
0.5)*(n-1
þ
0.5
þ
N/4));
end
end
tdac_coef
2*tdac_coef;
Program 11.15. Inverse W-IMDCT function.
¼
function [ opsig ]
¼
wimdct(tdac_coef)
%
% This function transforms the W-MDCT coefficients back to the signal.
% Usage:
% tdac_coeff: N/2 W-MDCT coeffcients
% opsig: output signal black with N samples
%
N
¼
length(tdac_coef);
tmp_coef
¼
((-1)^(N
þ
1))*tdac_coef(N:-1:1);
tdac_coef
¼
[ tdac_coef tmp_coef];
Search WWH ::
Custom Search