[svn] / branches / dev-api-4 / xvidcore / src / utils / x86_asm / mem_transfer_mmx.asm Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/src/utils/x86_asm/mem_transfer_mmx.asm

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

trunk/xvidcore/src/utils/x86_asm/mem_transfer_mmx.asm revision 654, Sun Nov 17 00:51:11 2002 UTC branches/dev-api-4/xvidcore/src/utils/x86_asm/mem_transfer_mmx.asm revision 1192, Tue Oct 28 22:23:03 2003 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 file is part of XviD, a free MPEG-4 video encoder/decoder  ; *  Copyright (C) 2001 Peter Ross <pross@xvid.org>
7    ; *                2001 Michael Militzer <isibaar@xvid.org>
8    ; *                2002 Pascal Massimino <skal@planet-d.net>
9  ; *  ; *
10  ; *  XviD is free software; you can redistribute it and/or modify it  ; *  This program is free software ; you can redistribute it and/or modify
11  ; *  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
12  ; *  the Free Software Foundation; either version 2 of the License, or  ; *  the Free Software Foundation; either version 2 of the License, or
13  ; *  (at your option) any later version.  ; *  (at your option) any later version.
14  ; *  ; *
# Line 19  Line 21 
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  ; *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
23  ; *  ; *
24  ; *  Under section 8 of the GNU General Public License, the copyright  ; * $Id: mem_transfer_mmx.asm,v 1.9.2.1 2003-10-28 22:23:03 edgomez Exp $
 ; *  holders of XVID explicitly forbid distribution in the following  
 ; *  countries:  
25  ; *  ; *
26  ; *    - Japan  ; ***************************************************************************/
 ; *    - United States of America  
 ; *  
 ; *  Linking XviD statically or dynamically with other modules is making a  
 ; *  combined work based on XviD.  Thus, the terms and conditions of the  
 ; *  GNU General Public License cover the whole combination.  
 ; *  
 ; *  As a special exception, the copyright holders of XviD give you  
 ; *  permission to link XviD with independent modules that communicate with  
 ; *  XviD solely through the VFW1.1 and DShow interfaces, regardless of the  
 ; *  license terms of these independent modules, and to copy and distribute  
 ; *  the resulting combined work under terms of your choice, provided that  
 ; *  every copy of the combined work is accompanied by a complete copy of  
 ; *  the source code of XviD (the version of XviD used to produce the  
 ; *  combined work), being distributed under the terms of the GNU General  
 ; *  Public License plus this exception.  An independent module is a module  
 ; *  which is not derived from or based on XviD.  
 ; *  
 ; *  Note that people who make modified versions of XviD are not obligated  
 ; *  to grant this special exception for their modified versions; it is  
 ; *  their choice whether to do so.  The GNU General Public License gives  
 ; *  permission to release a modified version without this exception; this  
 ; *  exception also makes it possible to release a modified version which  
 ; *  carries forward this exception.  
 ; *  
 ; * $Id: mem_transfer_mmx.asm,v 1.8 2002-11-17 00:51:11 edgomez Exp $  
 ; *  
 ; *************************************************************************/  
   
 ;/**************************************************************************  
 ; *  
 ; *     History:  
 ; *  
 ; * 04.06.2002  speed enhancement (unroll+overlap). -Skal-  
 ; *             + added transfer_8to16sub2_mmx/xmm  
 ; * 07.01.2002  merge functions from compensate_mmx; rename functions  
 ; *     07.11.2001      initial version; (c)2001 peter ross <pross@xvid.org>  
 ; *  
 ; *************************************************************************/  
27    
28    BITS 32
 bits 32  
