optimized nanmean filter