From 80a61f08d2d6059b0aaffa4c8b8120fb0ab0ca75 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 24 Jul 2008 10:53:32 +0000 Subject: [PATCH] Remove AltiVec vector declaration compiler compatibility macros. The original problem was that FSF and Apple gcc used a different syntax for vector declarations, i.e. {} vs. (). Nowadays Apple gcc versions support the standard {} syntax and versions that support {} are available on all relevant Mac OS X versions. Thus the greater compatibility is no longer worth cluttering the code with macros. Originally committed as revision 14366 to svn://svn.ffmpeg.org/ffmpeg/trunk --- configure | 6 +- libavcodec/ppc/dsputil_altivec.c | 40 ++++++------- libavcodec/ppc/fdct_altivec.c | 6 +- libavcodec/ppc/h264_altivec.c | 10 ++-- libavcodec/ppc/h264_template_altivec.c | 12 ++-- libavcodec/ppc/idct_altivec.c | 10 ++-- libavcodec/ppc/mpegvideo_altivec.c | 2 +- libavcodec/ppc/util_altivec.h | 4 +- libavutil/internal.h | 8 --- libpostproc/postprocess_altivec_template.c | 68 +++++++++++----------- 10 files changed, 78 insertions(+), 88 deletions(-) diff --git a/configure b/configure index eb77a52fce..9eeca21dc9 100755 --- a/configure +++ b/configure @@ -725,7 +725,6 @@ HAVE_LIST=" $ARCH_EXT_LIST $THREADS_LIST altivec_h - altivec_vector_braces arpa_inet_h bswap byteswap_h @@ -1567,10 +1566,9 @@ int main(void) { EOF # check if our compiler supports braces for vector declarations - check_cc <>6 at the end diff --git a/libavcodec/ppc/h264_template_altivec.c b/libavcodec/ppc/h264_template_altivec.c index b4a5ddcdc5..d0f2fc0da7 100644 --- a/libavcodec/ppc/h264_template_altivec.c +++ b/libavcodec/ppc/h264_template_altivec.c @@ -102,15 +102,15 @@ void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, POWERPC_PERF_START_COUNT(PREFIX_h264_chroma_mc8_num, 1); if (((unsigned long)dst) % 16 == 0) { - fperm = (vec_u8_t)AVV(0x10, 0x11, 0x12, 0x13, + fperm = (vec_u8_t){0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x08, 0x09, 0x0A, 0x0B, - 0x0C, 0x0D, 0x0E, 0x0F); + 0x0C, 0x0D, 0x0E, 0x0F}; } else { - fperm = (vec_u8_t)AVV(0x00, 0x01, 0x02, 0x03, + fperm = (vec_u8_t){0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x18, 0x19, 0x1A, 0x1B, - 0x1C, 0x1D, 0x1E, 0x1F); + 0x1C, 0x1D, 0x1E, 0x1F}; } vsrcAuc = vec_ld(0, src); @@ -485,8 +485,8 @@ static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp, pp1A, pp1B, pp2A, pp2B, psumA, psumB; const vec_u8_t mperm = (const vec_u8_t) - AVV(0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B, - 0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F); + {0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B, + 0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F}; int16_t *tmpbis = tmp; vec_s16_t tmpM1ssA, tmpM1ssB, tmpM2ssA, tmpM2ssB, diff --git a/libavcodec/ppc/idct_altivec.c b/libavcodec/ppc/idct_altivec.c index 5d596b1acd..7acef487a6 100644 --- a/libavcodec/ppc/idct_altivec.c +++ b/libavcodec/ppc/idct_altivec.c @@ -157,11 +157,11 @@ static const_vector_s16_t constants[5] = { - AVV(23170, 13573, 6518, 21895, -23170, -21895, 32, 31), - AVV(16384, 22725, 21407, 19266, 16384, 19266, 21407, 22725), - AVV(22725, 31521, 29692, 26722, 22725, 26722, 29692, 31521), - AVV(21407, 29692, 27969, 25172, 21407, 25172, 27969, 29692), - AVV(19266, 26722, 25172, 22654, 19266, 22654, 25172, 26722) + {23170, 13573, 6518, 21895, -23170, -21895, 32, 31}, + {16384, 22725, 21407, 19266, 16384, 19266, 21407, 22725}, + {22725, 31521, 29692, 26722, 22725, 26722, 29692, 31521}, + {21407, 29692, 27969, 25172, 21407, 25172, 27969, 29692}, + {19266, 26722, 25172, 22654, 19266, 22654, 25172, 26722} }; void idct_put_altivec(uint8_t* dest, int stride, vector_s16_t* block) diff --git a/libavcodec/ppc/mpegvideo_altivec.c b/libavcodec/ppc/mpegvideo_altivec.c index f2e4fae092..4c9ae2da36 100644 --- a/libavcodec/ppc/mpegvideo_altivec.c +++ b/libavcodec/ppc/mpegvideo_altivec.c @@ -66,7 +66,7 @@ do { \ } -#define FOUROF(a) AVV(a,a,a,a) +#define FOUROF(a) {a,a,a,a} int dct_quantize_altivec(MpegEncContext* s, DCTELEM* data, int n, diff --git a/libavcodec/ppc/util_altivec.h b/libavcodec/ppc/util_altivec.h index 6a8afb1b22..74fc2ab1ce 100644 --- a/libavcodec/ppc/util_altivec.h +++ b/libavcodec/ppc/util_altivec.h @@ -43,8 +43,8 @@ #define WORD_s2 0x18,0x19,0x1a,0x1b #define WORD_s3 0x1c,0x1d,0x1e,0x1f -#define vcprm(a,b,c,d) (const vector unsigned char)AVV(WORD_ ## a, WORD_ ## b, WORD_ ## c, WORD_ ## d) -#define vcii(a,b,c,d) (const vector float)AVV(FLOAT_ ## a, FLOAT_ ## b, FLOAT_ ## c, FLOAT_ ## d) +#define vcprm(a,b,c,d) (const vector unsigned char){WORD_ ## a, WORD_ ## b, WORD_ ## c, WORD_ ## d} +#define vcii(a,b,c,d) (const vector float){FLOAT_ ## a, FLOAT_ ## b, FLOAT_ ## c, FLOAT_ ## d} // vcprmle is used to keep the same index as in the SSE version. // it's the same as vcprm, with the index inversed diff --git a/libavutil/internal.h b/libavutil/internal.h index ce4983bb2b..cc62d3b221 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -50,14 +50,6 @@ #endif #endif -#ifdef HAVE_ALTIVEC -#ifdef HAVE_ALTIVEC_VECTOR_BRACES -#define AVV(x...) {x} -#else -#define AVV(x...) (x) -#endif -#endif - #ifndef M_PI #define M_PI 3.14159265358979323846 #endif diff --git a/libpostproc/postprocess_altivec_template.c b/libpostproc/postprocess_altivec_template.c index 0842cdb629..159f99055b 100644 --- a/libpostproc/postprocess_altivec_template.c +++ b/libpostproc/postprocess_altivec_template.c @@ -184,11 +184,11 @@ static inline int vertClassify_altivec(uint8_t src[], int stride, PPContext *c) if (numEq > c->ppMode.flatnessThreshold){ const vector unsigned char mmoP1 = (const vector unsigned char) - AVV(0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, - 0x00, 0x01, 0x12, 0x13, 0x08, 0x09, 0x1A, 0x1B); + {0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, + 0x00, 0x01, 0x12, 0x13, 0x08, 0x09, 0x1A, 0x1B}; const vector unsigned char mmoP2 = (const vector unsigned char) - AVV(0x04, 0x05, 0x16, 0x17, 0x0C, 0x0D, 0x1E, 0x1F, - 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f); + {0x04, 0x05, 0x16, 0x17, 0x0C, 0x0D, 0x1E, 0x1F, + 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f}; const vector unsigned char mmoP = (const vector unsigned char) vec_lvsl(8, (unsigned char*)0); @@ -350,8 +350,8 @@ static inline void doVertLowPass_altivec(uint8_t *src, int stride, PPContext *c) COMPUTE_VR(7, 8, 9); const vector signed char neg1 = vec_splat_s8(-1); - const vector unsigned char permHH = (const vector unsigned char)AVV(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); + const vector unsigned char permHH = (const vector unsigned char){0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; #define PACK_AND_STORE(i) \ { const vector unsigned char perms##i = \ @@ -505,8 +505,8 @@ static inline void doVertDefFilter_altivec(uint8_t src[], int stride, PPContext const vector unsigned char st5 = vec_packsu(vb5plusd, (vector signed short)zero); const vector signed char neg1 = vec_splat_s8(-1); - const vector unsigned char permHH = (const vector unsigned char)AVV(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); + const vector unsigned char permHH = (const vector unsigned char){0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; #define STORE(i) \ { const vector unsigned char perms##i = \ @@ -566,8 +566,8 @@ static inline void dering_altivec(uint8_t src[], int stride, PPContext *c) { vector unsigned char v_avg; { const vector unsigned char trunc_perm = (vector unsigned char) - AVV(0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18); + {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18}; const vector unsigned char trunc_src12 = vec_perm(src1, src2, trunc_perm); const vector unsigned char trunc_src34 = vec_perm(src3, src4, trunc_perm); const vector unsigned char trunc_src56 = vec_perm(src5, src6, trunc_perm); @@ -605,11 +605,11 @@ static inline void dering_altivec(uint8_t src[], int stride, PPContext *c) { DECLARE_ALIGNED(16, signed int, S[8]); { const vector unsigned short mask1 = (vector unsigned short) - AVV(0x0001, 0x0002, 0x0004, 0x0008, - 0x0010, 0x0020, 0x0040, 0x0080); + {0x0001, 0x0002, 0x0004, 0x0008, + 0x0010, 0x0020, 0x0040, 0x0080}; const vector unsigned short mask2 = (vector unsigned short) - AVV(0x0100, 0x0200, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000); + {0x0100, 0x0200, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000}; const vector unsigned int vuint32_16 = vec_sl(vec_splat_u32(1), vec_splat_u32(4)); const vector unsigned int vuint32_1 = vec_splat_u32(1); @@ -706,33 +706,33 @@ static inline void dering_altivec(uint8_t src[], int stride, PPContext *c) { const vector unsigned int vuint32_4 = vec_splat_u32(4); const vector unsigned char permA1 = (vector unsigned char) - AVV(0x00, 0x01, 0x02, 0x10, 0x11, 0x12, 0x1F, 0x1F, - 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F); + {0x00, 0x01, 0x02, 0x10, 0x11, 0x12, 0x1F, 0x1F, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F}; const vector unsigned char permA2 = (vector unsigned char) - AVV(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x10, 0x11, - 0x12, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F); + {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x10, 0x11, + 0x12, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F}; const vector unsigned char permA1inc = (vector unsigned char) - AVV(0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; const vector unsigned char permA2inc = (vector unsigned char) - AVV(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; const vector unsigned char magic = (vector unsigned char) - AVV(0x01, 0x02, 0x01, 0x02, 0x04, 0x02, 0x01, 0x02, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + {0x01, 0x02, 0x01, 0x02, 0x04, 0x02, 0x01, 0x02, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; const vector unsigned char extractPerm = (vector unsigned char) - AVV(0x10, 0x10, 0x10, 0x01, 0x10, 0x10, 0x10, 0x01, - 0x10, 0x10, 0x10, 0x01, 0x10, 0x10, 0x10, 0x01); + {0x10, 0x10, 0x10, 0x01, 0x10, 0x10, 0x10, 0x01, + 0x10, 0x10, 0x10, 0x01, 0x10, 0x10, 0x10, 0x01}; const vector unsigned char extractPermInc = (vector unsigned char) - AVV(0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01); + {0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01}; const vector unsigned char identity = vec_lvsl(0,(unsigned char *)0); const vector unsigned char tenRight = (vector unsigned char) - AVV(0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + {0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; const vector unsigned char eightLeft = (vector unsigned char) - AVV(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08); + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08}; #define F_INIT(i) \ @@ -979,8 +979,8 @@ static inline void RENAME(tempNoiseReducer)(uint8_t *src, int stride, } const vector signed char neg1 = vec_splat_s8(-1); - const vector unsigned char permHH = (const vector unsigned char)AVV(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F); + const vector unsigned char permHH = (const vector unsigned char){0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F}; #define PACK_AND_STORE(src, i) \ const vector unsigned char perms##src##i = \