diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2003-01-16 21:54:55 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-01-16 21:54:55 +0000 |
commit | db40a39aba6a22729279ac8915b52b182473f209 (patch) | |
tree | bd67103c33705c172f5cac6838edc4899a1bfc80 /libavcodec/ppc/dsputil_altivec.h | |
parent | f44a2df04fb553ef076594daca3ed4ccab315123 (diff) | |
download | ffmpeg-db40a39aba6a22729279ac8915b52b182473f209.tar.gz |
AltiVec perf (take 2), plus a couple AltiVec functions by (Romain Dolbeau <dolbeau at irisa dot fr>)
Originally committed as revision 1464 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ppc/dsputil_altivec.h')
-rw-r--r-- | libavcodec/ppc/dsputil_altivec.h | 65 |
1 files changed, 62 insertions, 3 deletions
diff --git a/libavcodec/ppc/dsputil_altivec.h b/libavcodec/ppc/dsputil_altivec.h index 4a6043fe2f..b7b4238db9 100644 --- a/libavcodec/ppc/dsputil_altivec.h +++ b/libavcodec/ppc/dsputil_altivec.h @@ -31,13 +31,16 @@ extern int pix_sum_altivec(UINT8 * pix, int line_size); extern void diff_pixels_altivec(DCTELEM* block, const UINT8* s1, const UINT8* s2, int stride); extern void get_pixels_altivec(DCTELEM* block, const UINT8 * pixels, int line_size); -extern void gmc1_altivec(UINT8 *dst, UINT8 *src, int stride, int h, int x16, int y16, int rounder); - extern void add_bytes_altivec(uint8_t *dst, uint8_t *src, int w); +extern void put_pixels_clamped_altivec(const DCTELEM *block, UINT8 *restrict pixels, int line_size); +void put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h); +void avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h); -extern int has_altivec(void); +extern void gmc1_altivec(UINT8 *dst, UINT8 *src, int stride, int h, int x16, int y16, int rounder); +extern int has_altivec(void); +#ifdef HAVE_ALTIVEC // used to build registers permutation vectors (vcprm) // the 's' are for words in the _s_econd vector @@ -63,3 +66,59 @@ extern int has_altivec(void); #define FLOAT_p 1. #define vcii(a,b,c,d) (const vector float)(FLOAT_ ## a, FLOAT_ ## b, FLOAT_ ## c, FLOAT_ ## d) + +#ifdef ALTIVEC_TBL_PERFORMANCE_REPORT +void altivec_display_perf_report(void); +/* if you add to the enum below, also add to the perfname array + in dsputil_altivec.c */ +enum altivec_perf_index { + altivec_fft_num = 0, + altivec_gmc1_num, + altivec_dct_unquantize_h263_num, + altivec_idct_add_num, + altivec_idct_put_num, + altivec_put_pixels_clamped_num, + altivec_put_pixels16_num, + altivec_avg_pixels16_num, + altivec_perf_total +}; +enum altivec_data_index { + altivec_data_min = 0, + altivec_data_max, + altivec_data_sum, + altivec_data_num, + altivec_data_total +}; +extern unsigned long long perfdata[altivec_perf_total][altivec_data_total]; +#define ALTIVEC_TBL_DECLARE(a, cond) register unsigned long tbl_start, tbl_stop +#define ALTIVEC_TBL_START_COUNT(a, cond) do { asm("mftb %0" : "=r" (tbl_start)); } while (0) +#define ALTIVEC_TBL_STOP_COUNT(a, cond) do { \ + asm volatile("mftb %0" : "=r" (tbl_stop)); \ + if (tbl_stop > tbl_start) \ + { \ + unsigned long diff = tbl_stop - tbl_start; \ + if (cond) \ + { \ + if (diff < perfdata[a][altivec_data_min]) \ + perfdata[a][altivec_data_min] = diff; \ + if (diff > perfdata[a][altivec_data_max]) \ + perfdata[a][altivec_data_max] = diff; \ + perfdata[a][altivec_data_sum] += diff; \ + perfdata[a][altivec_data_num] ++; \ + } \ + } \ +} while (0) +#else /* ALTIVEC_TBL_PERFORMANCE_REPORT */ +#define ALTIVEC_TBL_DECLARE(a, cond) +#define ALTIVEC_TBL_START_COUNT(a, cond) +#define ALTIVEC_TBL_STOP_COUNT(a, cond) +#endif /* ALTIVEC_TBL_PERFORMANCE_REPORT */ + +#else /* HAVE_ALTIVEC */ +#ifdef ALTIVEC_USE_REFERENCE_C_CODE +#error "I can't use ALTIVEC_USE_REFERENCE_C_CODE if I don't use HAVE_ALTIVEC" +#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ +#ifdef ALTIVEC_TBL_PERFORMANCE_REPORT +#error "I can't use ALTIVEC_TBL_PERFORMANCE_REPORT if I don't use HAVE_ALTIVEC" +#endif /* ALTIVEC_TBL_PERFORMANCE_REPORT */ +#endif /* HAVE_ALTIVEC */ |