Initial revision
[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
28extern void (*get_pixels)(DCTELEM *block, const UINT8 *pixels, int line_size);
29extern void (*put_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size);
30extern void (*add_pixels_clamped)(const DCTELEM *block, UINT8 *pixels, int line_size);
31
32void get_pixels_c(DCTELEM *block, const UINT8 *pixels, int line_size);
33void put_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size);
34void add_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size);
35
36/* add and put pixel (decoding) */
37typedef void (*op_pixels_func)(UINT8 *block, const UINT8 *pixels, int line_size, int h);
38
39extern op_pixels_func put_pixels_tab[4];
40extern op_pixels_func avg_pixels_tab[4];
41extern op_pixels_func put_no_rnd_pixels_tab[4];
42extern op_pixels_func avg_no_rnd_pixels_tab[4];
43
44/* sub pixel (encoding) */
45extern 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
52typedef int (*op_pixels_abs_func)(UINT8 *blk1, UINT8 *blk2, int line_size, int h);
53
54extern op_pixels_abs_func pix_abs16x16;
55extern op_pixels_abs_func pix_abs16x16_x2;
56extern op_pixels_abs_func pix_abs16x16_y2;
57extern op_pixels_abs_func pix_abs16x16_xy2;
58
59int pix_abs16x16_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
60int pix_abs16x16_x2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
61int pix_abs16x16_y2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
62int pix_abs16x16_xy2_c(UINT8 *blk1, UINT8 *blk2, int lx, int h);
63
64#ifdef CONFIG_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
72extern int mm_flags;
73
74int mm_support(void);
75
76static inline void emms(void)
77{
78 asm volatile ("emms;");
79}
80
81#define __align8 __attribute__ ((aligned (8)))
82
83void dsputil_init_mmx(void);
84
85#else
86
87#define __align8
88
89#endif
90
91#endif