function [thw,twh,tww]=ct(ld,hd,J)

%%%compute the threshold%%%%%%%%%%
hx=1;
hy=1;
for j=1:J
   lf=padf0(ld,j);
   hf=padf0(hd,j);
   
   t_wwx=conv(hx,hf);
   t_wwy=conv(hy,hf);
   tww(j)=norm(t_wwx)*norm(t_wwy);
   
   t_whx=conv(hx,hf);
   t_why=conv(hy,lf);
   twh(j)=norm(t_whx)*norm(t_why);
   
   t_hwx=conv(hx,lf);
   t_hwy=conv(hy,hf);
   thw(j)=norm(t_hwx)*norm(t_hwy);
   
   hx=conv(hx,lf);
   hy=conv(hy,lf);
end
