function [h, g, ht, gt, sh, sg, sht, sgt] = qmf2hgs(h,ht);

% qmf2hgs -- aternating flip filter
%  Usage
%    [h, g, ht, gt, sh, sg, sht, sgt] = qmf2hgs(h,dh)
%  Inputs
%    h      given scaling filter
%    ht     given dual filter
% Outputs
%    g      the corresponding hp (bi)orthogonal qmf filter
%    gt=g   the corresponding synthesis filter
%    ht=h   the corresponding synthesis filter
%    sh=sht   the shifts of h and ht
%    sg=sgt   the shifts of g and gt
%
%  Description
%    alternating flip: g(i) = h(p-i+1)*(-1)^(i+1)
%    all the other parameters are for consistency with
%    general biorthogonal filters
%  See Also
%    ortfilt

if nargin == 1, ht = h; end 
p = length(h); pt = length(ht);
sht = floor((pt-1)/2);
sh = floor((p-1)/2);
gt = (-1)^p*(-1).^(0:p-1).*fliplr(h); sgt = -p + sh +2;
g = (-1)^pt*(-1).^(0:pt-1).*fliplr(ht); sg = -pt + sht +2; 

