Wednesday, September 22, 2010

H.264 – Intra Prediction

H.264 Video Codec – Intra Prediction
The Intra-coded macroblock, coded by itself without temporal prediction, to exploit spatial correlation among pixels. Intra-coded macroblock occurs in Intra-coded slice or the macroblock having unacceptable temporal correction of motion compensated prediction. Essentially Intra-coded macroblock introduces the high amount of coded bits. This is a bottleneck for reducing the bitrate. This is reduced using intra prediction methods (or modes).
For encoding a block or macroblock in Intra-coded mode, a prediction block is formed based on previously reconstructed (but, unfiltered for deblocking) blocks. The residual signal between the current block and the prediction is finally encoded. For the luma samples, there are three basic types of intra prediction are defined: for 4 x 4 subblock, 8 x 8 block (FRExt only), or for a 16 x 16 macroblock (Full macroblock prediction). There are total 9 prediction modes for each 4 x 4 and 8 x 8 luma blocks; and 4 modes for a 16 x 16 luma block; and 4 modes for each chroma blocks.

Figure 1: Labelling of Prediction Samples
Figure 1 shows a 4 x 4 luma block that is to be predicted. For the predicted samples [a, b, …, p] for the current block, the above and left previously reconstructed samples [A, B, …, M] are used according to direction modes. The arrows in Figure 2 indicate the direction of prediction in each mode.

Figure 2: Possible Prediction Direction for INTRA_4X4 Mode

  1. Intra_4X4 Mode

For mode 0 (vertical) and mode 1 (horizontal), the predicted samples are formed by extrapolation from upper samples [A, B, C, D] and from left samples [I, J, K, L], respectively. For mode 2 (DC), all of the predicted samples are formed by mean of upper and left samples [A, B, C, D, I, J, K, L]. For mode 3 (diagonal down left), mode 4 (diagonal down right), mode 5 (vertical right), mode 6 (horizontal down), mode 7 (vertical left), and mode 8 (horizontal up), the predicted samples are formed from a weighted average of the prediction samples A-M. For example, samples a and d are respectively predicted by round(I/4 + M/2 + A/4) and round(B/4 + C/2 + D/4) in mode 4, also by round(I/2 + J/2) and round(J/4 + K/2 + L/4) in mode 8. The encoder may select the prediction mode for each block that minimizes the residual between the block to be encoded and its prediction.

Figure 3: 4X4 Luma Prediction Modes
Figure 3 shows, Intra 4 x 4 prediction mode directions for luma component (vertical : 0, horizontal : 1, DC : 2, diagonal down left : 3, diagonal down right : 4, vertical right : 5, horizontal down : 6, vertical left : 7, horizontal up : 8)

  1. Intra_8X8 (FRExt only)

For prediction of each 8 x 8 luma block, one mode is selected from the 9 modes, similar to the (4x4) intrablock prediction.

  1. Intra_16X16 Mode

For prediction of all 16 x 16 luma components of a macroblock, four modes are available. For mode 0 (vertical), mode 1 (horizontal), mode 2 (DC), the predictions are similar with the cases of 4 x 4 luma block. For mode 4 (Plane), a linear plane function is fitted to the upper and left samples.

Figure 4: 16X16 Luma Prediction Modes

  1. Chroma Component

Each chroma component of a macroblock is predicted from chroma samples above and/or to the left that have previously been encoded and reconstructed. The chroma prediction is defined for three possible block sizes, 8 x 8 chroma in 4:2:0 format, 8 x 16 chroma in 4:2:2 format, and 16 x 16 chroma in 4:4:4 format. The 4 prediction modes for all of these cases are very similar to the 16 x 16 luma prediction modes, except that the order of mode numbers is different: mode 0 (DC), mode 1 (horizontal), mode 2 (vertical), and mode 3 (plane).

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.