void decoder_mbinter(DECODER * dec, const MACROBLOCK * pMB, const uint32_t x_pos, const uint32_t y_pos, const uint32_t cbp, Bitstream * bs, const uint32_t rounding, const int ref, const int bvop) { uint32_t stride = dec->edged_width; uint32_t stride2 = stride / 2; uint32_t i; uint8_t *pY_Cur, *pU_Cur, *pV_Cur; int uv_dx, uv_dy; VECTOR mv[4]; /* local copy of mvs */ /*获取指向图像空间的指针*/ pY_Cur = dec->cur.y + (y_pos << 4) * stride + (x_pos << 4); pU_Cur = dec->cur.u + (y_pos << 3) * stride2 + (x_pos << 3); pV_Cur = dec->cur.v + (y_pos << 3) * stride2 + (x_pos << 3); for (i = 0; i < 4; i++) mv[i] = pMB->mvs[i]; /*获取运动向量*/ validate_vector(mv, x_pos, y_pos, dec); /*检查运动向量的合法性*/ /******************************运动补偿*****************************/ if ((pMB->mode != MODE_INTER4V)) { /* 编码模式是INTER、INTER_Q、NOT_CODED、FORWARD、BACKWARD */ uv_dx = mv[0].x; uv_dy = mv[0].y; uv_dx = (uv_dx >> 1) + roundtab_79[uv_dx & 0x3]; uv_dy = (uv_dy >> 1) + roundtab_79[uv_dy & 0x3]; /*亮度插值*/ interpolate16x16_switch(dec->cur.y,dec->refn[ref] .y,16*x_pos,16*y_pos,mv[0].x, mv[0].y, stride, rounding); } /*色度插值 */ interpolate8x8_switch(dec->cur.u, dec->refn[ref] .u, 8 * x_pos, 8 * y_pos,uv_dx, uv_dy, stride2, rounding); interpolate8x8_switch(dec->cur.v, dec->refn[ref]. v, 8 * x_pos, 8 * y_pos,uv_dx, uv_dy, stride2, rounding); /******************************运动补偿*****************************/ /*根据cbp*/ if (cbp) decoder_mb_decode(dec, cbp, bs, pY_Cur, pU_Cur, pV_Cur, pMB); } |