============ Step 1: Determine adjacent blocks ==============
MV prediction is divided by macro blocks (or sub-macro blocks, if there is sub-segmentation), and the same macro block is divided (or sub-macro blocks) all 4*4 music videos in the same region have the same predicted values. Determine the adjacent Block Based on the pixel pixel1 in the upper left corner and pixel pixel2 in the upper right corner of each macro block (or sub-Macro Block:
The four X Four adjacent pixels on the left side of pixel1 are adjacent blocks A when the front macro block is divided (or the sub macro block is split ).
4*4 adjacent pixels at the top of pixel1 are adjacent blocks B when the front macro block is divided (or the sub macro block is split ).
The 4*4 pixels in the upper right corner of pixel2 are adjacent blocks when the front macro block is divided (or the sub macro block is split ).
The 4*4 pixels on the top left corner of pixel1 are adjacent blocks D when the front macro block is divided (or the sub macro block is split ). Take the most complex 8*8 Macro Block Segmentation type as an example (only sub-Macro Block Segmentation exists at this time). The analysis is as follows:
Assume that the black box represents a macro block, each green box represents a 4x4 block, and each red box represents an 8x8 block. When the Macro Block split mode is 8*8 (medium red line), the sub-Macro Block split mode is: the first 8*8 is 8*8, the second 8*8 block is 4*4 (medium blue line), and the third 8*8 block is 4*8 (medium blue line ), the fourth 8*8 block is 8*4 (Blue Line ). The method for determining adjacent blocks is as follows:
The first prediction object is the first 8*8 blocks. With pixels pixel1 in the upper left corner and pixel2 in the upper right corner as the reference points, A is 4*4 on the seventh day, B is 4*4 on the 2nd, C is 4*4 on the 4th, and D is 4*4 on the 1st. 9, 14, 15 and 8 share the same MV forecast value
The second prediction object is the first 4*4 block of the second 8*8 block, that is, block 10. the reference point is pixel 1 in the upper left corner and pixel pixel2 in the upper right corner. Then: A is 4*4 on the 9th, B is 4*4 on the 4th, C is 4*4 on the 5th, and D is 4 on the 3rd.
The third prediction object is the second 4*4 block of the second 8*8 block, that is, Block 11. If the pixel pixel1 in the upper left corner and pixel pixel2 in the upper right corner are used as the reference points, then: A is 4x4 on the 10 th, B is 4x4 on the 5 th, C is 4x4 on the 6 th, and D is 4x4 on the 4 th.
The fourth prediction object is the third 4*4 block of the second 8*8 block, that is, Block 16. With pixel pixel1 in the upper left corner and pixel pixel2 in the upper right corner as the reference point, then: A is 4x4 on the 15th, B is 4x4 on the 10th, C is 4x4 on the 11th, and D is 4x4 on the 9th.
The fifth prediction object is the fourth 4*4 block of the second 8*8 block, that is, Block 17. With pixel pixel1 in the upper left corner and pixel pixel2 in the upper right corner as the reference point, then: A is 4*4 on the 16th, B is 4*4 on the 11th, C is 4*4 on the 12th, and D is 4 on the 10th.
The sixth prediction object is the first 4*8 block of the third 8*8 block, with the pixel pixel1 in the upper left corner and pixel pixel2 in the upper right corner as the reference point, then: A is 4*4 on the 19th, B is 4*4 on the 14th, C is 4*4 on the 15th, and D is 4*4 on the 13th. 26 and 20 share the same MV forecast value
The seventh prediction object is the second 4*8 block of the third 8*8 block, with the pixel pixel1 in the upper left corner and pixel pixel2 in the upper right corner as the reference point, then: A is 4*4 on the 20th day, B is 4*4 on the 15th day, C is 4*4 on the 16th day, and D is 4*4 on the 14th day. 27 share the same MV forecast value as 21
The eighth prediction object is the first 8*4 blocks of the fourth 8*8 blocks. The reference point is pixel 1 in the upper left corner and pixel pixel2 in the upper right corner: A is 4*4 on the 21st, B is 4*4 on the 16th, C is 4*4 on the 18th, and D is 4*4 on the 15th. 23 and 22 share the same MV forecast value
The ninth prediction object is the second 8*4 block of the fourth 8*8 block, and takes pixel pixel1 in the upper left corner and pixel pixel2 in the upper right corner as the reference point. Then: A is 4*4 on the 27 th, B is 4*4 on the 22nd, C is 4*4 on the 24 th, and D is 4*4 on the 21st. 29 has the same MV forecast value as 28
=========== Step 2: determine the availability of A, B, and C ==============
Determine whether A, B, and C macro blocks exist or whether they are allowed to participate in prediction. If C is not available, use D instead of C.
=========== Step 3: prediction MV ================
1. If only one of the three reference blocks A, B, and C is the same as the current prediction object, select the MV OF THE REFERENCE block as the final MV prediction value.
2. If the front macro block is 8*16 or 16*8:
(1) If the front macro block is 8*16 Split Type:
For 8*16 split on the left, if A is split into the same reference frame as the current one, the MV of A is used as the final MV predicted value of the split.
For the 8*16 split on the right, if C is split into the same reference frame as the current one, the MV of C is used as the final MV predicted value of the split.
(2) If the front macro block is 16*8 split type:
For the Top 16x8 split, if B is split into the same reference frame as the current one, the music video of B is used as the final music video predicted value of the split.
For the bottom 16*8 split, if A is split into the same reference frame as the current one, the MV of A is used as the final MV predicted value of the split.
3. In other cases, if one of B and C is available or both are available, medium-Value Prediction is used (the value of the MV in A, B, and C is the predicted value of the final mV)
4. In other cases where B and C are unavailable, the MV of A is used as the final MV forecast value.
[Note]: 1. the method for determining adjacent blocks when macro blocks are separated is the same as that described in Step 1: 16*16 is equivalent to 8*8*16, 16*8 is equivalent to 4*8, 8*4, respectively.
2. For an adjacent component that is unavailable, its MV may still be used in MV prediction, but its value is 0. For example, if a is unavailable and B and C is available, the result may still be the value in A, B, and C, but the MV of A is 0;
3. for adjacent unavailable blocks, the reference frame index is set to-1, which must be different from the current prediction object;
4. verifiable: when both the first and second conditions of step 3 are met, calculating the MV forecast value based on the first condition is equivalent to calculating the MV forecast value based on the second condition;
5. The prediction process is Standard 8.4.1.3 content, the corresponding code in jm86 is setmotionvectorpredictorFunction;
6. In the case of mbaff, adjacent blocks refer to the corresponding co-locate blocks.