29    
30  %macro cglobal 1  %macro cglobal 1
31          %ifdef PREFIX          %ifdef PREFIX
# Line 75  Line 36 
36          %endif          %endif
37  %endmacro  %endmacro
38    
39    ;=============================================================================
40    ; Code
41    ;=============================================================================
42    
43  section .text  SECTION .text
44    
45  cglobal transfer_8to16copy_mmx  cglobal transfer_8to16copy_mmx
46  cglobal transfer_16to8copy_mmx  cglobal transfer_16to8copy_mmx
47  cglobal transfer_8to16sub_mmx  cglobal transfer_8to16sub_mmx
48    cglobal transfer_8to16subro_mmx
49  cglobal transfer_8to16sub2_mmx  cglobal transfer_8to16sub2_mmx
50  cglobal transfer_8to16sub2_xmm  cglobal transfer_8to16sub2_xmm
51  cglobal transfer_16to8add_mmx  cglobal transfer_16to8add_mmx
52  cglobal transfer8x8_copy_mmx  cglobal transfer8x8_copy_mmx
53    
54  ;===========================================================================  ;-----------------------------------------------------------------------------
55  ;  ;
56  ; void transfer_8to16copy_mmx(int16_t * const dst,  ; void transfer_8to16copy_mmx(int16_t * const dst,
57  ;                                                       const uint8_t * const src,  ;                                                       const uint8_t * const src,
58  ;                                                       uint32_t stride);  ;                                                       uint32_t stride);
59  ;  ;
60  ;===========================================================================  ;-----------------------------------------------------------------------------
61    
62  %macro COPY_8_TO_16 1  %macro COPY_8_TO_16 1
63    movq mm0, [eax]    movq mm0, [eax]
# Line 110  Line 75 
75    movq [ecx+%1*32+24], mm3    movq [ecx+%1*32+24], mm3
76  %endmacro  %endmacro
77    
78  align 16  ALIGN 16
79  transfer_8to16copy_mmx:  transfer_8to16copy_mmx:
80    
81    mov ecx, [esp+ 4] ; Dst    mov ecx, [esp+ 4] ; Dst
# Line 124  Line 89 
89    COPY_8_TO_16 3    COPY_8_TO_16 3
90    ret    ret
91    
92  ;===========================================================================  ;-----------------------------------------------------------------------------
93  ;  ;
94  ; void transfer_16to8copy_mmx(uint8_t * const dst,  ; void transfer_16to8copy_mmx(uint8_t * const dst,
95  ;                                                       const int16_t * const src,  ;                                                       const int16_t * const src,
96  ;                                                       uint32_t stride);  ;                                                       uint32_t stride);
97  ;  ;
98  ;===========================================================================  ;-----------------------------------------------------------------------------
99    
100  %macro COPY_16_TO_8 1  %macro COPY_16_TO_8 1
101    movq mm0, [eax+%1*32]    movq mm0, [eax+%1*32]
# Line 143  Line 108 
108    movq [ecx+edx], mm2    movq [ecx+edx], mm2
109  %endmacro  %endmacro
110    
111  align 16  ALIGN 16
112  transfer_16to8copy_mmx:  transfer_16to8copy_mmx:
113    
114    mov ecx, [esp+ 4] ; Dst    mov ecx, [esp+ 4] ; Dst
# Line 159  Line 124 
124    COPY_16_TO_8 3    COPY_16_TO_8 3
125    ret    ret
126    
127  ;===========================================================================  ;-----------------------------------------------------------------------------
128  ;  ;
129  ; void transfer_8to16sub_mmx(int16_t * const dct,  ; void transfer_8to16sub_mmx(int16_t * const dct,
130  ;                               uint8_t * const cur,  ;                               uint8_t * const cur,
131  ;                               const uint8_t * const ref,  ;                               const uint8_t * const ref,
132  ;                               const uint32_t stride);  ;                               const uint32_t stride);
133  ;  ;
134  ;===========================================================================  ;-----------------------------------------------------------------------------
 ;/**************************************************************************  
 ; *  
 ; *     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@xvid.org>  
 ; *  
 ; *************************************************************************/  
