Encoder

A video encoder can reuse known picture content and code the differences. Lossy coding rounds away detail to save bits. The decoder follows the resulting bitstream to rebuild the pictures.

For one sample, a guess of 80 and a correction of +5 rebuild 85. If lossy coding changes that correction to +4, the result is 84. The encoder keeps that same 84 for later predictions, so it works from what the decoder knows.

Predict, code, reconstruct

A simplified predictive transform encoder, as used in video codecs such as H.264.

A predictive encoder codes the difference and reconstructs its own referenceAcross the top, subtract the prediction from the input block, transform this residual, quantise its coefficients and entropy-code the indices into a bitstream. Prediction instructions and quantiser settings are also coded. A branch from the quantised indices runs down to rescaling and inverse transform. Add the same prediction to this decoded residual and store the reconstructed samples. Already reconstructed neighbours or reference pictures supply later predictions. The lower path is local reconstruction inside the encoder, not a second output. Codec-specific filtering and control decisions are omitted.Input samples−Difference02 · PatternsTransform03 · Lose precisionQuantise04 · Pack symbolsEntropy codeIndices + instructionsBitstream outQuantised indices01 · PredictionA starting guessSame predictionLOCAL RECONSTRUCTION · INSIDE THE ENCODERRebuild the differenceRescale + inverse transform+Store decodedsamples for reuse
Scroll horizontally to inspect the full diagram. Keyboard: focus the diagram and use the arrow keys.
  1. 01PredictionGuess a block from already decoded neighbours or other pictures.
  2. 02Residual and transformSubtract the guess. Describe the remaining difference as amounts of simple patterns.
  3. 03QuantisationRound the pattern weights. Small variations can disappear from the reconstructed picture.
  4. 04Entropy codingWrite the rounded values and prediction instructions into the bitstream without further loss.