fa8eb239a56001cd0538658a671e4b648376c23b
[libav.git] / libavcodec / dsputil.h
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
28 extern void (*get_pixels)(DCTELEM *block, const UINT8 *pixels, int line_size);
29 extern void (*put_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size);
30 extern void (*add_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size);
31
32 void get_pixels_c(DCTELEM *block, const UINT8 *pixels, int line_size);
33 void put_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size);
34 void add_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size);
35
36 /* add and put pixel (decoding) */
37 typedef void (*op_pixels_func)(UINT8 *block, const UINT8 *pixels, int line_size, int h);
38
39 extern op_pixels_func put_pixels_tab[4];
40 extern op_pixels_func avg_pixels_tab[4];
41 extern op_pixels_func put_no_rnd_pixels_tab[4];
42 extern op_pixels_func avg_no_rnd_pixels_tab[4];
43
44 /* sub pixel (encoding) */
45 extern void (*sub_pixels_tab[4])(DCTELEM *block, const UINT8 *pixels, int line_size, int h);
46
47 #define sub_pixels_2(block, pixels, line_size, dxy) \
48 sub_pixels_tab[dxy](block, pixels, line_size, 8)
49
50 /* motion estimation */
51
52 typedef int (*op_pixels_abs_func)(UINT8 *blk1, UINT8 *blk2, int line_size, int h);
53
54 extern op_pixels_abs_func pix_abs16x16;
55 extern op_pixels_abs_func pix_abs16x16_x2;
56 extern op_pixels_abs_func pix_abs16x16_y2;
57 extern op_pixels_abs_func pix_abs16x16_xy2;
58
59 int pix_abs16x16_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
60 int pix_abs16x16_x2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
61 int pix_abs16x16_y2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
62 int pix_abs16x16_xy2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
63
64 #ifdef HAVE_MMX
65
66 #define MM_MMX 0x0001 /* standard MMX */
67 #define MM_3DNOW 0x0004 /* AMD 3DNOW */
68 #define MM_MMXEXT 0x0002 /* SSE integer functions or AMD MMX ext */
69 #define MM_SSE 0x0008 /* SSE functions */
70 #define MM_SSE2 0x0010 /* PIV SSE2 functions */
71
72 extern int mm_flags;
73
74 int mm_support(void);
75
76 static inline void emms(void)
77 {
78 asm volatile ("emms;");
79 }
80
81 #define __align8 __attribute__ ((aligned (8)))
82
83 void dsputil_init_mmx(void);
84
85 #else
86
87 #define __align8
88
89 #endif
90
91 #endif