98 |
dx = (dx & 3) ? (dx >> 1) | 1 : dx / 2; |
dx = (dx & 3) ? (dx >> 1) | 1 : dx / 2; |
99 |
dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2; |
dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2; |
100 |
|
|
101 |
/* uv-image-based compensation */ |
/* u,v-image-based compensation |
|
/* Always do block-based compensation, until check for HALFPEL is possible |
|
|
#ifdef BFRAMES |
|
102 |
compensate8x8_halfpel(&dct_codes[4 * 64], cur->u, ref->u, refh->u, |
compensate8x8_halfpel(&dct_codes[4 * 64], cur->u, ref->u, refh->u, |
103 |
refv->u, refhv->u, 8 * i, 8 * j, dx, dy, |
refv->u, refhv->u, 8 * i, 8 * j, dx, dy, |
104 |
edged_width / 2); |
edged_width / 2); |
105 |
compensate8x8_halfpel(&dct_codes[5 * 64], cur->v, ref->v, refh->v, |
compensate8x8_halfpel(&dct_codes[5 * 64], cur->v, ref->v, refh->v, |
106 |
refv->v, refhv->v, 8 * i, 8 * j, dx, dy, |
refv->v, refhv->v, 8 * i, 8 * j, dx, dy, |
107 |
edged_width / 2); |
edged_width / 2); |
|
#else |
|
108 |
*/ |
*/ |
109 |
/* uv-block-based compensation */ |
|
110 |
|
|
111 |
|
/* --- u,v-block-based interpolation & compensation --- */ |
112 |
|
|
113 |
interpolate8x8_switch(refv->u, ref->u, 8 * i, 8 * j, dx, dy, |
interpolate8x8_switch(refv->u, ref->u, 8 * i, 8 * j, dx, dy, |
114 |
edged_width / 2, rounding); |
edged_width / 2, rounding); |
115 |
transfer_8to16sub(&dct_codes[4 * 64], |
transfer_8to16sub(&dct_codes[4 * 64], |
123 |
cur->v + 8 * j * edged_width / 2 + 8 * i, |
cur->v + 8 * j * edged_width / 2 + 8 * i, |
124 |
refv->v + 8 * j * edged_width / 2 + 8 * i, |
refv->v + 8 * j * edged_width / 2 + 8 * i, |
125 |
edged_width / 2); |
edged_width / 2); |
126 |
/* |
/* */ |
127 |
#endif |
|
|
*/ |
|
128 |
} else // mode == MODE_INTER4V |
} else // mode == MODE_INTER4V |
129 |
{ |
{ |
130 |
int32_t sum, dx, dy; |
int32_t sum, dx, dy; |
150 |
dy = (sum ? SIGN(sum) * |
dy = (sum ? SIGN(sum) * |
151 |
(roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2) : 0); |
(roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2) : 0); |
152 |
|
|
153 |
/* uv-image-based compensation */ |
/* --- uv-image-based compensation -- - |
|
#ifdef BFRAMES |
|
154 |
compensate8x8_halfpel(&dct_codes[4 * 64], cur->u, ref->u, refh->u, |
compensate8x8_halfpel(&dct_codes[4 * 64], cur->u, ref->u, refh->u, |
155 |
refv->u, refhv->u, 8 * i, 8 * j, dx, dy, |
refv->u, refhv->u, 8 * i, 8 * j, dx, dy, |
156 |
edged_width / 2); |
edged_width / 2); |
157 |
compensate8x8_halfpel(&dct_codes[5 * 64], cur->v, ref->v, refh->v, |
compensate8x8_halfpel(&dct_codes[5 * 64], cur->v, ref->v, refh->v, |
158 |
refv->v, refhv->v, 8 * i, 8 * j, dx, dy, |
refv->v, refhv->v, 8 * i, 8 * j, dx, dy, |
159 |
edged_width / 2); |
edged_width / 2); |
160 |
#else |
*/ |
161 |
/* uv-block-based compensation */ |
|
162 |
|
/* --- uv-block-based compensation --- |
163 |
|
WARNING: these ditry the refv->u and refv->v images */ |
164 |
|
|
165 |
interpolate8x8_switch(refv->u, ref->u, 8 * i, 8 * j, dx, dy, |
interpolate8x8_switch(refv->u, ref->u, 8 * i, 8 * j, dx, dy, |
166 |
edged_width / 2, rounding); |
edged_width / 2, rounding); |
167 |
transfer_8to16sub(&dct_codes[4 * 64], |
transfer_8to16sub(&dct_codes[4 * 64], |
175 |
cur->v + 8 * j * edged_width / 2 + 8 * i, |
cur->v + 8 * j * edged_width / 2 + 8 * i, |
176 |
refv->v + 8 * j * edged_width / 2 + 8 * i, |
refv->v + 8 * j * edged_width / 2 + 8 * i, |
177 |
edged_width / 2); |
edged_width / 2); |
178 |
#endif |
/* */ |
179 |
} |
} |
180 |
} |
} |
181 |
|
|
240 |
dx = (dx & 3) ? (dx >> 1) | 1 : dx / 2; |
dx = (dx & 3) ? (dx >> 1) | 1 : dx / 2; |
241 |
dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2; |
dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2; |
242 |
|
|
243 |
/* uv-image-based compensation */ |
/* --- uv-image-based compensation --- |
244 |
compensate8x8_halfpel(&dct_codes[4 * 64], cur->u, f_ref->u, f_refh->u, |
compensate8x8_halfpel(&dct_codes[4 * 64], cur->u, f_ref->u, f_refh->u, |
245 |
f_refv->u, f_refhv->u, 8 * i, 8 * j, dx, dy, |
f_refv->u, f_refhv->u, 8 * i, 8 * j, dx, dy, |
246 |
edged_width / 2); |
edged_width / 2); |
247 |
compensate8x8_halfpel(&dct_codes[5 * 64], cur->v, f_ref->v, f_refh->v, |
compensate8x8_halfpel(&dct_codes[5 * 64], cur->v, f_ref->v, f_refh->v, |
248 |
f_refv->v, f_refhv->v, 8 * i, 8 * j, dx, dy, |
f_refv->v, f_refhv->v, 8 * i, 8 * j, dx, dy, |
249 |
edged_width / 2); |
edged_width / 2); |
250 |
|
*/ |
251 |
|
|
252 |
|
/* --- u,v-block-based interpolation & compensation --- */ |
253 |
|
interpolate8x8_switch(f_refv->u, f_ref->u, 8 * i, 8 * j, dx, dy, |
254 |
|
edged_width / 2, 0); |
255 |
|
transfer_8to16sub(&dct_codes[4 * 64], |
256 |
|
cur->u + 8 * j * edged_width / 2 + 8 * i, |
257 |
|
f_refv->u + 8 * j * edged_width / 2 + 8 * i, |
258 |
|
edged_width / 2); |
259 |
|
|
260 |
|
interpolate8x8_switch(f_refv->v, f_ref->v, 8 * i, 8 * j, dx, dy, |
261 |
|
edged_width / 2, 0); |
262 |
|
transfer_8to16sub(&dct_codes[5 * 64], |
263 |
|
cur->v + 8 * j * edged_width / 2 + 8 * i, |
264 |
|
f_refv->v + 8 * j * edged_width / 2 + 8 * i, |
265 |
|
edged_width / 2); |
266 |
|
/* */ |
267 |
|
|
268 |
break; |
break; |
269 |
|
|
298 |
b_dx = (b_dx & 3) ? (b_dx >> 1) | 1 : b_dx / 2; |
b_dx = (b_dx & 3) ? (b_dx >> 1) | 1 : b_dx / 2; |
299 |
b_dy = (b_dy & 3) ? (b_dy >> 1) | 1 : b_dy / 2; |
b_dy = (b_dy & 3) ? (b_dy >> 1) | 1 : b_dy / 2; |
300 |
|
|
301 |
/* uv-image-based compensation */ |
/* --- uv-image-based compensation --- |
302 |
compensate8x8_halfpel(&dct_codes[4 * 64], cur->u, b_ref->u, b_refh->u, |
compensate8x8_halfpel(&dct_codes[4 * 64], cur->u, b_ref->u, b_refh->u, |
303 |
b_refv->u, b_refhv->u, 8 * i, 8 * j, b_dx, b_dy, |
b_refv->u, b_refhv->u, 8 * i, 8 * j, b_dx, b_dy, |
304 |
edged_width / 2); |
edged_width / 2); |
305 |
compensate8x8_halfpel(&dct_codes[5 * 64], cur->v, b_ref->v, b_refh->v, |
compensate8x8_halfpel(&dct_codes[5 * 64], cur->v, b_ref->v, b_refh->v, |
306 |
b_refv->v, b_refhv->v, 8 * i, 8 * j, b_dx, b_dy, |
b_refv->v, b_refhv->v, 8 * i, 8 * j, b_dx, b_dy, |
307 |
edged_width / 2); |
edged_width / 2); |
308 |
|
*/ |
309 |
|
|
310 |
|
/* --- u,v-block-based interpolation & compensation --- */ |
311 |
|
interpolate8x8_switch(b_refv->u, b_ref->u, 8 * i, 8 * j, b_dx, b_dy, |
312 |
|
edged_width / 2, 0); |
313 |
|
transfer_8to16sub(&dct_codes[4 * 64], |
314 |
|
cur->u + 8 * j * edged_width / 2 + 8 * i, |
315 |
|
b_refv->u + 8 * j * edged_width / 2 + 8 * i, |
316 |
|
edged_width / 2); |
317 |
|
|
318 |
|
interpolate8x8_switch(b_refv->v, b_ref->v, 8 * i, 8 * j, b_dx, b_dy, |
319 |
|
edged_width / 2, 0); |
320 |
|
transfer_8to16sub(&dct_codes[5 * 64], |
321 |
|
cur->v + 8 * j * edged_width / 2 + 8 * i, |
322 |
|
b_refv->v + 8 * j * edged_width / 2 + 8 * i, |
323 |
|
edged_width / 2); |
324 |
|
/* */ |
325 |
|
|
326 |
break; |
break; |
327 |
|
|
353 |
b_dx = (b_dx & 3) ? (b_dx >> 1) | 1 : b_dx / 2; |
b_dx = (b_dx & 3) ? (b_dx >> 1) | 1 : b_dx / 2; |
354 |
b_dy = (b_dy & 3) ? (b_dy >> 1) | 1 : b_dy / 2; |
b_dy = (b_dy & 3) ? (b_dy >> 1) | 1 : b_dy / 2; |
355 |
|
|
356 |
|
/* --- uv-image-based compensation --- |
357 |
|
|
358 |
transfer_8to16sub2_c(&dct_codes[4 * 64], |
transfer_8to16sub2_c(&dct_codes[4 * 64], |
359 |
cur->u + (y * 8) * edged_width / 2 + (x * 8), |
cur->u + (y * 8) * edged_width / 2 + (x * 8), |
360 |
get_ref(f_ref->u, f_refh->u, f_refv->u, |
get_ref(f_ref->u, f_refh->u, f_refv->u, |
374 |
b_refhv->v, 8 * i, 8 * j, 1, b_dx, b_dy, |
b_refhv->v, 8 * i, 8 * j, 1, b_dx, b_dy, |
375 |
edged_width / 2), |
edged_width / 2), |
376 |
edged_width / 2); |
edged_width / 2); |
377 |
|
*/ |
378 |
|
|
379 |
|
/* --- u,v-block-based interpolation & compensation --- */ |
380 |
|
interpolate8x8_switch(f_refv->u, f_ref->u, 8 * i, 8 * j, dx, dy, edged_width / 2, 0); |
381 |
|
interpolate8x8_switch(b_refv->u, b_ref->u, 8 * i, 8 * j, b_dx, b_dy, edged_width / 2, 0); |
382 |
|
transfer_8to16sub2_c(&dct_codes[4 * 64], |
383 |
|
cur->u + 8 * y * edged_width / 2 + 8 * x, |
384 |
|
f_refv->u + 8 * j * edged_width / 2 + 8 * i, |
385 |
|
b_refv->u + 8 * j * edged_width / 2 + 8 * i, |
386 |
|
edged_width / 2); |
387 |
|
|
388 |
|
interpolate8x8_switch(f_refv->v, f_ref->v, 8 * i, 8 * j, dx, dy, edged_width / 2, 0); |
389 |
|
interpolate8x8_switch(b_refv->v, b_ref->v, 8 * i, 8 * j, b_dx, b_dy, edged_width / 2, 0); |
390 |
|
transfer_8to16sub2_c(&dct_codes[5 * 64], |
391 |
|
cur->v + 8 * y * edged_width / 2 + 8 * x, |
392 |
|
f_refv->v + 8 * j * edged_width / 2 + 8 * i, |
393 |
|
b_refv->v + 8 * j * edged_width / 2 + 8 * i, |
394 |
|
edged_width / 2); |
395 |
|
/* */ |
396 |
break; |
break; |
397 |
|
|
398 |
case MODE_DIRECT: |
case MODE_DIRECT: |
437 |
sum /= 2; |
sum /= 2; |
438 |
*/ |
*/ |
439 |
|
|
440 |
|
/* --- uv-image-based compensation --- |
441 |
transfer_8to16sub2_c(&dct_codes[4 * 64], |
transfer_8to16sub2_c(&dct_codes[4 * 64], |
442 |
cur->u + (y * 8) * edged_width / 2 + (x * 8), |
cur->u + (y * 8) * edged_width / 2 + (x * 8), |
443 |
get_ref(f_ref->u, f_refh->u, f_refv->u, |
get_ref(f_ref->u, f_refh->u, f_refv->u, |
457 |
b_refhv->v, i, j, 8, b_dx, b_dy, |
b_refhv->v, i, j, 8, b_dx, b_dy, |
458 |
edged_width / 2), |
edged_width / 2), |
459 |
edged_width / 2); |
edged_width / 2); |
460 |
|
*/ |
461 |
|
|
462 |
|
|
463 |
|
/* --- uv-block-based compensation */ |
464 |
|
interpolate8x8_switch(f_refv->u, f_ref->u, 8 * i, 8 * j, dx, dy, edged_width / 2, 0); |
465 |
|
interpolate8x8_switch(b_refv->u, b_ref->u, 8 * i, 8 * j, b_dx, b_dy, edged_width / 2, 0); |
466 |
|
transfer_8to16sub2_c(&dct_codes[4 * 64], |
467 |
|
cur->u + 8 * y * edged_width / 2 + 8 * x, |
468 |
|
f_refv->u + 8 * j * edged_width / 2 + 8 * i, |
469 |
|
b_refv->u + 8 * j * edged_width / 2 + 8 * i, |
470 |
|
edged_width / 2); |
471 |
|
|
472 |
|
interpolate8x8_switch(f_refv->v, f_ref->v, 8 * i, 8 * j, dx, dy, edged_width / 2, 0); |
473 |
|
interpolate8x8_switch(b_refv->v, b_ref->v, 8 * i, 8 * j, b_dx, b_dy, edged_width / 2, 0); |
474 |
|
transfer_8to16sub2_c(&dct_codes[5 * 64], |
475 |
|
cur->v + 8 * y * edged_width / 2 + 8 * x, |
476 |
|
f_refv->v + 8 * j * edged_width / 2 + 8 * i, |
477 |
|
b_refv->v + 8 * j * edged_width / 2 + 8 * i, |
478 |
|
edged_width / 2); |
479 |
|
/* */ |
480 |
break; |
break; |
481 |
} |
} |
482 |
} |
} |