function fieldOut=interp_llc2160to1080(fieldIn,nfx0,nfy0);
%-------
%function fieldOut=interp_llc2160to1080(fieldIn);
% Input:
%  fieldIn: either compact size or individual face
%
% Output:
%  fieldOut: either compact size or individual face
%----

%check size
sz0=size(fieldIn);
if(length(sz0)==2);sz0=[sz0 1];end;

nz=sz0(3);

nx0=nfx0(1);
nx1p=nfy0(1);
nx2p=nfx0(4);

sz=sz0./2;
nfx=nfx0./2;
nfy=nfy0./2;
nx1=nx1p/2;
nx2=nx2p/2;

if(sz0(2)==nx1p+nx0+nx2p+nx1p);	%this is compact format
  b0f{1}=fieldIn(:,1:nfy0(1));
  b0f{3}=fieldIn(:,nfy0(1)+1:nfy0(1)+nfy0(3));
  b0f{4}=reshape(fieldIn(:,nfy0(1)+nfy0(3)+1:nfy0(1)+nfy0(3)+nfx0(4)),nfx0(4),nfy0(4));
  b0f{5}=reshape(fieldIn(:,nfy0(1)+nfy0(3)+nfx0(4)+1:nfy0(1)+nfy0(3)+nfx0(4)+nfx0(5)),nfx0(5),nfy0(5));

  for iface=[1,3:5];
    clear temp0 temp temp1 sz0p szp
    eval(['temp0=b0f{' num2str(iface) '};']);
    sz0p=size(temp0);
    szp=sz0p/2;
    temp=zeros(szp(1),sz0p(2),nz);
    temp=(temp0(1:2:sz0p(1),:,:)+temp0(2:2:sz0p(1),:,:))./2;
    temp1=zeros(szp(1),szp(2),nz);
    temp1=(temp(:,1:2:sz0p(2),:)+temp(:,2:2:sz0p(2),:))./2;
    eval(['bf{' num2str(iface) '}=temp1;']);
  end;
  %now put back to compact:
  fieldOut=cat(2,bf{1},bf{3},reshape(bf{4},nfy(4),nfx(4)),reshape(bf{5},nfy(5),nfx(5)));

else;	%just 1 face
  clear temp temp1
  temp=zeros(sz(1),sz0(2),nz);
  temp=(temp0(1:2:sz0(1),:,:)+temp0(2:2:sz0(1),:,:))./2;
  temp1=zeros(sz(1),sz(2),nz);
  temp1=(temp(:,1:2:sz0(2),:)+temp(:,2:2:sz0(2),:))./2;
  fieldOut=temp1;
end;

return
