Parent Directory | Revision Log
Revision 1.5 - (view) (download)
1 : | Isibaar | 1.1 | ;/************************************************************************** |
2 : | ; * | ||
3 : | ; * XVID MPEG-4 VIDEO CODEC | ||
4 : | ; * mmx 8bit<->16bit transfers | ||
5 : | ; * | ||
6 : | ; * This program is an implementation of a part of one or more MPEG-4 | ||
7 : | ; * Video tools as specified in ISO/IEC 14496-2 standard. Those intending | ||
8 : | ; * to use this software module in hardware or software products are | ||
9 : | ; * advised that its use may infringe existing patents or copyrights, and | ||
10 : | ; * any such use would be at such party's own risk. The original | ||
11 : | ; * developer of this software module and his/her company, and subsequent | ||
12 : | ; * editors and their companies, will have no liability for use of this | ||
13 : | ; * software or modifications or derivatives thereof. | ||
14 : | ; * | ||
15 : | ; * This program is free software; you can redistribute it and/or modify | ||
16 : | ; * it under the terms of the GNU General Public License as published by | ||
17 : | ; * the Free Software Foundation; either version 2 of the License, or | ||
18 : | ; * (at your option) any later version. | ||
19 : | ; * | ||
20 : | ; * This program is distributed in the hope that it will be useful, | ||
21 : | ; * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
22 : | ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
23 : | ; * GNU General Public License for more details. | ||
24 : | ; * | ||
25 : | ; * You should have received a copy of the GNU General Public License | ||
26 : | ; * along with this program; if not, write to the Free Software | ||
27 : | ; * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 : | ; * | ||
29 : | ; *************************************************************************/ | ||
30 : | |||
31 : | ;/************************************************************************** | ||
32 : | ; * | ||
33 : | ; * History: | ||
34 : | ; * | ||
35 : | Isibaar | 1.5 | ; * 04.06.2002 speed enhancement (unroll+overlap). -Skal- |
36 : | ; * + added transfer_8to16sub2_mmx/xmm | ||
37 : | Isibaar | 1.1 | ; * 07.01.2002 merge functions from compensate_mmx; rename functions |
38 : | ; * 07.11.2001 initial version; (c)2001 peter ross <pross@cs.rmit.edu.au> | ||
39 : | ; * | ||
40 : | ; *************************************************************************/ | ||
41 : | |||
42 : | |||
43 : | bits 32 | ||
44 : | |||
45 : | %macro cglobal 1 | ||
46 : | %ifdef PREFIX | ||
47 : | global _%1 | ||
48 : | %define %1 _%1 | ||
49 : | %else | ||
50 : | global %1 | ||
51 : | %endif | ||
52 : | %endmacro | ||
53 : | |||
54 : | |||
55 : | section .text | ||
56 : | |||
57 : | Isibaar | 1.5 | cglobal transfer_8to16copy_mmx |
58 : | cglobal transfer_8to16copy_mmx | ||
59 : | cglobal transfer_16to8copy_mmx | ||
60 : | cglobal transfer_8to16sub_mmx | ||
61 : | cglobal transfer_8to16sub2_mmx | ||
62 : | cglobal transfer_8to16sub2_xmm | ||
63 : | cglobal transfer_16to8add_mmx | ||
64 : | cglobal transfer8x8_copy_mmx | ||
65 : | Isibaar | 1.1 | |
66 : | ;=========================================================================== | ||
67 : | ; | ||
68 : | ; void transfer_8to16copy_mmx(int16_t * const dst, | ||
69 : | ; const uint8_t * const src, | ||
70 : | ; uint32_t stride); | ||
71 : | ; | ||
72 : | ;=========================================================================== | ||
73 : | |||
74 : | Isibaar | 1.5 | %macro COPY_8_TO_16 1 |
75 : | movq mm0, [eax] | ||
76 : | movq mm1, [eax+edx] | ||
77 : | movq mm2, mm0 | ||
78 : | movq mm3, mm1 | ||
79 : | punpcklbw mm0, mm7 | ||
80 : | movq [ecx+%1*32], mm0 | ||
81 : | punpcklbw mm1, mm7 | ||
82 : | movq [ecx+%1*32+16], mm1 | ||
83 : | punpckhbw mm2, mm7 | ||
84 : | punpckhbw mm3, mm7 | ||
85 : | lea eax,[eax+2*edx] | ||
86 : | movq [ecx+%1*32+8], mm2 | ||
87 : | movq [ecx+%1*32+24], mm3 | ||
88 : | %endmacro | ||
89 : | |||
90 : | Isibaar | 1.1 | align 16 |
91 : | Isibaar | 1.5 | transfer_8to16copy_mmx: |
92 : | Isibaar | 1.1 | |
93 : | Isibaar | 1.5 | mov ecx, [esp+ 4] ; Dst |
94 : | mov eax, [esp+ 8] ; Src | ||
95 : | mov edx, [esp+12] ; Stride | ||
96 : | pxor mm7,mm7 | ||
97 : | |||
98 : | COPY_8_TO_16 0 | ||
99 : | COPY_8_TO_16 1 | ||
100 : | COPY_8_TO_16 2 | ||
101 : | COPY_8_TO_16 3 | ||
102 : | ret | ||
103 : | Isibaar | 1.1 | |
104 : | ;=========================================================================== | ||
105 : | ; | ||
106 : | ; void transfer_16to8copy_mmx(uint8_t * const dst, | ||
107 : | ; const int16_t * const src, | ||
108 : | ; uint32_t stride); | ||
109 : | ; | ||
110 : | ;=========================================================================== | ||
111 : | |||
112 : | Isibaar | 1.5 | %macro COPY_16_TO_8 1 |
113 : | movq mm0, [eax+%1*32] | ||
114 : | movq mm1, [eax+%1*32+8] | ||
115 : | packuswb mm0, mm1 | ||
116 : | movq [ecx], mm0 | ||
117 : | movq mm2, [eax+%1*32+16] | ||
118 : | movq mm3, [eax+%1*32+24] | ||
119 : | packuswb mm2, mm3 | ||
120 : | movq [ecx+edx], mm2 | ||
121 : | %endmacro | ||
122 : | |||
123 : | Isibaar | 1.1 | align 16 |
124 : | Isibaar | 1.5 | transfer_16to8copy_mmx: |
125 : | Isibaar | 1.1 | |
126 : | Isibaar | 1.5 | mov ecx, [esp+ 4] ; Dst |
127 : | mov eax, [esp+ 8] ; Src | ||
128 : | mov edx, [esp+12] ; Stride | ||
129 : | |||
130 : | COPY_16_TO_8 0 | ||
131 : | lea ecx,[ecx+2*edx] | ||
132 : | COPY_16_TO_8 1 | ||
133 : | lea ecx,[ecx+2*edx] | ||
134 : | COPY_16_TO_8 2 | ||
135 : | lea ecx,[ecx+2*edx] | ||
136 : | COPY_16_TO_8 3 | ||
137 : | ret | ||
138 : | Isibaar | 1.1 | |
139 : | ;=========================================================================== | ||
140 : | ; | ||
141 : | ; void transfer_8to16sub_mmx(int16_t * const dct, | ||
142 : | ; uint8_t * const cur, | ||
143 : | ; const uint8_t * const ref, | ||
144 : | ; const uint32_t stride); | ||
145 : | ; | ||
146 : | ;=========================================================================== | ||
147 : | ;/************************************************************************** | ||
148 : | ; * | ||
149 : | ; * History: | ||
150 : | ; * | ||
151 : | ; * 27.12.2001 renamed from 'compensate' to 'transfer_8to16sub' | ||
152 : | ; * 02.12.2001 loop unrolled, code runs 10% faster now (Isibaar) | ||
153 : | ; * 30.11.2001 16 pixels are processed per iteration (Isibaar) | ||
154 : | ; * 30.11.2001 .text missing | ||
155 : | ; * 06.11.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au> | ||
156 : | ; * | ||
157 : | ; *************************************************************************/ | ||
158 : | |||
159 : | Isibaar | 1.5 | %macro COPY_8_TO_16_SUB 1 |
160 : | movq mm0, [eax] ; cur | ||
161 : | movq mm2, [eax+edx] | ||
162 : | movq mm1, mm0 | ||
163 : | movq mm3, mm2 | ||
164 : | |||
165 : | punpcklbw mm0, mm7 | ||
166 : | punpcklbw mm2, mm7 | ||
167 : | movq mm4, [ebx] ; ref | ||
168 : | punpckhbw mm1, mm7 | ||
169 : | punpckhbw mm3, mm7 | ||
170 : | movq mm5, [ebx+edx] ; ref | ||
171 : | |||
172 : | movq mm6, mm4 | ||
173 : | movq [eax], mm4 | ||
174 : | movq [eax+edx], mm5 | ||
175 : | punpcklbw mm4, mm7 | ||
176 : | punpckhbw mm6, mm7 | ||
177 : | psubsw mm0, mm4 | ||
178 : | psubsw mm1, mm6 | ||
179 : | movq mm6, mm5 | ||
180 : | punpcklbw mm5, mm7 | ||
181 : | punpckhbw mm6, mm7 | ||
182 : | psubsw mm2, mm5 | ||
183 : | lea eax,[eax+2*edx] | ||
184 : | psubsw mm3, mm6 | ||
185 : | lea ebx,[ebx+2*edx] | ||
186 : | |||
187 : | movq [ecx+%1*32+ 0], mm0 ; dst | ||
188 : | movq [ecx+%1*32+ 8], mm1 | ||
189 : | movq [ecx+%1*32+16], mm2 | ||
190 : | movq [ecx+%1*32+24], mm3 | ||
191 : | %endmacro | ||
192 : | |||
193 : | Isibaar | 1.1 | align 16 |
194 : | Isibaar | 1.5 | transfer_8to16sub_mmx: |
195 : | mov ecx, [esp + 4] ; Dst | ||
196 : | mov eax, [esp + 8] ; Cur | ||
197 : | push ebx | ||
198 : | mov ebx, [esp+4+12] ; Ref | ||
199 : | mov edx, [esp+4+16] ; Stride | ||
200 : | pxor mm7, mm7 | ||
201 : | Isibaar | 1.1 | |
202 : | Isibaar | 1.5 | COPY_8_TO_16_SUB 0 |
203 : | COPY_8_TO_16_SUB 1 | ||
204 : | COPY_8_TO_16_SUB 2 | ||
205 : | COPY_8_TO_16_SUB 3 | ||
206 : | Isibaar | 1.1 | |
207 : | Isibaar | 1.5 | pop ebx |
208 : | ret | ||
209 : | Isibaar | 1.1 | |
210 : | Isibaar | 1.5 | ;=========================================================================== |
211 : | ; | ||
212 : | ; void transfer_8to16sub2_mmx(int16_t * const dct, | ||
213 : | ; uint8_t * const cur, | ||
214 : | ; const uint8_t * ref1, | ||
215 : | ; const uint8_t * ref2, | ||
216 : | ; const uint32_t stride) | ||
217 : | ; | ||
218 : | ;=========================================================================== | ||
219 : | |||
220 : | %macro COPY_8_TO_16_SUB2_MMX 1 | ||
221 : | movq mm0, [eax] ; cur | ||
222 : | movq mm2, [eax+edx] | ||
223 : | |||
224 : | ; mm4 <- (ref1+ref2+1) / 2 | ||
225 : | movq mm4, [ebx] ; ref1 | ||
226 : | movq mm1, [esi] ; ref2 | ||
227 : | movq mm6, mm4 | ||
228 : | movq mm3, mm1 | ||
229 : | punpcklbw mm4, mm7 | ||
230 : | punpcklbw mm1, mm7 | ||
231 : | punpckhbw mm6, mm7 | ||
232 : | punpckhbw mm3, mm7 | ||
233 : | paddusw mm4, mm1 | ||
234 : | paddusw mm6, mm3 | ||
235 : | psrlw mm4,1 | ||
236 : | psrlw mm6,1 | ||
237 : | packuswb mm4, mm6 | ||
238 : | |||
239 : | ; mm5 <- (ref1+ref2+1) / 2 | ||
240 : | movq mm5, [ebx+edx] ; ref1 | ||
241 : | movq mm1, [esi+edx] ; ref2 | ||
242 : | movq mm6, mm5 | ||
243 : | movq mm3, mm1 | ||
244 : | punpcklbw mm5, mm7 | ||
245 : | punpcklbw mm1, mm7 | ||
246 : | punpckhbw mm6, mm7 | ||
247 : | punpckhbw mm3, mm7 | ||
248 : | paddusw mm5, mm1 | ||
249 : | paddusw mm6, mm3 | ||
250 : | lea esi,[esi+2*edx] | ||
251 : | psrlw mm5,1 | ||
252 : | psrlw mm6,1 | ||
253 : | packuswb mm5, mm6 | ||
254 : | |||
255 : | |||
256 : | movq mm1, mm0 | ||
257 : | movq mm3, mm2 | ||
258 : | punpcklbw mm0, mm7 | ||
259 : | punpcklbw mm2, mm7 | ||
260 : | punpckhbw mm1, mm7 | ||
261 : | punpckhbw mm3, mm7 | ||
262 : | |||
263 : | movq mm6, mm4 | ||
264 : | punpcklbw mm4, mm7 | ||
265 : | punpckhbw mm6, mm7 | ||
266 : | psubsw mm0, mm4 | ||
267 : | psubsw mm1, mm6 | ||
268 : | movq mm6, mm5 | ||
269 : | punpcklbw mm5, mm7 | ||
270 : | punpckhbw mm6, mm7 | ||
271 : | psubsw mm2, mm5 | ||
272 : | lea eax,[eax+2*edx] | ||
273 : | psubsw mm3, mm6 | ||
274 : | lea ebx,[ebx+2*edx] | ||
275 : | |||
276 : | movq [ecx+%1*32+ 0], mm0 ; dst | ||
277 : | movq [ecx+%1*32+ 8], mm1 | ||
278 : | movq [ecx+%1*32+16], mm2 | ||
279 : | movq [ecx+%1*32+24], mm3 | ||
280 : | %endmacro | ||
281 : | Isibaar | 1.1 | |
282 : | Isibaar | 1.5 | align 16 |
283 : | transfer_8to16sub2_mmx: | ||
284 : | mov ecx, [esp + 4] ; Dst | ||
285 : | mov eax, [esp + 8] ; Cur | ||
286 : | push ebx | ||
287 : | mov ebx, [esp+4+12] ; Ref1 | ||
288 : | push esi | ||
289 : | mov esi, [esp+8+16] ; Ref2 | ||
290 : | mov edx, [esp+8+20] ; Stride | ||
291 : | pxor mm7, mm7 | ||
292 : | |||
293 : | COPY_8_TO_16_SUB2_MMX 0 | ||
294 : | COPY_8_TO_16_SUB2_MMX 1 | ||
295 : | COPY_8_TO_16_SUB2_MMX 2 | ||
296 : | COPY_8_TO_16_SUB2_MMX 3 | ||
297 : | |||
298 : | pop esi | ||
299 : | pop ebx | ||
300 : | ret | ||
301 : | Isibaar | 1.1 | |
302 : | edgomez | 1.2 | ;=========================================================================== |
303 : | ; | ||
304 : | ; void transfer_8to16sub2_xmm(int16_t * const dct, | ||
305 : | Isibaar | 1.5 | ; uint8_t * const cur, |
306 : | ; const uint8_t * ref1, | ||
307 : | ; const uint8_t * ref2, | ||
308 : | ; const uint32_t stride) | ||
309 : | edgomez | 1.2 | ; |
310 : | ;=========================================================================== | ||
311 : | |||
312 : | Isibaar | 1.5 | %macro COPY_8_TO_16_SUB2_SSE 1 |
313 : | movq mm0, [eax] ; cur | ||
314 : | movq mm2, [eax+edx] | ||
315 : | movq mm1, mm0 | ||
316 : | movq mm3, mm2 | ||
317 : | |||
318 : | punpcklbw mm0, mm7 | ||
319 : | punpcklbw mm2, mm7 | ||
320 : | movq mm4, [ebx] ; ref1 | ||
321 : | pavgb mm4, [esi] ; ref2 | ||
322 : | punpckhbw mm1, mm7 | ||
323 : | punpckhbw mm3, mm7 | ||
324 : | movq mm5, [ebx+edx] ; ref | ||
325 : | pavgb mm5, [esi+edx] ; ref2 | ||
326 : | |||
327 : | movq mm6, mm4 | ||
328 : | punpcklbw mm4, mm7 | ||
329 : | punpckhbw mm6, mm7 | ||
330 : | psubsw mm0, mm4 | ||
331 : | psubsw mm1, mm6 | ||
332 : | lea esi,[esi+2*edx] | ||
333 : | movq mm6, mm5 | ||
334 : | punpcklbw mm5, mm7 | ||
335 : | punpckhbw mm6, mm7 | ||
336 : | psubsw mm2, mm5 | ||
337 : | lea eax,[eax+2*edx] | ||
338 : | psubsw mm3, mm6 | ||
339 : | lea ebx,[ebx+2*edx] | ||
340 : | |||
341 : | movq [ecx+%1*32+ 0], mm0 ; dst | ||
342 : | movq [ecx+%1*32+ 8], mm1 | ||
343 : | movq [ecx+%1*32+16], mm2 | ||
344 : | movq [ecx+%1*32+24], mm3 | ||
345 : | %endmacro | ||
346 : | |||
347 : | edgomez | 1.2 | align 16 |
348 : | Isibaar | 1.5 | transfer_8to16sub2_xmm: |
349 : | mov ecx, [esp + 4] ; Dst | ||
350 : | mov eax, [esp + 8] ; Cur | ||
351 : | push ebx | ||
352 : | mov ebx, [esp+4+12] ; Ref1 | ||
353 : | push esi | ||
354 : | mov esi, [esp+8+16] ; Ref2 | ||
355 : | mov edx, [esp+8+20] ; Stride | ||
356 : | pxor mm7, mm7 | ||
357 : | |||
358 : | COPY_8_TO_16_SUB2_SSE 0 | ||
359 : | COPY_8_TO_16_SUB2_SSE 1 | ||
360 : | COPY_8_TO_16_SUB2_SSE 2 | ||
361 : | COPY_8_TO_16_SUB2_SSE 3 | ||
362 : | |||
363 : | pop esi | ||
364 : | pop ebx | ||
365 : | ret | ||
366 : | Isibaar | 1.1 | |
367 : | ;=========================================================================== | ||
368 : | ; | ||
369 : | ; void transfer_16to8add_mmx(uint8_t * const dst, | ||
370 : | ; const int16_t * const src, | ||
371 : | ; uint32_t stride); | ||
372 : | ; | ||
373 : | ;=========================================================================== | ||
374 : | |||
375 : | Isibaar | 1.5 | %macro COPY_16_TO_8_ADD 1 |
376 : | movq mm0, [ecx] | ||
377 : | movq mm2, [ecx+edx] | ||
378 : | movq mm1, mm0 | ||
379 : | movq mm3, mm2 | ||
380 : | punpcklbw mm0, mm7 | ||
381 : | punpcklbw mm2, mm7 | ||
382 : | punpckhbw mm1, mm7 | ||
383 : | punpckhbw mm3, mm7 | ||
384 : | paddsw mm0, [eax+%1*32+ 0] | ||
385 : | paddsw mm1, [eax+%1*32+ 8] | ||
386 : | paddsw mm2, [eax+%1*32+16] | ||
387 : | paddsw mm3, [eax+%1*32+24] | ||
388 : | packuswb mm0, mm1 | ||
389 : | movq [ecx], mm0 | ||
390 : | packuswb mm2, mm3 | ||
391 : | movq [ecx+edx], mm2 | ||
392 : | %endmacro | ||
393 : | Isibaar | 1.1 | |
394 : | |||
395 : | Isibaar | 1.5 | align 16 |
396 : | transfer_16to8add_mmx: | ||
397 : | mov ecx, [esp+ 4] ; Dst | ||
398 : | mov eax, [esp+ 8] ; Src | ||
399 : | mov edx, [esp+12] ; Stride | ||
400 : | pxor mm7, mm7 | ||
401 : | |||
402 : | COPY_16_TO_8_ADD 0 | ||
403 : | lea ecx,[ecx+2*edx] | ||
404 : | COPY_16_TO_8_ADD 1 | ||
405 : | lea ecx,[ecx+2*edx] | ||
406 : | COPY_16_TO_8_ADD 2 | ||
407 : | lea ecx,[ecx+2*edx] | ||
408 : | COPY_16_TO_8_ADD 3 | ||
409 : | ret | ||
410 : | Isibaar | 1.1 | |
411 : | ;=========================================================================== | ||
412 : | ; | ||
413 : | ; void transfer8x8_copy_mmx(uint8_t * const dst, | ||
414 : | ; const uint8_t * const src, | ||
415 : | ; const uint32_t stride); | ||
416 : | ; | ||
417 : | ; | ||
418 : | ;=========================================================================== | ||
419 : | |||
420 : | Isibaar | 1.5 | %macro COPY_8_TO_8 0 |
421 : | movq mm0, [eax] | ||
422 : | movq mm1, [eax+edx] | ||
423 : | movq [ecx], mm0 | ||
424 : | lea eax,[eax+2*edx] | ||
425 : | movq [ecx+edx], mm1 | ||
426 : | %endmacro | ||
427 : | |||
428 : | Isibaar | 1.1 | align 16 |
429 : | Isibaar | 1.5 | transfer8x8_copy_mmx: |
430 : | mov ecx, [esp+ 4] ; Dst | ||
431 : | mov eax, [esp+ 8] ; Src | ||
432 : | mov edx, [esp+12] ; Stride | ||
433 : | |||
434 : | COPY_8_TO_8 | ||
435 : | lea ecx,[ecx+2*edx] | ||
436 : | COPY_8_TO_8 | ||
437 : | lea ecx,[ecx+2*edx] | ||
438 : | COPY_8_TO_8 | ||
439 : | lea ecx,[ecx+2*edx] | ||
440 : | COPY_8_TO_8 | ||
441 : | ret |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |