[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 77, Thu Mar 28 16:14:23 2002 UTC revision 78, Thu Mar 28 20:57:25 2002 UTC
# Line 100  Line 100 
100    
101    
102    
103  /* diamond search stuff  /*
104     keep the the sequence in circular order (so optimization works)   * diamond search stuff
105     * keep the the sequence in circular order (so optimization works)
106  */  */
107    
108  typedef struct  typedef struct
# Line 185  Line 186 
186                          const uint32_t width, const uint32_t height,                          const uint32_t width, const uint32_t height,
187                          const uint32_t fcode)                          const uint32_t fcode)
188  {  {
189    
190          const int search_range = 32 << (fcode - 1);          const int search_range = 32 << (fcode - 1);
191      const int high = search_range - 1;      const int high = search_range - 1;
192      const int low = -search_range;      const int low = -search_range;
# Line 200  Line 202 
202      *max_dy = MIN(high, hp_height - hp_y);      *max_dy = MIN(high, hp_height - hp_y);
203      *min_dx = MAX(low,  -(hp_edge + hp_x));      *min_dx = MAX(low,  -(hp_edge + hp_x));
204      *min_dy = MAX(low,  -(hp_edge + hp_y));      *min_dy = MAX(low,  -(hp_edge + hp_y));
205    
206  }  }
207    
208    
209  /* getref: calculate reference image pointer  /*
210  the decision to use interpolation h/v/hv or the normal image is   * getref: calculate reference image pointer
211  based on dx & dy.   * the decision to use interpolation h/v/hv or the normal image is
212     * based on dx & dy.
213  */  */
214    
215  static __inline const uint8_t * get_ref(  static __inline const uint8_t * get_ref(
# Line 218  Line 222 
222                                  const int32_t dx, const int32_t dy,                                  const int32_t dx, const int32_t dy,
223                                  const uint32_t stride)                                  const uint32_t stride)
224  {  {
225    
226          switch ( ((dx&1)<<1) + (dy&1) )         // ((dx%2)?2:0)+((dy%2)?1:0)          switch ( ((dx&1)<<1) + (dy&1) )         // ((dx%2)?2:0)+((dy%2)?1:0)
227      {      {
228          case 0 : return refn + (x*block+dx/2) + (y*block+dy/2)*stride;          case 0 : return refn + (x*block+dx/2) + (y*block+dy/2)*stride;
# Line 226  Line 231 
231          default :          default :
232          case 3 : return refhv + (x*block+(dx-1)/2) + (y*block+(dy-1)/2)*stride;          case 3 : return refhv + (x*block+(dx-1)/2) + (y*block+(dy-1)/2)*stride;
233          }          }
234    
235  }  }
236    
237    
# Line 241  Line 247 
247                                  const VECTOR* mv,       // measured in half-pel!                                  const VECTOR* mv,       // measured in half-pel!
248                                  const uint32_t stride)                                  const uint32_t stride)
249  {  {
250    
251          switch ( (((mv->x)&1)<<1) + ((mv->y)&1) )          switch ( (((mv->x)&1)<<1) + ((mv->y)&1) )
252      {      {
253          case 0 : return refn + (x*block+(mv->x)/2) + (y*block+(mv->y)/2)*stride;          case 0 : return refn + (x*block+(mv->x)/2) + (y*block+(mv->y)/2)*stride;
# Line 249  Line 256 
256          default :          default :
257          case 3 : return refhv + (x*block+((mv->x)-1)/2) + (y*block+((mv->y)-1)/2)*stride;          case 3 : return refhv + (x*block+((mv->x)-1)/2) + (y*block+((mv->y)-1)/2)*stride;
258          }          }
259    
260  }  }
261    
262  #ifndef SEARCH16  #ifndef SEARCH16

Legend:
Removed from v.77  
changed lines
  Added in v.78

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