[svn] / trunk / xvidcore / src / utils / x86_asm / mem_transfer_mmx.asm Repository:
ViewVC logotype

Diff of /trunk/xvidcore/src/utils/x86_asm/mem_transfer_mmx.asm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.3  
changed lines
  Added in v.1382

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4