VirtualBox

source: vbox/trunk/src/libs/ffmpeg-20060710/libavcodec/ppc/dsputil_ppc.h@ 11551

Last change on this file since 11551 was 5776, checked in by vboxsync, 17 years ago

ffmpeg: exported to OSE

File size: 6.3 KB
Line 
1/*
2 * Copyright (c) 2003-2004 Romain Dolbeau <[email protected]>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef _DSPUTIL_PPC_
20#define _DSPUTIL_PPC_
21
22#ifdef CONFIG_DARWIN
23/* The Apple assembler shipped w/ gcc-3.3 knows about DCBZL, previous assemblers don't
24 We assume here that the Darwin GCC is from Apple.... */
25#if (__GNUC__ * 100 + __GNUC_MINOR__ < 303)
26#define NO_DCBZL
27#endif
28#else /* CONFIG_DARWIN */
29/* I don't think any non-Apple assembler knows about DCBZL */
30#define NO_DCBZL
31#endif /* CONFIG_DARWIN */
32
33#ifdef POWERPC_PERFORMANCE_REPORT
34void powerpc_display_perf_report(void);
35/* the 604* have 2, the G3* have 4, the G4s have 6,
36 and the G5 are completely different (they MUST use
37 POWERPC_MODE_64BITS, and let's hope all future 64 bis PPC
38 will use the same PMCs... */
39#define POWERPC_NUM_PMC_ENABLED 6
40/* if you add to the enum below, also add to the perfname array
41 in dsputil_ppc.c */
42enum powerpc_perf_index {
43 altivec_fft_num = 0,
44 altivec_gmc1_num,
45 altivec_dct_unquantize_h263_num,
46 altivec_fdct,
47 altivec_idct_add_num,
48 altivec_idct_put_num,
49 altivec_put_pixels16_num,
50 altivec_avg_pixels16_num,
51 altivec_avg_pixels8_num,
52 altivec_put_pixels8_xy2_num,
53 altivec_put_no_rnd_pixels8_xy2_num,
54 altivec_put_pixels16_xy2_num,
55 altivec_put_no_rnd_pixels16_xy2_num,
56 altivec_hadamard8_diff8x8_num,
57 altivec_hadamard8_diff16_num,
58 altivec_avg_pixels8_xy2_num,
59 powerpc_clear_blocks_dcbz32,
60 powerpc_clear_blocks_dcbz128,
61 altivec_put_h264_chroma_mc8_num,
62 altivec_avg_h264_chroma_mc8_num,
63 altivec_put_h264_qpel16_h_lowpass_num,
64 altivec_avg_h264_qpel16_h_lowpass_num,
65 altivec_put_h264_qpel16_v_lowpass_num,
66 altivec_avg_h264_qpel16_v_lowpass_num,
67 altivec_put_h264_qpel16_hv_lowpass_num,
68 altivec_avg_h264_qpel16_hv_lowpass_num,
69 powerpc_perf_total
70};
71enum powerpc_data_index {
72 powerpc_data_min = 0,
73 powerpc_data_max,
74 powerpc_data_sum,
75 powerpc_data_num,
76 powerpc_data_total
77};
78extern unsigned long long perfdata[POWERPC_NUM_PMC_ENABLED][powerpc_perf_total][powerpc_data_total];
79
80#ifndef POWERPC_MODE_64BITS
81#define POWERP_PMC_DATATYPE unsigned long
82#define POWERPC_GET_PMC1(a) asm volatile("mfspr %0, 937" : "=r" (a))
83#define POWERPC_GET_PMC2(a) asm volatile("mfspr %0, 938" : "=r" (a))
84#if (POWERPC_NUM_PMC_ENABLED > 2)
85#define POWERPC_GET_PMC3(a) asm volatile("mfspr %0, 941" : "=r" (a))
86#define POWERPC_GET_PMC4(a) asm volatile("mfspr %0, 942" : "=r" (a))
87#else
88#define POWERPC_GET_PMC3(a) do {} while (0)
89#define POWERPC_GET_PMC4(a) do {} while (0)
90#endif
91#if (POWERPC_NUM_PMC_ENABLED > 4)
92#define POWERPC_GET_PMC5(a) asm volatile("mfspr %0, 929" : "=r" (a))
93#define POWERPC_GET_PMC6(a) asm volatile("mfspr %0, 930" : "=r" (a))
94#else
95#define POWERPC_GET_PMC5(a) do {} while (0)
96#define POWERPC_GET_PMC6(a) do {} while (0)
97#endif
98#else /* POWERPC_MODE_64BITS */
99#define POWERP_PMC_DATATYPE unsigned long long
100#define POWERPC_GET_PMC1(a) asm volatile("mfspr %0, 771" : "=r" (a))
101#define POWERPC_GET_PMC2(a) asm volatile("mfspr %0, 772" : "=r" (a))
102#if (POWERPC_NUM_PMC_ENABLED > 2)
103#define POWERPC_GET_PMC3(a) asm volatile("mfspr %0, 773" : "=r" (a))
104#define POWERPC_GET_PMC4(a) asm volatile("mfspr %0, 774" : "=r" (a))
105#else
106#define POWERPC_GET_PMC3(a) do {} while (0)
107#define POWERPC_GET_PMC4(a) do {} while (0)
108#endif
109#if (POWERPC_NUM_PMC_ENABLED > 4)
110#define POWERPC_GET_PMC5(a) asm volatile("mfspr %0, 775" : "=r" (a))
111#define POWERPC_GET_PMC6(a) asm volatile("mfspr %0, 776" : "=r" (a))
112#else
113#define POWERPC_GET_PMC5(a) do {} while (0)
114#define POWERPC_GET_PMC6(a) do {} while (0)
115#endif
116#endif /* POWERPC_MODE_64BITS */
117#define POWERPC_PERF_DECLARE(a, cond) \
118 POWERP_PMC_DATATYPE \
119 pmc_start[POWERPC_NUM_PMC_ENABLED], \
120 pmc_stop[POWERPC_NUM_PMC_ENABLED], \
121 pmc_loop_index;
122#define POWERPC_PERF_START_COUNT(a, cond) do { \
123 POWERPC_GET_PMC6(pmc_start[5]); \
124 POWERPC_GET_PMC5(pmc_start[4]); \
125 POWERPC_GET_PMC4(pmc_start[3]); \
126 POWERPC_GET_PMC3(pmc_start[2]); \
127 POWERPC_GET_PMC2(pmc_start[1]); \
128 POWERPC_GET_PMC1(pmc_start[0]); \
129 } while (0)
130#define POWERPC_PERF_STOP_COUNT(a, cond) do { \
131 POWERPC_GET_PMC1(pmc_stop[0]); \
132 POWERPC_GET_PMC2(pmc_stop[1]); \
133 POWERPC_GET_PMC3(pmc_stop[2]); \
134 POWERPC_GET_PMC4(pmc_stop[3]); \
135 POWERPC_GET_PMC5(pmc_stop[4]); \
136 POWERPC_GET_PMC6(pmc_stop[5]); \
137 if (cond) \
138 { \
139 for(pmc_loop_index = 0; \
140 pmc_loop_index < POWERPC_NUM_PMC_ENABLED; \
141 pmc_loop_index++) \
142 { \
143 if (pmc_stop[pmc_loop_index] >= pmc_start[pmc_loop_index]) \
144 { \
145 POWERP_PMC_DATATYPE diff = \
146 pmc_stop[pmc_loop_index] - pmc_start[pmc_loop_index]; \
147 if (diff < perfdata[pmc_loop_index][a][powerpc_data_min]) \
148 perfdata[pmc_loop_index][a][powerpc_data_min] = diff; \
149 if (diff > perfdata[pmc_loop_index][a][powerpc_data_max]) \
150 perfdata[pmc_loop_index][a][powerpc_data_max] = diff; \
151 perfdata[pmc_loop_index][a][powerpc_data_sum] += diff; \
152 perfdata[pmc_loop_index][a][powerpc_data_num] ++; \
153 } \
154 } \
155 } \
156} while (0)
157#else /* POWERPC_PERFORMANCE_REPORT */
158// those are needed to avoid empty statements.
159#define POWERPC_PERF_DECLARE(a, cond) int altivec_placeholder __attribute__ ((unused))
160#define POWERPC_PERF_START_COUNT(a, cond) do {} while (0)
161#define POWERPC_PERF_STOP_COUNT(a, cond) do {} while (0)
162#endif /* POWERPC_PERFORMANCE_REPORT */
163
164#endif /* _DSPUTIL_PPC_ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette