[svn] / branches / dev-api-3 / xvidcore / src / motion / motion_comp.c Repository:
ViewVC logotype

Diff of /branches/dev-api-3/xvidcore/src/motion/motion_comp.c

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

revision 588, Thu Oct 10 12:16:00 2002 UTC revision 617, Wed Oct 30 23:12:13 2002 UTC
# Line 1  Line 1 
1    // 30.10.2002   corrected qpel chroma rounding
2  // 04.10.2002   added qpel support to MBMotionCompensation  // 04.10.2002   added qpel support to MBMotionCompensation
3  // 01.05.2002   updated MBMotionCompensationBVOP  // 01.05.2002   updated MBMotionCompensationBVOP
4  // 14.04.2002   bframe compensation  // 14.04.2002   bframe compensation
# Line 5  Line 6 
6  #include "../encoder.h"  #include "../encoder.h"
7  #include "../utils/mbfunctions.h"  #include "../utils/mbfunctions.h"
8  #include "../image/interpolate8x8.h"  #include "../image/interpolate8x8.h"
9    #include "../image/qpel.h"
10  #include "../utils/timer.h"  #include "../utils/timer.h"
11  #include "motion.h"  #include "motion.h"
12    
13  #define ABS(X) (((X)>0)?(X):-(X))  #define ABS(X) (((X)>0)?(X):-(X))
14  #define SIGN(X) (((X)>0)?1:-1)  #define SIGN(X) (((X)>0)?1:-1)
15    
   
16  static __inline void  static __inline void
17  compensate16x16_interpolate(int16_t * const dct_codes,  compensate16x16_interpolate(int16_t * const dct_codes,
18                                                      uint8_t * const cur,                                                      uint8_t * const cur,
# Line 157  Line 158 
158    
159                  if (quarterpel)                  if (quarterpel)
160                  {                  {
161                          dx = (dx >> 1) | (dx & 1);                          dx /= 2;
162                          dy = (dy >> 1) | (dy & 1);                          dy /= 2;
163                  }                  }
164    
165                  dx = (dx & 3) ? (dx >> 1) | 1 : dx / 2;                  dx = (dx >> 1) + roundtab_79[dx & 0x3];
166                  dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2;                  dy = (dy >> 1) + roundtab_79[dy & 0x3];
167    
168                  /* uv-block-based compensation */                  /* uv-block-based compensation */
169                  transfer_8to16sub(&dct_codes[4 * 64],                  transfer_8to16sub(&dct_codes[4 * 64],
# Line 199  Line 200 
200                                                            refv->y, refhv->y, 16 * i + 8, 16 * j + 8,                                                            refv->y, refhv->y, 16 * i + 8, 16 * j + 8,
201                                                            mvs[3].x, mvs[3].y, edged_width, quarterpel, rounding);                                                            mvs[3].x, mvs[3].y, edged_width, quarterpel, rounding);
202    
                 sum = mvs[0].x + mvs[1].x + mvs[2].x + mvs[3].x;  
   
203                  if(quarterpel)                  if(quarterpel)
204                          sum /= 2;                          sum = (mvs[0].x / 2) + (mvs[1].x / 2) + (mvs[2].x / 2) + (mvs[3].x / 2);
205                    else
206                  dx = (sum ? SIGN(sum) *                          sum = mvs[0].x + mvs[1].x + mvs[2].x + mvs[3].x;
                           (roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2) : 0);  
207    
208                  sum = mvs[0].y + mvs[1].y + mvs[2].y + mvs[3].y;                  dx = (sum >> 3) + roundtab_76[sum & 0xf];
209    
210                  if(quarterpel)                  if(quarterpel)
211                          sum /= 2;                          sum = (mvs[0].y / 2) + (mvs[1].y / 2) + (mvs[2].y / 2) + (mvs[3].y / 2);
212                    else
213                            sum = mvs[0].y + mvs[1].y + mvs[2].y + mvs[3].y;
214    
215                  dy = (sum ? SIGN(sum) *                  dy = (sum >> 3) + roundtab_76[sum & 0xf];
                           (roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2) : 0);  
216    
217                  /* uv-block-based compensation */                  /* uv-block-based compensation */
218                  transfer_8to16sub(&dct_codes[4 * 64],                  transfer_8to16sub(&dct_codes[4 * 64],

Legend:
Removed from v.588  
changed lines
  Added in v.617

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