comparison ppc/dsputil_altivec.h @ 1009:3b7cc8e4b83f libavcodec

AltiVec perf (take 2), plus a couple AltiVec functions by (Romain Dolbeau <dolbeau at irisa dot fr>)
author michaelni
date Thu, 16 Jan 2003 21:54:55 +0000
parents edc10966b081
children 35cf2f4a0f8c
comparison
equal deleted inserted replaced
1008:fb6cbb8a04a3 1009:3b7cc8e4b83f
29 extern int sse16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size); 29 extern int sse16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size);
30 extern int pix_sum_altivec(UINT8 * pix, int line_size); 30 extern int pix_sum_altivec(UINT8 * pix, int line_size);
31 extern void diff_pixels_altivec(DCTELEM* block, const UINT8* s1, const UINT8* s2, int stride); 31 extern void diff_pixels_altivec(DCTELEM* block, const UINT8* s1, const UINT8* s2, int stride);
32 extern void get_pixels_altivec(DCTELEM* block, const UINT8 * pixels, int line_size); 32 extern void get_pixels_altivec(DCTELEM* block, const UINT8 * pixels, int line_size);
33 33
34 extern void add_bytes_altivec(uint8_t *dst, uint8_t *src, int w);
35 extern void put_pixels_clamped_altivec(const DCTELEM *block, UINT8 *restrict pixels, int line_size);
36 void put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h);
37 void avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h);
38
34 extern void gmc1_altivec(UINT8 *dst, UINT8 *src, int stride, int h, int x16, int y16, int rounder); 39 extern void gmc1_altivec(UINT8 *dst, UINT8 *src, int stride, int h, int x16, int y16, int rounder);
35
36 extern void add_bytes_altivec(uint8_t *dst, uint8_t *src, int w);
37 40
38 extern int has_altivec(void); 41 extern int has_altivec(void);
39 42
40 43 #ifdef HAVE_ALTIVEC
41 44
42 // used to build registers permutation vectors (vcprm) 45 // used to build registers permutation vectors (vcprm)
43 // the 's' are for words in the _s_econd vector 46 // the 's' are for words in the _s_econd vector
44 #define WORD_0 0x00,0x01,0x02,0x03 47 #define WORD_0 0x00,0x01,0x02,0x03
45 #define WORD_1 0x04,0x05,0x06,0x07 48 #define WORD_1 0x04,0x05,0x06,0x07
61 // n is _n_egative, p is _p_ositive 64 // n is _n_egative, p is _p_ositive
62 #define FLOAT_n -1. 65 #define FLOAT_n -1.
63 #define FLOAT_p 1. 66 #define FLOAT_p 1.
64 67
65 #define vcii(a,b,c,d) (const vector float)(FLOAT_ ## a, FLOAT_ ## b, FLOAT_ ## c, FLOAT_ ## d) 68 #define vcii(a,b,c,d) (const vector float)(FLOAT_ ## a, FLOAT_ ## b, FLOAT_ ## c, FLOAT_ ## d)
69
70 #ifdef ALTIVEC_TBL_PERFORMANCE_REPORT
71 void altivec_display_perf_report(void);
72 /* if you add to the enum below, also add to the perfname array
73 in dsputil_altivec.c */
74 enum altivec_perf_index {
75 altivec_fft_num = 0,
76 altivec_gmc1_num,
77 altivec_dct_unquantize_h263_num,
78 altivec_idct_add_num,
79 altivec_idct_put_num,
80 altivec_put_pixels_clamped_num,
81 altivec_put_pixels16_num,
82 altivec_avg_pixels16_num,
83 altivec_perf_total
84 };
85 enum altivec_data_index {
86 altivec_data_min = 0,
87 altivec_data_max,
88 altivec_data_sum,
89 altivec_data_num,
90 altivec_data_total
91 };
92 extern unsigned long long perfdata[altivec_perf_total][altivec_data_total];
93 #define ALTIVEC_TBL_DECLARE(a, cond) register unsigned long tbl_start, tbl_stop
94 #define ALTIVEC_TBL_START_COUNT(a, cond) do { asm("mftb %0" : "=r" (tbl_start)); } while (0)
95 #define ALTIVEC_TBL_STOP_COUNT(a, cond) do { \
96 asm volatile("mftb %0" : "=r" (tbl_stop)); \
97 if (tbl_stop > tbl_start) \
98 { \
99 unsigned long diff = tbl_stop - tbl_start; \
100 if (cond) \
101 { \
102 if (diff < perfdata[a][altivec_data_min]) \
103 perfdata[a][altivec_data_min] = diff; \
104 if (diff > perfdata[a][altivec_data_max]) \
105 perfdata[a][altivec_data_max] = diff; \
106 perfdata[a][altivec_data_sum] += diff; \
107 perfdata[a][altivec_data_num] ++; \
108 } \
109 } \
110 } while (0)
111 #else /* ALTIVEC_TBL_PERFORMANCE_REPORT */
112 #define ALTIVEC_TBL_DECLARE(a, cond)
113 #define ALTIVEC_TBL_START_COUNT(a, cond)
114 #define ALTIVEC_TBL_STOP_COUNT(a, cond)
115 #endif /* ALTIVEC_TBL_PERFORMANCE_REPORT */
116
117 #else /* HAVE_ALTIVEC */
118 #ifdef ALTIVEC_USE_REFERENCE_C_CODE
119 #error "I can't use ALTIVEC_USE_REFERENCE_C_CODE if I don't use HAVE_ALTIVEC"
120 #endif /* ALTIVEC_USE_REFERENCE_C_CODE */
121 #ifdef ALTIVEC_TBL_PERFORMANCE_REPORT
122 #error "I can't use ALTIVEC_TBL_PERFORMANCE_REPORT if I don't use HAVE_ALTIVEC"
123 #endif /* ALTIVEC_TBL_PERFORMANCE_REPORT */
124 #endif /* HAVE_ALTIVEC */