www.pudn.com > Upload_EZW128.zip > SYNTH21.M


function sy = synth21(sub,lpf,hpf) 
%synth1(sub, lpf, hpf) takes the one level subband decomposed  
%image and reconstructs it using the filter bank made up of  
%lpf and hpf. Orthonormal filter bank with circular extension.  
%upsampling algorithm-courtsey: Dinesh Nadarajah. 
% 
%This routine is used by the routine synth2d for the reconstruction 
%of a wavelet decomposed image. 
% 
%Author: Ajit S. Bopardikar 
%Copyright (c) 1998 by Addison Wesley Longman, Inc. 
% 
 
  [m,n] = size(sub); %determine the size of the subband image 
  l = length(lpf); %length of the filter 
   
  ll =  sub(1:m/2,:)'; %Isolate the lowpass columns 
  hh =  sub(m/2+1:m,:)'; %Isolate the highpass columns 
 
  ll = [ll(:,m/2-l/2+1:m/2) ll]; %circular extension 
  hh = [hh(:,m/2-l/2+1:m/2) hh]; %circular extension 
   
  %here starts upsampling 
   
  [r,c] = size(ll);   
  upl = zeros(r,2*c); 
  uph = zeros(r,2*c); 
 
  upl(:,1:2:2*c) = ll; 
  uph(:,1:2:2*c) = hh; 
 
  %here ends upsampling 
   
  %upl = upsamp(ll,2); %upsample by 2 
  %uph = upsamp(hh,2); %upsample by 2 
 
  sync = conv2(upl,lpf)+conv2(uph,hpf); %synthesis of columns 
  sync = sync(:,l+1:l+m)'; %this finishes the column synthesis 
   
  ll =  sync(:,1:n/2); %Isolate the lowpass row 
  hh =  sync(:,n/2+1:n); %Isolate the highpass rows 
 
  ll = [ll(:,n/2-l/2+1:n/2) ll]; %circular extension 
  hh = [hh(:,n/2-l/2+1:n/2) hh]; %circular extension 
   
  %here begins upsampling 
 
  [r,c] = size(ll);   
  upl = zeros(r,2*c); 
  uph = zeros(r,2*c); 
 
  upl(:,1:2:2*c) = ll; 
  uph(:,1:2:2*c) = hh; 
 
  %here ends upsampling 
     
  %upl = upsamp(ll,2); %upsample by 2 
  %uph = upsamp(hh,2); %upsample by 2 
 
  sy = conv2(upl,lpf)+conv2(uph,hpf); %synthesis of rows 
  sy = sy(:,l+1:l+n); %this finishes the row synthesis