A rank-ordered marginal filter for deinterlacing