Mercurial > libavcodec.hg
comparison ppc/dsputil_ppc.h @ 7333:a8a79f5385f6 libavcodec
cosmetics: Reformat PPC code in libavcodec according to style guidelines.
This includes indentation changes, comment reformatting, consistent brace
placement and some prettyprinting.
author | diego |
---|---|
date | Sun, 20 Jul 2008 18:58:30 +0000 |
parents | 1d83e9c34641 |
children | c4a4495715dd |
comparison
equal
deleted
inserted
replaced
7332:b1003e468c3d | 7333:a8a79f5385f6 |
---|---|
29 will use the same PMCs... */ | 29 will use the same PMCs... */ |
30 #define POWERPC_NUM_PMC_ENABLED 6 | 30 #define POWERPC_NUM_PMC_ENABLED 6 |
31 /* if you add to the enum below, also add to the perfname array | 31 /* if you add to the enum below, also add to the perfname array |
32 in dsputil_ppc.c */ | 32 in dsputil_ppc.c */ |
33 enum powerpc_perf_index { | 33 enum powerpc_perf_index { |
34 altivec_fft_num = 0, | 34 altivec_fft_num = 0, |
35 altivec_gmc1_num, | 35 altivec_gmc1_num, |
36 altivec_dct_unquantize_h263_num, | 36 altivec_dct_unquantize_h263_num, |
37 altivec_fdct, | 37 altivec_fdct, |
38 altivec_idct_add_num, | 38 altivec_idct_add_num, |
39 altivec_idct_put_num, | 39 altivec_idct_put_num, |
40 altivec_put_pixels16_num, | 40 altivec_put_pixels16_num, |
41 altivec_avg_pixels16_num, | 41 altivec_avg_pixels16_num, |
42 altivec_avg_pixels8_num, | 42 altivec_avg_pixels8_num, |
43 altivec_put_pixels8_xy2_num, | 43 altivec_put_pixels8_xy2_num, |
44 altivec_put_no_rnd_pixels8_xy2_num, | 44 altivec_put_no_rnd_pixels8_xy2_num, |
45 altivec_put_pixels16_xy2_num, | 45 altivec_put_pixels16_xy2_num, |
46 altivec_put_no_rnd_pixels16_xy2_num, | 46 altivec_put_no_rnd_pixels16_xy2_num, |
47 altivec_hadamard8_diff8x8_num, | 47 altivec_hadamard8_diff8x8_num, |
48 altivec_hadamard8_diff16_num, | 48 altivec_hadamard8_diff16_num, |
49 altivec_avg_pixels8_xy2_num, | 49 altivec_avg_pixels8_xy2_num, |
50 powerpc_clear_blocks_dcbz32, | 50 powerpc_clear_blocks_dcbz32, |
51 powerpc_clear_blocks_dcbz128, | 51 powerpc_clear_blocks_dcbz128, |
52 altivec_put_h264_chroma_mc8_num, | 52 altivec_put_h264_chroma_mc8_num, |
53 altivec_avg_h264_chroma_mc8_num, | 53 altivec_avg_h264_chroma_mc8_num, |
54 altivec_put_h264_qpel16_h_lowpass_num, | 54 altivec_put_h264_qpel16_h_lowpass_num, |
55 altivec_avg_h264_qpel16_h_lowpass_num, | 55 altivec_avg_h264_qpel16_h_lowpass_num, |
56 altivec_put_h264_qpel16_v_lowpass_num, | 56 altivec_put_h264_qpel16_v_lowpass_num, |
57 altivec_avg_h264_qpel16_v_lowpass_num, | 57 altivec_avg_h264_qpel16_v_lowpass_num, |
58 altivec_put_h264_qpel16_hv_lowpass_num, | 58 altivec_put_h264_qpel16_hv_lowpass_num, |
59 altivec_avg_h264_qpel16_hv_lowpass_num, | 59 altivec_avg_h264_qpel16_hv_lowpass_num, |
60 powerpc_perf_total | 60 powerpc_perf_total |
61 }; | 61 }; |
62 enum powerpc_data_index { | 62 enum powerpc_data_index { |
63 powerpc_data_min = 0, | 63 powerpc_data_min = 0, |
64 powerpc_data_max, | 64 powerpc_data_max, |
65 powerpc_data_sum, | 65 powerpc_data_sum, |
66 powerpc_data_num, | 66 powerpc_data_num, |
67 powerpc_data_total | 67 powerpc_data_total |
68 }; | 68 }; |
69 extern unsigned long long perfdata[POWERPC_NUM_PMC_ENABLED][powerpc_perf_total][powerpc_data_total]; | 69 extern unsigned long long perfdata[POWERPC_NUM_PMC_ENABLED][powerpc_perf_total][powerpc_data_total]; |
70 | 70 |
71 #ifndef HAVE_PPC64 | 71 #ifndef HAVE_PPC64 |
72 #define POWERP_PMC_DATATYPE unsigned long | 72 #define POWERP_PMC_DATATYPE unsigned long |
103 #else | 103 #else |
104 #define POWERPC_GET_PMC5(a) do {} while (0) | 104 #define POWERPC_GET_PMC5(a) do {} while (0) |
105 #define POWERPC_GET_PMC6(a) do {} while (0) | 105 #define POWERPC_GET_PMC6(a) do {} while (0) |
106 #endif | 106 #endif |
107 #endif /* HAVE_PPC64 */ | 107 #endif /* HAVE_PPC64 */ |
108 #define POWERPC_PERF_DECLARE(a, cond) \ | 108 #define POWERPC_PERF_DECLARE(a, cond) \ |
109 POWERP_PMC_DATATYPE \ | 109 POWERP_PMC_DATATYPE \ |
110 pmc_start[POWERPC_NUM_PMC_ENABLED], \ | 110 pmc_start[POWERPC_NUM_PMC_ENABLED], \ |
111 pmc_stop[POWERPC_NUM_PMC_ENABLED], \ | 111 pmc_stop[POWERPC_NUM_PMC_ENABLED], \ |
112 pmc_loop_index; | 112 pmc_loop_index; |
113 #define POWERPC_PERF_START_COUNT(a, cond) do { \ | 113 #define POWERPC_PERF_START_COUNT(a, cond) do { \ |
114 POWERPC_GET_PMC6(pmc_start[5]); \ | 114 POWERPC_GET_PMC6(pmc_start[5]); \ |
115 POWERPC_GET_PMC5(pmc_start[4]); \ | 115 POWERPC_GET_PMC5(pmc_start[4]); \ |
116 POWERPC_GET_PMC4(pmc_start[3]); \ | 116 POWERPC_GET_PMC4(pmc_start[3]); \ |
117 POWERPC_GET_PMC3(pmc_start[2]); \ | 117 POWERPC_GET_PMC3(pmc_start[2]); \ |
118 POWERPC_GET_PMC2(pmc_start[1]); \ | 118 POWERPC_GET_PMC2(pmc_start[1]); \ |
119 POWERPC_GET_PMC1(pmc_start[0]); \ | 119 POWERPC_GET_PMC1(pmc_start[0]); \ |
120 } while (0) | 120 } while (0) |
121 #define POWERPC_PERF_STOP_COUNT(a, cond) do { \ | 121 #define POWERPC_PERF_STOP_COUNT(a, cond) do { \ |
122 POWERPC_GET_PMC1(pmc_stop[0]); \ | 122 POWERPC_GET_PMC1(pmc_stop[0]); \ |
123 POWERPC_GET_PMC2(pmc_stop[1]); \ | 123 POWERPC_GET_PMC2(pmc_stop[1]); \ |
124 POWERPC_GET_PMC3(pmc_stop[2]); \ | 124 POWERPC_GET_PMC3(pmc_stop[2]); \ |
125 POWERPC_GET_PMC4(pmc_stop[3]); \ | 125 POWERPC_GET_PMC4(pmc_stop[3]); \ |
126 POWERPC_GET_PMC5(pmc_stop[4]); \ | 126 POWERPC_GET_PMC5(pmc_stop[4]); \ |
127 POWERPC_GET_PMC6(pmc_stop[5]); \ | 127 POWERPC_GET_PMC6(pmc_stop[5]); \ |
128 if (cond) \ | 128 if (cond) { \ |
129 { \ | 129 for(pmc_loop_index = 0; \ |
130 for(pmc_loop_index = 0; \ | 130 pmc_loop_index < POWERPC_NUM_PMC_ENABLED; \ |
131 pmc_loop_index < POWERPC_NUM_PMC_ENABLED; \ | 131 pmc_loop_index++) { \ |
132 pmc_loop_index++) \ | 132 if (pmc_stop[pmc_loop_index] >= pmc_start[pmc_loop_index]) { \ |
133 { \ | 133 POWERP_PMC_DATATYPE diff = \ |
134 if (pmc_stop[pmc_loop_index] >= pmc_start[pmc_loop_index]) \ | 134 pmc_stop[pmc_loop_index] - pmc_start[pmc_loop_index]; \ |
135 { \ | 135 if (diff < perfdata[pmc_loop_index][a][powerpc_data_min]) \ |
136 POWERP_PMC_DATATYPE diff = \ | 136 perfdata[pmc_loop_index][a][powerpc_data_min] = diff; \ |
137 pmc_stop[pmc_loop_index] - pmc_start[pmc_loop_index]; \ | 137 if (diff > perfdata[pmc_loop_index][a][powerpc_data_max]) \ |
138 if (diff < perfdata[pmc_loop_index][a][powerpc_data_min]) \ | 138 perfdata[pmc_loop_index][a][powerpc_data_max] = diff; \ |
139 perfdata[pmc_loop_index][a][powerpc_data_min] = diff; \ | 139 perfdata[pmc_loop_index][a][powerpc_data_sum] += diff; \ |
140 if (diff > perfdata[pmc_loop_index][a][powerpc_data_max]) \ | 140 perfdata[pmc_loop_index][a][powerpc_data_num] ++; \ |
141 perfdata[pmc_loop_index][a][powerpc_data_max] = diff; \ | 141 } \ |
142 perfdata[pmc_loop_index][a][powerpc_data_sum] += diff; \ | 142 } \ |
143 perfdata[pmc_loop_index][a][powerpc_data_num] ++; \ | 143 } \ |
144 } \ | |
145 } \ | |
146 } \ | |
147 } while (0) | 144 } while (0) |
148 #else /* CONFIG_POWERPC_PERF */ | 145 #else /* CONFIG_POWERPC_PERF */ |
149 // those are needed to avoid empty statements. | 146 // those are needed to avoid empty statements. |
150 #define POWERPC_PERF_DECLARE(a, cond) int altivec_placeholder __attribute__ ((unused)) | 147 #define POWERPC_PERF_DECLARE(a, cond) int altivec_placeholder __attribute__ ((unused)) |
151 #define POWERPC_PERF_START_COUNT(a, cond) do {} while (0) | 148 #define POWERPC_PERF_START_COUNT(a, cond) do {} while (0) |