%wP2d_level3P
%design of 2D wavelet packets down to third level using binary subdivision
fSP2=[];
SP2=[];
fSP=[];
SP=[];
lole1=input('loglength of signal;0--former; ?')
if lole1>0
    lole=lole1;
    N=2^lole;
end
shi=1;%input('shift to the center--1; ?')
SdSt1=input('number of subdivision steps;0--former; ?')
if SdSt1>0
    SdSt=SdSt1;
    M=N*2^(SdSt-1);
end
Par1=input('spline order;0--former; ?')
if Par1>0
    P=Par1;
end


%fSP=cell(3);


for kk=1:3
 for mm=0:2^kk-1  
[spli, fspli]=wp_genP([kk,mm],P,N,SdSt);
SP{kk,mm+1}=spli;
fSP{kk,mm+1}=fspli;end
end

for kk=1:3
    a=[];%cell(3);
    for mm=1:2^kk 
   for nn=1:2^kk  
      
los=fSP{kk,mm};
his=fSP{kk,nn};
ps=los'*his;
      
lo=SP{kk,mm};
hi=SP{kk,nn};
p=lo'*hi;
 as{mm,nn}=ps;
 a{mm,nn}=p;
   end
    end
fSP2{kk}=as;
SP2{kk}=a;
end

