clear all
close all
%  [aaf, ssf] = Lift53;
% af = aaf{1};
% sf = ssf{1};
% %   [af, sf] = bior22filter;
% imagedata = zeros(32,32);
% %  imagedata(13,13) = 100;
% w = dwt2D(imagedata, 1, af);
%  w{1}{1}(6,6) = 100;
% rec = idwt2D(w, 1, sf);
% c = dwtcell2arr(w, 1);
% imshow([c, rec], [])
% calcpsnr(rec, imagedata)
% lsi53 = {'p', [-0.5 -0.5], [1], [0];'u', [0.25 0.25], [0], [0]; [1], [1/2], [], []};
lsia = {'p', [-0.75 -0.25], [0], [0];'u', [0.125 0.375], [0], [1]; [1], [1], [], []};
% imagedata  = rotplane(64,64, 135);
imagedata = double(imread('lena512.pgm'));
% imagedata = zeros(256,256);
J = 5;
dset = -3:3;
ldset=length(dset);
% [y, dinfo, pinfo] = DLifting2D_comb(imagedata, J, lsia);
[y] = DLifting2D_yao(imagedata, J, lsia, dset);
coeff = dwtcell2arr(y, J);
M = max(max(abs(coeff)))

fid = fopen('e:\\coeff','w');
fwrite(fid, coeff', 'int32');
fclose(fid);