1 |
|
/***************************************************************************** |
2 |
|
* |
3 |
|
* XVID MPEG-4 VIDEO CODEC |
4 |
|
* - 8<->16 bit buffer transfer header - |
5 |
|
* |
6 |
|
* Copyright(C) 2001-2003 Peter Ross <pross@xvid.org> |
7 |
|
* |
8 |
|
* This program is free software ; you can redistribute it and/or modify |
9 |
|
* it under the terms of the GNU General Public License as published by |
10 |
|
* the Free Software Foundation ; either version 2 of the License, or |
11 |
|
* (at your option) any later version. |
12 |
|
* |
13 |
|
* This program is distributed in the hope that it will be useful, |
14 |
|
* but WITHOUT ANY WARRANTY ; without even the implied warranty of |
15 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
* GNU General Public License for more details. |
17 |
|
* |
18 |
|
* You should have received a copy of the GNU General Public License |
19 |
|
* along with this program ; if not, write to the Free Software |
20 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
|
* |
22 |
|
* $Id$ |
23 |
|
* |
24 |
|
****************************************************************************/ |
25 |
|
|
26 |
#ifndef _MEM_TRANSFER_H |
#ifndef _MEM_TRANSFER_H |
27 |
#define _MEM_TRANSFER_H |
#define _MEM_TRANSFER_H |
28 |
|
|
29 |
// transfer8to16 |
/***************************************************************************** |
30 |
|
* transfer8to16 API |
31 |
|
****************************************************************************/ |
32 |
|
|
33 |
typedef void (TRANSFER_8TO16COPY)(int16_t * const dst, |
typedef void (TRANSFER_8TO16COPY)(int16_t * const dst, |
34 |
const uint8_t * const src, |
const uint8_t * const src, |
35 |
uint32_t stride); |
uint32_t stride); |
36 |
|
|
37 |
typedef TRANSFER_8TO16COPY* TRANSFER_8TO16COPY_PTR; |
typedef TRANSFER_8TO16COPY* TRANSFER_8TO16COPY_PTR; |
38 |
|
|
39 |
|
/* Our global function pointer - Initialized in xvid.c */ |
40 |
extern TRANSFER_8TO16COPY_PTR transfer_8to16copy; |
extern TRANSFER_8TO16COPY_PTR transfer_8to16copy; |
|
TRANSFER_8TO16COPY transfer_8to16copy_c; |
|
|
TRANSFER_8TO16COPY transfer_8to16copy_mmx; |
|
41 |
|
|
42 |
// transfer16to8 |
/* Implemented functions */ |
43 |
|
extern TRANSFER_8TO16COPY transfer_8to16copy_c; |
44 |
|
|
45 |
|
#ifdef ARCH_IS_IA32 |
46 |
|
extern TRANSFER_8TO16COPY transfer_8to16copy_mmx; |
47 |
|
extern TRANSFER_8TO16COPY transfer_8to16copy_3dne; |
48 |
|
#endif |
49 |
|
|
50 |
|
#ifdef ARCH_IS_IA64 |
51 |
|
extern TRANSFER_8TO16COPY transfer_8to16copy_ia64; |
52 |
|
#endif |
53 |
|
|
54 |
|
#ifdef ARCH_IS_PPC |
55 |
|
extern TRANSFER_8TO16COPY transfer_8to16copy_altivec_c; |
56 |
|
#endif |
57 |
|
|
58 |
|
/***************************************************************************** |
59 |
|
* transfer16to8 API |
60 |
|
****************************************************************************/ |
61 |
|
|
62 |
typedef void (TRANSFER_16TO8COPY)(uint8_t * const dst, |
typedef void (TRANSFER_16TO8COPY)(uint8_t * const dst, |
63 |
const int16_t * const src, |
const int16_t * const src, |
64 |
uint32_t stride); |
uint32_t stride); |
65 |
typedef TRANSFER_16TO8COPY* TRANSFER_16TO8COPY_PTR; |
typedef TRANSFER_16TO8COPY* TRANSFER_16TO8COPY_PTR; |
66 |
|
|
67 |
|
/* Our global function pointer - Initialized in xvid.c */ |
68 |
extern TRANSFER_16TO8COPY_PTR transfer_16to8copy; |
extern TRANSFER_16TO8COPY_PTR transfer_16to8copy; |
|
TRANSFER_16TO8COPY transfer_16to8copy_c; |
|
|
TRANSFER_16TO8COPY transfer_16to8copy_mmx; |
|
69 |
|
|
70 |
// transfer8to16sub |
/* Implemented functions */ |
71 |
|
extern TRANSFER_16TO8COPY transfer_16to8copy_c; |
72 |
|
|
73 |
|
#ifdef ARCH_IS_IA32 |
74 |
|
extern TRANSFER_16TO8COPY transfer_16to8copy_mmx; |
75 |
|
extern TRANSFER_16TO8COPY transfer_16to8copy_3dne; |
76 |
|
#endif |
77 |
|
|
78 |
|
#ifdef ARCH_IS_IA64 |
79 |
|
extern TRANSFER_16TO8COPY transfer_16to8copy_ia64; |
80 |
|
#endif |
81 |
|
|
82 |
|
#ifdef ARCH_IS_PPC |
83 |
|
extern TRANSFER_16TO8COPY transfer_16to8copy_altivec_c; |
84 |
|
#endif |
85 |
|
|
86 |
|
/***************************************************************************** |
87 |
|
* transfer8to16 + substraction *writeback* op API |
88 |
|
****************************************************************************/ |
89 |
|
|
90 |
typedef void (TRANSFER_8TO16SUB)(int16_t * const dct, |
typedef void (TRANSFER_8TO16SUB)(int16_t * const dct, |
91 |
uint8_t * const cur, |
uint8_t * const cur, |
92 |
const uint8_t * ref, |
const uint8_t * ref, |
93 |
const uint32_t stride); |
const uint32_t stride); |
94 |
|
|
95 |
typedef TRANSFER_8TO16SUB* TRANSFER_8TO16SUB_PTR; |
typedef TRANSFER_8TO16SUB* TRANSFER_8TO16SUB_PTR; |
96 |
|
|
97 |
|
/* Our global function pointer - Initialized in xvid.c */ |
98 |
extern TRANSFER_8TO16SUB_PTR transfer_8to16sub; |
extern TRANSFER_8TO16SUB_PTR transfer_8to16sub; |
|
TRANSFER_8TO16SUB transfer_8to16sub_c; |
|
|
TRANSFER_8TO16SUB transfer_8to16sub_mmx; |
|
99 |
|
|
100 |
// transfer8to16sub2 |
/* Implemented functions */ |
101 |
|
extern TRANSFER_8TO16SUB transfer_8to16sub_c; |
102 |
|
|
103 |
|
#ifdef ARCH_IS_IA32 |
104 |
|
extern TRANSFER_8TO16SUB transfer_8to16sub_mmx; |
105 |
|
extern TRANSFER_8TO16SUB transfer_8to16sub_3dne; |
106 |
|
#endif |
107 |
|
|
108 |
|
#ifdef ARCH_IS_IA64 |
109 |
|
extern TRANSFER_8TO16SUB transfer_8to16sub_ia64; |
110 |
|
#endif |
111 |
|
|
112 |
|
#ifdef ARCH_IS_PPC |
113 |
|
extern TRANSFER_8TO16SUB transfer_8to16sub_altivec_c; |
114 |
|
#endif |
115 |
|
|
116 |
|
/***************************************************************************** |
117 |
|
* transfer8to16 + substraction *readonly* op API |
118 |
|
****************************************************************************/ |
119 |
|
|
120 |
|
typedef void (TRANSFER_8TO16SUBRO) (int16_t * const dct, |
121 |
|
const uint8_t * const cur, |
122 |
|
const uint8_t * ref, |
123 |
|
const uint32_t stride); |
124 |
|
|
125 |
|
typedef TRANSFER_8TO16SUBRO *TRANSFER_8TO16SUBRO_PTR; |
126 |
|
|
127 |
|
/* Our global function pointer - Initialized in xvid.c */ |
128 |
|
extern TRANSFER_8TO16SUBRO_PTR transfer_8to16subro; |
129 |
|
|
130 |
|
/* Implemented functions */ |
131 |
|
extern TRANSFER_8TO16SUBRO transfer_8to16subro_c; |
132 |
|
|
133 |
|
#ifdef ARCH_IS_IA32 |
134 |
|
extern TRANSFER_8TO16SUBRO transfer_8to16subro_mmx; |
135 |
|
extern TRANSFER_8TO16SUBRO transfer_8to16subro_3dne; |
136 |
|
#endif |
137 |
|
|
138 |
|
#ifdef ARCH_IS_PPC |
139 |
|
extern TRANSFER_8TO16SUBRO transfer_8to16subro_altivec_c; |
140 |
|
#endif |
141 |
|
|
142 |
|
/***************************************************************************** |
143 |
|
* transfer8to16 + substraction op API - Bidirectionnal Version |
144 |
|
****************************************************************************/ |
145 |
|
|
146 |
typedef void (TRANSFER_8TO16SUB2)(int16_t * const dct, |
typedef void (TRANSFER_8TO16SUB2)(int16_t * const dct, |
147 |
uint8_t * const cur, |
uint8_t * const cur, |
148 |
const uint8_t * ref1, |
const uint8_t * ref1, |
149 |
const uint8_t * ref2, |
const uint8_t * ref2, |
150 |
const uint32_t stride); |
const uint32_t stride); |
151 |
|
|
152 |
typedef TRANSFER_8TO16SUB2* TRANSFER_8TO16SUB2_PTR; |
typedef TRANSFER_8TO16SUB2* TRANSFER_8TO16SUB2_PTR; |
153 |
|
|
154 |
|
/* Our global function pointer - Initialized in xvid.c */ |
155 |
extern TRANSFER_8TO16SUB2_PTR transfer_8to16sub2; |
extern TRANSFER_8TO16SUB2_PTR transfer_8to16sub2; |
156 |
|
|
157 |
|
/* Implemented functions */ |
158 |
TRANSFER_8TO16SUB2 transfer_8to16sub2_c; |
TRANSFER_8TO16SUB2 transfer_8to16sub2_c; |
|
//TRANSFER_8TO16SUB2 transfer_8to16sub2_mmx; |
|
159 |
|
|
160 |
|
#ifdef ARCH_IS_IA32 |
161 |
|
extern TRANSFER_8TO16SUB2 transfer_8to16sub2_mmx; |
162 |
|
extern TRANSFER_8TO16SUB2 transfer_8to16sub2_xmm; |
163 |
|
extern TRANSFER_8TO16SUB2 transfer_8to16sub2_3dne; |
164 |
|
#endif |
165 |
|
|
166 |
|
#ifdef ARCH_IS_IA64 |
167 |
|
extern TRANSFER_8TO16SUB2 transfer_8to16sub2_ia64; |
168 |
|
#endif |
169 |
|
|
170 |
|
#ifdef ARCH_IS_PPC |
171 |
|
extern TRANSFER_8TO16SUB2 transfer_8to16sub2_altivec_c; |
172 |
|
#endif |
173 |
|
|
174 |
|
/***************************************************************************** |
175 |
|
* transfer8to16 + substraction op API - Bidirectionnal Version *readonly* |
176 |
|
****************************************************************************/ |
177 |
|
|
178 |
|
typedef void (TRANSFER_8TO16SUB2RO) (int16_t * const dct, |
179 |
|
const uint8_t * const cur, |
180 |
|
const uint8_t * ref1, |
181 |
|
const uint8_t * ref2, |
182 |
|
const uint32_t stride); |
183 |
|
|
184 |
|
typedef TRANSFER_8TO16SUB2RO *TRANSFER_8TO16SUB2RO_PTR; |
185 |
|
|
186 |
|
/* Our global function pointer - Initialized in xvid.c */ |
187 |
|
extern TRANSFER_8TO16SUB2RO_PTR transfer_8to16sub2ro; |
188 |
|
|
189 |
|
/* Implemented functions */ |
190 |
|
TRANSFER_8TO16SUB2RO transfer_8to16sub2ro_c; |
191 |
|
|
192 |
|
#ifdef ARCH_IS_IA32 |
193 |
|
extern TRANSFER_8TO16SUB2RO transfer_8to16sub2ro_xmm; |
194 |
|
#endif |
195 |
|
|
196 |
|
/***************************************************************************** |
197 |
|
* transfer16to8 + addition op API |
198 |
|
****************************************************************************/ |
199 |
|
|
|
// transfer16to8add |
|
200 |
typedef void (TRANSFER_16TO8ADD)(uint8_t * const dst, |
typedef void (TRANSFER_16TO8ADD)(uint8_t * const dst, |
201 |
const int16_t * const src, |
const int16_t * const src, |
202 |
uint32_t stride); |
uint32_t stride); |
203 |
|
|
204 |
typedef TRANSFER_16TO8ADD* TRANSFER_16TO8ADD_PTR; |
typedef TRANSFER_16TO8ADD* TRANSFER_16TO8ADD_PTR; |
205 |
|
|
206 |
|
/* Our global function pointer - Initialized in xvid.c */ |
207 |
extern TRANSFER_16TO8ADD_PTR transfer_16to8add; |
extern TRANSFER_16TO8ADD_PTR transfer_16to8add; |
|
TRANSFER_16TO8ADD transfer_16to8add_c; |
|
|
TRANSFER_16TO8ADD transfer_16to8add_mmx; |
|
208 |
|
|
209 |
// transfer8x8_copy |
/* Implemented functions */ |
210 |
|
extern TRANSFER_16TO8ADD transfer_16to8add_c; |
211 |
|
|
212 |
|
#ifdef ARCH_IS_IA32 |
213 |
|
extern TRANSFER_16TO8ADD transfer_16to8add_mmx; |
214 |
|
extern TRANSFER_16TO8ADD transfer_16to8add_3dne; |
215 |
|
#endif |
216 |
|
|
217 |
|
#ifdef ARCH_IS_IA64 |
218 |
|
extern TRANSFER_16TO8ADD transfer_16to8add_ia64; |
219 |
|
#endif |
220 |
|
|
221 |
|
#ifdef ARCH_IS_PPC |
222 |
|
extern TRANSFER_16TO8ADD transfer_16to8add_altivec_c; |
223 |
|
#endif |
224 |
|
|
225 |
|
/***************************************************************************** |
226 |
|
* transfer8to8 + no op |
227 |
|
****************************************************************************/ |
228 |
|
|
229 |
typedef void (TRANSFER8X8_COPY)(uint8_t * const dst, |
typedef void (TRANSFER8X8_COPY)(uint8_t * const dst, |
230 |
const uint8_t * const src, |
const uint8_t * const src, |
231 |
const uint32_t stride); |
const uint32_t stride); |
232 |
|
|
233 |
typedef TRANSFER8X8_COPY* TRANSFER8X8_COPY_PTR; |
typedef TRANSFER8X8_COPY* TRANSFER8X8_COPY_PTR; |
234 |
|
|
235 |
|
/* Our global function pointer - Initialized in xvid.c */ |
236 |
extern TRANSFER8X8_COPY_PTR transfer8x8_copy; |
extern TRANSFER8X8_COPY_PTR transfer8x8_copy; |
|
TRANSFER8X8_COPY transfer8x8_copy_c; |
|
|
TRANSFER8X8_COPY transfer8x8_copy_mmx; |
|
237 |
|
|
238 |
#endif /* _MEM_TRANSFER_H_ */ |
/* Implemented functions */ |
239 |
|
extern TRANSFER8X8_COPY transfer8x8_copy_c; |
240 |
|
|
241 |
|
#ifdef ARCH_IS_IA32 |
242 |
|
extern TRANSFER8X8_COPY transfer8x8_copy_mmx; |
243 |
|
extern TRANSFER8X8_COPY transfer8x8_copy_3dne; |
244 |
|
#endif |
245 |
|
|
246 |
|
#ifdef ARCH_IS_IA64 |
247 |
|
extern TRANSFER8X8_COPY transfer8x8_copy_ia64; |
248 |
|
#endif |
249 |
|
|
250 |
|
#ifdef ARCH_IS_PPC |
251 |
|
extern TRANSFER8X8_COPY transfer8x8_copy_altivec_c; |
252 |
|
#endif |
253 |
|
|
254 |
|
static __inline void |
255 |
|
transfer16x16_copy(uint8_t * const dst, |
256 |
|
const uint8_t * const src, |
257 |
|
const uint32_t stride) |
258 |
|
{ |
259 |
|
transfer8x8_copy(dst, src, stride); |
260 |
|
transfer8x8_copy(dst + 8, src + 8, stride); |
261 |
|
transfer8x8_copy(dst + 8*stride, src + 8*stride, stride); |
262 |
|
transfer8x8_copy(dst + 8*stride + 8, src + 8*stride + 8, stride); |
263 |
|
} |
264 |
|
|
265 |
|
static __inline void |
266 |
|
transfer32x32_copy(uint8_t * const dst, |
267 |
|
const uint8_t * const src, |
268 |
|
const uint32_t stride) |
269 |
|
{ |
270 |
|
transfer16x16_copy(dst, src, stride); |
271 |
|
transfer16x16_copy(dst + 16, src + 16, stride); |
272 |
|
transfer16x16_copy(dst + 16*stride, src + 16*stride, stride); |
273 |
|
transfer16x16_copy(dst + 16*stride + 16, src + 16*stride + 16, stride); |
274 |
|
} |
275 |
|
|
276 |
|
|
277 |
|
#endif |