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 |
|
#ifdef ARCH_IS_X86_64 |
59 |
|
extern TRANSFER_8TO16COPY transfer_8to16copy_x86_64; |
60 |
|
#endif |
61 |
|
|
62 |
|
/***************************************************************************** |
63 |
|
* transfer16to8 API |
64 |
|
****************************************************************************/ |
65 |
|
|
66 |
typedef void (TRANSFER_16TO8COPY)(uint8_t * const dst, |
typedef void (TRANSFER_16TO8COPY)(uint8_t * const dst, |
67 |
const int16_t * const src, |
const int16_t * const src, |
68 |
uint32_t stride); |
uint32_t stride); |
69 |
typedef TRANSFER_16TO8COPY* TRANSFER_16TO8COPY_PTR; |
typedef TRANSFER_16TO8COPY* TRANSFER_16TO8COPY_PTR; |
70 |
|
|
71 |
|
/* Our global function pointer - Initialized in xvid.c */ |
72 |
extern TRANSFER_16TO8COPY_PTR transfer_16to8copy; |
extern TRANSFER_16TO8COPY_PTR transfer_16to8copy; |
|
TRANSFER_16TO8COPY transfer_16to8copy_c; |
|
|
TRANSFER_16TO8COPY transfer_16to8copy_mmx; |
|
73 |
|
|
74 |
// transfer8to16sub |
/* Implemented functions */ |
75 |
|
extern TRANSFER_16TO8COPY transfer_16to8copy_c; |
76 |
|
|
77 |
|
#ifdef ARCH_IS_IA32 |
78 |
|
extern TRANSFER_16TO8COPY transfer_16to8copy_mmx; |
79 |
|
extern TRANSFER_16TO8COPY transfer_16to8copy_3dne; |
80 |
|
#endif |
81 |
|
|
82 |
|
#ifdef ARCH_IS_IA64 |
83 |
|
extern TRANSFER_16TO8COPY transfer_16to8copy_ia64; |
84 |
|
#endif |
85 |
|
|
86 |
|
#ifdef ARCH_IS_PPC |
87 |
|
extern TRANSFER_16TO8COPY transfer_16to8copy_altivec_c; |
88 |
|
#endif |
89 |
|
|
90 |
|
#ifdef ARCH_IS_X86_64 |
91 |
|
extern TRANSFER_16TO8COPY transfer_16to8copy_x86_64; |
92 |
|
#endif |
93 |
|
|
94 |
|
/***************************************************************************** |
95 |
|
* transfer8to16 + substraction *writeback* op API |
96 |
|
****************************************************************************/ |
97 |
|
|
98 |
typedef void (TRANSFER_8TO16SUB)(int16_t * const dct, |
typedef void (TRANSFER_8TO16SUB)(int16_t * const dct, |
99 |
uint8_t * const cur, |
uint8_t * const cur, |
100 |
const uint8_t * ref, |
const uint8_t * ref, |
101 |
const uint32_t stride); |
const uint32_t stride); |
102 |
|
|
103 |
typedef TRANSFER_8TO16SUB* TRANSFER_8TO16SUB_PTR; |
typedef TRANSFER_8TO16SUB* TRANSFER_8TO16SUB_PTR; |
104 |
|
|
105 |
|
/* Our global function pointer - Initialized in xvid.c */ |
106 |
extern TRANSFER_8TO16SUB_PTR transfer_8to16sub; |
extern TRANSFER_8TO16SUB_PTR transfer_8to16sub; |
|
TRANSFER_8TO16SUB transfer_8to16sub_c; |
|
|
TRANSFER_8TO16SUB transfer_8to16sub_mmx; |
|
107 |
|
|
108 |
// transfer16to8add |
/* Implemented functions */ |
109 |
|
extern TRANSFER_8TO16SUB transfer_8to16sub_c; |
110 |
|
|
111 |
|
#ifdef ARCH_IS_IA32 |
112 |
|
extern TRANSFER_8TO16SUB transfer_8to16sub_mmx; |
113 |
|
extern TRANSFER_8TO16SUB transfer_8to16sub_3dne; |
114 |
|
#endif |
115 |
|
|
116 |
|
#ifdef ARCH_IS_IA64 |
117 |
|
extern TRANSFER_8TO16SUB transfer_8to16sub_ia64; |
118 |
|
#endif |
119 |
|
|
120 |
|
#ifdef ARCH_IS_PPC |
121 |
|
extern TRANSFER_8TO16SUB transfer_8to16sub_altivec_c; |
122 |
|
#endif |
123 |
|
|
124 |
|
#ifdef ARCH_IS_X86_64 |
125 |
|
extern TRANSFER_8TO16SUB transfer_8to16sub_x86_64; |
126 |
|
#endif |
127 |
|
|
128 |
|
/***************************************************************************** |
129 |
|
* transfer8to16 + substraction *readonly* op API |
130 |
|
****************************************************************************/ |
131 |
|
|
132 |
|
typedef void (TRANSFER_8TO16SUBRO) (int16_t * const dct, |
133 |
|
const uint8_t * const cur, |
134 |
|
const uint8_t * ref, |
135 |
|
const uint32_t stride); |
136 |
|
|
137 |
|
typedef TRANSFER_8TO16SUBRO *TRANSFER_8TO16SUBRO_PTR; |
138 |
|
|
139 |
|
/* Our global function pointer - Initialized in xvid.c */ |
140 |
|
extern TRANSFER_8TO16SUBRO_PTR transfer_8to16subro; |
141 |
|
|
142 |
|
/* Implemented functions */ |
143 |
|
extern TRANSFER_8TO16SUBRO transfer_8to16subro_c; |
144 |
|
|
145 |
|
#ifdef ARCH_IS_IA32 |
146 |
|
extern TRANSFER_8TO16SUBRO transfer_8to16subro_mmx; |
147 |
|
extern TRANSFER_8TO16SUBRO transfer_8to16subro_3dne; |
148 |
|
#endif |
149 |
|
|
150 |
|
#ifdef ARCH_IS_PPC |
151 |
|
extern TRANSFER_8TO16SUBRO transfer_8to16subro_altivec_c; |
152 |
|
#endif |
153 |
|
|
154 |
|
#ifdef ARCH_IS_X86_64 |
155 |
|
extern TRANSFER_8TO16SUBRO transfer_8to16subro_x86_64; |
156 |
|
#endif |
157 |
|
|
158 |
|
/***************************************************************************** |
159 |
|
* transfer8to16 + substraction op API - Bidirectionnal Version |
160 |
|
****************************************************************************/ |
161 |
|
|
162 |
|
typedef void (TRANSFER_8TO16SUB2) (int16_t * const dct, |
163 |
|
uint8_t * const cur, |
164 |
|
const uint8_t * ref1, |
165 |
|
const uint8_t * ref2, |
166 |
|
const uint32_t stride); |
167 |
|
|
168 |
|
typedef TRANSFER_8TO16SUB2 *TRANSFER_8TO16SUB2_PTR; |
169 |
|
|
170 |
|
/* Our global function pointer - Initialized in xvid.c */ |
171 |
|
extern TRANSFER_8TO16SUB2_PTR transfer_8to16sub2; |
172 |
|
|
173 |
|
/* Implemented functions */ |
174 |
|
TRANSFER_8TO16SUB2 transfer_8to16sub2_c; |
175 |
|
|
176 |
|
#ifdef ARCH_IS_IA32 |
177 |
|
extern TRANSFER_8TO16SUB2 transfer_8to16sub2_mmx; |
178 |
|
extern TRANSFER_8TO16SUB2 transfer_8to16sub2_xmm; |
179 |
|
extern TRANSFER_8TO16SUB2 transfer_8to16sub2_3dne; |
180 |
|
#endif |
181 |
|
|
182 |
|
#ifdef ARCH_IS_IA64 |
183 |
|
extern TRANSFER_8TO16SUB2 transfer_8to16sub2_ia64; |
184 |
|
#endif |
185 |
|
|
186 |
|
#ifdef ARCH_IS_PPC |
187 |
|
extern TRANSFER_8TO16SUB2 transfer_8to16sub2_altivec_c; |
188 |
|
#endif |
189 |
|
|
190 |
|
#ifdef ARCH_IS_X86_64 |
191 |
|
extern TRANSFER_8TO16SUB2 transfer_8to16sub2_x86_64; |
192 |
|
#endif |
193 |
|
|
194 |
|
/***************************************************************************** |
195 |
|
* transfer8to16 + substraction op API - Bidirectionnal Version *readonly* |
196 |
|
****************************************************************************/ |
197 |
|
|
198 |
|
typedef void (TRANSFER_8TO16SUB2RO) (int16_t * const dct, |
199 |
|
const uint8_t * const cur, |
200 |
|
const uint8_t * ref1, |
201 |
|
const uint8_t * ref2, |
202 |
|
const uint32_t stride); |
203 |
|
|
204 |
|
typedef TRANSFER_8TO16SUB2RO *TRANSFER_8TO16SUB2RO_PTR; |
205 |
|
|
206 |
|
/* Our global function pointer - Initialized in xvid.c */ |
207 |
|
extern TRANSFER_8TO16SUB2RO_PTR transfer_8to16sub2ro; |
208 |
|
|
209 |
|
/* Implemented functions */ |
210 |
|
TRANSFER_8TO16SUB2RO transfer_8to16sub2ro_c; |
211 |
|
|
212 |
|
#ifdef ARCH_IS_IA32 |
213 |
|
extern TRANSFER_8TO16SUB2RO transfer_8to16sub2ro_xmm; |
214 |
|
#endif |
215 |
|
|
216 |
|
#ifdef ARCH_IS_X86_64 |
217 |
|
extern TRANSFER_8TO16SUB2RO transfer_8to16sub2ro_x86_64; |
218 |
|
#endif |
219 |
|
|
220 |
|
/***************************************************************************** |
221 |
|
* transfer16to8 + addition op API |
222 |
|
****************************************************************************/ |
223 |
|
|
224 |
typedef void (TRANSFER_16TO8ADD)(uint8_t * const dst, |
typedef void (TRANSFER_16TO8ADD)(uint8_t * const dst, |
225 |
const int16_t * const src, |
const int16_t * const src, |
226 |
uint32_t stride); |
uint32_t stride); |
227 |
|
|
228 |
typedef TRANSFER_16TO8ADD* TRANSFER_16TO8ADD_PTR; |
typedef TRANSFER_16TO8ADD* TRANSFER_16TO8ADD_PTR; |
229 |
|
|
230 |
|
/* Our global function pointer - Initialized in xvid.c */ |
231 |
extern TRANSFER_16TO8ADD_PTR transfer_16to8add; |
extern TRANSFER_16TO8ADD_PTR transfer_16to8add; |
|
TRANSFER_16TO8ADD transfer_16to8add_c; |
|
|
TRANSFER_16TO8ADD transfer_16to8add_mmx; |
|
232 |
|
|
233 |
// transfer8x8_copy |
/* Implemented functions */ |
234 |
|
extern TRANSFER_16TO8ADD transfer_16to8add_c; |
235 |
|
|
236 |
|
#ifdef ARCH_IS_IA32 |
237 |
|
extern TRANSFER_16TO8ADD transfer_16to8add_mmx; |
238 |
|
extern TRANSFER_16TO8ADD transfer_16to8add_3dne; |
239 |
|
#endif |
240 |
|
|
241 |
|
#ifdef ARCH_IS_IA64 |
242 |
|
extern TRANSFER_16TO8ADD transfer_16to8add_ia64; |
243 |
|
#endif |
244 |
|
|
245 |
|
#ifdef ARCH_IS_PPC |
246 |
|
extern TRANSFER_16TO8ADD transfer_16to8add_altivec_c; |
247 |
|
#endif |
248 |
|
|
249 |
|
#ifdef ARCH_IS_X86_64 |
250 |
|
extern TRANSFER_16TO8ADD transfer_16to8add_x86_64; |
251 |
|
#endif |
252 |
|
|
253 |
|
/***************************************************************************** |
254 |
|
* transfer8to8 + no op |
255 |
|
****************************************************************************/ |
256 |
|
|
257 |
typedef void (TRANSFER8X8_COPY)(uint8_t * const dst, |
typedef void (TRANSFER8X8_COPY)(uint8_t * const dst, |
258 |
const uint8_t * const src, |
const uint8_t * const src, |
259 |
const uint32_t stride); |
const uint32_t stride); |
260 |
|
|
261 |
typedef TRANSFER8X8_COPY* TRANSFER8X8_COPY_PTR; |
typedef TRANSFER8X8_COPY* TRANSFER8X8_COPY_PTR; |
262 |
|
|
263 |
|
/* Our global function pointer - Initialized in xvid.c */ |
264 |
extern TRANSFER8X8_COPY_PTR transfer8x8_copy; |
extern TRANSFER8X8_COPY_PTR transfer8x8_copy; |
|
TRANSFER8X8_COPY transfer8x8_copy_c; |
|
|
TRANSFER8X8_COPY transfer8x8_copy_mmx; |
|
265 |
|
|
266 |
#endif /* _MEM_TRANSFER_H_ */ |
/* Implemented functions */ |
267 |
|
extern TRANSFER8X8_COPY transfer8x8_copy_c; |
268 |
|
|
269 |
|
#ifdef ARCH_IS_IA32 |
270 |
|
extern TRANSFER8X8_COPY transfer8x8_copy_mmx; |
271 |
|
extern TRANSFER8X8_COPY transfer8x8_copy_3dne; |
272 |
|
#endif |
273 |
|
|
274 |
|
#ifdef ARCH_IS_IA64 |
275 |
|
extern TRANSFER8X8_COPY transfer8x8_copy_ia64; |
276 |
|
#endif |
277 |
|
|
278 |
|
#ifdef ARCH_IS_PPC |
279 |
|
extern TRANSFER8X8_COPY transfer8x8_copy_altivec_c; |
280 |
|
#endif |
281 |
|
|
282 |
|
#ifdef ARCH_IS_X86_64 |
283 |
|
extern TRANSFER8X8_COPY transfer8x8_copy_x86_64; |
284 |
|
#endif |
285 |
|
|
286 |
|
static __inline void |
287 |
|
transfer16x16_copy(uint8_t * const dst, |
288 |
|
const uint8_t * const src, |
289 |
|
const uint32_t stride) |
290 |
|
{ |
291 |
|
transfer8x8_copy(dst, src, stride); |
292 |
|
transfer8x8_copy(dst + 8, src + 8, stride); |
293 |
|
transfer8x8_copy(dst + 8*stride, src + 8*stride, stride); |
294 |
|
transfer8x8_copy(dst + 8*stride + 8, src + 8*stride + 8, stride); |
295 |
|
} |
296 |
|
|
297 |
|
static __inline void |
298 |
|
transfer32x32_copy(uint8_t * const dst, |
299 |
|
const uint8_t * const src, |
300 |
|
const uint32_t stride) |
301 |
|
{ |
302 |
|
transfer16x16_copy(dst, src, stride); |
303 |
|
transfer16x16_copy(dst + 16, src + 16, stride); |
304 |
|
transfer16x16_copy(dst + 16*stride, src + 16*stride, stride); |
305 |
|
transfer16x16_copy(dst + 16*stride + 16, src + 16*stride + 16, stride); |
306 |
|
} |
307 |
|
|
308 |
|
|
309 |
|
#endif |