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

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

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

revision 151, Mon Apr 29 07:23:16 2002 UTC revision 152, Wed May 1 13:00:02 2002 UTC
# Line 1  Line 1 
1    // 01.05.2002   updated MBMotionCompensationBVOP
2  // 14.04.2002   bframe compensation  // 14.04.2002   bframe compensation
3    
4  #include "../encoder.h"  #include "../encoder.h"
# Line 92  Line 93 
93                  dx = (dx & 3) ? (dx >> 1) | 1 : dx / 2;                  dx = (dx & 3) ? (dx >> 1) | 1 : dx / 2;
94                  dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2;                  dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2;
95    
96                  /* uv-image-based compensation                  /* uv-image-based compensation */
97                     compensate8x8_halfpel(dct_codes[4], cur->u, ref->u, refh->u, refv->u, refhv->u,  #ifdef BFRAMES
98                       compensate8x8_halfpel(&dct_codes[4*64], cur->u, ref->u, refh->u, refv->u, refhv->u,
99                     8*i, 8*j, dx, dy, edged_width/2);                     8*i, 8*j, dx, dy, edged_width/2);
100                     compensate8x8_halfpel(dct_codes[5], cur->v, ref->v, refh->v, refv->v, refhv->v,                     compensate8x8_halfpel(&dct_codes[5*64], cur->v, ref->v, refh->v, refv->v, refhv->v,
101                     8*i, 8*j, dx, dy, edged_width/2);            */                     8*i, 8*j, dx, dy, edged_width/2);
102    #else
103                  /* uv-block-based compensation */                  /* uv-block-based compensation */
104                  interpolate8x8_switch(refv->u, ref->u, 8*i, 8*j, dx, dy, edged_width/2, rounding);                  interpolate8x8_switch(refv->u, ref->u, 8*i, 8*j, dx, dy, edged_width/2, rounding);
105                  transfer_8to16sub(&dct_codes[4*64],                  transfer_8to16sub(&dct_codes[4*64],
# Line 108  Line 110 
110                  transfer_8to16sub(&dct_codes[5*64],                  transfer_8to16sub(&dct_codes[5*64],
111                                    cur->v + 8*j*edged_width/2 + 8*i,                                    cur->v + 8*j*edged_width/2 + 8*i,
112                                    refv->v + 8*j*edged_width/2 + 8*i, edged_width/2);                                    refv->v + 8*j*edged_width/2 + 8*i, edged_width/2);
113    #endif
114          }          }
115          else    // mode == MODE_INTER4V          else    // mode == MODE_INTER4V
116          {          {
# Line 129  Line 131 
131                  sum = mb->mvs[0].y + mb->mvs[1].y + mb->mvs[2].y + mb->mvs[3].y;                  sum = mb->mvs[0].y + mb->mvs[1].y + mb->mvs[2].y + mb->mvs[3].y;
132                  dy = (sum ? SIGN(sum) * (roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2) : 0);                  dy = (sum ? SIGN(sum) * (roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2) : 0);
133    
134                  /* uv-image-based compensation                  /* uv-image-based compensation */
135                     compensate8x8_halfpel(dct_codes[4], cur->u, ref->u, refh->u, refv->u, refhv->u,  #ifdef BFRAMES
136                       compensate8x8_halfpel(&dct_codes[4*64], cur->u, ref->u, refh->u, refv->u, refhv->u,
137                     8*i, 8*j, dx, dy, edged_width/2);                     8*i, 8*j, dx, dy, edged_width/2);
138                     compensate8x8_halfpel(dct_codes[5], cur->v, ref->v, refh->v, refv->v, refhv->v,                     compensate8x8_halfpel(&dct_codes[5*64], cur->v, ref->v, refh->v, refv->v, refhv->v,
139                     8*i, 8*j, dx, dy, edged_width/2);            */                     8*i, 8*j, dx, dy, edged_width/2);
140    #else
141                  /* uv-block-based compensation */                  /* uv-block-based compensation */
142                  interpolate8x8_switch(refv->u, ref->u, 8*i, 8*j, dx, dy, edged_width/2, rounding);                  interpolate8x8_switch(refv->u, ref->u, 8*i, 8*j, dx, dy, edged_width/2, rounding);
143                  transfer_8to16sub(&dct_codes[4*64],                  transfer_8to16sub(&dct_codes[4*64],
# Line 145  Line 148 
148                  transfer_8to16sub(&dct_codes[5*64],                  transfer_8to16sub(&dct_codes[5*64],
149                                    cur->v + 8*j*edged_width/2 + 8*i,                                    cur->v + 8*j*edged_width/2 + 8*i,
150                                    refv->v + 8*j*edged_width/2 + 8*i, edged_width/2);                                    refv->v + 8*j*edged_width/2 + 8*i, edged_width/2);
151    #endif
152          }          }
153  }  }
154    
155    
   
