34 static void gmc1_altivec(uint8_t *dst ,
const uint8_t *
src ,
35 int stride,
int h,
int x16,
int y16,
int rounder)
40 (16 - x16) * (16 - y16),
46 register const vector
unsigned char vczero =
47 (
const vector
unsigned char) vec_splat_u8(0);
48 register const vector
unsigned short vcsr8 =
49 (
const vector
unsigned short) vec_splat_u16(8);
50 register vector
unsigned char dstv, dstv2, srcvB, srcvC, srcvD;
51 register vector
unsigned short tempB, tempC, tempD;
52 unsigned long dst_odd = (
unsigned long) dst & 0x0000000F;
53 unsigned long src_really_odd = (
unsigned long)
src & 0x0000000F;
54 register vector
unsigned short tempA =
55 vec_ld(0, (
const unsigned short *) ABCD);
56 register vector
unsigned short Av = vec_splat(tempA, 0);
57 register vector
unsigned short Bv = vec_splat(tempA, 1);
58 register vector
unsigned short Cv = vec_splat(tempA, 2);
59 register vector
unsigned short Dv = vec_splat(tempA, 3);
60 register vector
unsigned short rounderV =
61 vec_splat((
vec_u16) vec_lde(0, &rounder_a), 0);
66 register vector
unsigned char src_0 = vec_ld(0,
src);
67 register vector
unsigned char src_1 = vec_ld(16,
src);
68 register vector
unsigned char srcvA = vec_perm(src_0, src_1,
71 if (src_really_odd != 0x0000000F)
74 srcvB = vec_perm(src_0, src_1, vec_lvsl(1,
src));
77 srcvA = vec_mergeh(vczero, srcvA);
78 srcvB = vec_mergeh(vczero, srcvB);
80 for (
i = 0;
i <
h;
i++) {
81 dst_odd = (
unsigned long) dst & 0x0000000F;
82 src_really_odd = (((
unsigned long)
src) +
stride) & 0x0000000F;
84 dstv = vec_ld(0, dst);
91 srcvC = vec_perm(src_0, src_1, vec_lvsl(
stride + 0,
src));
93 if (src_really_odd != 0x0000000F)
96 srcvD = vec_perm(src_0, src_1, vec_lvsl(
stride + 1,
src));
100 srcvC = vec_mergeh(vczero, srcvC);
101 srcvD = vec_mergeh(vczero, srcvD);
106 tempA = vec_mladd((vector
unsigned short) srcvA, Av, rounderV);
107 tempB = vec_mladd((vector
unsigned short) srcvB, Bv, tempA);
108 tempC = vec_mladd((vector
unsigned short) srcvC, Cv, tempB);
109 tempD = vec_mladd((vector
unsigned short) srcvD, Dv, tempC);
114 tempD = vec_sr(tempD, vcsr8);
116 dstv2 = vec_pack(tempD, (vector
unsigned short) vczero);
119 dstv2 = vec_perm(dstv, dstv2, vcprm(0, 1,
s0,
s1));
121 dstv2 = vec_perm(dstv, dstv2, vcprm(
s0,
s1, 2, 3));
123 vec_st(dstv2, 0, dst);
137 c->gmc1 = gmc1_altivec;