function [psnr1,psnr2,snr1,snr2]=snrimg(img)
%img in the form of (2^n+1)x(2^n+1)
timg = imgsplit(img);
[m,n] = size(timg);
for j=1:m,
    for k=1:n,
        u1{j,k}=laplace2d(timg{j,k},1);
        v1 = timg{j,k}-u1{j,k};
        coef1{j,k} = dst(dst(v1(2:end-1,2:end-1))');
        order1{j,k} = flipud(sort(abs(coef1{j,k}(:))));
        u2{j,k}=biharmlst(timg{j,k});
        v2 = timg{j,k}-u2{j,k};
        coef2{j,k} = dst(dst(v2(2:end-1,2:end-1))');
        order2{j,k} = flipud(sort(abs(coef2{j,k}(:))));
    end
end

for t=1:31*31,
   for j=1:m,
       for k=1:n,
           temp1{j,k} = u1{j,k};
           temp1{j,k}(2:end-1,2:end-1) = temp1{j,k}(2:end-1,2:end-1)+idst(idst((abs(coef1{j,k})>=order1{j,k}(t)).*coef1{j,k})');
           temp2{j,k} = u2{j,k};
           temp2{j,k}(2:end-1,2:end-1) = temp2{j,k}(2:end-1,2:end-1)+idst(idst((abs(coef1{j,k})>=order1{j,k}(t)).*coef2{j,k})');
       end
   end
   temp1merge = imgmerge(temp1);
   temp2merge = imgmerge(temp2);
   
   [psnr1(t),snr1(t)]=snr(img,temp1merge);
   [psnr2(t),snr2(t)]=snr(img,temp2merge);
end


