19 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
* |
* |
22 |
* $Id: interpolate8x8_altivec.c,v 1.2 2004-10-17 10:20:15 edgomez Exp $ |
* $Id$ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
81 |
#ifdef DEBUG |
#ifdef DEBUG |
82 |
/* Dump alignment errors if DEBUG is defined */ |
/* Dump alignment errors if DEBUG is defined */ |
83 |
if(((unsigned long)dst) & 0x7) |
if(((unsigned long)dst) & 0x7) |
84 |
fprintf(stderr, "interpolate8x8_halfpel_h_altivec_c:incorrect align, dst: %x\n", dst); |
fprintf(stderr, "interpolate8x8_halfpel_h_altivec_c:incorrect align, dst: %lx\n", (long)dst); |
85 |
if(stride & 0x7) |
if(stride & 0x7) |
86 |
fprintf(stderr, "interpolate8x8_halfpel_h_altivec_c:incorrect stride, stride: %u\n", stride); |
fprintf(stderr, "interpolate8x8_halfpel_h_altivec_c:incorrect stride, stride: %u\n", stride); |
87 |
#endif |
#endif |
145 |
#ifdef DEBUG |
#ifdef DEBUG |
146 |
/* if this is on, print alignment errors */ |
/* if this is on, print alignment errors */ |
147 |
if(((unsigned long)dst) & 0x7) |
if(((unsigned long)dst) & 0x7) |
148 |
fprintf(stderr, "interpolate8x8_halfpel_v_altivec_c:incorrect align, dst: %x\n", dst); |
fprintf(stderr, "interpolate8x8_halfpel_v_altivec_c:incorrect align, dst: %lx\n", (long)dst); |
149 |
if(stride & 0x7) |
if(stride & 0x7) |
150 |
fprintf(stderr, "interpolate8x8_halfpel_v_altivec_c:incorrect stride, stride: %u\n", stride); |
fprintf(stderr, "interpolate8x8_halfpel_v_altivec_c:incorrect stride, stride: %u\n", stride); |
151 |
#endif |
#endif |
186 |
s3 = (vector unsigned short)vec_mergeh(zerovec, t); \ |
s3 = (vector unsigned short)vec_mergeh(zerovec, t); \ |
187 |
t = vec_perm(vec_ld(1, src + stride), vec_ld(17, src + stride), vec_lvsl(1, src + stride)); \ |
t = vec_perm(vec_ld(1, src + stride), vec_ld(17, src + stride), vec_lvsl(1, src + stride)); \ |
188 |
s4 = (vector unsigned short)vec_mergeh(zerovec, t); \ |
s4 = (vector unsigned short)vec_mergeh(zerovec, t); \ |
189 |
s1 = vec_add(s1, vec_add(s2, vec_add(s3, s4))); \ |
s1 = vec_add(s1,s2);\ |
190 |
|
s3 = vec_add(s3,s4);\ |
191 |
|
s1 = vec_add(s1,s3);\ |
192 |
s1 = vec_add(s1, adding); \ |
s1 = vec_add(s1, adding); \ |
193 |
s1 = vec_sr(s1, two); \ |
s1 = vec_sr(s1, two); \ |
194 |
t = vec_pack(s1, s1); \ |
t = vec_pack(s1, s1); \ |
270 |
#ifdef DEBUG |
#ifdef DEBUG |
271 |
/* If this is on, print alignment errors */ |
/* If this is on, print alignment errors */ |
272 |
if(((unsigned long)dst) & 0x7) |
if(((unsigned long)dst) & 0x7) |
273 |
fprintf(stderr, "interpolate8x8_avg2_altivec_c:incorrect align, dst: %x\n", dst); |
fprintf(stderr, "interpolate8x8_avg2_altivec_c:incorrect align, dst: %lx\n", (long)dst); |
274 |
if(stride & 0x7) |
if(stride & 0x7) |
275 |
fprintf(stderr, "interpolate8x8_avg2_altivec_c:incorrect stride, stride: %u\n", stride); |
fprintf(stderr, "interpolate8x8_avg2_altivec_c:incorrect stride, stride: %u\n", stride); |
276 |
if(rounding > (32767 + 2)) |
if(rounding > (32767 + 2)) |
365 |
#ifdef DEBUG |
#ifdef DEBUG |
366 |
/* if debug is set, print alignment errors */ |
/* if debug is set, print alignment errors */ |
367 |
if(((unsigned)dst) & 0x7) |
if(((unsigned)dst) & 0x7) |
368 |
fprintf(stderr, "interpolate8x8_avg4_altivec_c:incorrect align, dst: %x\n", dst); |
fprintf(stderr, "interpolate8x8_avg4_altivec_c:incorrect align, dst: %lx\n", (long)dst); |
369 |
if(stride & 0x7) |
if(stride & 0x7) |
370 |
fprintf(stderr, "interpolate8x8_avg4_altivec_c:incorrect stride, stride: %u\n", stride); |
fprintf(stderr, "interpolate8x8_avg4_altivec_c:incorrect stride, stride: %u\n", stride); |
371 |
#endif |
#endif |
409 |
\ |
\ |
410 |
s2 = vec_perm(s1,s1,rot1); \ |
s2 = vec_perm(s1,s1,rot1); \ |
411 |
tmp = vec_avg(s1,s2); \ |
tmp = vec_avg(s1,s2); \ |
412 |
s1 = vec_sub(tmp,vec_and(vec_xor(s1,s2),one)); \ |
s1 = vec_xor(s1,s2);\ |
413 |
|
s1 = vec_sub(tmp,vec_and(s1,one));\ |
414 |
\ |
\ |
415 |
d = vec_avg(s1,d);\ |
d = vec_avg(s1,d);\ |
416 |
\ |
\ |
459 |
register vector unsigned char mask; |
register vector unsigned char mask; |
460 |
|
|
461 |
#ifdef DEBUG |
#ifdef DEBUG |
462 |
if(((unsigned)dst) & 0x7); |
if(((unsigned)dst) & 0x7) |
463 |
fprintf(stderr, "interpolate8x8_halfpel_h_add_altivec_c:incorrect align, dst: %x\n", dst); |
fprintf(stderr, "interpolate8x8_halfpel_h_add_altivec_c:incorrect align, dst: %lx\n", (long)dst); |
464 |
if(stride & 0x7) |
if(stride & 0x7) |
465 |
fprintf(stderr, "interpolate8x8_halfpel_h_add_altivec_c:incorrect stride, stride: %u\n", stride); |
fprintf(stderr, "interpolate8x8_halfpel_h_add_altivec_c:incorrect stride, stride: %u\n", stride); |
466 |
#endif |
#endif |
505 |
d = vec_perm(vec_ld(0,dst),vec_ld(16,dst),mask_dst);\ |
d = vec_perm(vec_ld(0,dst),vec_ld(16,dst),mask_dst);\ |
506 |
\ |
\ |
507 |
tmp = vec_avg(s1,s2);\ |
tmp = vec_avg(s1,s2);\ |
508 |
s1 = vec_sub(tmp,vec_and(vec_xor(s1,s2),vec_splat_u8(1)));\ |
s1 = vec_xor(s1,s2);\ |
509 |
|
s1 = vec_sub(tmp,vec_and(s1,vec_splat_u8(1)));\ |
510 |
d = vec_avg(s1,d);\ |
d = vec_avg(s1,d);\ |
511 |
\ |
\ |
512 |
mask = vec_perm(mask_stencil,mask_stencil,mask_dst);\ |
mask = vec_perm(mask_stencil,mask_stencil,mask_dst);\ |
555 |
|
|
556 |
#ifdef DEBUG |
#ifdef DEBUG |
557 |
if(((unsigned)dst) & 0x7) |
if(((unsigned)dst) & 0x7) |
558 |
fprintf(stderr, "interpolate8x8_halfpel_v_add_altivec_c:incorrect align, dst: %x\n", dst); |
fprintf(stderr, "interpolate8x8_halfpel_v_add_altivec_c:incorrect align, dst: %lx\n", (long)dst); |
559 |
if(stride & 0x7) |
if(stride & 0x7) |
560 |
fprintf(stderr, "interpolate8x8_halfpel_v_add_altivec_c:incorrect align, dst: %u\n", stride); |
fprintf(stderr, "interpolate8x8_halfpel_v_add_altivec_c:incorrect align, dst: %u\n", stride); |
561 |
#endif |
#endif |
682 |
|
|
683 |
#ifdef DEBUG |
#ifdef DEBUG |
684 |
if(((unsigned)dst) & 0x7) |
if(((unsigned)dst) & 0x7) |
685 |
fprintf(stderr, "interpolate8x8_halfpel_hv_add_altivec_c:incorrect align, dst: %x\n",dst); |
fprintf(stderr, "interpolate8x8_halfpel_hv_add_altivec_c:incorrect align, dst: %lx\n", (long)dst); |
686 |
if(stride & 0x7) |
if(stride & 0x7) |
687 |
fprintf(stderr, "interpolate8x8_halfpel_hv_add_altivec_c:incorrect stride, stride: %u\n", stride); |
fprintf(stderr, "interpolate8x8_halfpel_hv_add_altivec_c:incorrect stride, stride: %u\n", stride); |
688 |
#endif |
#endif |