On the generalized nearest neighbor filter