[svn] / trunk / xvidcore / src / motion / motion_est.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/src/motion/motion_est.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 972, Fri Apr 4 22:16:15 2003 UTC revision 973, Sat Apr 5 15:54:59 2003 UTC
# Line 81  Line 81 
81  static __inline uint32_t  static __inline uint32_t
82  d_mv_bits(int x, int y, const VECTOR pred, const uint32_t iFcode, const int qpel, const int rrv)  d_mv_bits(int x, int y, const VECTOR pred, const uint32_t iFcode, const int qpel, const int rrv)
83  {  {
84          int xb, yb;          int bits;
85          x = qpel ? x<<1 : x;          const int q = (1 << (iFcode - 1)) - 1;
86          y = qpel ? y<<1 : y;  
87            x <<= qpel;
88            y <<= qpel;
89          if (rrv) { x = RRV_MV_SCALEDOWN(x); y = RRV_MV_SCALEDOWN(y); }          if (rrv) { x = RRV_MV_SCALEDOWN(x); y = RRV_MV_SCALEDOWN(y); }
90    
91          x -= pred.x;          x -= pred.x;
92          y -= pred.y;          bits = (x != 0 ? iFcode:0);
93            x = abs(x);
94          if (x) {          x += q;
                 x = ABS(x);  
                 x += (1 << (iFcode - 1)) - 1;  
95                  x >>= (iFcode - 1);                  x >>= (iFcode - 1);
96                  if (x > 32) x = 32;          bits += mvtab[x];
97                  xb = mvtab[x] + iFcode;  
98          } else xb = 1;          y -= pred.y;
99            bits += (y != 0 ? iFcode:0);
100          if (y) {          y = abs(y);
101                  y = ABS(y);          y += q;
                 y += (1 << (iFcode - 1)) - 1;  
102                  y >>= (iFcode - 1);                  y >>= (iFcode - 1);
103                  if (y > 32) y = 32;          bits += mvtab[y];
104                  yb = mvtab[y] + iFcode;  
105          } else yb = 1;          return bits;
         return xb + yb;  
106  }  }
107    
108  static int32_t ChromaSAD2(int fx, int fy, int bx, int by, const SearchData * const data)  static int32_t ChromaSAD2(int fx, int fy, int bx, int by, const SearchData * const data)
# Line 379  Line 377 
377  {  {
378          int32_t sad; uint32_t t;          int32_t sad; uint32_t t;
379          const uint8_t * Reference;          const uint8_t * Reference;
380            VECTOR * current;
381    
382          if ( (x > data->max_dx) || (x < data->min_dx)          if ( (x > data->max_dx) || (x < data->min_dx)
383                  || (y > data->max_dy) || (y < data->min_dy) ) return;                  || (y > data->max_dy) || (y < data->min_dy) ) return;
384    
385          if (!data->qpel_precision) Reference = GetReference(x, y, data);          if (!data->qpel_precision) {
386          else Reference = Interpolate8x8qpel(x, y, 0, 0, data);                  Reference = GetReference(x, y, data);
387                    current = data->currentMV;
388            } else { // x and y are in 1/4 precision
389                    Reference = Interpolate8x8qpel(x, y, 0, 0, data);
390                    current = data->currentQMV;
391            }
392    
393          sad = sad8(data->Cur, Reference, data->iEdgedWidth);          sad = sad8(data->Cur, Reference, data->iEdgedWidth);
394          t = d_mv_bits(x, y, data->predMV, data->iFcode, data->qpel^data->qpel_precision, 0);          t = d_mv_bits(x, y, data->predMV, data->iFcode, data->qpel^data->qpel_precision, 0);
# Line 393  Line 397 
397    
398          if (sad < *(data->iMinSAD)) {          if (sad < *(data->iMinSAD)) {
399                  *(data->iMinSAD) = sad;                  *(data->iMinSAD) = sad;
400                  data->currentMV->x = x; data->currentMV->y = y;                  current->x = x; current->y = y;
401                  *dir = Direction;                  *dir = Direction;
402          }          }
403  }  }

Legend:
Removed from v.972  
changed lines
  Added in v.973

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4