Code for handling upsampling in surround_analysis()