zero = vec_splat_u8(0); sad = vec_splat_u32(0);
sad = (vector unsigned int)(0);
int pix_abs16x16_y2_altivec(uint8_t *pix1, uint8_t *pix2, int line_size){    int s, i;    vector unsigned char *tv, zero;    vector unsigned char pix1v, pix2v, pix3v, avgv, t5;    vector unsigned int sad;    vector signed int sumdiffs;    uint8_t *pix3 = pix2 + line_size;    s = 0;    zero = vec_splat_u8(0);    sad = vec_splat_u32(0);    /*       Due to the fact that pix3 = pix2 + line_size, the pix3 of one       iteration becomes pix2 in the next iteration. We can use this       fact to avoid a potentially expensive unaligned read, each       time around the loop.       Read unaligned pixels into our vectors. The vectors are as follows:       pix2v: pix2[0]-pix2[15]       Split the pixel vectors into shorts    */    tv = (vector unsigned char *) &pix2[0];    pix2v = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix2[0]));        for(i=0;i<16;i++) {        /*           Read unaligned pixels into our vectors. The vectors are as follows:           pix1v: pix1[0]-pix1[15]           pix3v: pix3[0]-pix3[15]        */        tv = (vector unsigned char *) pix1;        pix1v = vec_perm(tv[0], tv[1], vec_lvsl(0, pix1));        tv = (vector unsigned char *) &pix3[0];        pix3v = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix3[0]));        /* Calculate the average vector */        avgv = vec_avg(pix2v, pix3v);        /* Calculate a sum of abs differences vector */        t5 = vec_sub(vec_max(pix1v, avgv), vec_min(pix1v, avgv));        /* Add each 4 pixel group together and put 4 results into sad */        sad = vec_sum4s(t5, sad);                pix1 += line_size;        pix2v = pix3v;        pix3 += line_size;            }        /* Sum up the four partial sums, and put the result into s */    sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero);    sumdiffs = vec_splat(sumdiffs, 3);    vec_ste(sumdiffs, 0, &s);    return s;    }