summaryrefslogtreecommitdiffstats
path: root/k9vamps/ac.h
blob: c79100fa8eb7ec2fa3052a004a8bdaa9c2773e44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 *  ac.h
 *
 *  Copyright (C) Thomas Östreich - November 2002
 *
 *  This file is part of transcode, a video stream processing tool
 *      
 *  transcode is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *   
 *  transcode is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *   
 *  You should have received a copy of the GNU General Public License
 *  along with GNU Make; see the file COPYING.  If not, write to
 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
 *
 */

#ifndef _AC_H
#define _AC_H

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "k9common.h"

#include <unistd.h>

// #include "libtc/libtc.h"

#ifdef __bsdi__
typedef unsigned int uint32_t;
#endif

//mm_support
#define MM_C        0x0000 //plain C (default)
#define MM_IA32ASM  0x0001 //32-bit assembler optimized code (non-MMX)
#define MM_AMD64ASM 0x0002 //64-bit assembler optimized code (non-MMX)
#define MM_CMOVE    0x0004 //CMOVcc instruction
#define MM_MMX      0x0008 //standard MMX 
#define MM_MMXEXT   0x0010 //SSE integer functions or AMD MMX ext
#define MM_3DNOW    0x0020 //AMD 3DNOW 
#define MM_SSE      0x0040 //SSE functions 
#define MM_SSE2     0x0080 //PIV SSE2 functions 
#define MM_3DNOWEXT 0x0100 //AMD 3DNow! ext.
#define MM_SSE3     0x0200 //Prescott SSE3

extern void * (*tc_memcpy)(void *, const void *, size_t);
extern void tc_memcpy_init(int verbose, int mmflags);

extern int mm_flag;
int ac_mmflag();
void ac_mmtest();
char *ac_mmstr(int flag, int mode);

//ac_memcpy
void * ac_memcpy_mmx(void *dest, const void *src, size_t bytes);
void * ac_memcpy_amdmmx(void *dest, const void *src, size_t bytes);
void * ac_memcpy_amd64(void *dest, const void *src, size_t bytes);

//average (simple average over 2 rows)
int ac_average_mmx(char *row1, char *row2, char *out, int bytes);
int ac_average_sse(char *row1, char *row2, char *out, int bytes);
int ac_average_sse2(char *row1, char *row2, char *out, int bytes);

//swap
int ac_swap_rgb2bgr_asm(char *im, int bytes);
int ac_swap_rgb2bgr_asm64(char *im, int pixels);

//rescale
int ac_rescale_mmxext(char *row1, char *row2, char *out, int bytes, 
		      unsigned long weight1, unsigned long weight2);
int ac_rescale_sse(char *row1, char *row2, char *out, int bytes, 
		   unsigned long weight1, unsigned long weight2);
int ac_rescale_sse2(char *row1, char *row2, char *out, int bytes, 
		    unsigned long weight1, unsigned long weight2);

#endif