adding 2D downsampling function
adding the upsample function