135    
136  %macro COPY_8_TO_16_SUB 1  ; when second argument == 1, reference (ebx) block is to current (eax)
137    %macro COPY_8_TO_16_SUB 2
138    movq mm0, [eax]      ; cur    movq mm0, [eax]      ; cur
139    movq mm2, [eax+edx]    movq mm2, [eax+edx]
140    movq mm1, mm0    movq mm1, mm0
# Line 193  Line 148 
148    movq mm5, [ebx+edx]  ; ref    movq mm5, [ebx+edx]  ; ref
149    
150    movq mm6, mm4    movq mm6, mm4
151    %if %2 == 1
152    movq [eax], mm4    movq [eax], mm4
153    movq [eax+edx], mm5    movq [eax+edx], mm5
154    %endif
155    punpcklbw mm4, mm7    punpcklbw mm4, mm7
156    punpckhbw mm6, mm7    punpckhbw mm6, mm7
157    psubsw mm0, mm4    psubsw mm0, mm4
# Line 213  Line 170 
170          movq [ecx+%1*32+24], mm3          movq [ecx+%1*32+24], mm3
171  %endmacro  %endmacro
172    
173  align 16  ALIGN 16
174  transfer_8to16sub_mmx:  transfer_8to16sub_mmx:
175    mov ecx, [esp  + 4] ; Dst    mov ecx, [esp  + 4] ; Dst
176    mov eax, [esp  + 8] ; Cur    mov eax, [esp  + 8] ; Cur
# Line 222  Line 179 
179    mov edx, [esp+4+16] ; Stride    mov edx, [esp+4+16] ; Stride
180    pxor mm7, mm7    pxor mm7, mm7
181    
182    COPY_8_TO_16_SUB 0    COPY_8_TO_16_SUB 0, 1
183    COPY_8_TO_16_SUB 1    COPY_8_TO_16_SUB 1, 1
184    COPY_8_TO_16_SUB 2    COPY_8_TO_16_SUB 2, 1
185    COPY_8_TO_16_SUB 3    COPY_8_TO_16_SUB 3, 1
186    
187    pop ebx    pop ebx
188    ret    ret
189    
190  ;===========================================================================  
191    ALIGN 16
192    transfer_8to16subro_mmx:
193      mov ecx, [esp  + 4] ; Dst
194      mov eax, [esp  + 8] ; Cur
195      push ebx
196      mov ebx, [esp+4+12] ; Ref
197      mov edx, [esp+4+16] ; Stride
198      pxor mm7, mm7
199    
200      COPY_8_TO_16_SUB 0, 0
201      COPY_8_TO_16_SUB 1, 0
202      COPY_8_TO_16_SUB 2, 0
203      COPY_8_TO_16_SUB 3, 0
204    
205      pop ebx
206      ret
207    
208    
209    ;-----------------------------------------------------------------------------
210  ;  ;
211  ; void transfer_8to16sub2_mmx(int16_t * const dct,  ; void transfer_8to16sub2_mmx(int16_t * const dct,
212  ;                               uint8_t * const cur,  ;                               uint8_t * const cur,
# Line 238  Line 214 
214  ;                               const uint8_t * ref2,  ;                               const uint8_t * ref2,
215  ;                               const uint32_t stride)  ;                               const uint32_t stride)
216  ;  ;
217  ;===========================================================================  ;-----------------------------------------------------------------------------
218    
219  %macro COPY_8_TO_16_SUB2_MMX 1  %macro COPY_8_TO_16_SUB2_MMX 1
220    movq mm0, [eax]      ; cur    movq mm0, [eax]      ; cur
# Line 302  Line 278 
278          movq [ecx+%1*32+24], mm3          movq [ecx+%1*32+24], mm3
279  %endmacro  %endmacro
280    
281  align 16  ALIGN 16
282  transfer_8to16sub2_mmx:  transfer_8to16sub2_mmx:
283    mov ecx, [esp  + 4] ; Dst    mov ecx, [esp  + 4] ; Dst
284    mov eax, [esp  + 8] ; Cur    mov eax, [esp  + 8] ; Cur
# Line 322  Line 298 
298    pop ebx    pop ebx
299    ret    ret
300    
301  ;===========================================================================  ;-----------------------------------------------------------------------------
302  ;  ;
303  ; void transfer_8to16sub2_xmm(int16_t * const dct,  ; void transfer_8to16sub2_xmm(int16_t * const dct,
304  ;                               uint8_t * const cur,  ;                               uint8_t * const cur,
# Line 330  Line 306 
306  ;                               const uint8_t * ref2,  ;                               const uint8_t * ref2,
307  ;                               const uint32_t stride)  ;                               const uint32_t stride)
308  ;  ;
309  ;===========================================================================  ;-----------------------------------------------------------------------------
310    
311  %macro COPY_8_TO_16_SUB2_SSE 1  %macro COPY_8_TO_16_SUB2_SSE 1
312    movq mm0, [eax]      ; cur    movq mm0, [eax]      ; cur
# Line 367  Line 343 
343          movq [ecx+%1*32+24], mm3          movq [ecx+%1*32+24], mm3
344  %endmacro  %endmacro
345    
346  align 16  ALIGN 16
347  transfer_8to16sub2_xmm:  transfer_8to16sub2_xmm:
348    mov ecx, [esp  + 4] ; Dst    mov ecx, [esp  + 4] ; Dst
349    mov eax, [esp  + 8] ; Cur    mov eax, [esp  + 8] ; Cur
# Line 387  Line 363 
363    pop ebx    pop ebx
364    ret    ret
365    
366  ;===========================================================================  ;-----------------------------------------------------------------------------
367  ;  ;
368  ; void transfer_16to8add_mmx(uint8_t * const dst,  ; void transfer_16to8add_mmx(uint8_t * const dst,
369  ;                                               const int16_t * const src,  ;                                               const int16_t * const src,
370  ;                                               uint32_t stride);  ;                                               uint32_t stride);
371  ;  ;
372  ;===========================================================================  ;-----------------------------------------------------------------------------
373    
374  %macro COPY_16_TO_8_ADD 1  %macro COPY_16_TO_8_ADD 1
375    movq mm0, [ecx]    movq mm0, [ecx]
# Line 415  Line 391 
391  %endmacro  %endmacro
392    
393    
394  align 16  ALIGN 16
395  transfer_16to8add_mmx:  transfer_16to8add_mmx:
396    mov ecx, [esp+ 4] ; Dst    mov ecx, [esp+ 4] ; Dst
397    mov eax, [esp+ 8] ; Src    mov eax, [esp+ 8] ; Src
# Line 431  Line 407 
407    COPY_16_TO_8_ADD 3    COPY_16_TO_8_ADD 3
408    ret    ret
409    
410  ;===========================================================================  ;-----------------------------------------------------------------------------
411  ;  ;
412  ; void transfer8x8_copy_mmx(uint8_t * const dst,  ; void transfer8x8_copy_mmx(uint8_t * const dst,
413  ;                                       const uint8_t * const src,  ;                                       const uint8_t * const src,
414  ;                                       const uint32_t stride);  ;                                       const uint32_t stride);
415  ;  ;
416  ;  ;
417  ;===========================================================================  ;-----------------------------------------------------------------------------
418    
419  %macro COPY_8_TO_8 0  %macro COPY_8_TO_8 0
420    movq mm0, [eax]    movq mm0, [eax]
# Line 448  Line 424 
424    movq [ecx+edx], mm1    movq [ecx+edx], mm1
425  %endmacro  %endmacro
426    
427  align 16  ALIGN 16
428  transfer8x8_copy_mmx:  transfer8x8_copy_mmx:
429    mov ecx, [esp+ 4] ; Dst    mov ecx, [esp+ 4] ; Dst
430    mov eax, [esp+ 8] ; Src    mov eax, [esp+ 8] ; Src

Legend:
Removed from v.654  
changed lines
  Added in v.1192

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