--- motion_inlines.h 2003/09/10 22:19:00 1.1.2.1 +++ motion_inlines.h 2003/11/16 15:32:38 1.1.2.6 @@ -21,7 +21,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: motion_inlines.h,v 1.1.2.1 2003/09/10 22:19:00 edgomez Exp $ + * $Id: motion_inlines.h,v 1.1.2.6 2003/11/16 15:32:38 edgomez Exp $ * ****************************************************************************/ @@ -70,22 +70,22 @@ *min_dy = MAX(low, k); } -/* mv.length table */ -static const int mvtab[64] = { - 1, 2, 3, 4, 6, 7, 7, 7, - 9, 9, 9, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, - 10, 11, 11, 11, 11, 11, 11, 12, +/* reversed mv.length table */ +static const int r_mvtab[64] = { + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12 + 12, 12, 12, 12, 12, 12, 12, 12, + 12, 11, 11, 11, 11, 11, 11, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 9, 9, 9, + 7, 7, 7, 6, 4, 3, 2, 1 }; static __inline uint32_t d_mv_bits(int x, int y, const VECTOR pred, const uint32_t iFcode, const int qpel, const int rrv) { - int bits; - const int q = (1 << (iFcode - 1)) - 1; + unsigned int bits; x <<= qpel; y <<= qpel; @@ -93,17 +93,15 @@ x -= pred.x; bits = (x != 0 ? iFcode:0); - x = abs(x); - x += q; + x = -abs(x); x >>= (iFcode - 1); - bits += mvtab[x]; + bits += r_mvtab[x+63]; y -= pred.y; bits += (y != 0 ? iFcode:0); - y = abs(y); - y += q; + y = -abs(y); y >>= (iFcode - 1); - bits += mvtab[y]; + bits += r_mvtab[y+63]; return bits; } @@ -133,11 +131,13 @@ pMB->mvs[0] = pMB->mvs[1] = pMB->mvs[2] = pMB->mvs[3] = zeroMV; pMB->qmvs[0] = pMB->qmvs[1] = pMB->qmvs[2] = pMB->qmvs[3] = zeroMV; pMB->sad16 = pMB->sad8[0] = pMB->sad8[1] = pMB->sad8[2] = pMB->sad8[3] = sad; + pMB->mcsel = 0; + pMB->cbp = 0; } /* check if given vector is equal to any vector checked before */ static __inline int -vector_repeats(const VECTOR * const pmv, const int i) +vector_repeats(const VECTOR * const pmv, const unsigned int i) { unsigned int j; for (j = 0; j < i; j++) @@ -148,7 +148,7 @@ /* make a binary mask that prevents diamonds/squares from checking a vector which has been checked as a prediction */ static __inline int -make_mask(const VECTOR * const pmv, const int i, const int current) +make_mask(const VECTOR * const pmv, const unsigned int i, const unsigned int current) { unsigned int mask = 255, j; for (j = 0; j < i; j++) {