void avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)

{

POWERPC_TBL_DECLARE(altivec_avg_pixels16_num, 1);

#ifdef ALTIVEC_USE_REFERENCE_C_CODE

    int i;



POWERPC_TBL_START_COUNT(altivec_avg_pixels16_num, 1);



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

      op_avg(*((uint32_t*)(block)),(((const struct unaligned_32 *)(pixels))->l));

      op_avg(*((uint32_t*)(block+4)),(((const struct unaligned_32 *)(pixels+4))->l));

      op_avg(*((uint32_t*)(block+8)),(((const struct unaligned_32 *)(pixels+8))->l));

      op_avg(*((uint32_t*)(block+12)),(((const struct unaligned_32 *)(pixels+12))->l));

      pixels+=line_size;

      block +=line_size;

    }



POWERPC_TBL_STOP_COUNT(altivec_avg_pixels16_num, 1);



#else /* ALTIVEC_USE_REFERENCE_C_CODE */

    register vector unsigned char pixelsv1, pixelsv2, pixelsv, blockv;

    register vector unsigned char perm = vec_lvsl(0, pixels);

    int i;



POWERPC_TBL_START_COUNT(altivec_avg_pixels16_num, 1);



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

      pixelsv1 = vec_ld(0, (unsigned char*)pixels);

      pixelsv2 = vec_ld(16, (unsigned char*)pixels);

      blockv = vec_ld(0, block);

      pixelsv = vec_perm(pixelsv1, pixelsv2, perm);

      blockv = vec_avg(blockv,pixelsv);

      vec_st(blockv, 0, (unsigned char*)block);

      pixels+=line_size;

      block +=line_size;

    }



POWERPC_TBL_STOP_COUNT(altivec_avg_pixels16_num, 1);



#endif /* ALTIVEC_USE_REFERENCE_C_CODE */

}

void avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)

{

POWERPC_TBL_DECLARE(altivec_avg_pixels16_num, 1);

#ifdef ALTIVEC_USE_REFERENCE_C_CODE

    int i;



POWERPC_TBL_START_COUNT(altivec_avg_pixels16_num, 1);



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

      op_avg(*((uint32_t*)(block)),(((const struct unaligned_32 *)(pixels))->l));

      op_avg(*((uint32_t*)(block+4)),(((const struct unaligned_32 *)(pixels+4))->l));

      op_avg(*((uint32_t*)(block+8)),(((const struct unaligned_32 *)(pixels+8))->l));

      op_avg(*((uint32_t*)(block+12)),(((const struct unaligned_32 *)(pixels+12))->l));

      pixels+=line_size;

      block +=line_size;

    }



POWERPC_TBL_STOP_COUNT(altivec_avg_pixels16_num, 1);



#else 

    register vector unsigned char pixelsv1, pixelsv2, pixelsv, blockv;

    register vector unsigned char perm = vec_lvsl(0, pixels);

    int i;



POWERPC_TBL_START_COUNT(altivec_avg_pixels16_num, 1);



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

      pixelsv1 = vec_ld(0, (unsigned char*)pixels);

      pixelsv2 = vec_ld(16, (unsigned char*)pixels);

      blockv = vec_ld(0, block);

      pixelsv = vec_perm(pixelsv1, pixelsv2, perm);

      blockv = vec_avg(blockv,pixelsv);

      vec_st(blockv, 0, (unsigned char*)block);

      pixels+=line_size;

      block +=line_size;

    }



POWERPC_TBL_STOP_COUNT(altivec_avg_pixels16_num, 1);



#endif 

}

void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3)

{

POWERPC_TBL_DECLARE(altivec_avg_pixels16_num, 1);

#ifdef ALTIVEC_USE_REFERENCE_C_CODE

    int VAR_6;



POWERPC_TBL_START_COUNT(altivec_avg_pixels16_num, 1);



    for(VAR_6=0; VAR_6<VAR_3; VAR_6++) {

      op_avg(*((uint32_t*)(VAR_0)),(((const struct unaligned_32 *)(VAR_1))->l));

      op_avg(*((uint32_t*)(VAR_0+4)),(((const struct unaligned_32 *)(VAR_1+4))->l));

      op_avg(*((uint32_t*)(VAR_0+8)),(((const struct unaligned_32 *)(VAR_1+8))->l));

      op_avg(*((uint32_t*)(VAR_0+12)),(((const struct unaligned_32 *)(VAR_1+12))->l));

      VAR_1+=VAR_2;

      VAR_0 +=VAR_2;

    }



POWERPC_TBL_STOP_COUNT(altivec_avg_pixels16_num, 1);



#else 

    register vector unsigned char VAR_4, pixelsv2, pixelsv, blockv;

    register vector unsigned char VAR_5 = vec_lvsl(0, VAR_1);

    int VAR_6;



POWERPC_TBL_START_COUNT(altivec_avg_pixels16_num, 1);



    for(VAR_6=0; VAR_6<VAR_3; VAR_6++) {

      VAR_4 = vec_ld(0, (unsigned char*)VAR_1);

      pixelsv2 = vec_ld(16, (unsigned char*)VAR_1);

      blockv = vec_ld(0, VAR_0);

      pixelsv = vec_perm(VAR_4, pixelsv2, VAR_5);

      blockv = vec_avg(blockv,pixelsv);

      vec_st(blockv, 0, (unsigned char*)VAR_0);

      VAR_1+=VAR_2;

      VAR_0 +=VAR_2;

    }



POWERPC_TBL_STOP_COUNT(altivec_avg_pixels16_num, 1);



#endif 

}

void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3)
{ POWERPC_TBL_DECLARE(altivec_avg_pixels16_num, 1); #ifdef ALTIVEC_USE_REFERENCE_C_CODE
int VAR_6; POWERPC_TBL_START_COUNT(altivec_avg_pixels16_num, 1); for(VAR_6=0; VAR_6<VAR_3; VAR_6++) { op_avg(*((uint32_t*)(VAR_0)),(((const struct unaligned_32 *)(VAR_1))->l)); op_avg(*((uint32_t*)(VAR_0+4)),(((const struct unaligned_32 *)(VAR_1+4))->l)); op_avg(*((uint32_t*)(VAR_0+8)),(((const struct unaligned_32 *)(VAR_1+8))->l)); op_avg(*((uint32_t*)(VAR_0+12)),(((const struct unaligned_32 *)(VAR_1+12))->l)); VAR_1+=VAR_2; VAR_0 +=VAR_2; } POWERPC_TBL_STOP_COUNT(altivec_avg_pixels16_num, 1); #else
register vector unsigned char VAR_4, pixelsv2, pixelsv, blockv; register vector unsigned char VAR_5 = vec_lvsl(0, VAR_1); int VAR_6; POWERPC_TBL_START_COUNT(altivec_avg_pixels16_num, 1); for(VAR_6=0; VAR_6<VAR_3; VAR_6++) { VAR_4 = vec_ld(0, (unsigned char*)VAR_1); pixelsv2 = vec_ld(16, (unsigned char*)VAR_1); blockv = vec_ld(0, VAR_0); pixelsv = vec_perm(VAR_4, pixelsv2, VAR_5); blockv = vec_avg(blockv,pixelsv); vec_st(blockv, 0, (unsigned char*)VAR_0); VAR_1+=VAR_2; VAR_0 +=VAR_2; } POWERPC_TBL_STOP_COUNT(altivec_avg_pixels16_num, 1); #endif
}