Grades 9–12 · Computing
How can a video reuse an earlier picture?
Successive video pictures often contain much of the same scene. Instead of independently describing every picture, a video encoder can reuse parts of a picture the decoder already knows. Motion-compensated prediction identifies reference samples that resemble a block in the current picture.
In the diagramReuse a prediction, then add the differenceReference row already known to the decoder102030405060PredictionCurrent41Residual01RebuiltOffset +1Exact residual; no quantization or bitrate estimate
The reference must be the reconstructed version also available to the decoder, not an unavailable original. In the tiny example, the known reference row is [10,20,30,40,50,60]. The current four-sample block is [20,30,41,50]. Starting one sample to the right of the reference row's beginning gives a prediction of [20,30,40,50]. This offset is the example's motion information.
Subtracting prediction from current samples gives the residual [0,0,1,0]. A decoder obtains the same prediction from the reference and offset, then adds the transmitted residual. The result is exactly [20,30,41,50]. The one-sample difference has not been guessed away.
A good prediction can produce a residual with many zeros or small values, which later coding stages may represent economically. But the motion information also costs bits. A smaller residual does not, by itself, prove that a complete file is smaller.
Real video codecs search over blocks, references and motion choices; many also transform and quantize residuals, trading exactness for lower bitrate. Our arithmetic leaves residuals unchanged so the reconstruction principle is visible. A motion vector is a useful correspondence between image regions, not a guarantee that a physical object really moved by that amount.
About this explanation
Starting knowledge: Read pixel sample values, indexed arrays, signed differences and vector offsets.
Sources
- Vcodex — H.264/AVC Inter Prediction