1 Vocabulary conventions of this article
Macro BLOCK: H264 encoded base unit, 16x16 pixel (or sample) composition
Block: A unit of 8x8 pixels (or samples)
Sub-block: a unit of 4x4 pixels (or sampling)
2 in-Frame brightness prediction mode
H264 specification, the macro block has 4 kinds of intra-frame brightness prediction mode, the pattern number is 0,1,2,3, the block and the child block respectively has 9 kinds of intra-frame brightness prediction mode, the pattern number from 0 to 9, namely 0,1,2,.......,8. Specifically not detailed, you can check the H264 standard. The following sub-block is an example of how its luminance prediction mode is encoded into the stream.
3 The syntactic elements of the block luminance Prediction mode encoding
Prev_intra4x4_pred_mode_flag: Whether to use the minimum value of the upper left sub-block luminance prediction mode number for this chunk, after calculating the best luminance prediction mode for the child block, the destructors number is equal to the minimum value of the Luminance Prediction mode number on the left sub-block of the child, PREV_ Intra4x4_pred_mode_flag is 1, otherwise 0.
Rem_intra4x4_pred_mode:prev_intra4x4_pred_mode_flag is 0 o'clock, indicating the best luminance prediction mode number for the child block or the best luminance prediction mode number for the child block minus 1.
4 the pseudo-code procedure of the syntactic element assignment for the luminance Prediction mode encoding of the sub-block
for(luma4x4blkidx=0; luma4x4blkidx< -; luma4x4blkidx++) {Minmodebetwennleftandupsubblock[luma4x4blkidx]= (if the left or upper sub-block is not available, such as a cross-chip boundary or a non-intra-frame encoding mode)?2: Min (Minmodeofleftsubblock,minmodeofupsubblock); Bestmode[luma4x4blkidx]=calculate the optimal luminance prediction mode for the sub-block ();if(Bestmode[luma4x4blkidx] = =Minmodebetwennleftandupsubblock[luma4x4blkidx]) {prev_intra4x4_pred_mode_flag[Luma4x4blkidx]=1; }Else{prev_intra4x4_pred_mode_flag[Luma4x4blkidx]=0; }if(!prev_intra4x4_pred_mode_flag[Luma4x4blkidx]) {if(Bestmode[luma4x4blkidx] <Minmodebetwennleftandupsubblock[luma4x4blkidx]) {rem_intra4x4_pred_mode[Luma4x4blkidx]=Bestmode[luma4x4blkidx]; }Else{rem_intra4x4_pred_mode[Luma4x4blkidx]= Bestmode[luma4x4blkidx]-1;//Callout 4} } }
5 Why to calculate Minmodebetwennleftandupsubblock
The Luminance prediction mode number within each 4x4 block frame must be encoded to the decoder for decoding. This information may require a large number of bit representations, but the neighbor
The In-frame mode is usually relevant. For example, A, B, and E are left, top, and current blocks, respectively, if the A and B prediction modes
Formula 1, the best predictive mode for E is probably also mode 1. Therefore, this association is commonly used to encode 4x4 intra-frame luminance Prediction model numbers.
6 Experience the profound H264
There are 9 kinds of brightness prediction mode in the frame, its number is 0,1,......,8, the upper bounds of the range (8) is 4 bits by 2, and the upper bounds of the value of Rem_intra4x4_pred_mode can be limited to 4 by labeling 7, thus 3 bits can be expressed. A little bit less, H264 is through this ingenious design to achieve the purpose of improving coding efficiency.
H264 encoding process for intra-frame predictive mode numbering