--- trunk/xvidcore/src/motion/motion_est.c 2002/09/07 13:41:13 444 +++ trunk/xvidcore/src/motion/motion_est.c 2002/09/21 11:59:22 504 @@ -141,8 +141,8 @@ static const VECTOR zeroMV = { 0, 0 }; VECTOR predMV; - int32_t x, y; - int32_t iIntra = 0; + uint32_t x, y; + uint32_t iIntra = 0; VECTOR pmv; if (sadInit) @@ -153,9 +153,6 @@ MACROBLOCK *const pMB = &pMBs[x + y * iWcount]; - if (pMB->mode == MODE_NOT_CODED) - continue; - predMV = get_pmv2(pMBs, pParam->mb_width, 0, x, y, 0); pMB->sad16 = @@ -359,8 +356,8 @@ { iMinSAD=iSAD; currMV->x=(X); currMV->y=(Y); iDirection=(D); iFound=0; } } \ } +#if 0 /* too slow and not fully functional at the moment */ -/* int32_t ZeroSearch16( const uint8_t * const pRef, const uint8_t * const pRefH, @@ -399,7 +396,7 @@ return iSAD; } -*/ +#endif /* 0 */ int32_t Diamond16_MainSearch(const uint8_t * const pRef, @@ -409,12 +406,12 @@ const uint8_t * const cur, const int x, const int y, - const int start_x, - const int start_y, - int iMinSAD, - VECTOR * const currMV, - const int center_x, - const int center_y, + const int start_x, + const int start_y, + int iMinSAD, + VECTOR * const currMV, + const int center_x, + const int center_y, const int32_t min_dx, const int32_t max_dx, const int32_t min_dy, @@ -476,12 +473,12 @@ const uint8_t * const cur, const int x, const int y, - const int start_x, - const int start_y, - int iMinSAD, - VECTOR * const currMV, - const int center_x, - const int center_y, + const int start_x, + const int start_y, + int iMinSAD, + VECTOR * const currMV, + const int center_x, + const int center_y, const int32_t min_dx, const int32_t max_dx, const int32_t min_dy, @@ -655,12 +652,12 @@ const uint8_t * const cur, const int x, const int y, - const int start_x, - const int start_y, - int iMinSAD, - VECTOR * const currMV, - const int center_x, - const int center_y, + const int start_x, + const int start_y, + int iMinSAD, + VECTOR * const currMV, + const int center_x, + const int center_y, const int32_t min_dx, const int32_t max_dx, const int32_t min_dy, @@ -693,12 +690,12 @@ const uint8_t * const cur, const int x, const int y, - int start_x, - int start_y, - int iMinSAD, - VECTOR * const currMV, - const int center_x, - const int center_y, + const int start_xi, + const int start_yi, + int iMinSAD, + VECTOR * const currMV, + const int center_x, + const int center_y, const int32_t min_dx, const int32_t max_dx, const int32_t min_dy, @@ -711,6 +708,7 @@ { int32_t iSAD; + int start_x = start_xi, start_y = start_yi; /* directions: 1 - left (x-1); 2 - right (x+1), 4 - up (y-1); 8 - down (y+1) */ @@ -841,9 +839,13 @@ } while (1); //forever } + return iMinSAD; } +/* Disabled bframe specific code */ +#if 0 + #define CHECK_MV16_F_INTERPOL(X,Y) { \ if ( ((X) <= f_max_dx) && ((X) >= f_min_dx) \ && ((Y) <= f_max_dy) && ((Y) >= f_min_dy) ) \ @@ -900,55 +902,55 @@ { iMinSAD=iSAD; b_currMV->x=(X); b_currMV->y=(Y); iFound=0;} } \ } -int32_t -Diamond16_InterpolMainSearch( - const uint8_t * const f_pRef, - const uint8_t * const f_pRefH, - const uint8_t * const f_pRefV, - const uint8_t * const f_pRefHV, - const uint8_t * const cur, - - const uint8_t * const b_pRef, - const uint8_t * const b_pRefH, - const uint8_t * const b_pRefV, - const uint8_t * const b_pRefHV, - - const int x, - const int y, - - const int f_start_x, - const int f_start_y, - const int b_start_x, - const int b_start_y, - - int iMinSAD, - VECTOR * const f_currMV, - VECTOR * const b_currMV, - - const int f_center_x, - const int f_center_y, - const int b_center_x, - const int b_center_y, - - const int32_t f_min_dx, - const int32_t f_max_dx, - const int32_t f_min_dy, - const int32_t f_max_dy, - - const int32_t b_min_dx, - const int32_t b_max_dx, - const int32_t b_min_dy, - const int32_t b_max_dy, +int32_t +Diamond16_InterpolMainSearch(const uint8_t * const f_pRef, + const uint8_t * const f_pRefH, + const uint8_t * const f_pRefV, + const uint8_t * const f_pRefHV, + + const uint8_t * const cur, + + const uint8_t * const b_pRef, + const uint8_t * const b_pRefH, + const uint8_t * const b_pRefV, + const uint8_t * const b_pRefHV, + + const int x, + const int y, + + const int f_start_x, + const int f_start_y, + const int b_start_x, + const int b_start_y, + + int iMinSAD, + VECTOR * const f_currMV, + VECTOR * const b_currMV, + + const int f_center_x, + const int f_center_y, + const int b_center_x, + const int b_center_y, + + const int32_t f_min_dx, + const int32_t f_max_dx, + const int32_t f_min_dy, + const int32_t f_max_dy, + + const int32_t b_min_dx, + const int32_t b_max_dx, + const int32_t b_min_dy, + const int32_t b_max_dy, - const int32_t iEdgedWidth, - const int32_t iDiamondSize, + const int32_t iEdgedWidth, + const int32_t iDiamondSize, - const int32_t f_iFcode, - const int32_t b_iFcode, + const int32_t f_iFcode, + const int32_t b_iFcode, - const int32_t iQuant, - int iFound) + const int32_t iQuant, + int iFound) { /* Do a diamond search around given starting point, return SAD of best */ @@ -1089,6 +1091,7 @@ return iMinSAD; } +#endif /* 0 */ int32_t AdvDiamond8_MainSearch(const uint8_t * const pRef, @@ -1098,8 +1101,8 @@ const uint8_t * const cur, const int x, const int y, - int start_x, - int start_y, + const int start_xi, + const int start_yi, int iMinSAD, VECTOR * const currMV, const int center_x, @@ -1116,6 +1119,7 @@ { int32_t iSAD; + int start_x = start_xi, start_y = start_yi; /* directions: 1 - left (x-1); 2 - right (x+1), 4 - up (y-1); 8 - down (y+1) */ @@ -1452,7 +1456,7 @@ if ((iMinSAD < 256) || ((MVequal(*currMV, prevMB->mvs[0])) && ((int32_t) iMinSAD < prevMB->sad16))) { - if (iMinSAD < 2 * iQuant) // high chances for SKIP-mode + if (iMinSAD < (int)(2 * iQuant)) // high chances for SKIP-mode { if (!MVzero(*currMV)) { iMinSAD += MV16_00_BIAS; @@ -1657,12 +1661,12 @@ const uint8_t * const cur, const int x, const int y, - int32_t start_x, - int32_t start_y, + const int32_t start_x, + const int32_t start_y, int32_t iMinSAD, VECTOR * const currMV, - const int center_x, - const int center_y, + const int center_x, + const int center_y, const int32_t min_dx, const int32_t max_dx, const int32_t min_dy, @@ -1721,27 +1725,27 @@ int32_t Square8_MainSearch(const uint8_t * const pRef, - const uint8_t * const pRefH, - const uint8_t * const pRefV, - const uint8_t * const pRefHV, - const uint8_t * const cur, - const int x, - const int y, - int32_t start_x, - int32_t start_y, - int32_t iMinSAD, - VECTOR * const currMV, + const uint8_t * const pRefH, + const uint8_t * const pRefV, + const uint8_t * const pRefHV, + const uint8_t * const cur, + const int x, + const int y, + const int32_t start_x, + const int32_t start_y, + int32_t iMinSAD, + VECTOR * const currMV, const int center_x, const int center_y, - const int32_t min_dx, - const int32_t max_dx, - const int32_t min_dy, - const int32_t max_dy, - const int32_t iEdgedWidth, - const int32_t iDiamondSize, - const int32_t iFcode, - const int32_t iQuant, - int iFound) + const int32_t min_dx, + const int32_t max_dx, + const int32_t min_dy, + const int32_t max_dy, + const int32_t iEdgedWidth, + const int32_t iDiamondSize, + const int32_t iFcode, + const int32_t iQuant, + int iFound) { /* Do a square search around given starting point, return SAD of best */ @@ -1903,23 +1907,23 @@ int32_t Halfpel8_Refine_c(const uint8_t * const pRef, - const uint8_t * const pRefH, - const uint8_t * const pRefV, - const uint8_t * const pRefHV, - const uint8_t * const cur, - const int x, - const int y, - VECTOR * const currMV, - int32_t iMinSAD, - const int center_x, - const int center_y, - const int32_t min_dx, - const int32_t max_dx, - const int32_t min_dy, - const int32_t max_dy, - const int32_t iFcode, - const int32_t iQuant, - const int32_t iEdgedWidth) + const uint8_t * const pRefH, + const uint8_t * const pRefV, + const uint8_t * const pRefHV, + const uint8_t * const cur, + const int x, + const int y, + VECTOR * const currMV, + int32_t iMinSAD, + const int center_x, + const int center_y, + const int32_t min_dx, + const int32_t max_dx, + const int32_t min_dy, + const int32_t max_dy, + const int32_t iFcode, + const int32_t iQuant, + const int32_t iEdgedWidth) { /* Do a half-pel refinement (or rather a "smallest possible amount" refinement) */ @@ -2784,7 +2788,8 @@ } - +/* Disabled bframe specific code */ +# if 0 int32_t PMVfastIntSearch16(const uint8_t * const pRef, const uint8_t * const pRefH, @@ -2831,8 +2836,8 @@ MainSearch16FuncPtr MainSearchPtr; - const MACROBLOCK *const prevMB = prevMBs + x + y * iWcount; - MACROBLOCK *const pMB = pMBs + x + y * iWcount; + MACROBLOCK *const prevMB = (MACROBLOCK *const)prevMBs + x + y * iWcount; + MACROBLOCK *const pMB = (MACROBLOCK *const)(pMBs + x + y * iWcount); int32_t threshA, threshB; int32_t bPredEq; @@ -2902,7 +2907,7 @@ if ((iMinSAD < 256) || ((MVequal(*currMV, prevMB->i_mvs[0])) && ((int32_t) iMinSAD < prevMB->i_sad16))) { - if (iMinSAD < 2 * iQuant) // high chances for SKIP-mode + if (iMinSAD < (int)(2 * iQuant)) // high chances for SKIP-mode { if (!MVzero(*currMV)) { iMinSAD += MV16_00_BIAS; @@ -3071,9 +3076,8 @@ pmv[0] = get_pmv2(pMBs, pParam->mb_width, 0, x, y, 0); // get _REAL_ prediction (halfpel possible) -PMVfastInt16_Terminate_without_Refine: currPMV->x = currMV->x - center_x; currPMV->y = currMV->y - center_y; return iMinSAD; } - +#endif /* 0 */