Ch. 3 · Anatomy of a Hybrid Codec

한국어日本語
7 min

Intra Prediction Explained: How Codecs Predict Within a Frame

Intra prediction estimates a block from its reconstructed neighbors, so only the residual gets coded. Compare DC, Planar and directional modes across codecs.

Intra prediction estimates the values of the current block within the same frame, using only pixels from already-reconstructed neighboring blocks. It is the actual implementation of the 'spatial redundancy removal' from Chapter 1.

An analogy

Picture a wallpaper pattern. If you know which way the pattern runs on the neighboring tile, you can guess fairly accurately how it continues on the current tile. You only need to write down the part you couldn't guess (the residual).

Already-reconstructed neighbors (reference) Current block (no pixels yet) Extends pixel values along a 45° direction
Directional intra prediction — pixels from the left and top neighbors are 'pulled in' at a specified angle to fill the block

The explosion in mode count

CodecNumber of intra modesNotes
H.2649 (for 4×4)Vertical, horizontal, DC, and diagonal families
HEVC3533 directional + DC + Planar
AV156 directional + non-directional modesFine angles (fixed 3° steps) + Smooth/Paeth, etc.
VVC65 directional + DC + Planar+ extension tools such as MRL and ISP

More modes allow more precise prediction, but the bits that signal 'which mode was used' also increase. That's why the MPM (Most Probable Mode) technique, which predicts the most likely mode to save signaling bits, evolved alongside.

Non-directional modes — DC and Planar

  • DC mode — Fills the whole block with the average of the neighboring pixels. Suited to very flat areas (sky, walls).
  • Planar mode — Interpolates a sloped surface from the top, left, top-right, and bottom-left pixels. Suited to gentle gradients.
  • Directional modes — 'Pull in' neighboring pixels along a specific angle. Suited to straight edges and texture patterns.
In practice — mode selection is RDO's job too

For each block, the encoder tries every possible intra mode (or a shortlist of candidates) and picks the one with the smallest J = D + λR. For speed, practical encoders use a two-stage approach: first narrow down candidates with a low-cost SATD (Sum of Absolute Transformed Differences), then run the real RDO (simulating transform + quantization + entropy coding) on only the top few.

Why intra frames are expensive

Intra prediction can't use any temporal information, so at the same quality it spends far more bits than an inter-predicted frame. That's why a GOP (Group of Pictures) places intra frames (keyframes) sparsely and inter frames densely. Still, intra frames are required at regular intervals for seeking and stream switching — this is the core trade-off of GOP structure, which we'll cover in Chapter 10.

Intra predictionIntra prediction

Spatial prediction that estimates a block from neighboring pixels in the same frame only.

MPMMost Probable Mode

Predicts the current mode from neighboring blocks' modes to save signaling bits.

SATDSATD

Sum of absolute differences in the transformed domain. A metric for quickly narrowing down mode candidates.

ResidualResidual

The difference between the original and the prediction. The actual target of transform, quantization, and entropy coding.

Check yourself

Which mode is best suited to a completely flat region such as sky in intra prediction?