Added upsample cython function; fixes to downsample function to preserve image flux