function [th,r]=th_r(wbase,flag)

%%%%%%%%%%%%%%%%%%%%%%%%
J=4;
if wbase==1 %bior1.1
   [ld,hd,lr,hr]=wfilters('bior1.1');
   [thw,twh,tww]=ct(ld,hd,J);
   if flag==1;
      th=tww;
      r=[0.5 0.5 0.5];
   else
      th=twh;
      r=[0.5 0.5 0.5];
   end
elseif wbase==2  %bior1.3
   [ld,hd,lr,hr]=wfilters('bior1.3');
   [thw,twh,tww]=ct(ld,hd,J);
   if flag==1;
      th=tww;
      r=[0.37 0.37 0.37];
   else
      th=twh;
      r=[0.49 0.49 0.49];
   end
elseif wbase==3  %bior2.2
   [ld,hd,lr,hr]=wfilters('bior2.2');
   [thw,twh,tww]=ct(ld,hd,J);
   if flag==1;
      th=tww;
      r=[0.28 0.25 0.23];
   else
      th=twh;
      r=[0.45 0.41 0.40];
   end
elseif wbase==4  %bior2.4
   [ld,hd,lr,hr]=wfilters('bior2.4');
   [thw,twh,tww]=ct(ld,hd,J);
   if flag==1;
      th=tww;
      r=[0.22 0.18 0.17];
   else
      th=twh;
      r=[0.37 0.32 0.30];
   end
elseif wbase==5  %bior3.3
   [ld,hd,lr,hr]=wfilters('bior3.3');
   [thw,twh,tww]=ct(ld,hd,J);
   if flag==1;
      th=tww;
      r=[0.16 0.12 0.11];
   else
      th=twh;
      r=[0.24 0.13 0.08];
   end
elseif wbase==6  %db2
   [ld,hd,lr,hr]=wfilters('db2');
   [thw,twh,tww]=ct(ld,hd,J);
   if flag==1;
      th=tww;
      r=[0.33 0.33 0.33];
   else
      th=twh;
      r=[0.48 0.48 0.48];
   end
elseif wbase==7  %db3
   [ld,hd,lr,hr]=wfilters('db3');
   [thw,twh,tww]=ct(ld,hd,J);
   if flag==1;
      th=tww;
      r=[0.23 0.23 0.23];
   else
      th=twh;
      r=[0.38 0.38 0.33];
   end
else %%%db4
   [ld,hd,lr,hr]=wfilters('db4');
   [thw,twh,tww]=ct(ld,hd,J);
   if flag==1;
      th=tww;
      r=[0.22 0.22 0.22];
   else
      th=twh;
      r=[0.28 0.28 0.25];
   end
end
