1. 任务要求
- 输出第一帧第二行第三个宏块的mode;
- 输出第二帧第二行第三个宏块的mode和mv。
2. jm_vc10
2.1 宏块类型
mb_type 宏块类型的数值
// Available MB modes
typedef enum {
PSKIP = 0,
BSKIP_DIRECT = 0,
P16x16 = 1,
P16x8 = 2,
P8x16 = 3,
SMB8x8 = 4,
SMB8x4 = 5,
SMB4x8 = 6,
SMB4x4 = 7,
P8x8 = 8,
I4MB = 9,
I16MB = 10,
IBLOCK = 11,
SI4MB = 12,
I8MB = 13,
IPCM = 14,
MAXMODE = 15
} MBModeTypes;
2.2 帧内预测模式
1)4×4亮度预测模式
4×4亮度子块有9种可选预测模式,独立预测每一个4×4亮度子块,适用于带有大量细节的图像编码。
// 4x4 intra prediction modes
enum {
VERT_PRED = 0,
HOR_PRED = 1,
DC_PRED = 2,
DIAG_DOWN_LEFT_PRED = 3,
DIAG_DOWN_RIGHT_PRED = 4,
VERT_RIGHT_PRED = 5,
HOR_DOWN_PRED = 6,
VERT_LEFT_PRED = 7,
HOR_UP_PRED = 8
} I4x4PredModes;
2)16x16亮度预测模式
16×16亮度块有4种预测模式,预测整个16×16亮度块,适用于平坦区域图像编码。
// 16x16 intra prediction modes
enum {
VERT_PRED_16 = 0,
HOR_PRED_16 = 1,
DC_PRED_16 = 2,
PLANE_16 = 3
} I16x16PredModes;
3)8x8色度块预测模式
色度块也有4种预测模式,类似于16×16亮度块预测模式,只不过具体的序号不一样。
// 8x8 chroma intra prediction modes
enum {
DC_PRED_8 = 0,
HOR_PRED_8 = 1,
VERT_PRED_8 = 2,
PLANE_8 = 3
} I8x8PredModes;
3. 实验
3.1 添加代码
在 macroblock.c 的2866行添加:
// output info
if (p_Vid->frame_no==0 && currMB->mb_x == 2 && currMB->mb_y== 1) {
printf("\n----------> Pic: %i (I/P) MB_x: %i MB_y: %i\n\n", p_Vid->frame_no, currMB->mb_x, currMB->mb_y);
printf("MB type:%i\n", currMB->mb_type);
printf("MB mode:%i\n", currMB->c_ipred_mode);
printf("-----------------------------------");
}
if (p_Vid->frame_no == 1 && currMB->mb_x == 2 && currMB->mb_y == 1) {
printf("\n----------> Pic: %i (I/P) MB_x: %i MB_y: %i\n\n", p_Vid->frame_no, currMB->mb_x, currMB->mb_y);
printf("MB type:%i\n", currMB->mb_type);
printf("MB mode:%i\n", currMB->c_ipred_mode);
printf("MB MV_x:%i\n", currMB->mvd[0][0][0][0]);
printf("MB MV_y:%i\n", currMB->mvd[0][0][0][1]);
printf("-----------------------------------");
}