Mercurial > libavcodec.hg
annotate dsputil.h @ 19:82d4c9be9873 libavcodec
MMX/MMXEXT iDCT support, using external functions currently defined in libmpeg2
Gives average 13-20% mpeg decoding speedup on x86 systems.
| author | arpi_esp |
|---|---|
| date | Fri, 03 Aug 2001 18:33:03 +0000 |
| parents | ec4642daa6fe |
| children | 2733a4c1c693 |
| rev | line source |
|---|---|
| 0 | 1 #ifndef DSPUTIL_H |
| 2 #define DSPUTIL_H | |
| 3 | |
| 4 #include "common.h" | |
| 5 #include <inttypes.h> | |
| 6 | |
| 7 /* dct code */ | |
| 8 typedef short DCTELEM; | |
| 9 | |
| 10 void jpeg_fdct_ifast (DCTELEM *data); | |
| 11 | |
| 12 void j_rev_dct (DCTELEM *data); | |
| 13 | |
| 14 void fdct_mmx(DCTELEM *block); | |
| 15 | |
| 16 void (*av_fdct)(DCTELEM *block); | |
| 17 | |
| 18 /* pixel operations */ | |
| 19 #define MAX_NEG_CROP 384 | |
| 20 | |
| 21 /* temporary */ | |
| 22 extern UINT32 squareTbl[512]; | |
| 23 | |
| 24 void dsputil_init(void); | |
| 25 | |
| 26 /* pixel ops : interface with DCT */ | |
| 27 | |
|
19
82d4c9be9873
MMX/MMXEXT iDCT support, using external functions currently defined in libmpeg2
arpi_esp
parents:
6
diff
changeset
|
28 extern void (*ff_idct)(DCTELEM *block); |
| 0 | 29 extern void (*get_pixels)(DCTELEM *block, const UINT8 *pixels, int line_size); |
| 30 extern void (*put_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size); | |
| 31 extern void (*add_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size); | |
| 32 | |
| 33 void get_pixels_c(DCTELEM *block, const UINT8 *pixels, int line_size); | |
| 34 void put_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size); | |
| 35 void add_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size); | |
| 36 | |
| 37 /* add and put pixel (decoding) */ | |
| 38 typedef void (*op_pixels_func)(UINT8 *block, const UINT8 *pixels, int line_size, int h); | |
| 39 | |
| 40 extern op_pixels_func put_pixels_tab[4]; | |
| 41 extern op_pixels_func avg_pixels_tab[4]; | |
| 42 extern op_pixels_func put_no_rnd_pixels_tab[4]; | |
| 43 extern op_pixels_func avg_no_rnd_pixels_tab[4]; | |
| 44 | |
| 45 /* sub pixel (encoding) */ | |
| 46 extern void (*sub_pixels_tab[4])(DCTELEM *block, const UINT8 *pixels, int line_size, int h); | |
| 47 | |
| 48 #define sub_pixels_2(block, pixels, line_size, dxy) \ | |
| 49 sub_pixels_tab[dxy](block, pixels, line_size, 8) | |
| 50 | |
| 51 /* motion estimation */ | |
| 52 | |
| 53 typedef int (*op_pixels_abs_func)(UINT8 *blk1, UINT8 *blk2, int line_size, int h); | |
| 54 | |
| 55 extern op_pixels_abs_func pix_abs16x16; | |
| 56 extern op_pixels_abs_func pix_abs16x16_x2; | |
| 57 extern op_pixels_abs_func pix_abs16x16_y2; | |
| 58 extern op_pixels_abs_func pix_abs16x16_xy2; | |
| 59 | |
| 60 int pix_abs16x16_c(UINT8 *blk1, UINT8 *blk2, int lx, int h); | |
| 61 int pix_abs16x16_x2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h); | |
| 62 int pix_abs16x16_y2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h); | |
| 63 int pix_abs16x16_xy2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h); | |
| 64 | |
| 2 | 65 #ifdef HAVE_MMX |
| 0 | 66 |
| 67 #define MM_MMX 0x0001 /* standard MMX */ | |
| 68 #define MM_3DNOW 0x0004 /* AMD 3DNOW */ | |
| 69 #define MM_MMXEXT 0x0002 /* SSE integer functions or AMD MMX ext */ | |
| 70 #define MM_SSE 0x0008 /* SSE functions */ | |
| 71 #define MM_SSE2 0x0010 /* PIV SSE2 functions */ | |
| 72 | |
| 73 extern int mm_flags; | |
| 74 | |
| 75 int mm_support(void); | |
| 76 | |
| 77 static inline void emms(void) | |
| 78 { | |
|
6
ec4642daa6fe
added emms_c() macro which should can used in c code in both mmx/non mmx cases
glantau
parents:
2
diff
changeset
|
79 __asm __volatile ("emms;":::"memory"); |
|
ec4642daa6fe
added emms_c() macro which should can used in c code in both mmx/non mmx cases
glantau
parents:
2
diff
changeset
|
80 } |
|
ec4642daa6fe
added emms_c() macro which should can used in c code in both mmx/non mmx cases
glantau
parents:
2
diff
changeset
|
81 |
|
ec4642daa6fe
added emms_c() macro which should can used in c code in both mmx/non mmx cases
glantau
parents:
2
diff
changeset
|
82 #define emms_c() \ |
|
ec4642daa6fe
added emms_c() macro which should can used in c code in both mmx/non mmx cases
glantau
parents:
2
diff
changeset
|
83 {\ |
|
ec4642daa6fe
added emms_c() macro which should can used in c code in both mmx/non mmx cases
glantau
parents:
2
diff
changeset
|
84 if (mm_flags & MM_MMX)\ |
|
ec4642daa6fe
added emms_c() macro which should can used in c code in both mmx/non mmx cases
glantau
parents:
2
diff
changeset
|
85 emms();\ |
| 0 | 86 } |
| 87 | |
| 88 #define __align8 __attribute__ ((aligned (8))) | |
| 89 | |
| 90 void dsputil_init_mmx(void); | |
| 91 | |
| 92 #else | |
| 93 | |
|
6
ec4642daa6fe
added emms_c() macro which should can used in c code in both mmx/non mmx cases
glantau
parents:
2
diff
changeset
|
94 #define emms_c() |
|
ec4642daa6fe
added emms_c() macro which should can used in c code in both mmx/non mmx cases
glantau
parents:
2
diff
changeset
|
95 |
| 0 | 96 #define __align8 |
| 97 | |
| 98 #endif | |
| 99 | |
| 100 #endif |
