Motion vector (MV) data coding is important to the performance of video coding, especially for codecs with a high level of MV accuracy (1/4 or 1/8 pel). For this reason, MV coding and decoding is quite complicated, since significant gains in efficiency can be made by choosing a good prediction and entropy coding structure. The basic format of the MV coding module is similar to the coding of coefficient data: it consists of prediction, followed by binarisation, context modelling and adaptive arithmetic coding:

Figure: motion vector entropy coding architecture
Overall, a single pass is made over the macroblocks to code the MV data: the MB data and the block data pertaining to the MB. The MB data is coded first, splitting level followed by common mode (if necessary i.e. if the splitting level is not 0). The block data is coded for the prediction units, considered in raster order, with the mode first followed by the reference 1 motion vector and/or the reference 2 motion vector, as appropriate.