Read full document

Cavlc example

Page 1 of 38
CAVLC (Context based Adaptive Variable Length Coding)
H.264, the latest video compression standard, uses CAVLC for encoding the coefficients after quantization. CAVLC encodes the coefficients (the coefficients may be positive or negative) into binary bit stream.







In H.264 Encoder, the predicted submacroblock (of size 4x4) is subtracted from the original submacroblock (of size 4x4), resulting the residue submacroblock (of size 4x4). This residue is transformed by modified Discrete Cosine Transform. The transformed residue is also of size 4x4. Then this transformed residue is quantized (dividing by some defined number, QStep). This quantized-transformed residue is encoded as follows. Encoding process:

There will be 16 coefficients in a 4x4 submacroblock. The total number of coefficients is tot_coef = 16.




The 16 coefficients are taken in a zig-zag manner as shown in the above figure, and written in an array.
(0,0) – (0,1) – (1,0) – (2,0) – (1,1) – (0,2) – (0,3) – (1,2) – (2,1) – (3,0) – (3,1) – (2,2) – (1,3) – (2,3) – (3,2) – (3,3)
Note: For Chroma coding, two different blocks will come for coding. One is Chroma DC of 2x2 size (in case of 4:2:0), or 4x2 size (in case 4:2:2) or 4x4 size (in case of 4:4:4). Here, tot_coef = 4.

Another one is Chroma AC of 4x4 size. But in this Chroma AC, the DC Coefficient is 0 at (0,0). Here, tot_coef = 15.
The important parameters to be encoded.
1. Number of nonzero coefficients (numCoef) and Trailing Ones (T1) 2. The pattern of Trailing Ones (T1)
3. The nonzero coefficients (Levels)
4. Number of zeros embedded in the nonzero coefficients (Total_zeros) 5. The location of those embedded zeros (run_before)
1. Number of nonzero coefficients (numCoef) and Trailing Ones (T1)

CAVLC Encoder


Calculate number...

Rate this document

What do you think about the quality of this document?

Share this document

Let your classmates know about this document and more at