updated dct-test to test IDCTs too
[libav.git] / libavcodec / dsputil.h
CommitLineData
de6d9b64
FB
1#ifndef DSPUTIL_H
2#define DSPUTIL_H
3
4#include "common.h"
5#include <inttypes.h>
6
7/* dct code */
8typedef short DCTELEM;
9
10void jpeg_fdct_ifast (DCTELEM *data);
11
12void j_rev_dct (DCTELEM *data);
13
14void fdct_mmx(DCTELEM *block);
15
16void (*av_fdct)(DCTELEM *block);
17
18/* pixel operations */
19#define MAX_NEG_CROP 384
20
21/* temporary */
22extern UINT32 squareTbl[512];
23
24void dsputil_init(void);
25
26/* pixel ops : interface with DCT */
27
4af7bcc1 28extern void (*ff_idct)(DCTELEM *block);
de6d9b64
FB
29extern void (*get_pixels)(DCTELEM *block, const UINT8 *pixels, int line_size);
30extern void (*put_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size);
31extern void (*add_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size);
32
33void get_pixels_c(DCTELEM *block, const UINT8 *pixels, int line_size);
34void put_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size);
35void add_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size);
36
37/* add and put pixel (decoding) */
38typedef void (*op_pixels_func)(UINT8 *block, const UINT8 *pixels, int line_size, int h);
39
40extern op_pixels_func put_pixels_tab[4];
41extern op_pixels_func avg_pixels_tab[4];
42extern op_pixels_func put_no_rnd_pixels_tab[4];
43extern op_pixels_func avg_no_rnd_pixels_tab[4];
44
45/* sub pixel (encoding) */
46extern 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
53typedef int (*op_pixels_abs_func)(UINT8 *blk1, UINT8 *blk2, int line_size, int h);
54
55extern op_pixels_abs_func pix_abs16x16;
56extern op_pixels_abs_func pix_abs16x16_x2;
57extern op_pixels_abs_func pix_abs16x16_y2;
58extern op_pixels_abs_func pix_abs16x16_xy2;
59
60int pix_abs16x16_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
61int pix_abs16x16_x2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
62int pix_abs16x16_y2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
63int pix_abs16x16_xy2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
64
980fc7b8 65#ifdef HAVE_MMX
de6d9b64
FB
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
73extern int mm_flags;
74
75int mm_support(void);
76
77static inline void emms(void)
78{
fb16b7e7
FB
79 __asm __volatile ("emms;":::"memory");
80}
81
82#define emms_c() \
83{\
84 if (mm_flags & MM_MMX)\
85 emms();\
de6d9b64
FB
86}
87
88#define __align8 __attribute__ ((aligned (8)))
89
90void dsputil_init_mmx(void);
91
92#else
93
fb16b7e7
FB
94#define emms_c()
95
de6d9b64
FB
96#define __align8
97
98#endif
99
100#endif