static int pix_sum_altivec(uint8_t *pix, int line_size)

{

    int i, s;

    const vector unsigned int zero =

        (const vector unsigned int) vec_splat_u32(0);

    vector unsigned int sad = (vector unsigned int) vec_splat_u32(0);

    vector signed int sumdiffs;



    for (i = 0; i < 16; i++) {

        /* Read the potentially unaligned 16 pixels into t1. */

        //vector unsigned char pixl = vec_ld(0,  pix);

        //vector unsigned char pixr = vec_ld(15, pix);

        //vector unsigned char t1   = vec_perm(pixl, pixr, perm);

        vector unsigned char t1   = vec_vsx_ld(0,  pix);



        /* Add each 4 pixel group together and put 4 results into sad. */

        sad = vec_sum4s(t1, sad);



        pix += 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_vsx_st(sumdiffs, 0, &s);

    return s;

}

static int pix_sum_altivec(uint8_t *pix, int line_size)

{

    int i, s;

    const vector unsigned int zero =

        (const vector unsigned int) vec_splat_u32(0);

    vector unsigned int sad = (vector unsigned int) vec_splat_u32(0);

    vector signed int sumdiffs;



    for (i = 0; i < 16; i++) {

        

        

        

        

        vector unsigned char t1   = vec_vsx_ld(0,  pix);



        

        sad = vec_sum4s(t1, sad);



        pix += line_size;

    }



    

    sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero);

    sumdiffs = vec_splat(sumdiffs, 3);

    vec_vsx_st(sumdiffs, 0, &s);

    return s;

}

    vec_vsx_st(sumdiffs, 0, &s);
static int FUNC_0(uint8_t *VAR_0, int VAR_1)

{

    int VAR_2, VAR_3;

    const vector unsigned int VAR_4 =

        (const vector unsigned int) vec_splat_u32(0);

    vector unsigned int sad = (vector unsigned int) vec_splat_u32(0);

    vector signed int sumdiffs;



    for (VAR_2 = 0; VAR_2 < 16; VAR_2++) {

        

        

        

        

        vector unsigned char t1   = vec_vsx_ld(0,  VAR_0);



        

        sad = vec_sum4s(t1, sad);



        VAR_0 += VAR_1;

    }



    

    sumdiffs = vec_sums((vector signed int) sad, (vector signed int) VAR_4);

    sumdiffs = vec_splat(sumdiffs, 3);

    vec_vsx_st(sumdiffs, 0, &VAR_3);

    return VAR_3;

}

static int FUNC_0(uint8_t *VAR_0, int VAR_1)
{ int VAR_2, VAR_3; const vector unsigned int VAR_4 =
(const vector unsigned int) vec_splat_u32(0); vector unsigned int sad = (vector unsigned int) vec_splat_u32(0); vector signed int sumdiffs; for (VAR_2 = 0; VAR_2 < 16; VAR_2++) { vector unsigned char t1   = vec_vsx_ld(0,  VAR_0); sad = vec_sum4s(t1, sad); VAR_0 += VAR_1; } sumdiffs = vec_sums((vector signed int) sad, (vector signed int) VAR_4); sumdiffs = vec_splat(sumdiffs, 3); vec_vsx_st(sumdiffs, 0, &VAR_3); return VAR_3; }