From: Eric Petit Date: Sat, 14 May 2005 07:08:08 +0000 (+0000) Subject: ppc/: compile fixes for Linux/PPC (courtesy of Rasmus Rohde) and X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=04ded39b9ba4e8f0b983efcc056292f25d544b9f;p=x264.git ppc/: compile fixes for Linux/PPC (courtesy of Rasmus Rohde) and for gcc < 4 git-svn-id: svn://svn.videolan.org/x264/trunk@231 df754926-b1dd-0310-bc7b-ec298dee348c --- diff --git a/common/ppc/mc.c b/common/ppc/mc.c index cc59c0f6..7e3ed461 100644 --- a/common/ppc/mc.c +++ b/common/ppc/mc.c @@ -92,8 +92,8 @@ static inline void pixel_avg_w16( uint8_t *dst, int i_dst, PREP_STORE16; for( y = 0; y < i_height; y++ ) { - VEC_LOAD( src1, src1v, 16 ); - VEC_LOAD( src2, src2v, 16 ); + VEC_LOAD( src1, src1v, 16, vec_u8_t ); + VEC_LOAD( src2, src2v, 16, vec_u8_t ); src1v = vec_avg( src1v, src2v ); VEC_STORE16( src1v, dst ); @@ -306,14 +306,14 @@ static void mc_chroma_altivec_4xh( uint8_t *src, int i_src_stride, permv = vec_lvsl( 0, (uint8_t *) 1 ); shiftv = vec_splat_u16( 6 ); - VEC_LOAD( src, src2v_8, 5 ); + VEC_LOAD( src, src2v_8, 5, vec_u8_t ); src3v_8 = vec_perm( src2v_8, src2v_8, permv ); for( y = 0; y < i_height; y++ ) { src0v_8 = src2v_8; src1v_8 = src3v_8; - VEC_LOAD( srcp, src2v_8, 5 ); + VEC_LOAD( srcp, src2v_8, 5, vec_u8_t ); src3v_8 = vec_perm( src2v_8, src2v_8, permv ); dstv_16 = k32v; @@ -372,14 +372,14 @@ static void mc_chroma_altivec_8xh( uint8_t *src, int i_src_stride, permv = vec_lvsl( 0, (uint8_t *) 1 ); shiftv = vec_splat_u16( 6 ); - VEC_LOAD( src, src2v_8, 9 ); + VEC_LOAD( src, src2v_8, 9, vec_u8_t ); src3v_8 = vec_perm( src2v_8, src2v_8, permv ); for( y = 0; y < i_height; y++ ) { src0v_8 = src2v_8; src1v_8 = src3v_8; - VEC_LOAD( srcp, src2v_8, 9 ); + VEC_LOAD( srcp, src2v_8, 9, vec_u8_t ); src3v_8 = vec_perm( src2v_8, src2v_8, permv ); dstv_16 = k32v; diff --git a/common/ppc/pixel.c b/common/ppc/pixel.c index bc69e5a1..11243002 100644 --- a/common/ppc/pixel.c +++ b/common/ppc/pixel.c @@ -53,8 +53,8 @@ static int name( uint8_t *pix1, int i_pix1, \ vec_s32_t sumv = zero_s32v; \ for( y = 0; y < ly; y++ ) \ { \ - VEC_LOAD( pix1, pix1v, lx ); \ - VEC_LOAD( pix2, pix2v, lx ); \ + VEC_LOAD( pix1, pix1v, lx, vec_u8_t ); \ + VEC_LOAD( pix2, pix2v, lx, vec_u8_t ); \ sumv = (vec_s32_t) vec_sum4s( \ vec_sub( vec_max( pix1v, pix2v ), \ vec_min( pix1v, pix2v ) ), \ @@ -155,18 +155,18 @@ PIXEL_SAD_ALTIVEC( pixel_sad_8x8_altivec, 8, 8, 2s, 1 ) * Loads n bytes from p1 and p2, do the diff of the high elements into * d, increments p1 and p2 by i1 and i2 **********************************************************************/ -#define PREP_DIFF \ - LOAD_ZERO; \ - PREP_LOAD; \ +#define PREP_DIFF \ + LOAD_ZERO; \ + PREP_LOAD; \ vec_s16_t pix1v, pix2v; -#define VEC_DIFF_H(p1,i1,p2,i2,n,d) \ - VEC_LOAD( p1, pix1v, n ); \ - pix1v = vec_u8_to_s16( pix1v ); \ - VEC_LOAD( p2, pix2v, n ); \ - pix2v = vec_u8_to_s16( pix2v ); \ - d = vec_sub( pix1v, pix2v ); \ - p1 += i1; \ +#define VEC_DIFF_H(p1,i1,p2,i2,n,d) \ + VEC_LOAD( p1, pix1v, n, vec_s16_t ); \ + pix1v = vec_u8_to_s16( pix1v ); \ + VEC_LOAD( p2, pix2v, n, vec_s16_t ); \ + pix2v = vec_u8_to_s16( pix2v ); \ + d = vec_sub( pix1v, pix2v ); \ + p1 += i1; \ p2 += i2 /*********************************************************************** @@ -180,16 +180,16 @@ PIXEL_SAD_ALTIVEC( pixel_sad_8x8_altivec, 8, 8, 2s, 1 ) * dh, the diff of the low elements into dl, increments p1 and p2 by i1 * and i2 **********************************************************************/ -#define VEC_DIFF_HL(p1,i1,p2,i2,dh,dl) \ - VEC_LOAD( p1, pix1v, 16 ); \ - temp0v = vec_u8_to_s16_h( pix1v ); \ - temp1v = vec_u8_to_s16_l( pix1v ); \ - VEC_LOAD( p2, pix2v, 16 ); \ - temp2v = vec_u8_to_s16_h( pix2v ); \ - temp3v = vec_u8_to_s16_l( pix2v ); \ - dh = vec_sub( temp0v, temp2v ); \ - dl = vec_sub( temp1v, temp3v ); \ - p1 += i1; \ +#define VEC_DIFF_HL(p1,i1,p2,i2,dh,dl) \ + VEC_LOAD( p1, pix1v, 16, vec_s16_t ); \ + temp0v = vec_u8_to_s16_h( pix1v ); \ + temp1v = vec_u8_to_s16_l( pix1v ); \ + VEC_LOAD( p2, pix2v, 16, vec_s16_t ); \ + temp2v = vec_u8_to_s16_h( pix2v ); \ + temp3v = vec_u8_to_s16_l( pix2v ); \ + dh = vec_sub( temp0v, temp2v ); \ + dl = vec_sub( temp1v, temp3v ); \ + p1 += i1; \ p2 += i2 /*********************************************************************** diff --git a/common/ppc/ppccommon.h b/common/ppc/ppccommon.h index b298265e..35f773f1 100644 --- a/common/ppc/ppccommon.h +++ b/common/ppc/ppccommon.h @@ -68,16 +68,16 @@ /*********************************************************************** * PREP_LOAD: declares two vectors required to perform unaligned loads - * VEC_LOAD: loads n bytes from address p into vector v + * VEC_LOAD: loads n bytes from u8 * p into vector v of type t **********************************************************************/ #define PREP_LOAD \ vec_u8_t _hv, _lv -#define VEC_LOAD( p, v, n ) \ - _hv = vec_ld( 0, p ); \ - v = vec_lvsl( 0, p ); \ - _lv = vec_ld( n - 1, p ); \ - v = vec_perm( _hv, _lv, v ) +#define VEC_LOAD( p, v, n, t ) \ + _hv = vec_ld( 0, p ); \ + v = (t) vec_lvsl( 0, p ); \ + _lv = vec_ld( n - 1, p ); \ + v = (t) vec_perm( _hv, _lv, (vec_u8_t) v ) /*********************************************************************** * PREP_STORE##n: declares required vectors to store n bytes to a