comparison ppc/dsputil_ppc.c @ 8590:7a463923ecd1 libavcodec

Change semantic of CONFIG_*, HAVE_* and ARCH_*. They are now always defined to either 0 or 1.
author aurel
date Tue, 13 Jan 2009 23:44:16 +0000
parents cf4d575b1982
children 68e959302527
comparison
equal deleted inserted replaced
8589:a29b5b5c3c9d 8590:7a463923ecd1
22 22
23 #include "libavcodec/dsputil.h" 23 #include "libavcodec/dsputil.h"
24 24
25 #include "dsputil_ppc.h" 25 #include "dsputil_ppc.h"
26 26
27 #ifdef HAVE_ALTIVEC 27 #if HAVE_ALTIVEC
28 #include "dsputil_altivec.h" 28 #include "dsputil_altivec.h"
29 29
30 void fdct_altivec(int16_t *block); 30 void fdct_altivec(int16_t *block);
31 void gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h, 31 void gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h,
32 int x16, int y16, int rounder); 32 int x16, int y16, int rounder);
46 int mm_flags = 0; 46 int mm_flags = 0;
47 47
48 int mm_support(void) 48 int mm_support(void)
49 { 49 {
50 int result = 0; 50 int result = 0;
51 #ifdef HAVE_ALTIVEC 51 #if HAVE_ALTIVEC
52 if (has_altivec()) { 52 if (has_altivec()) {
53 result |= FF_MM_ALTIVEC; 53 result |= FF_MM_ALTIVEC;
54 } 54 }
55 #endif /* result */ 55 #endif /* result */
56 return result; 56 return result;
57 } 57 }
58 58
59 #ifdef CONFIG_POWERPC_PERF 59 #if CONFIG_POWERPC_PERF
60 unsigned long long perfdata[POWERPC_NUM_PMC_ENABLED][powerpc_perf_total][powerpc_data_total]; 60 unsigned long long perfdata[POWERPC_NUM_PMC_ENABLED][powerpc_perf_total][powerpc_data_total];
61 /* list below must match enum in dsputil_ppc.h */ 61 /* list below must match enum in dsputil_ppc.h */
62 static unsigned char* perfname[] = { 62 static unsigned char* perfname[] = {
63 "ff_fft_calc_altivec", 63 "ff_fft_calc_altivec",
64 "gmc1_altivec", 64 "gmc1_altivec",
89 "" 89 ""
90 }; 90 };
91 #include <stdio.h> 91 #include <stdio.h>
92 #endif 92 #endif
93 93
94 #ifdef CONFIG_POWERPC_PERF 94 #if CONFIG_POWERPC_PERF
95 void powerpc_display_perf_report(void) 95 void powerpc_display_perf_report(void)
96 { 96 {
97 int i, j; 97 int i, j;
98 av_log(NULL, AV_LOG_INFO, "PowerPC performance report\n Values are from the PMC registers, and represent whatever the registers are set to record.\n"); 98 av_log(NULL, AV_LOG_INFO, "PowerPC performance report\n Values are from the PMC registers, and represent whatever the registers are set to record.\n");
99 for(i = 0 ; i < powerpc_perf_total ; i++) { 99 for(i = 0 ; i < powerpc_perf_total ; i++) {
163 POWERPC_PERF_STOP_COUNT(powerpc_clear_blocks_dcbz32, 1); 163 POWERPC_PERF_STOP_COUNT(powerpc_clear_blocks_dcbz32, 1);
164 } 164 }
165 165
166 /* same as above, when dcbzl clear a whole 128B cache line 166 /* same as above, when dcbzl clear a whole 128B cache line
167 i.e. the PPC970 aka G5 */ 167 i.e. the PPC970 aka G5 */
168 #ifdef HAVE_DCBZL 168 #if HAVE_DCBZL
169 void clear_blocks_dcbz128_ppc(DCTELEM *blocks) 169 void clear_blocks_dcbz128_ppc(DCTELEM *blocks)
170 { 170 {
171 POWERPC_PERF_DECLARE(powerpc_clear_blocks_dcbz128, 1); 171 POWERPC_PERF_DECLARE(powerpc_clear_blocks_dcbz128, 1);
172 register int misal = ((unsigned long)blocks & 0x0000007f); 172 register int misal = ((unsigned long)blocks & 0x0000007f);
173 register int i = 0; 173 register int i = 0;
193 { 193 {
194 memset(blocks, 0, sizeof(DCTELEM)*6*64); 194 memset(blocks, 0, sizeof(DCTELEM)*6*64);
195 } 195 }
196 #endif 196 #endif
197 197
198 #ifdef HAVE_DCBZL 198 #if HAVE_DCBZL
199 /* check dcbz report how many bytes are set to 0 by dcbz */ 199 /* check dcbz report how many bytes are set to 0 by dcbz */
200 /* update 24/06/2003 : replace dcbz by dcbzl to get 200 /* update 24/06/2003 : replace dcbz by dcbzl to get
201 the intended effect (Apple "fixed" dcbz) 201 the intended effect (Apple "fixed" dcbz)
202 unfortunately this cannot be used unless the assembler 202 unfortunately this cannot be used unless the assembler
203 knows about dcbzl ... */ 203 knows about dcbzl ... */
259 break; 259 break;
260 default: 260 default:
261 break; 261 break;
262 } 262 }
263 263
264 #ifdef HAVE_ALTIVEC 264 #if HAVE_ALTIVEC
265 if(ENABLE_H264_DECODER) dsputil_h264_init_ppc(c, avctx); 265 if(ENABLE_H264_DECODER) dsputil_h264_init_ppc(c, avctx);
266 266
267 if (has_altivec()) { 267 if (has_altivec()) {
268 mm_flags |= FF_MM_ALTIVEC; 268 mm_flags |= FF_MM_ALTIVEC;
269 269
273 vc1dsp_init_altivec(c, avctx); 273 vc1dsp_init_altivec(c, avctx);
274 float_init_altivec(c, avctx); 274 float_init_altivec(c, avctx);
275 int_init_altivec(c, avctx); 275 int_init_altivec(c, avctx);
276 c->gmc1 = gmc1_altivec; 276 c->gmc1 = gmc1_altivec;
277 277
278 #ifdef CONFIG_ENCODERS 278 #if CONFIG_ENCODERS
279 if (avctx->dct_algo == FF_DCT_AUTO || 279 if (avctx->dct_algo == FF_DCT_AUTO ||
280 avctx->dct_algo == FF_DCT_ALTIVEC) { 280 avctx->dct_algo == FF_DCT_ALTIVEC) {
281 c->fdct = fdct_altivec; 281 c->fdct = fdct_altivec;
282 } 282 }
283 #endif //CONFIG_ENCODERS 283 #endif //CONFIG_ENCODERS
289 c->idct_add = idct_add_altivec; 289 c->idct_add = idct_add_altivec;
290 c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; 290 c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
291 } 291 }
292 } 292 }
293 293
294 #ifdef CONFIG_POWERPC_PERF 294 #if CONFIG_POWERPC_PERF
295 { 295 {
296 int i, j; 296 int i, j;
297 for (i = 0 ; i < powerpc_perf_total ; i++) { 297 for (i = 0 ; i < powerpc_perf_total ; i++) {
298 for (j = 0; j < POWERPC_NUM_PMC_ENABLED ; j++) { 298 for (j = 0; j < POWERPC_NUM_PMC_ENABLED ; j++) {
299 perfdata[j][i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFFULL; 299 perfdata[j][i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFFULL;