fixed upsample shift by selecting the line that has the data depending on which line is currently being written into