comparison ppc/gmc_altivec.c @ 1015:35cf2f4a0f8c libavcodec

PPC perf, PPC clear_block, AltiVec put_pixels8_xy2 patch by (Romain Dolbeau <dolbeau at irisa dot fr>)
author michaelni
date Sun, 19 Jan 2003 19:00:45 +0000
parents 3b7cc8e4b83f
children b4172ff70d27
comparison
equal deleted inserted replaced
1014:48349e11c9b2 1015:35cf2f4a0f8c
26 altivec-enhanced gmc1. ATM this code assume stride is a multiple of 8, 26 altivec-enhanced gmc1. ATM this code assume stride is a multiple of 8,
27 to preserve proper dst alignement. 27 to preserve proper dst alignement.
28 */ 28 */
29 void gmc1_altivec(UINT8 *dst /* align 8 */, UINT8 *src /* align1 */, int stride, int h, int x16, int y16, int rounder) 29 void gmc1_altivec(UINT8 *dst /* align 8 */, UINT8 *src /* align1 */, int stride, int h, int x16, int y16, int rounder)
30 { 30 {
31 ALTIVEC_TBL_DECLARE(altivec_gmc1_num, h == 8); 31 POWERPC_TBL_DECLARE(altivec_gmc1_num, h == 8);
32 #ifdef ALTIVEC_USE_REFERENCE_C_CODE 32 #ifdef ALTIVEC_USE_REFERENCE_C_CODE
33 const int A=(16-x16)*(16-y16); 33 const int A=(16-x16)*(16-y16);
34 const int B=( x16)*(16-y16); 34 const int B=( x16)*(16-y16);
35 const int C=(16-x16)*( y16); 35 const int C=(16-x16)*( y16);
36 const int D=( x16)*( y16); 36 const int D=( x16)*( y16);
37 int i; 37 int i;
38 38
39 ALTIVEC_TBL_START_COUNT(altivec_gmc1_num, h == 8); 39 POWERPC_TBL_START_COUNT(altivec_gmc1_num, h == 8);
40 40
41 for(i=0; i<h; i++) 41 for(i=0; i<h; i++)
42 { 42 {
43 dst[0]= (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + rounder)>>8; 43 dst[0]= (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + rounder)>>8;
44 dst[1]= (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + rounder)>>8; 44 dst[1]= (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + rounder)>>8;
50 dst[7]= (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + rounder)>>8; 50 dst[7]= (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + rounder)>>8;
51 dst+= stride; 51 dst+= stride;
52 src+= stride; 52 src+= stride;
53 } 53 }
54 54
55 ALTIVEC_TBL_STOP_COUNT(altivec_gmc1_num, h == 8); 55 POWERPC_TBL_STOP_COUNT(altivec_gmc1_num, h == 8);
56 56
57 #else /* ALTIVEC_USE_REFERENCE_C_CODE */ 57 #else /* ALTIVEC_USE_REFERENCE_C_CODE */
58 const unsigned short __attribute__ ((aligned(16))) rounder_a[8] = 58 const unsigned short __attribute__ ((aligned(16))) rounder_a[8] =
59 {rounder, rounder, rounder, rounder, 59 {rounder, rounder, rounder, rounder,
60 rounder, rounder, rounder, rounder}; 60 rounder, rounder, rounder, rounder};
73 int i; 73 int i;
74 unsigned long dst_odd = (unsigned long)dst & 0x0000000F; 74 unsigned long dst_odd = (unsigned long)dst & 0x0000000F;
75 unsigned long src_really_odd = (unsigned long)src & 0x0000000F; 75 unsigned long src_really_odd = (unsigned long)src & 0x0000000F;
76 76
77 77
78 ALTIVEC_TBL_START_COUNT(altivec_gmc1_num, h == 8); 78 POWERPC_TBL_START_COUNT(altivec_gmc1_num, h == 8);
79 79
80 tempA = vec_ld(0, (unsigned short*)ABCD); 80 tempA = vec_ld(0, (unsigned short*)ABCD);
81 Av = vec_splat(tempA, 0); 81 Av = vec_splat(tempA, 0);
82 Bv = vec_splat(tempA, 1); 82 Bv = vec_splat(tempA, 1);
83 Cv = vec_splat(tempA, 2); 83 Cv = vec_splat(tempA, 2);
161 161
162 dst += stride; 162 dst += stride;
163 src += stride; 163 src += stride;
164 } 164 }
165 165
166 ALTIVEC_TBL_STOP_COUNT(altivec_gmc1_num, h == 8); 166 POWERPC_TBL_STOP_COUNT(altivec_gmc1_num, h == 8);
167 167
168 #endif /* ALTIVEC_USE_REFERENCE_C_CODE */ 168 #endif /* ALTIVEC_USE_REFERENCE_C_CODE */
169 } 169 }