Debian Codegraph @

ext/scale2x/scale2x.h

raw symbols SCIP
1 /*
2 * This file is part of the Scale2x project.
3 *
4 * Copyright (C) 2001, 2002, 2003, 2004 Andrea Mazzoleni
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17 #ifndef __SCALE2X_H
18 #define __SCALE2X_H
19
20 // OpenJazz modification
21 #ifndef restrict
22 # if (defined(_WIN32) && defined(_MSC_VER)) || defined(__GNUC__)
23 # define restrict __restrict
24 # else
25 # define restrict // ignore
26 # endif
27 #endif
28
29 typedef unsigned char scale2x_uint8;
30 typedef unsigned short scale2x_uint16;
31 typedef unsigned scale2x_uint32;
32
33 /**
34 * Enable the SSE2 implementation.
35 */
36 #if defined(__GNUC__) && defined(__SSE2__)
37 #define USE_SCALE2X_SSE2 1
38 #endif
39
40 /**
41 * Memory alignment required.
42 */
43 #ifdef USE_SCALE2X_SSE2
44 #define SCALE2X_ALIGN_SIZE 16
45 #else
46 #define SCALE2X_ALIGN_SIZE 1
47 #endif
48
49 /**
50 * Extra allocation to ensure alignment.
51 */
52 #define SCALE2X_ALIGN_ALLOC (SCALE2X_ALIGN_SIZE - 1)
53
54 /**
55 * Align a pointer to bytes.
56 */
57 static inline void* scale2x_align_ptr(const void* ptr)
58 {
59 #ifdef USE_SCALE2X_SSE2
60 __asm__(
61 "add $15, %0\n"
62 "and $-16, %0\n"
63 : "+r" (ptr)
64 :
65 : "cc"
66 );
67 #endif
68 return (void*)ptr;
69 }
70
71 /**
72 * Align a size in bytes.
73 */
74 static inline unsigned scale2x_align_size(unsigned size)
75 {
76 #ifdef USE_SCALE2X_SSE2
77 __asm__(
78 "add $15, %0\n"
79 "and $-16, %0\n"
80 : "+r" (size)
81 :
82 : "cc"
83 );
84 #endif
85 return size;
86 }
87
88 void scale2x_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count);
89 void scale2x_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count);
90 void scale2x_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count);
91
92 void scale2x3_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count);
93 void scale2x3_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count);
94 void scale2x3_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count);
95
96 void scale2x4_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, scale2x_uint8* dst3, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count);
97 void scale2x4_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, scale2x_uint16* dst3, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count);
98 void scale2x4_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, scale2x_uint32* dst3, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count);
99
100 #ifdef USE_SCALE2X_SSE2
101 void scale2x_8_sse2(scale2x_uint8* dst0, scale2x_uint8* dst1, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count);
102 void scale2x_16_sse2(scale2x_uint16* dst0, scale2x_uint16* dst1, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count);
103 void scale2x_32_sse2(scale2x_uint32* dst0, scale2x_uint32* dst1, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count);
104
105 void scale2x3_8_sse2(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count);
106 void scale2x3_16_sse2(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count);
107 void scale2x3_32_sse2(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count);
108
109 void scale2x4_8_sse2(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, scale2x_uint8* dst3, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count);
110 void scale2x4_16_sse2(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, scale2x_uint16* dst3, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count);
111 void scale2x4_32_sse2(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, scale2x_uint32* dst3, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count);
112 #endif
113
114 #endif
115