H.264 Prediction

From MultimediaWiki
Jump to navigation Jump to search

This page documents the various prediction methods used in H.264 and related formats such as Sorenson Video 3 and RealVideo 4.

4x4 Prediction Modes

Vertical

  • H.264: mode 0
  • SVQ3: mode 0
  • RV40: mode 0
  D | T0  T1  T2  T3
---------------------
 L0 | T0  T1  T2  T3
 L1 | T0  T1  T2  T3
 L2 | T0  T1  T2  T3
 L3 | T0  T1  T2  T3

Horizontal

  • H.264: mode 1
  • SVQ3: mode 1
  • RV40: mode 1
  D | T0  T1  T2  T3
---------------------
 L0 | L0  L0  L0  L0
 L1 | L1  L1  L1  L1
 L2 | L2  L2  L2  L2
 L3 | L3  L3  L3  L3

DC

  • H.264: mode 2
  • SVQ3: mode 2
  • RV40: mode 2
  D | T0  T1  T2  T3
---------------------
 L0 |  Z   Z   Z   Z
 L1 |  Z   Z   Z   Z
 L2 |  Z   Z   Z   Z
 L3 |  Z   Z   Z   Z


where Z is computed as:

Z = (T0 + T1 + T2 + T3 + L0 + L1 + L2 + L3 + 4) / 8

Diagonal Down/Left

  • H.264: mode 3
  • SVQ3: not used
  • RV40: mode 3
  D | T0  T1  T2  T3  T4  T5  T6  T7
-------------------------------------
 L0 |  a   b   c   d
 L1 |  b   c   d   e
 L2 |  c   d   e   f
 L3 |  d   e   f   g

where:

 a = (T0 + 2*T1 + T2 + 2) / 4
 b = (T1 + 2*T2 + T3 + 2) / 4
 c = (T2 + 2*T3 + T4 + 2) / 4
 d = (T3 + 2*T4 + T5 + 2) / 4
 e = (T4 + 2*T5 + T6 + 2) / 4
 f = (T5 + 2*T6 + T7 + 2) / 4
 g = (T6 * 3*T7      + 2) / 4

Diagonal Down/Left (SVQ3)

  • H.264: not used
  • SVQ3: mode 3
  • RV40: not used
  D | T0  T1  T2  T3
---------------------
 L0 |  a   b   c   c
 L1 |  b   c   c   c
 L2 |  c   c   c   c
 L3 |  c   c   c   c

where:

 a = (L1 + T1) / 2
 b = (L2 + T2) / 2
 c = (L3 + T3) / 2

Diagonal Down/Right

  • H.264: mode 4
  • SVQ3: mode 4
  • RV40: mode 4
 LT | T0  T1  T2  T3
---------------------
 L0 |  d   e   f   g
 L1 |  c   d   e   f
 L2 |  b   c   d   e
 L3 |  a   b   c   d

where:

 a = (L3 + 2*L2 + L1 + 2) / 4
 b = (L2 + 2*L1 + L0 + 2) / 4
 c = (L1 + 2*L0 + LT + 2) / 4
 d = (L0 + 2*LT + T0 + 2) / 4
 e = (LT + 2*T0 + T1 + 2) / 4
 f = (T0 + 2*T1 + T2 + 2) / 4
 g = (T1 + 2*T2 + T3 + 2) / 4

Vertical/Right

Horizontal/Down

Vertical/Left

Horizontal/Up

Left/DC

Top/DC

DC-128

16x16 Prediction Modes

DC

Vertical

Horizontal

Plane

Left Mean