% IDWT
% This function computes the inverse discrete wavelet transform of a given 
% given input vector F.  The vector F must be a column vector.

function f=idwt(c0,c1,F,level)
%fprintf('level=%d\n',level)
%fprintf('N=%d\n',size(F,1))
N=size(F,1);

f= 2*Lfilt(c0,c1,2*level)'*F(1:level) + 2*Hfilt(c0,c1,2*level)'*F(level+1:2*level);
nlevel = level*2;

if nlevel < N
	f=[f;F(nlevel+1:N)];
	f=idwt(c0,c1,f,nlevel);
end
