Ch. 5 · AVC / H.264

한국어日本語
6 min

H.264 Prediction Tools: Intra Modes, Multiple Reference Frames, Weighted Prediction

Intra modes, quarter-pixel motion, up to 16 reference frames and weighted prediction: the concrete numbers behind Chapter 3's prediction theory.

Let's see what the intra/inter prediction from Chapter 3 actually looks like in H.264. These numbers become the 'baseline' when we compare against HEVC and AV1 later.

ItemH.264 implementation
Intra prediction modes4×4/8×8: 9 directions; 16×16: 4 directions (vertical, horizontal, DC, plane)
Inter prediction precision1/4 pixel (luma), 6-tap interpolation filter
Reference framesUp to 16 (multi-frame reference)
B-frame referencesBidirectional; temporal direct mode lets it skip sending the motion vector
TransformInteger 4×4 DCT approximation; High Profile can also choose 8×8
Entropy codingCAVLC (Huffman family) or CABAC (arithmetic coding, see Chapter 2)
A decisive invention H.264 introduced — multiple reference frames

The previous standard (MPEG-2) fixed references at exactly one frame (P) or two (B: past + future). H.264 lets a block pick any of up to 16 past frames as its reference. For example, with flickering lights or a repeating background (say, poles passing by a window), a frame from several frames back can be more similar than the immediately preceding one, and the encoder can find and use it directly.

t-3 t-2 t-1 t (current) References t-3 directly (may be more similar)
Multiple reference frames — it doesn't have to be the 'immediately previous' one

Weighted prediction

In fade-in/fade-out scenes, it is more accurate to fetch the reference with its brightness scaled by a fixed ratio than to copy it as-is. H.264 supports weight and offset parameters for exactly this, so the codec itself accommodates a common scene-transition technique in film and broadcast content.

In practice

Multiple reference frames help quality, but they multiply the encoder's motion estimation cost by the number of frames. Production encoders (x264) often limit the default to around 2–4 reference frames — using all 16 makes encoding time grow sharply relative to the quality gain. The gap between 'the maximum the standard allows' and 'the value actually used in practice' is a pattern that repeats throughout codec work.

Multi-frame referenceMulti-frame reference

A feature introduced in H.264 that picks the best match among several past frames.

Weighted predictionWeighted prediction

A technique that applies a brightness weight to the reference frame, for fades and similar scenes.

CAVLCCAVLC

Context-Adaptive Variable-Length Coding. H.264's Huffman-family entropy coding.

Check yourself

In which situation is H.264's multiple-reference-frame feature typically useful?