Move MV stack construction out of encoding function such that the value of the nearest MV can be determined before encoding