[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 580, Sat Oct 5 21:39:39 2002 UTC revision 581, Sat Oct 5 21:42:04 2002 UTC
# Line 1  Line 1 
1    // 04.10.2002   added qpel support to MBMotionCompensation
2  // 01.05.2002   updated MBMotionCompensationBVOP  // 01.05.2002   updated MBMotionCompensationBVOP
3  // 14.04.2002   bframe compensation  // 14.04.2002   bframe compensation
4    
# Line 12  Line 13 
13    
14    
15  static __inline void  static __inline void
16  compensate8x8_halfpel(int16_t * const dct_codes,  compensate8x8_interpolate(int16_t * const dct_codes,
17                                            uint8_t * const cur,                                            uint8_t * const cur,
18                                            const uint8_t * const ref,                                            const uint8_t * const ref,
19                                            const uint8_t * const refh,                                            const uint8_t * const refh,
# Line 21  Line 22 
22                                            const uint32_t x,                                            const uint32_t x,
23                                            const uint32_t y,                                            const uint32_t y,
24                                            const int32_t dx,                                            const int32_t dx,
25                                            const int dy,                                                    const int32_t dy,
26                                            const uint32_t stride)                                                    const uint32_t stride,
27                                                      const uint32_t quarterpel,
28                                                      const uint32_t rounding)
29    {
30            if(quarterpel) {
31                    interpolate8x8_quarterpel((uint8_t *) refv, (uint8_t *) ref, (uint8_t *) refh,
32                            (uint8_t *) refh + 64, (uint8_t *) refhv, x, y, dx, dy, stride, rounding);
33    
34                    transfer_8to16sub(dct_codes, cur + y*stride + x,
35                                                      refv + y*stride + x, stride);
36            }
37            else
38  {  {
39          const uint8_t * reference;          const uint8_t * reference;
40    
# Line 37  Line 49 
49          transfer_8to16sub(dct_codes, cur + y * stride + x,          transfer_8to16sub(dct_codes, cur + y * stride + x,
50                                                    reference, stride);                                                    reference, stride);
51  }  }
52    }
53    
54  void  void
55  MBMotionCompensation(MACROBLOCK * const mb,  MBMotionCompensation(MACROBLOCK * const mb,
# Line 51  Line 64 
64                                           const uint32_t width,                                           const uint32_t width,
65                                           const uint32_t height,                                           const uint32_t height,
66                                           const uint32_t edged_width,                                           const uint32_t edged_width,
67                                             const uint32_t quarterpel,
68                                           const uint32_t rounding)                                           const uint32_t rounding)
69  {  {
70          if (mb->mode == MODE_NOT_CODED) {          if (mb->mode == MODE_NOT_CODED) {
# Line 80  Line 94 
94                  int32_t dx = mb->mvs[0].x;                  int32_t dx = mb->mvs[0].x;
95                  int32_t dy = mb->mvs[0].y;                  int32_t dy = mb->mvs[0].y;
96    
97                  compensate8x8_halfpel(&dct_codes[0 * 64], cur->y, ref->y, refh->y,                  if(quarterpel) {
98                            dx = mb->qmvs[0].x;
99                            dy = mb->qmvs[0].y;
100                    }
101    
102                    compensate8x8_interpolate(&dct_codes[0 * 64], cur->y, ref->y, refh->y,
103                                                            refv->y, refhv->y, 16 * i, 16 * j, dx, dy,                                                            refv->y, refhv->y, 16 * i, 16 * j, dx, dy,
104                                                            edged_width);                                                            edged_width, quarterpel, rounding);
105                  compensate8x8_halfpel(&dct_codes[1 * 64], cur->y, ref->y, refh->y,                  compensate8x8_interpolate(&dct_codes[1 * 64], cur->y, ref->y, refh->y,
106                                                            refv->y, refhv->y, 16 * i + 8, 16 * j, dx, dy,                                                            refv->y, refhv->y, 16 * i + 8, 16 * j, dx, dy,
107                                                            edged_width);                                                            edged_width, quarterpel, rounding);
108                  compensate8x8_halfpel(&dct_codes[2 * 64], cur->y, ref->y, refh->y,                  compensate8x8_interpolate(&dct_codes[2 * 64], cur->y, ref->y, refh->y,
109                                                            refv->y, refhv->y, 16 * i, 16 * j + 8, dx, dy,                                                            refv->y, refhv->y, 16 * i, 16 * j + 8, dx, dy,
110                                                            edged_width);                                                            edged_width, quarterpel, rounding);
111                  compensate8x8_halfpel(&dct_codes[3 * 64], cur->y, ref->y, refh->y,                  compensate8x8_interpolate(&dct_codes[3 * 64], cur->y, ref->y, refh->y,
112                                                            refv->y, refhv->y, 16 * i + 8, 16 * j + 8, dx,                                                            refv->y, refhv->y, 16 * i + 8, 16 * j + 8, dx,
113                                                            dy, edged_width);                                                            dy, edged_width, quarterpel, rounding);
114    
115                    if (quarterpel)
116                    {
117                            dx = (dx >> 1) | (dx & 1);
118                            dy = (dy >> 1) | (dy & 1);
119                    }
120    
121                  dx = (dx & 3) ? (dx >> 1) | 1 : dx / 2;                  dx = (dx & 3) ? (dx >> 1) | 1 : dx / 2;
122                  dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2;                  dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2;
# Line 111  Line 136 
136    
137          } else {                                        // mode == MODE_INTER4V          } else {                                        // mode == MODE_INTER4V
138                  int32_t sum, dx, dy;                  int32_t sum, dx, dy;
139                    VECTOR *mvs;
140    
141                  compensate8x8_halfpel(&dct_codes[0 * 64], cur->y, ref->y, refh->y,                  if(quarterpel)
142                                                            refv->y, refhv->y, 16 * i, 16 * j, mb->mvs[0].x,                          mvs = mb->qmvs;
143                                                            mb->mvs[0].y, edged_width);                  else
144                  compensate8x8_halfpel(&dct_codes[1 * 64], cur->y, ref->y, refh->y,                          mvs = mb->mvs;
145    
146                    compensate8x8_interpolate(&dct_codes[0 * 64], cur->y, ref->y, refh->y,
147                                                              refv->y, refhv->y, 16 * i, 16 * j, mvs[0].x,
148                                                              mvs[0].y, edged_width, quarterpel, rounding);
149                    compensate8x8_interpolate(&dct_codes[1 * 64], cur->y, ref->y, refh->y,
150                                                            refv->y, refhv->y, 16 * i + 8, 16 * j,                                                            refv->y, refhv->y, 16 * i + 8, 16 * j,
151                                                            mb->mvs[1].x, mb->mvs[1].y, edged_width);                                                            mvs[1].x, mvs[1].y, edged_width, quarterpel, rounding);
152                  compensate8x8_halfpel(&dct_codes[2 * 64], cur->y, ref->y, refh->y,                  compensate8x8_interpolate(&dct_codes[2 * 64], cur->y, ref->y, refh->y,
153                                                            refv->y, refhv->y, 16 * i, 16 * j + 8,                                                            refv->y, refhv->y, 16 * i, 16 * j + 8,
154                                                            mb->mvs[2].x, mb->mvs[2].y, edged_width);                                                            mvs[2].x, mvs[2].y, edged_width, quarterpel, rounding);
155                  compensate8x8_halfpel(&dct_codes[3 * 64], cur->y, ref->y, refh->y,                  compensate8x8_interpolate(&dct_codes[3 * 64], cur->y, ref->y, refh->y,
156                                                            refv->y, refhv->y, 16 * i + 8, 16 * j + 8,                                                            refv->y, refhv->y, 16 * i + 8, 16 * j + 8,
157                                                            mb->mvs[3].x, mb->mvs[3].y, edged_width);                                                            mvs[3].x, mvs[3].y, edged_width, quarterpel, rounding);
158    
159                    sum = mvs[0].x + mvs[1].x + mvs[2].x + mvs[3].x;
160    
161                    if(quarterpel)
162                            sum /= 2;
163    
                 sum = mb->mvs[0].x + mb->mvs[1].x + mb->mvs[2].x + mb->mvs[3].x;  
164                  dx = (sum ? SIGN(sum) *                  dx = (sum ? SIGN(sum) *
165                            (roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2) : 0);                            (roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2) : 0);
166    
167                  sum = mb->mvs[0].y + mb->mvs[1].y + mb->mvs[2].y + mb->mvs[3].y;                  sum = mvs[0].y + mvs[1].y + mvs[2].y + mvs[3].y;
168    
169                    if(quarterpel)
170                            sum /= 2;
171    
172                  dy = (sum ? SIGN(sum) *                  dy = (sum ? SIGN(sum) *
173                            (roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2) : 0);                            (roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2) : 0);
174    

Legend:
Removed from v.580  
changed lines
  Added in v.581

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