%
% FIR adjoint quadrature filter, p-periodic input
%

function u=ipcqfilter(v, f, p)
  u=zeros(1,2*p);  % Allocate output array
  lf=length(f);    % FIR filter length.
  % Treat even k and odd k differently
  for k=0:2:2*p-1  % Even k
    for n=0:2:lf-1 % ...use even n 
      u(1+k) = u(1+k) + f(1+n)*v(1+mod((k-n)/2,p));
    end
  end
  for k=1:2:2*p-1  % Odd k
    for n=1:2:lf-1 % ...use odd n 
      u(1+k) = u(1+k) + f(1+n)*v(1+mod((k-n)/2,p));
    end
  end
  return
end
