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

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

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

revision 1.9, Sat Feb 15 15:22:19 2003 UTC revision 1.10, Mon Mar 22 22:36:24 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$
   
 ;/**************************************************************************  
 ; *  
 ; *     History:  
25  ; *  ; *
26  ; * 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@cs.rmit.edu.au>  
 ; *  
 ; *************************************************************************/  
   
27    
28  bits 32  BITS 32
29    
30  %macro cglobal 1  %macro cglobal 1
31          %ifdef PREFIX          %ifdef PREFIX
# Line 51  Line 36 
36          %endif          %endif
37  %endmacro  %endmacro
38    
39    ;=============================================================================
40    ; Read only data
41    ;=============================================================================
42    
43    %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  SECTION .text
58    
59  cglobal transfer_8to16copy_mmx  cglobal transfer_8to16copy_mmx
60  cglobal transfer_16to8copy_mmx  cglobal transfer_16to8copy_mmx
# Line 63  Line 65 
65  cglobal transfer_16to8add_mmx  cglobal transfer_16to8add_mmx
66  cglobal transfer8x8_copy_mmx  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  ;===========================================================================  ;-----------------------------------------------------------------------------
75    
76  %macro COPY_8_TO_16 1  %macro COPY_8_TO_16 1
77    movq mm0, [eax]    movq mm0, [eax]
# Line 87  Line 89 
89    movq [ecx+%1*32+24], mm3    movq [ecx+%1*32+24], mm3
90  %endmacro  %endmacro
91    
92  align 16  ALIGN 16
93  transfer_8to16copy_mmx:  transfer_8to16copy_mmx:
94    
95    mov ecx, [esp+ 4] ; Dst    mov ecx, [esp+ 4] ; Dst
# Line 101  Line 103 
103    COPY_8_TO_16 3    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  ;===========================================================================  ;-----------------------------------------------------------------------------
113    
114  %macro COPY_16_TO_8 1  %macro COPY_16_TO_8 1
115    movq mm0, [eax+%1*32]    movq mm0, [eax+%1*32]
# Line 120  Line 122 
122    movq [ecx+edx], mm2    movq [ecx+edx], mm2
123  %endmacro  %endmacro
124    
125  align 16  ALIGN 16
126  transfer_16to8copy_mmx:  transfer_16to8copy_mmx:
127    
128    mov ecx, [esp+ 4] ; Dst    mov ecx, [esp+ 4] ; Dst
# Line 136  Line 138 
138    COPY_16_TO_8 3    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  ; when second argument == 1, reference (ebx) block is to current (eax)  ; when second argument == 1, reference (ebx) block is to current (eax)
151  %macro COPY_8_TO_16_SUB 2  %macro COPY_8_TO_16_SUB 2
# Line 193  Line 184 
184    movq [ecx+%1*32+24], mm3    movq [ecx+%1*32+24], mm3
185  %endmacro  %endmacro
186    
187  align 16  ALIGN 16
188  transfer_8to16sub_mmx:  transfer_8to16sub_mmx:
189    mov ecx, [esp  + 4] ; Dst    mov ecx, [esp  + 4] ; Dst
190    mov eax, [esp  + 8] ; Cur    mov eax, [esp  + 8] ; Cur
# Line 211  Line 202 
202    ret    ret
203    
204    
205  align 16  ALIGN 16
206  transfer_8to16subro_mmx:  transfer_8to16subro_mmx:
207    mov ecx, [esp  + 4] ; Dst    mov ecx, [esp  + 4] ; Dst
208    mov eax, [esp  + 8] ; Cur    mov eax, [esp  + 8] ; Cur
# Line 229  Line 220 
220    ret    ret
221    
222    
223  ;===========================================================================  ;-----------------------------------------------------------------------------
224  ;  ;
225  ; void transfer_8to16sub2_mmx(int16_t * const dct,  ; void transfer_8to16sub2_mmx(int16_t * const dct,
226  ;                               uint8_t * const cur,  ;                               uint8_t * const cur,
# Line 237  Line 228 
228  ;                               const uint8_t * ref2,  ;                               const uint8_t * ref2,
229  ;                               const uint32_t stride)  ;                               const uint32_t stride)
230  ;  ;
231  ;===========================================================================  ;-----------------------------------------------------------------------------
232    
233  %macro COPY_8_TO_16_SUB2_MMX 1  %macro COPY_8_TO_16_SUB2_MMX 1
234    movq mm0, [eax]      ; cur    movq mm0, [eax]      ; cur
# Line 254  Line 245 
245    punpckhbw mm3, mm7    punpckhbw mm3, mm7
246    paddusw mm4, mm1    paddusw mm4, mm1
247    paddusw mm6, mm3    paddusw mm6, mm3
248      paddusw mm4, [mmx_one]
249      paddusw mm6, [mmx_one]
250    psrlw mm4,1    psrlw mm4,1
251    psrlw mm6,1    psrlw mm6,1
252    packuswb mm4, mm6    packuswb mm4, mm6
253      movq [eax], mm4
254    
255      ; mm5 <- (ref1+ref2+1) / 2      ; mm5 <- (ref1+ref2+1) / 2
256    movq mm5, [ebx+edx]  ; ref1    movq mm5, [ebx+edx]  ; ref1
# Line 269  Line 263 
263    punpckhbw mm3, mm7    punpckhbw mm3, mm7
264    paddusw mm5, mm1    paddusw mm5, mm1
265    paddusw mm6, mm3    paddusw mm6, mm3
266      paddusw mm5, [mmx_one]
267      paddusw mm6, [mmx_one]
268    lea esi,[esi+2*edx]    lea esi,[esi+2*edx]
269    psrlw mm5,1    psrlw mm5,1
270    psrlw mm6,1    psrlw mm6,1
271    packuswb mm5, mm6    packuswb mm5, mm6
272      movq [eax+edx], mm5
273    
274    movq mm1, mm0    movq mm1, mm0
275    movq mm3, mm2    movq mm3, mm2
# Line 301  Line 297 
297          movq [ecx+%1*32+24], mm3          movq [ecx+%1*32+24], mm3
298  %endmacro  %endmacro
299    
300  align 16  ALIGN 16
301  transfer_8to16sub2_mmx:  transfer_8to16sub2_mmx:
302    mov ecx, [esp  + 4] ; Dst    mov ecx, [esp  + 4] ; Dst
303    mov eax, [esp  + 8] ; Cur    mov eax, [esp  + 8] ; Cur
# Line 321  Line 317 
317    pop ebx    pop ebx
318    ret    ret
319    
320  ;===========================================================================  ;-----------------------------------------------------------------------------
321  ;  ;
322  ; void transfer_8to16sub2_xmm(int16_t * const dct,  ; void transfer_8to16sub2_xmm(int16_t * const dct,
323  ;                               uint8_t * const cur,  ;                               uint8_t * const cur,
# Line 329  Line 325 
325  ;                               const uint8_t * ref2,  ;                               const uint8_t * ref2,
326  ;                               const uint32_t stride)  ;                               const uint32_t stride)
327  ;  ;
328  ;===========================================================================  ;-----------------------------------------------------------------------------
329    
330  %macro COPY_8_TO_16_SUB2_SSE 1  %macro COPY_8_TO_16_SUB2_SSE 1
331    movq mm0, [eax]      ; cur    movq mm0, [eax]      ; cur
# Line 341  Line 337 
337    punpcklbw mm2, mm7    punpcklbw mm2, mm7
338    movq mm4, [ebx]      ; ref1    movq mm4, [ebx]      ; ref1
339    pavgb mm4, [esi]     ; ref2    pavgb mm4, [esi]     ; ref2
340      movq [eax], mm4
341          punpckhbw mm1, mm7          punpckhbw mm1, mm7
342          punpckhbw mm3, mm7          punpckhbw mm3, mm7
343    movq mm5, [ebx+edx]  ; ref    movq mm5, [ebx+edx]  ; ref
344    pavgb mm5, [esi+edx] ; ref2    pavgb mm5, [esi+edx] ; ref2
345      movq [eax+edx], mm5
346    
347    movq mm6, mm4    movq mm6, mm4
348    punpcklbw mm4, mm7    punpcklbw mm4, mm7
# Line 366  Line 364 
364          movq [ecx+%1*32+24], mm3          movq [ecx+%1*32+24], mm3
365  %endmacro  %endmacro
366    
367  align 16  ALIGN 16
368  transfer_8to16sub2_xmm:  transfer_8to16sub2_xmm:
369    mov ecx, [esp  + 4] ; Dst    mov ecx, [esp  + 4] ; Dst
370    mov eax, [esp  + 8] ; Cur    mov eax, [esp  + 8] ; Cur
# Line 386  Line 384 
384    pop ebx    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  ;===========================================================================  ;-----------------------------------------------------------------------------
394    
395  %macro COPY_16_TO_8_ADD 1  %macro COPY_16_TO_8_ADD 1
396    movq mm0, [ecx]    movq mm0, [ecx]
# Line 414  Line 412 
412  %endmacro  %endmacro
413    
414    
415  align 16  ALIGN 16
416  transfer_16to8add_mmx:  transfer_16to8add_mmx:
417    mov ecx, [esp+ 4] ; Dst    mov ecx, [esp+ 4] ; Dst
418    mov eax, [esp+ 8] ; Src    mov eax, [esp+ 8] ; Src
# Line 430  Line 428 
428    COPY_16_TO_8_ADD 3    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  ;===========================================================================  ;-----------------------------------------------------------------------------
439    
440  %macro COPY_8_TO_8 0  %macro COPY_8_TO_8 0
441    movq mm0, [eax]    movq mm0, [eax]
# Line 447  Line 445 
445    movq [ecx+edx], mm1    movq [ecx+edx], mm1
446  %endmacro  %endmacro
447    
448  align 16  ALIGN 16
449  transfer8x8_copy_mmx:  transfer8x8_copy_mmx:
450    mov ecx, [esp+ 4] ; Dst    mov ecx, [esp+ 4] ; Dst
451    mov eax, [esp+ 8] ; Src    mov eax, [esp+ 8] ; Src

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

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