33 static int pix_norm1_altivec(
const uint8_t *pix, ptrdiff_t line_size)
36 const vector
unsigned int zero =
37 (
const vector
unsigned int) vec_splat_u32(0);
38 vector
unsigned int sv = (vector
unsigned int) vec_splat_u32(0);
39 vector
signed int sum;
41 for (
i = 0;
i < 16;
i++) {
46 vector
unsigned char pixv = vec_vsx_ld(0, pix);
49 sv = vec_msum(pixv, pixv, sv);
54 sum = vec_sums((vector
signed int) sv, (vector
signed int)
zero);
55 sum = vec_splat(sum, 3);
60 static int pix_norm1_altivec(
const uint8_t *pix, ptrdiff_t line_size)
63 const vector
unsigned int zero =
64 (
const vector
unsigned int) vec_splat_u32(0);
65 vector
unsigned char perm = vec_lvsl(0, pix);
66 vector
unsigned int sv = (vector
unsigned int) vec_splat_u32(0);
67 vector
signed int sum;
69 for (
i = 0;
i < 16;
i++) {
71 vector
unsigned char pixl = vec_ld(0, pix);
72 vector
unsigned char pixr = vec_ld(15, pix);
73 vector
unsigned char pixv = vec_perm(pixl, pixr,
perm);
76 sv = vec_msum(pixv, pixv, sv);
81 sum = vec_sums((vector
signed int) sv, (vector
signed int)
zero);
82 sum = vec_splat(sum, 3);
90 static int pix_sum_altivec(
const uint8_t *pix, ptrdiff_t line_size)
93 const vector
unsigned int zero =
94 (
const vector
unsigned int) vec_splat_u32(0);
95 vector
unsigned int sad = (vector
unsigned int) vec_splat_u32(0);
96 vector
signed int sumdiffs;
98 for (
i = 0;
i < 16;
i++) {
103 vector
unsigned char t1 = vec_vsx_ld(0, pix);
106 sad = vec_sum4s(t1, sad);
112 sumdiffs = vec_sums((vector
signed int) sad, (vector
signed int)
zero);
113 sumdiffs = vec_splat(sumdiffs, 3);
114 vec_ste(sumdiffs, 0, &
s);
118 static int pix_sum_altivec(
const uint8_t *pix, ptrdiff_t line_size)
121 const vector
unsigned int zero =
122 (
const vector
unsigned int) vec_splat_u32(0);
123 vector
unsigned char perm = vec_lvsl(0, pix);
124 vector
unsigned int sad = (vector
unsigned int) vec_splat_u32(0);
125 vector
signed int sumdiffs;
127 for (
i = 0;
i < 16;
i++) {
129 vector
unsigned char pixl = vec_ld(0, pix);
130 vector
unsigned char pixr = vec_ld(15, pix);
131 vector
unsigned char t1 = vec_perm(pixl, pixr,
perm);
134 sad = vec_sum4s(t1, sad);
140 sumdiffs = vec_sums((vector
signed int) sad, (vector
signed int)
zero);
141 sumdiffs = vec_splat(sumdiffs, 3);
142 vec_ste(sumdiffs, 0, &
s);
158 c->pix_norm1 = pix_norm1_altivec;
159 c->pix_sum = pix_sum_altivec;