7 macroblock mode problems in JM8.5
OUTLINE:
1. Related options for variable size macroblock mode in CFG files
2, 7 macroblock mode corresponding to numerical constants
3, 7 macroblock mode is divided into macroblocks and sub-macroblock blocks
4. How to estimate the motion estimation of macroblocks and sub-macroblocks, use a common function to handle
5, legacy problem
1. Related options for variable size macroblock mode in CFG files
######################################################################################################################################################################################################################################################################################################## ##############################20coder control
######################################################################################################################################################################################################################################################################################################## ###########################################
...
INTERSEARCH16X16 = 1 # Inter Block search 16x16 (0 = disable, 1 = enable)
INTERSEARCH16X8 = 1 # Inter Block search 16x8 (0 = disable, 1 = enable)
INTERSEARCH8X16 = 1 # Inter Block search 8x16 (0 = disable, 1 = enable)
INTERSEARCH8X8 = 1 # Inter Block Search 8x8 (0 = disable, 1 = enable)
INTERSEARCH8X4 = 1 # Inter BLOCK Search 8x4 (0 = disable, 1 = enable)
INTERSEARCH4X8 = 1 # Inter BLOCK Search 4x8 (0 = disable, 1 = enable)
INTERSEARCH4X4 = 1 # Inter Block Search 4x4 (0 = disable, 1 = enable)
Explanation:
Various macroblocks can be selected outside the program.
...
2, 7 macroblock mode corresponding to numerical constants
The numerical constants corresponding to various macroblock patterns are as follows:
16 × 16-1 16 × 8-2 8 × 16-3 8 × 8-4 8 × 4-5 4 × 8-6 4 × 4-7
The value of the value of the ENCODE_ONE_MACROBLOCK () in the ENCOPT.C of the above numerical constant is used, and the BlockType variable in the partitionMotionSearch () of MV_Search.c is also used.
3, 7 macroblock mode is divided into macroblocks and sub-macroblock blocks
16x16, 16x8, 8x16 (, 8 x 8) is called macroblock level, while 8 × 8, 8 × 4, 4 × 8, 4 × 4 is referred to as a sub-mutant block level.
The function used is: eNCode_one_macroblock (), RDOPT.C
The function of this function is to encode a macroblock (including inter-frame, intra, intra prediction mode).
The important blocks are as follows:
...
// macroblock level motion estimation
/ / ===== Motion Estimation for 16x16, 16x8, 8x16 blocks =====
For (min_cost = 1 << 20, best_mode = 1, mode = 1; MODE <4; MODE ) {
IF (Valid [Mode]) / / The settings corresponding to the exterior of the program (ie, in the CFG file)
{
/ / For 16 × 16, MB is only divided into one block; for 16 × 8 and 8 × 16, MB is divided into two blocks
For (COST = 0, Block = 0; Block <(Mode == 1? 1: 2); Block )
{
// Block match !!! Lambda_motion Used to seek synchronization rate of motion vector consumption
PartitionMotionSearch (Mode, Block, Lambda_motion);
...
// Yahong block level motion estimation
IF (Valid [p8x8])
{
...
/ / ===== loop over Possible Coding Modes for 8x8 sub-part =====
For (min_cost8x8 = (1 << 20), min_rdcost = 1e30, index = (bframe? 0: 1); Index <5; INDEX )
{
IF (Valid [Mode = B8_MODE_TABLE [INDEX]] // b8_mode_table [6] = {0, 4, 5, 6, 7};
{
Curr_cbp_blk = 0;
IF (Mode == 0) // --- Direct Mode ---
{
...
} // if (Mode == 0)
Else
{
// --- Motion Estimation for All Reference Frames ---
PartitionMotionSearch (Mode, Block, Lambda_motion);
...
Note: From the above block, you can see that the seven macroblock mode in JM8.5 uses all traversal, so that the computational complexity is high.
4. How to estimate the motion estimation of macroblocks and sub-macroblocks, use a common function to handle
From 3 programs, it can be seen that for macroblocks and Yacang-level motion estimates, a common function is used: PartitionMotionSearch (), MV_Search.c
The important blocks are as follows:
......
// The start offset of the sub-blocks in various macroblock mode is relatively 4 * 4 blocks, which is conducive to the storage of motion vectors.
// [5] indicates the type of macroblock, [4] indicates a sub-block serial number under various types, and the case is 4 in P8x8 mode.
Static int BX0 [5] [4] = {{0,0,0,0}, {0, 0, 0, 0}, {0, 2, 0, 0} , {0, 2, 0, 2}};
Static int BY0 [5] [4] = {{0,0,0,0}, {0,0,0,0}, {0,0,0,0} , {0, 0, 2, 2}};
......
INT PartType = (BlockType <4? BlockType: 4); // Yahong block Parttype is set to 4
// step_? It is used to seek 4 * 4 levels of steps,
/ / Due to the difference between PartType and BlockType, there is a subtle difference between the two sets of steps, and the pave is made for the following cycle.
INT Step_h0 = (Input-> BLC_SIZE [PartType] [0] >> 2);
INT Step_v0 = (Input-> BLC_SIZE [PartType] [1] >> 2); int step_h = (Input-> BLC_SIZE [BlockType] [0] >> 2);
INT Step_v = (Input-> BLC_SIZE [BlockType] [1] >> 2);
......
/ / ===== loop over Sub Macro Block Partitions
// This is an adaptive for the cycle of the Yacang block.
// If less than 8 * 8 pieces, automatically take cycle
For (v = by0 [parttype] [block8x8]; v { PIC_BLOCK_Y = IMG-> block_y v;