annotate dsputil.h @ 62:4bfc845cdfea libavcodec

arm optimizations
author glantau
date Mon, 13 Aug 2001 21:45:36 +0000
parents 4ea4c10d03d8
children 06f63b58d2a8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1 #ifndef DSPUTIL_H
986e461dc072 Initial revision
glantau
parents:
diff changeset
2 #define DSPUTIL_H
986e461dc072 Initial revision
glantau
parents:
diff changeset
3
986e461dc072 Initial revision
glantau
parents:
diff changeset
4 #include "common.h"
986e461dc072 Initial revision
glantau
parents:
diff changeset
5
986e461dc072 Initial revision
glantau
parents:
diff changeset
6 /* dct code */
986e461dc072 Initial revision
glantau
parents:
diff changeset
7 typedef short DCTELEM;
986e461dc072 Initial revision
glantau
parents:
diff changeset
8
986e461dc072 Initial revision
glantau
parents:
diff changeset
9 void jpeg_fdct_ifast (DCTELEM *data);
986e461dc072 Initial revision
glantau
parents:
diff changeset
10
986e461dc072 Initial revision
glantau
parents:
diff changeset
11 void j_rev_dct (DCTELEM *data);
986e461dc072 Initial revision
glantau
parents:
diff changeset
12
986e461dc072 Initial revision
glantau
parents:
diff changeset
13 void fdct_mmx(DCTELEM *block);
986e461dc072 Initial revision
glantau
parents:
diff changeset
14
986e461dc072 Initial revision
glantau
parents:
diff changeset
15 void (*av_fdct)(DCTELEM *block);
986e461dc072 Initial revision
glantau
parents:
diff changeset
16
34
2733a4c1c693 added block permutation functions
glantau
parents: 19
diff changeset
17 /* encoding scans */
2733a4c1c693 added block permutation functions
glantau
parents: 19
diff changeset
18 extern UINT8 ff_alternate_horizontal_scan[64];
2733a4c1c693 added block permutation functions
glantau
parents: 19
diff changeset
19 extern UINT8 ff_alternate_vertical_scan[64];
2733a4c1c693 added block permutation functions
glantau
parents: 19
diff changeset
20 extern UINT8 zigzag_direct[64];
2733a4c1c693 added block permutation functions
glantau
parents: 19
diff changeset
21
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
22 /* pixel operations */
986e461dc072 Initial revision
glantau
parents:
diff changeset
23 #define MAX_NEG_CROP 384
986e461dc072 Initial revision
glantau
parents:
diff changeset
24
986e461dc072 Initial revision
glantau
parents:
diff changeset
25 /* temporary */
986e461dc072 Initial revision
glantau
parents:
diff changeset
26 extern UINT32 squareTbl[512];
50
4ea4c10d03d8 export for imgconvert usage
glantau
parents: 34
diff changeset
27 extern UINT8 cropTbl[256 + 2 * MAX_NEG_CROP];
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
28
986e461dc072 Initial revision
glantau
parents:
diff changeset
29 void dsputil_init(void);
986e461dc072 Initial revision
glantau
parents:
diff changeset
30
986e461dc072 Initial revision
glantau
parents:
diff changeset
31 /* pixel ops : interface with DCT */
986e461dc072 Initial revision
glantau
parents:
diff changeset
32
19
82d4c9be9873 MMX/MMXEXT iDCT support, using external functions currently defined in libmpeg2
arpi_esp
parents: 6
diff changeset
33 extern void (*ff_idct)(DCTELEM *block);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
34 extern void (*get_pixels)(DCTELEM *block, const UINT8 *pixels, int line_size);
986e461dc072 Initial revision
glantau
parents:
diff changeset
35 extern void (*put_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size);
986e461dc072 Initial revision
glantau
parents:
diff changeset
36 extern void (*add_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size);
986e461dc072 Initial revision
glantau
parents:
diff changeset
37
986e461dc072 Initial revision
glantau
parents:
diff changeset
38 void get_pixels_c(DCTELEM *block, const UINT8 *pixels, int line_size);
986e461dc072 Initial revision
glantau
parents:
diff changeset
39 void put_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size);
986e461dc072 Initial revision
glantau
parents:
diff changeset
40 void add_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size);
986e461dc072 Initial revision
glantau
parents:
diff changeset
41
986e461dc072 Initial revision
glantau
parents:
diff changeset
42 /* add and put pixel (decoding) */
986e461dc072 Initial revision
glantau
parents:
diff changeset
43 typedef void (*op_pixels_func)(UINT8 *block, const UINT8 *pixels, int line_size, int h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
44
986e461dc072 Initial revision
glantau
parents:
diff changeset
45 extern op_pixels_func put_pixels_tab[4];
986e461dc072 Initial revision
glantau
parents:
diff changeset
46 extern op_pixels_func avg_pixels_tab[4];
986e461dc072 Initial revision
glantau
parents:
diff changeset
47 extern op_pixels_func put_no_rnd_pixels_tab[4];
986e461dc072 Initial revision
glantau
parents:
diff changeset
48 extern op_pixels_func avg_no_rnd_pixels_tab[4];
986e461dc072 Initial revision
glantau
parents:
diff changeset
49
986e461dc072 Initial revision
glantau
parents:
diff changeset
50 /* sub pixel (encoding) */
986e461dc072 Initial revision
glantau
parents:
diff changeset
51 extern void (*sub_pixels_tab[4])(DCTELEM *block, const UINT8 *pixels, int line_size, int h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
52
986e461dc072 Initial revision
glantau
parents:
diff changeset
53 #define sub_pixels_2(block, pixels, line_size, dxy) \
986e461dc072 Initial revision
glantau
parents:
diff changeset
54 sub_pixels_tab[dxy](block, pixels, line_size, 8)
986e461dc072 Initial revision
glantau
parents:
diff changeset
55
986e461dc072 Initial revision
glantau
parents:
diff changeset
56 /* motion estimation */
986e461dc072 Initial revision
glantau
parents:
diff changeset
57
986e461dc072 Initial revision
glantau
parents:
diff changeset
58 typedef int (*op_pixels_abs_func)(UINT8 *blk1, UINT8 *blk2, int line_size, int h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
59
986e461dc072 Initial revision
glantau
parents:
diff changeset
60 extern op_pixels_abs_func pix_abs16x16;
986e461dc072 Initial revision
glantau
parents:
diff changeset
61 extern op_pixels_abs_func pix_abs16x16_x2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
62 extern op_pixels_abs_func pix_abs16x16_y2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
63 extern op_pixels_abs_func pix_abs16x16_xy2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
64
986e461dc072 Initial revision
glantau
parents:
diff changeset
65 int pix_abs16x16_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
66 int pix_abs16x16_x2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
67 int pix_abs16x16_y2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
68 int pix_abs16x16_xy2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
69
34
2733a4c1c693 added block permutation functions
glantau
parents: 19
diff changeset
70 static inline int block_permute_op(int j)
2733a4c1c693 added block permutation functions
glantau
parents: 19
diff changeset
71 {
2733a4c1c693 added block permutation functions
glantau
parents: 19
diff changeset
72 return (j & 0x38) | ((j & 6) >> 1) | ((j & 1) << 2);
2733a4c1c693 added block permutation functions
glantau
parents: 19
diff changeset
73 }
2733a4c1c693 added block permutation functions
glantau
parents: 19
diff changeset
74
2733a4c1c693 added block permutation functions
glantau
parents: 19
diff changeset
75 void block_permute(INT16 *block);
2733a4c1c693 added block permutation functions
glantau
parents: 19
diff changeset
76
62
4bfc845cdfea arm optimizations
glantau
parents: 50
diff changeset
77 #if defined(HAVE_MMX)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
78
986e461dc072 Initial revision
glantau
parents:
diff changeset
79 #define MM_MMX 0x0001 /* standard MMX */
986e461dc072 Initial revision
glantau
parents:
diff changeset
80 #define MM_3DNOW 0x0004 /* AMD 3DNOW */
986e461dc072 Initial revision
glantau
parents:
diff changeset
81 #define MM_MMXEXT 0x0002 /* SSE integer functions or AMD MMX ext */
986e461dc072 Initial revision
glantau
parents:
diff changeset
82 #define MM_SSE 0x0008 /* SSE functions */
986e461dc072 Initial revision
glantau
parents:
diff changeset
83 #define MM_SSE2 0x0010 /* PIV SSE2 functions */
986e461dc072 Initial revision
glantau
parents:
diff changeset
84
986e461dc072 Initial revision
glantau
parents:
diff changeset
85 extern int mm_flags;
986e461dc072 Initial revision
glantau
parents:
diff changeset
86
986e461dc072 Initial revision
glantau
parents:
diff changeset
87 int mm_support(void);
986e461dc072 Initial revision
glantau
parents:
diff changeset
88
986e461dc072 Initial revision
glantau
parents:
diff changeset
89 static inline void emms(void)
986e461dc072 Initial revision
glantau
parents:
diff changeset
90 {
6
ec4642daa6fe added emms_c() macro which should can used in c code in both mmx/non mmx cases
glantau
parents: 2
diff changeset
91 __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
92 }
ec4642daa6fe added emms_c() macro which should can used in c code in both mmx/non mmx cases
glantau
parents: 2
diff changeset
93
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 {\
ec4642daa6fe added emms_c() macro which should can used in c code in both mmx/non mmx cases
glantau
parents: 2
diff changeset
96 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
97 emms();\
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
98 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
99
986e461dc072 Initial revision
glantau
parents:
diff changeset
100 #define __align8 __attribute__ ((aligned (8)))
986e461dc072 Initial revision
glantau
parents:
diff changeset
101
986e461dc072 Initial revision
glantau
parents:
diff changeset
102 void dsputil_init_mmx(void);
986e461dc072 Initial revision
glantau
parents:
diff changeset
103
62
4bfc845cdfea arm optimizations
glantau
parents: 50
diff changeset
104 #elif defined(ARCH_ARMV4L)
4bfc845cdfea arm optimizations
glantau
parents: 50
diff changeset
105
4bfc845cdfea arm optimizations
glantau
parents: 50
diff changeset
106 #define emms_c()
4bfc845cdfea arm optimizations
glantau
parents: 50
diff changeset
107
4bfc845cdfea arm optimizations
glantau
parents: 50
diff changeset
108 /* This is to use 4 bytes read to the IDCT pointers for some 'zero'
4bfc845cdfea arm optimizations
glantau
parents: 50
diff changeset
109 line ptimizations */
4bfc845cdfea arm optimizations
glantau
parents: 50
diff changeset
110 #define __align8 __attribute__ ((aligned (4)))
4bfc845cdfea arm optimizations
glantau
parents: 50
diff changeset
111
4bfc845cdfea arm optimizations
glantau
parents: 50
diff changeset
112 void dsputil_init_armv4l(void);
4bfc845cdfea arm optimizations
glantau
parents: 50
diff changeset
113
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
114 #else
986e461dc072 Initial revision
glantau
parents:
diff changeset
115
6
ec4642daa6fe added emms_c() macro which should can used in c code in both mmx/non mmx cases
glantau
parents: 2
diff changeset
116 #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
117
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
118 #define __align8
986e461dc072 Initial revision
glantau
parents:
diff changeset
119
986e461dc072 Initial revision
glantau
parents:
diff changeset
120 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
121
986e461dc072 Initial revision
glantau
parents:
diff changeset
122 #endif