function Y = padding(Y, basic_info, b_tolevel)

padx = basic_info{1,b_tolevel}(1);
pady = basic_info{1,b_tolevel}(2);
extx = basic_info{1,b_tolevel}(3);
exty = basic_info{1,b_tolevel}(4);
wavelen = basic_info{1,b_tolevel}(5);
dimx=size(Y,1);
dimy=size(Y,2);
final_dimx=dimx+padx+extx;
final_dimy=dimy+pady+exty;
%padding first, so I only use "repeating final"
Y(:,dimy+1:dimy+pady)=repmat(Y(:,dimy),[1 pady]);
Y(dimx+1:dimx+padx,:)=repmat(Y(dimx,:),[padx 1]);

%NO need to extend since we wrap around.
%extend next for wrapping around
% Y(:,dimy+pady+1:dimy+pady+exty)=Y(:,1:exty);
% Y(dimx+padx+1:dimx+padx+extx,:)=Y(1:extx,:);