diff options
Diffstat (limited to 'src/libffmpeg/libavcodec/ppc/idct_altivec.c')
-rw-r--r-- | src/libffmpeg/libavcodec/ppc/idct_altivec.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/libffmpeg/libavcodec/ppc/idct_altivec.c b/src/libffmpeg/libavcodec/ppc/idct_altivec.c index 8036d403f..1619f1731 100644 --- a/src/libffmpeg/libavcodec/ppc/idct_altivec.c +++ b/src/libffmpeg/libavcodec/ppc/idct_altivec.c @@ -38,6 +38,7 @@ #include <stdlib.h> /* malloc(), free() */ #include <string.h> #include "../dsputil.h" +#include "dsputil_altivec.h" #define vector_s16_t vector signed short #define vector_u16_t vector unsigned short @@ -150,6 +151,8 @@ vx6 = vec_sra (vy6, shift); \ vx7 = vec_sra (vy7, shift); + +#ifdef CONFIG_DARWIN static const vector_s16_t constants[5] = { (vector_s16_t)(23170, 13573, 6518, 21895, -23170, -21895, 32, 31), (vector_s16_t)(16384, 22725, 21407, 19266, 16384, 19266, 21407, 22725), @@ -157,11 +160,30 @@ static const vector_s16_t constants[5] = { (vector_s16_t)(21407, 29692, 27969, 25172, 21407, 25172, 27969, 29692), (vector_s16_t)(19266, 26722, 25172, 22654, 19266, 22654, 25172, 26722) }; +#else +// broken gcc +static const vector_s16_t constants[5] = { + (vector_s16_t){23170, 13573, 6518, 21895, -23170, -21895, 32, 31}, + (vector_s16_t){16384, 22725, 21407, 19266, 16384, 19266, 21407, 22725}, + (vector_s16_t){22725, 31521, 29692, 26722, 22725, 26722, 29692, 31521}, + (vector_s16_t){21407, 29692, 27969, 25172, 21407, 25172, 27969, 29692}, + (vector_s16_t){19266, 26722, 25172, 22654, 19266, 22654, 25172, 26722} +}; +#endif void idct_put_altivec(uint8_t* dest, int stride, vector_s16_t* block) { +POWERPC_TBL_DECLARE(altivec_idct_put_num, 1); +#ifdef ALTIVEC_USE_REFERENCE_C_CODE +POWERPC_TBL_START_COUNT(altivec_idct_put_num, 1); + void simple_idct_put(UINT8 *dest, int line_size, INT16 *block); + simple_idct_put(dest, stride, (INT16*)block); +POWERPC_TBL_STOP_COUNT(altivec_idct_put_num, 1); +#else /* ALTIVEC_USE_REFERENCE_C_CODE */ vector_u8_t tmp; +POWERPC_TBL_START_COUNT(altivec_idct_put_num, 1); + IDCT #define COPY(dest,src) \ @@ -177,16 +199,28 @@ void idct_put_altivec(uint8_t* dest, int stride, vector_s16_t* block) COPY (dest, vx5) dest += stride; COPY (dest, vx6) dest += stride; COPY (dest, vx7) + +POWERPC_TBL_STOP_COUNT(altivec_idct_put_num, 1); +#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } void idct_add_altivec(uint8_t* dest, int stride, vector_s16_t* block) { +POWERPC_TBL_DECLARE(altivec_idct_add_num, 1); +#ifdef ALTIVEC_USE_REFERENCE_C_CODE +POWERPC_TBL_START_COUNT(altivec_idct_add_num, 1); + void simple_idct_add(UINT8 *dest, int line_size, INT16 *block); + simple_idct_add(dest, stride, (INT16*)block); +POWERPC_TBL_STOP_COUNT(altivec_idct_add_num, 1); +#else /* ALTIVEC_USE_REFERENCE_C_CODE */ vector_u8_t tmp; vector_s16_t tmp2, tmp3; vector_u8_t perm0; vector_u8_t perm1; vector_u8_t p0, p1, p; +POWERPC_TBL_START_COUNT(altivec_idct_add_num, 1); + IDCT p0 = vec_lvsl (0, dest); @@ -212,5 +246,8 @@ void idct_add_altivec(uint8_t* dest, int stride, vector_s16_t* block) ADD (dest, vx5, perm1) dest += stride; ADD (dest, vx6, perm0) dest += stride; ADD (dest, vx7, perm1) + +POWERPC_TBL_STOP_COUNT(altivec_idct_add_num, 1); +#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } |