Mercurial > libavcodec.hg
comparison ppc/dsputil_altivec.c @ 978:fd31916942ef libavcodec
suppressed pix_norm_altivec
author | bellard |
---|---|
date | Tue, 07 Jan 2003 22:51:32 +0000 |
parents | 2cef5c4c0ca6 |
children | 8bec850dc9c7 |
comparison
equal
deleted
inserted
replaced
977:3c2b94407f02 | 978:fd31916942ef |
---|---|
341 vec_ste(sum, 0, &s); | 341 vec_ste(sum, 0, &s); |
342 | 342 |
343 return s; | 343 return s; |
344 } | 344 } |
345 | 345 |
346 | |
347 int pix_norm_altivec(uint8_t *pix1, uint8_t *pix2, int line_size) | |
348 { | |
349 int s, i; | |
350 vector unsigned char *tv, zero; | |
351 vector unsigned char pix1v, pix2v, t5; | |
352 vector unsigned int sv; | |
353 vector signed int sum; | |
354 | |
355 zero = vec_splat_u8(0); | |
356 sv = vec_splat_u32(0); | |
357 s = 0; | |
358 for (i = 0; i < 16; i++) { | |
359 /* Read in the potentially unaligned pixels */ | |
360 tv = (vector unsigned char *) pix1; | |
361 pix1v = vec_perm(tv[0], tv[1], vec_lvsl(0, pix1)); | |
362 | |
363 tv = (vector unsigned char *) pix2; | |
364 pix2v = vec_perm(tv[0], tv[1], vec_lvsl(0, pix2)); | |
365 | |
366 /* | |
367 Since we want to use unsigned chars, we can take advantage | |
368 of the fact that abs(a-b)^2 = (a-b)^2. | |
369 */ | |
370 | |
371 /* Calculate a sum of abs differences vector */ | |
372 t5 = vec_sub(vec_max(pix1v, pix2v), vec_min(pix1v, pix2v)); | |
373 | |
374 /* Square the values and add them to our sum */ | |
375 sv = vec_msum(t5, t5, sv); | |
376 | |
377 pix1 += line_size; | |
378 pix2 += line_size; | |
379 } | |
380 /* Sum up the four partial sums, and put the result into s */ | |
381 sum = vec_sums((vector signed int) sv, (vector signed int) zero); | |
382 sum = vec_splat(sum, 3); | |
383 vec_ste(sum, 0, &s); | |
384 return s; | |
385 } | |
386 | |
387 | |
388 int pix_sum_altivec(UINT8 * pix, int line_size) | 346 int pix_sum_altivec(UINT8 * pix, int line_size) |
389 { | 347 { |
390 | 348 |
391 vector unsigned char perm, *pixv; | 349 vector unsigned char perm, *pixv; |
392 vector unsigned char t1; | 350 vector unsigned char t1; |