function [ l_tilde, h_tilde ] = lh_tilde(l, h, two2p) % FUNCTION: lh_tilde Part of DPWT toolbox. % % SYNOPSIS: [ L_TILDE, H_TILDE ] = lh_tilde(L, H, TWO2P) % % DESCRIPTION: Make DPWT filters L_TILDE and H_TILDE. % % The vectors L and H are assumed to be % the values of the finite impulse response % low-pass and high-pass filters over their interval % of support {0,1,...,length(l)-1}. The filters % are not checked to see if they form a perfect % reconstruction pair. Nor are they checked for % common length though this is assumed. The argument % TWO2P is the length (a power of 2) of the signal to % be filtered. % % NOTE: For more speed in dpwt() and idpwt() the vectors % calculated by LH_TILDE could be precalculated and % either passed as function parameters or made globally % available. % % This function is mainly for use by DPWT and IDPWT. % % % AUTHOR: Neil Getz % DATE: 12-11-92 MATSHIFT = 1; % matlab indices start at 1, not 0. Nt2 = length(l); % Saves some multiplications. if(Nt2~=length(h)), error('Arg 1 and arg 2 must be the same length.'); end if ( length(l) <= two2p ), % In this case 2N<=2^p, so the first 2N taps % of l_tilde and h_tilde are identical to % those of l and h, respectively. % This is just to save a little time since % the section following 'else' below would % return the same result as this section for % the length(l) <= two2p. l_tilde = l; h_tilde = h; else, % Here we have 2N>2^p and we need to apply a wrap. l_tilde = zeros(1, two2p); h_tilde = l_tilde; % for size for i = 0:min([Nt2,two2p])-1, imod2to_p = i - two2p*floor(i/two2p); % dex = i mod 2^p for k = 0:floor((Nt2-1-imod2to_p)/two2p), l_tilde( MATSHIFT + i ) ... = l_tilde( MATSHIFT + i ) + l( MATSHIFT + imod2to_p + k*two2p); h_tilde( MATSHIFT + i ) ... = h_tilde( MATSHIFT + i ) + h( MATSHIFT + imod2to_p + k*two2p); end end end