156  void MBMotionCompensationBVOP(  void MBMotionCompensationBVOP(
157                          MBParam * pParam,                          MBParam * pParam,
158                          MACROBLOCK * const mb,                          MACROBLOCK * const mb,
# Line 165  Line 167 
167                          const IMAGE * const b_refh,                          const IMAGE * const b_refh,
168                      const IMAGE * const b_refv,                      const IMAGE * const b_refv,
169                          const IMAGE * const b_refhv,                          const IMAGE * const b_refhv,
170                      int16_t dct_codes[][64])                      int16_t * dct_codes)
171  {  {
172          static const uint32_t roundtab[16] =          static const uint32_t roundtab[16] =
173                  { 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 };                  { 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 };
# Line 185  Line 187 
187                  dy = mb->mvs[0].y;                  dy = mb->mvs[0].y;
188    
189                  transfer_8to16sub_c(                  transfer_8to16sub_c(
190                          dct_codes[0],                          &dct_codes[0*64],
191                          cur->y + (j*16)*edged_width + (i*16),                          cur->y + (j*16)*edged_width + (i*16),
192                          get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y,                          get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y,
193                                                          i*16, j*16, 1, dx, dy, edged_width),                                                          i*16, j*16, 1, dx, dy, edged_width),
194                          edged_width);                          edged_width);
195    
196                  transfer_8to16sub(                  transfer_8to16sub(
197                          dct_codes[1],                          &dct_codes[1*64],
198                          cur->y + (j*16)*edged_width + (i*16+8),                          cur->y + (j*16)*edged_width + (i*16+8),
199                          get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y,                          get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y,
200                                                          i*16+8, j*16, 1, dx, dy, edged_width),                                                          i*16+8, j*16, 1, dx, dy, edged_width),
201                          edged_width);                          edged_width);
202    
203                  transfer_8to16sub_c(                  transfer_8to16sub_c(
204                          dct_codes[2],                          &dct_codes[2*64],
205                          cur->y + (j*16+8)*edged_width + (i*16),                          cur->y + (j*16+8)*edged_width + (i*16),
206                          get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y,                          get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y,
207                                                          i*16, j*16+8, 1, dx, dy, edged_width),                                                          i*16, j*16+8, 1, dx, dy, edged_width),
208                          edged_width);                          edged_width);
209    
210                  transfer_8to16sub(                  transfer_8to16sub(
211                          dct_codes[3],                          &dct_codes[3*64],
212                          cur->y + (j*16+8)*edged_width + (i*16+8),                          cur->y + (j*16+8)*edged_width + (i*16+8),
213                          get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y,                          get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y,
214                                                          i*16+8, j*16+8, 1, dx, dy, edged_width),                                                          i*16+8, j*16+8, 1, dx, dy, edged_width),
# Line 217  Line 219 
219                  dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2;                  dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2;
220    
221                  /* uv-image-based compensation */                  /* uv-image-based compensation */
222                  compensate8x8_halfpel(dct_codes[4], cur->u, f_ref->u, f_refh->u, f_refv->u, f_refhv->u,                  compensate8x8_halfpel(&dct_codes[4*64], cur->u, f_ref->u, f_refh->u, f_refv->u, f_refhv->u,
223                                                                  8*i, 8*j, dx, dy, edged_width/2);                                                                  8*i, 8*j, dx, dy, edged_width/2);
224                  compensate8x8_halfpel(dct_codes[5], cur->v, f_ref->v, f_refh->v, f_refv->v, f_refhv->v,                  compensate8x8_halfpel(&dct_codes[5*64], cur->v, f_ref->v, f_refh->v, f_refv->v, f_refhv->v,
225                                                                  8*i, 8*j, dx, dy, edged_width/2);                                                                  8*i, 8*j, dx, dy, edged_width/2);
226    
227                  break;                  break;
# Line 229  Line 231 
231                  b_dy = mb->b_mvs[0].y;                  b_dy = mb->b_mvs[0].y;
232    
233                  transfer_8to16sub_c(                  transfer_8to16sub_c(
234                          dct_codes[0],                          &dct_codes[0*64],
235                          cur->y + (j*16)*edged_width + (i*16),                          cur->y + (j*16)*edged_width + (i*16),
236                          get_ref(b_ref->y, b_refh->y, b_refv->y, b_refhv->y,                          get_ref(b_ref->y, b_refh->y, b_refv->y, b_refhv->y,
237                                                          i*16, j*16, 1, b_dx, b_dy, edged_width),                                                          i*16, j*16, 1, b_dx, b_dy, edged_width),
238                          edged_width);                          edged_width);
239    
240                  transfer_8to16sub(                  transfer_8to16sub(
241                          dct_codes[1],                          &dct_codes[1*64],
242                          cur->y + (j*16)*edged_width + (i*16+8),                          cur->y + (j*16)*edged_width + (i*16+8),
243                          get_ref(b_ref->y, b_refh->y, b_refv->y, b_refhv->y,                          get_ref(b_ref->y, b_refh->y, b_refv->y, b_refhv->y,
244                                                          i*16+8, j*16, 1, b_dx, b_dy, edged_width),                                                          i*16+8, j*16, 1, b_dx, b_dy, edged_width),
245                          edged_width);                          edged_width);
246    
247                  transfer_8to16sub_c(                  transfer_8to16sub_c(
248                          dct_codes[2],                          &dct_codes[2*64],
249                          cur->y + (j*16+8)*edged_width + (i*16),                          cur->y + (j*16+8)*edged_width + (i*16),
250                          get_ref(b_ref->y, b_refh->y, b_refv->y, b_refhv->y,                          get_ref(b_ref->y, b_refh->y, b_refv->y, b_refhv->y,
251                                                          i*16, j*16+8, 1, b_dx, b_dy, edged_width),                                                          i*16, j*16+8, 1, b_dx, b_dy, edged_width),
252                          edged_width);                          edged_width);
253    
254                  transfer_8to16sub(                  transfer_8to16sub(
255                          dct_codes[3],                          &dct_codes[3*64],
256                          cur->y + (j*16+8)*edged_width + (i*16+8),                          cur->y + (j*16+8)*edged_width + (i*16+8),
257                          get_ref(b_ref->y, b_refh->y, b_refv->y, b_refhv->y,                          get_ref(b_ref->y, b_refh->y, b_refv->y, b_refhv->y,
258                                                          i*16+8, j*16+8, 1, b_dx, b_dy, edged_width),                                                          i*16+8, j*16+8, 1, b_dx, b_dy, edged_width),
# Line 260  Line 262 
262                  b_dy = (b_dy & 3) ? (b_dy >> 1) | 1 : b_dy / 2;                  b_dy = (b_dy & 3) ? (b_dy >> 1) | 1 : b_dy / 2;
263    
264                  /* uv-image-based compensation */                  /* uv-image-based compensation */
265                  compensate8x8_halfpel(dct_codes[4], cur->u,                  compensate8x8_halfpel(&dct_codes[4*64], cur->u,
266                                          b_ref->u, b_refh->u, b_refv->u, b_refhv->u,                                          b_ref->u, b_refh->u, b_refv->u, b_refhv->u,
267                                          8*i, 8*j, b_dx, b_dy, edged_width/2);                                          8*i, 8*j, b_dx, b_dy, edged_width/2);
268                  compensate8x8_halfpel(dct_codes[5], cur->v,                  compensate8x8_halfpel(&dct_codes[5*64], cur->v,
269                                          b_ref->v, b_refh->v, b_refv->v, b_refhv->v,                                          b_ref->v, b_refh->v, b_refv->v, b_refhv->v,
270                                          8*i, 8*j, b_dx, b_dy, edged_width/2);                                          8*i, 8*j, b_dx, b_dy, edged_width/2);
271    
# Line 277  Line 279 
279                  b_dy = mb->b_mvs[0].y;                  b_dy = mb->b_mvs[0].y;
280    
281                  transfer_8to16sub2_c(                  transfer_8to16sub2_c(
282                                  dct_codes[0],                                  &dct_codes[0*64],
283                                  cur->y + (i*16) + (j*16)*edged_width,                                  cur->y + (i*16) + (j*16)*edged_width,
284                                  get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y,                                  get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y,
285                                                          16*i, 16*j, 1, dx, dy, edged_width),                                                          16*i, 16*j, 1, dx, dy, edged_width),
# Line 286  Line 288 
288                                  edged_width);                                  edged_width);
289    
290                  transfer_8to16sub2_c(                  transfer_8to16sub2_c(
291                                  dct_codes[1],                                  &dct_codes[1*64],
292                                  cur->y + (i*16+8) + (j*16)*edged_width,                                  cur->y + (i*16+8) + (j*16)*edged_width,
293                                  get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y,                                  get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y,
294                                                          16*i+8, 16*j, 1, dx, dy, edged_width),                                                          16*i+8, 16*j, 1, dx, dy, edged_width),
# Line 295  Line 297 
297                                  edged_width);                                  edged_width);
298    
299                  transfer_8to16sub2_c(                  transfer_8to16sub2_c(
300                                  dct_codes[2],                                  &dct_codes[2*64],
301                                  cur->y + (i*16) + (j*16+8)*edged_width,                                  cur->y + (i*16) + (j*16+8)*edged_width,
302                                  get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y,                                  get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y,
303                                                          16*i, 16*j+8, 1, dx, dy, edged_width),                                                          16*i, 16*j+8, 1, dx, dy, edged_width),
# Line 304  Line 306 
306                                  edged_width);                                  edged_width);
307    
308                  transfer_8to16sub2_c(                  transfer_8to16sub2_c(
309                                  dct_codes[3],                                  &dct_codes[3*64],
310                                  cur->y + (i*16+8) + (j*16+8)*edged_width,                                  cur->y + (i*16+8) + (j*16+8)*edged_width,
311                                  get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y,                                  get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y,
312                                                          16*i + 8, 16*j + 8, 1, dx, dy, edged_width),                                                          16*i + 8, 16*j + 8, 1, dx, dy, edged_width),
# Line 320  Line 322 
322                  b_dy = (b_dy & 3) ? (b_dy >> 1) | 1 : b_dy / 2;                  b_dy = (b_dy & 3) ? (b_dy >> 1) | 1 : b_dy / 2;
323    
324                  transfer_8to16sub2_c(                  transfer_8to16sub2_c(
325                                  dct_codes[4],                                  &dct_codes[4*64],
326                                  cur->u + (y*8)*edged_width/2 + (x*8),                                  cur->u + (y*8)*edged_width/2 + (x*8),
327                                  get_ref(f_ref->u, f_refh->u, f_refv->u, f_refhv->u,                                  get_ref(f_ref->u, f_refh->u, f_refv->u, f_refhv->u,
328                                                          8*i, 8*j, 1, dx, dy, edged_width/2),                                                          8*i, 8*j, 1, dx, dy, edged_width/2),
# Line 329  Line 331 
331                                  edged_width/2);                                  edged_width/2);
332    
333                  transfer_8to16sub2_c(                  transfer_8to16sub2_c(
334                                  dct_codes[5],                                  &dct_codes[5*64],
335                                  cur->v + (y*8)*edged_width/2 + (x*8),                                  cur->v + (y*8)*edged_width/2 + (x*8),
336                                  get_ref(f_ref->v, f_refh->v, f_refv->v, f_refhv->v,                                  get_ref(f_ref->v, f_refh->v, f_refv->v, f_refhv->v,
337                                                          8*i, 8*j, 1, dx, dy, edged_width/2),                                                          8*i, 8*j, 1, dx, dy, edged_width/2),
# Line 345  Line 347 
347          }          }
348    
349  }  }
   

Legend:
Removed from v.151  
changed lines
  Added in v.152

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