comparison ppc/gmc_altivec.c @ 1340:09b8fe0f0139 libavcodec

PPC fixes & clean-up patch by (Romain Dolbeau <dolbeau at irisa dot fr>)
author michaelni
date Fri, 04 Jul 2003 09:39:05 +0000
parents f3152eb76f1a
children e8ff4783f188
comparison
equal deleted inserted replaced
1339:338a2f6e6402 1340:09b8fe0f0139
26 26
27 /* 27 /*
28 altivec-enhanced gmc1. ATM this code assume stride is a multiple of 8, 28 altivec-enhanced gmc1. ATM this code assume stride is a multiple of 8,
29 to preserve proper dst alignement. 29 to preserve proper dst alignement.
30 */ 30 */
31 #define GMC1_PERF_COND (h==8)
31 void gmc1_altivec(uint8_t *dst /* align 8 */, uint8_t *src /* align1 */, int stride, int h, int x16, int y16, int rounder) 32 void gmc1_altivec(uint8_t *dst /* align 8 */, uint8_t *src /* align1 */, int stride, int h, int x16, int y16, int rounder)
32 { 33 {
33 POWERPC_TBL_DECLARE(altivec_gmc1_num, h == 8); 34 POWERPC_TBL_DECLARE(altivec_gmc1_num, GMC1_PERF_COND);
34 #ifdef ALTIVEC_USE_REFERENCE_C_CODE 35 #ifdef ALTIVEC_USE_REFERENCE_C_CODE
35 const int A=(16-x16)*(16-y16); 36 const int A=(16-x16)*(16-y16);
36 const int B=( x16)*(16-y16); 37 const int B=( x16)*(16-y16);
37 const int C=(16-x16)*( y16); 38 const int C=(16-x16)*( y16);
38 const int D=( x16)*( y16); 39 const int D=( x16)*( y16);
39 int i; 40 int i;
40 41
41 POWERPC_TBL_START_COUNT(altivec_gmc1_num, h == 8); 42 POWERPC_TBL_START_COUNT(altivec_gmc1_num, GMC1_PERF_COND);
42 43
43 for(i=0; i<h; i++) 44 for(i=0; i<h; i++)
44 { 45 {
45 dst[0]= (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + rounder)>>8; 46 dst[0]= (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + rounder)>>8;
46 dst[1]= (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + rounder)>>8; 47 dst[1]= (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + rounder)>>8;
52 dst[7]= (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + rounder)>>8; 53 dst[7]= (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + rounder)>>8;
53 dst+= stride; 54 dst+= stride;
54 src+= stride; 55 src+= stride;
55 } 56 }
56 57
57 POWERPC_TBL_STOP_COUNT(altivec_gmc1_num, h == 8); 58 POWERPC_TBL_STOP_COUNT(altivec_gmc1_num, GMC1_PERF_COND);
58 59
59 #else /* ALTIVEC_USE_REFERENCE_C_CODE */ 60 #else /* ALTIVEC_USE_REFERENCE_C_CODE */
60 const unsigned short __attribute__ ((aligned(16))) rounder_a[8] = 61 const unsigned short __attribute__ ((aligned(16))) rounder_a[8] =
61 {rounder, rounder, rounder, rounder, 62 {rounder, rounder, rounder, rounder,
62 rounder, rounder, rounder, rounder}; 63 rounder, rounder, rounder, rounder};
75 int i; 76 int i;
76 unsigned long dst_odd = (unsigned long)dst & 0x0000000F; 77 unsigned long dst_odd = (unsigned long)dst & 0x0000000F;
77 unsigned long src_really_odd = (unsigned long)src & 0x0000000F; 78 unsigned long src_really_odd = (unsigned long)src & 0x0000000F;
78 79
79 80
80 POWERPC_TBL_START_COUNT(altivec_gmc1_num, h == 8); 81 POWERPC_TBL_START_COUNT(altivec_gmc1_num, GMC1_PERF_COND);
81 82
82 tempA = vec_ld(0, (unsigned short*)ABCD); 83 tempA = vec_ld(0, (unsigned short*)ABCD);
83 Av = vec_splat(tempA, 0); 84 Av = vec_splat(tempA, 0);
84 Bv = vec_splat(tempA, 1); 85 Bv = vec_splat(tempA, 1);
85 Cv = vec_splat(tempA, 2); 86 Cv = vec_splat(tempA, 2);
163 164
164 dst += stride; 165 dst += stride;
165 src += stride; 166 src += stride;
166 } 167 }
167 168
168 POWERPC_TBL_STOP_COUNT(altivec_gmc1_num, h == 8); 169 POWERPC_TBL_STOP_COUNT(altivec_gmc1_num, GMC1_PERF_COND);
169 170
170 #endif /* ALTIVEC_USE_REFERENCE_C_CODE */ 171 #endif /* ALTIVEC_USE_REFERENCE_C_CODE */
171 } 172 }