function w = dpwt(f, l, level) % FUNCTION: dpwt Part of DPWT Toolbox % % SYNOPSIS: W = dpwt(F, L, [, LEVEL]) % % DESCRIPTION: This is the discrete periodic wavelet transform % using the filter (usually low-p[ass) corresponding to L. % The DPWT transform is performed down to level LEVEL. % The resulting W has the same length as F. If LEVEL is % not specified, or if LEVEL = 0 then the complete DPWT % is calculated. Vector L is assumed to consist of % the low-pass half of a perfect reconstruction % filter pair. % % The returned row vector W is W = [f0, w0, w1, ..., wp] % where f0 is length 1 and wp is a length 2^p row. These % are the wavelet coordinates of F. % % This routine does some argument testing and calculations % which are then passed on to the recursive function % R_DPWT which actually implements the DPWT. % % The length of F must be an integer power of 2. PADWITHZEROS % may be uses to bring F to the necessary dimensions. % Filter sequence L is not checked for satisfaction of % perfect reconstruction criteria. It must be of even length. % % SEE ALSO: R_DPWT, IDPWT, R_IDPWT, LH_TILDE, PADWITHZEROS % % REFERENCE: N. Getz, "A Fast Discrete Periodic Wavelet Transform", % Electronics Research Laboratory, U.C. Berkeley, 1992. % % AUTHOR: Neil Getz % DATE: 12-11-92 % p = log(length(f))/log(2); N = length(l)/2; % Argument checking. % if(nargin < 2 | nargin > 3), help dpwt; return; elseif(round(N) ~= N), error('Length of arg 2 must be an even integer.') elseif(p ~= round(p)), error('Length of arg 1 must be an integer power of 2.') elseif(nargin == 3), if((level > p)|(level < 0)) error('Level (arg 3) must not be greater than log 2 of length of arg 1.') end end % MATSHIFT = 1; % Matlab indices start at 1, not 0. % Conjugate filter calculation % h = l; % For length. for k = 0:2*N-1, h( MATSHIFT + k ) = (-1)^(MATSHIFT + k) * l(MATSHIFT + 2*N - 1 - k); end % % If level is not specified then go all the way. if(nargin == 2), level = 0; end % % The beef. w = r_dpwt(f, l, h, level); % END dpwt