comparison ppc/dsputil_ppc.h @ 1951:2599b8444831 libavcodec

better hadamard8_diff16 in AltiVec, and more patch by (Romain Dolbeau <dolbeau at irisa dot fr>)
author michael
date Thu, 22 Apr 2004 13:21:59 +0000
parents 66215baae7b9
children 4c663228e020
comparison
equal deleted inserted replaced
1950:a3c60fa850dc 1951:2599b8444831
49 altivec_put_pixels8_xy2_num, 49 altivec_put_pixels8_xy2_num,
50 altivec_put_no_rnd_pixels8_xy2_num, 50 altivec_put_no_rnd_pixels8_xy2_num,
51 altivec_put_pixels16_xy2_num, 51 altivec_put_pixels16_xy2_num,
52 altivec_put_no_rnd_pixels16_xy2_num, 52 altivec_put_no_rnd_pixels16_xy2_num,
53 altivec_hadamard8_diff8x8_num, 53 altivec_hadamard8_diff8x8_num,
54 altivec_hadamard8_diff16_num,
54 powerpc_clear_blocks_dcbz32, 55 powerpc_clear_blocks_dcbz32,
55 powerpc_clear_blocks_dcbz128, 56 powerpc_clear_blocks_dcbz128,
56 powerpc_perf_total 57 powerpc_perf_total
57 }; 58 };
58 enum powerpc_data_index { 59 enum powerpc_data_index {
62 powerpc_data_num, 63 powerpc_data_num,
63 powerpc_data_total 64 powerpc_data_total
64 }; 65 };
65 extern unsigned long long perfdata[POWERPC_NUM_PMC_ENABLED][powerpc_perf_total][powerpc_data_total]; 66 extern unsigned long long perfdata[POWERPC_NUM_PMC_ENABLED][powerpc_perf_total][powerpc_data_total];
66 67
68 #ifndef POWERPC_MODE_64BITS
69 #define POWERP_PMC_DATATYPE unsigned long
67 #define POWERPC_GET_PMC1(a) asm volatile("mfspr %0, 937" : "=r" (a)) 70 #define POWERPC_GET_PMC1(a) asm volatile("mfspr %0, 937" : "=r" (a))
68 #define POWERPC_GET_PMC2(a) asm volatile("mfspr %0, 938" : "=r" (a)) 71 #define POWERPC_GET_PMC2(a) asm volatile("mfspr %0, 938" : "=r" (a))
69 #if (POWERPC_NUM_PMC_ENABLED > 2) 72 #if (POWERPC_NUM_PMC_ENABLED > 2)
70 #define POWERPC_GET_PMC3(a) asm volatile("mfspr %0, 941" : "=r" (a)) 73 #define POWERPC_GET_PMC3(a) asm volatile("mfspr %0, 941" : "=r" (a))
71 #define POWERPC_GET_PMC4(a) asm volatile("mfspr %0, 942" : "=r" (a)) 74 #define POWERPC_GET_PMC4(a) asm volatile("mfspr %0, 942" : "=r" (a))
78 #define POWERPC_GET_PMC6(a) asm volatile("mfspr %0, 930" : "=r" (a)) 81 #define POWERPC_GET_PMC6(a) asm volatile("mfspr %0, 930" : "=r" (a))
79 #else 82 #else
80 #define POWERPC_GET_PMC5(a) do {} while (0) 83 #define POWERPC_GET_PMC5(a) do {} while (0)
81 #define POWERPC_GET_PMC6(a) do {} while (0) 84 #define POWERPC_GET_PMC6(a) do {} while (0)
82 #endif 85 #endif
83 #define POWERPC_PERF_DECLARE(a, cond) unsigned long pmc_start[POWERPC_NUM_PMC_ENABLED], pmc_stop[POWERPC_NUM_PMC_ENABLED], pmc_loop_index; 86 #else /* POWERPC_MODE_64BITS */
87 #define POWERP_PMC_DATATYPE unsigned long long
88 #define POWERPC_GET_PMC1(a) asm volatile("mfspr %0, 771" : "=r" (a))
89 #define POWERPC_GET_PMC2(a) asm volatile("mfspr %0, 772" : "=r" (a))
90 #if (POWERPC_NUM_PMC_ENABLED > 2)
91 #define POWERPC_GET_PMC3(a) asm volatile("mfspr %0, 773" : "=r" (a))
92 #define POWERPC_GET_PMC4(a) asm volatile("mfspr %0, 774" : "=r" (a))
93 #else
94 #define POWERPC_GET_PMC3(a) do {} while (0)
95 #define POWERPC_GET_PMC4(a) do {} while (0)
96 #endif
97 #if (POWERPC_NUM_PMC_ENABLED > 4)
98 #define POWERPC_GET_PMC5(a) asm volatile("mfspr %0, 775" : "=r" (a))
99 #define POWERPC_GET_PMC6(a) asm volatile("mfspr %0, 776" : "=r" (a))
100 #else
101 #define POWERPC_GET_PMC5(a) do {} while (0)
102 #define POWERPC_GET_PMC6(a) do {} while (0)
103 #endif
104 #endif /* POWERPC_MODE_64BITS */
105 #define POWERPC_PERF_DECLARE(a, cond) \
106 POWERP_PMC_DATATYPE \
107 pmc_start[POWERPC_NUM_PMC_ENABLED], \
108 pmc_stop[POWERPC_NUM_PMC_ENABLED], \
109 pmc_loop_index;
84 #define POWERPC_PERF_START_COUNT(a, cond) do { \ 110 #define POWERPC_PERF_START_COUNT(a, cond) do { \
85 POWERPC_GET_PMC6(pmc_start[5]); \ 111 POWERPC_GET_PMC6(pmc_start[5]); \
86 POWERPC_GET_PMC5(pmc_start[4]); \ 112 POWERPC_GET_PMC5(pmc_start[4]); \
87 POWERPC_GET_PMC4(pmc_start[3]); \ 113 POWERPC_GET_PMC4(pmc_start[3]); \
88 POWERPC_GET_PMC3(pmc_start[2]); \ 114 POWERPC_GET_PMC3(pmc_start[2]); \
100 { \ 126 { \
101 for(pmc_loop_index = 0; \ 127 for(pmc_loop_index = 0; \
102 pmc_loop_index < POWERPC_NUM_PMC_ENABLED; \ 128 pmc_loop_index < POWERPC_NUM_PMC_ENABLED; \
103 pmc_loop_index++) \ 129 pmc_loop_index++) \
104 { \ 130 { \
105 if (pmc_stop[pmc_loop_index] >= pmc_start[pmc_loop_index]) \ 131 if (pmc_stop[pmc_loop_index] >= pmc_start[pmc_loop_index]) \
106 { \ 132 { \
107 unsigned long diff = \ 133 POWERP_PMC_DATATYPE diff = \
108 pmc_stop[pmc_loop_index] - pmc_start[pmc_loop_index]; \ 134 pmc_stop[pmc_loop_index] - pmc_start[pmc_loop_index]; \
109 if (diff < perfdata[pmc_loop_index][a][powerpc_data_min]) \ 135 if (diff < perfdata[pmc_loop_index][a][powerpc_data_min]) \
110 perfdata[pmc_loop_index][a][powerpc_data_min] = diff; \ 136 perfdata[pmc_loop_index][a][powerpc_data_min] = diff; \
111 if (diff > perfdata[pmc_loop_index][a][powerpc_data_max]) \ 137 if (diff > perfdata[pmc_loop_index][a][powerpc_data_max]) \
112 perfdata[pmc_loop_index][a][powerpc_data_max] = diff; \ 138 perfdata[pmc_loop_index][a][powerpc_data_max] = diff; \