1D and 2D downsample code added.