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

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

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

revision 1.2, Sat Feb 15 15:22:19 2003 UTC revision 1.5, Sun Aug 22 11:46:10 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) 2002 Jaan Kalda
 ; *     Video tools as specified in ISO/IEC 14496-2 standard.  Those intending  
 ; *     to use this software module in hardware or software products are  
 ; *     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.  
7  ; *  ; *
8  ; *     This program is free software; you can redistribute it and/or modify  ; *     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  ; *     it under the terms of the GNU General Public License as published by
# Line 24  Line 17 
17  ; *  ; *
18  ; *     You should have received a copy of the GNU General Public License  ; *     You should have received a copy of the GNU General Public License
19  ; *     along with this program; if not, write to the Free Software  ; *     along with this program; if not, write to the Free Software
20  ; *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  ; *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21  ; *  ; *
22  ; *************************************************************************/  ; * $Id$
23    ; *
24  ; these 3dne functions are compatible with iSSE, but are optimized specifically for  ; ***************************************************************************/
 ; K7 pipelines  
 ;  
 ;------------------------------------------------------------------------------  
 ; 09.12.2002  Athlon optimizations contributed by Jaan Kalda  
 ;------------------------------------------------------------------------------  
   
   
 bits 32  
 %ifdef FORMAT_COFF  
 section .data data  
 %else  
 section .data data align=16  
 %endif  
   
25    
26  align 8  ; these 3dne functions are compatible with iSSE, but are optimized specifically
27  mm_zero:  ; for K7 pipelines
 dd 0,0  
28    
29    BITS 32
30    
31  %macro cglobal 1  %macro cglobal 1
32          %ifdef PREFIX          %ifdef PREFIX
33                    %ifdef MARK_FUNCS
34                            global _%1:function
35                            %define %1 _%1:function
36                    %else
37                  global _%1                  global _%1
38                  %define %1 _%1                  %define %1 _%1
39                    %endif
40            %else
41                    %ifdef MARK_FUNCS
42                            global %1:function
43          %else          %else
44                  global %1                  global %1
45          %endif          %endif
46            %endif
47  %endmacro  %endmacro
48    
49    ;=============================================================================
50    ; Read only data
51    ;=============================================================================
52    
53    %ifdef FORMAT_COFF
54    SECTION .rodata
55    %else
56    SECTION .rodata align=16
57    %endif
58    
59    ALIGN 8
60    mm_zero:
61            dd 0,0
62    ;=============================================================================
63    ; Macros
64    ;=============================================================================
65    
66  %macro nop4 0  %macro nop4 0
67  DB 08Dh,074h,026h,0          db 08Dh, 074h, 026h, 0
68  %endmacro  %endmacro
69    
70  section .text  ;=============================================================================
71    ; Code
72    ;=============================================================================
73    
74    SECTION .text
75    
76  cglobal transfer_8to16copy_3dne  cglobal transfer_8to16copy_3dne
77  cglobal transfer_16to8copy_3dne  cglobal transfer_16to8copy_3dne
# Line 71  Line 81 
81  cglobal transfer_16to8add_3dne  cglobal transfer_16to8add_3dne
82  cglobal transfer8x8_copy_3dne  cglobal transfer8x8_copy_3dne
83    
84  ;===========================================================================  ;-----------------------------------------------------------------------------
85  ;  ;
86  ; void transfer_8to16copy_3dne(int16_t * const dst,  ; void transfer_8to16copy_3dne(int16_t * const dst,
87  ;                                                       const uint8_t * const src,  ;                                                       const uint8_t * const src,
88  ;                                                       uint32_t stride);  ;                                                       uint32_t stride);
89  ;  ;
90  ;===========================================================================  ;-----------------------------------------------------------------------------
91    
92  align 16  ALIGN 16
93  transfer_8to16copy_3dne:  transfer_8to16copy_3dne:
94    
95    mov eax, [esp+ 8] ; Src    mov eax, [esp+ 8] ; Src
# Line 141  Line 151 
151    
152    
153    
154  ;===========================================================================  ;-----------------------------------------------------------------------------
155  ;  ;
156  ; void transfer_16to8copy_3dne(uint8_t * const dst,  ; void transfer_16to8copy_3dne(uint8_t * const dst,
157  ;                                                       const int16_t * const src,  ;                                                       const int16_t * const src,
158  ;                                                       uint32_t stride);  ;                                                       uint32_t stride);
159  ;  ;
160  ;===========================================================================  ;-----------------------------------------------------------------------------
161    
162  align 16  ALIGN 16
163  transfer_16to8copy_3dne:  transfer_16to8copy_3dne:
164    
165    mov eax, [esp+ 8] ; Src    mov eax, [esp+ 8] ; Src
# Line 185  Line 195 
195    movq [ecx+2*edx], mm6    movq [ecx+2*edx], mm6
196    ret    ret
197    
198  ;===========================================================================  ;-----------------------------------------------------------------------------
199  ;  ;
200  ; void transfer_8to16sub_3dne(int16_t * const dct,  ; void transfer_8to16sub_3dne(int16_t * const dct,
201  ;                               uint8_t * const cur,  ;                               uint8_t * const cur,
202  ;                               const uint8_t * const ref,  ;                               const uint8_t * const ref,
203  ;                               const uint32_t stride);  ;                               const uint32_t stride);
204  ;  ;
205  ;===========================================================================  ;-----------------------------------------------------------------------------
 ;/**************************************************************************  
 ; *  
 ; *     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>  
 ; *  
 ; *************************************************************************/  
206    
207  ; when second argument == 1, reference (ebx) block is to current (eax)  ; when second argument == 1, reference (ebx) block is to current (eax)
208  %macro COPY_8_TO_16_SUB 2  %macro COPY_8_TO_16_SUB 2
# Line 217  Line 216 
216    punpckhbw mm1, mm7    punpckhbw mm1, mm7
217    punpckhbw mm6, mm7    punpckhbw mm6, mm7
218    punpcklbw mm4, mm7    punpcklbw mm4, mm7
219  align 8  ALIGN 8
220    movq mm2, [byte eax+edx]    movq mm2, [byte eax+edx]
221    punpcklbw mm0, mm7    punpcklbw mm0, mm7
222    movq mm3, [byte eax+edx]    movq mm3, [byte eax+edx]
# Line 248  Line 247 
247    movq [edi+%1*32+24], mm3    movq [edi+%1*32+24], mm3
248  %endmacro  %endmacro
249    
250  align 16  ALIGN 16
251  transfer_8to16sub_3dne:  transfer_8to16sub_3dne:
252    mov eax, [esp + 8] ; Cur    mov eax, [esp + 8] ; Cur
253    mov ecx, [esp +12] ; Ref    mov ecx, [esp +12] ; Ref
# Line 257  Line 256 
256    mov edi, [esp+4+ 4] ; Dst    mov edi, [esp+4+ 4] ; Dst
257    pxor mm7, mm7    pxor mm7, mm7
258    nop    nop
259  align 4  ALIGN 4
260    COPY_8_TO_16_SUB 0, 1    COPY_8_TO_16_SUB 0, 1
261    COPY_8_TO_16_SUB 1, 1    COPY_8_TO_16_SUB 1, 1
262    COPY_8_TO_16_SUB 2, 1    COPY_8_TO_16_SUB 2, 1
# Line 265  Line 264 
264    mov edi,ecx    mov edi,ecx
265    ret    ret
266    
267  align 16  ALIGN 16
268  transfer_8to16subro_3dne:  transfer_8to16subro_3dne:
269    mov eax, [esp + 8] ; Cur    mov eax, [esp + 8] ; Cur
270    mov ecx, [esp +12] ; Ref    mov ecx, [esp +12] ; Ref
# Line 274  Line 273 
273    mov edi, [esp+4+ 4] ; Dst    mov edi, [esp+4+ 4] ; Dst
274    pxor mm7, mm7    pxor mm7, mm7
275    nop    nop
276  align 4  ALIGN 4
277    COPY_8_TO_16_SUB 0, 0    COPY_8_TO_16_SUB 0, 0
278    COPY_8_TO_16_SUB 1, 0    COPY_8_TO_16_SUB 1, 0
279    COPY_8_TO_16_SUB 2, 0    COPY_8_TO_16_SUB 2, 0
# Line 283  Line 282 
282    ret    ret
283    
284    
285  ;===========================================================================  ;-----------------------------------------------------------------------------
286  ;  ;
287  ; void transfer_8to16sub2_3dne(int16_t * const dct,  ; void transfer_8to16sub2_3dne(int16_t * const dct,
288  ;                               uint8_t * const cur,  ;                               uint8_t * const cur,
# Line 291  Line 290 
290  ;                               const uint8_t * ref2,  ;                               const uint8_t * ref2,
291  ;                               const uint32_t stride)  ;                               const uint32_t stride)
292  ;  ;
293  ;===========================================================================  ;-----------------------------------------------------------------------------
294    
295  %macro COPY_8_TO_16_SUB2_SSE 1  %macro COPY_8_TO_16_SUB2_SSE 1
296   db 0Fh, 6Fh, 44h, 20h, 00  ;movq mm0, [byte eax]      ; cur   db 0Fh, 6Fh, 44h, 20h, 00  ;movq mm0, [byte eax]      ; cur
# Line 305  Line 304 
304    
305    movq mm4, [byte ebx]      ; ref1    movq mm4, [byte ebx]      ; ref1
306    pavgb mm4, [byte esi]     ; ref2    pavgb mm4, [byte esi]     ; ref2
307      movq [eax], mm4
308    movq mm5, [ebx+edx]  ; ref    movq mm5, [ebx+edx]  ; ref
309    pavgb mm5, [esi+edx] ; ref2    pavgb mm5, [esi+edx] ; ref2
310      movq [eax+edx], mm5
311    movq mm6, mm4    movq mm6, mm4
312    punpcklbw mm4, mm7    punpcklbw mm4, mm7
313    punpckhbw mm6, mm7    punpckhbw mm6, mm7
# Line 332  Line 333 
333    movq [ecx+%1*32+24], mm3    movq [ecx+%1*32+24], mm3
334  %endmacro  %endmacro
335    
336  align 16  ALIGN 16
337  transfer_8to16sub2_3dne:  transfer_8to16sub2_3dne:
338    mov edx, [esp +20] ; Stride    mov edx, [esp +20] ; Stride
339    mov ecx, [esp  + 4] ; Dst    mov ecx, [esp  + 4] ; Dst
# Line 352  Line 353 
353    ret    ret
354    
355    
356  ;===========================================================================  ;-----------------------------------------------------------------------------
357  ;  ;
358  ; void transfer_16to8add_3dne(uint8_t * const dst,  ; void transfer_16to8add_3dne(uint8_t * const dst,
359  ;                                               const int16_t * const src,  ;                                               const int16_t * const src,
360  ;                                               uint32_t stride);  ;                                               uint32_t stride);
361  ;  ;
362  ;===========================================================================  ;-----------------------------------------------------------------------------
363    
364  %macro COPY_16_TO_8_ADD 1  %macro COPY_16_TO_8_ADD 1
365    db 0Fh, 6Fh, 44h, 21h, 00 ;movq mm0, [byte ecx]    db 0Fh, 6Fh, 44h, 21h, 00 ;movq mm0, [byte ecx]
# Line 381  Line 382 
382  %endmacro  %endmacro
383    
384    
385  align 16  ALIGN 16
386  transfer_16to8add_3dne:  transfer_16to8add_3dne:
387    mov ecx, [esp+ 4] ; Dst    mov ecx, [esp+ 4] ; Dst
388    mov edx, [esp+12] ; Stride    mov edx, [esp+12] ; Stride
# Line 398  Line 399 
399    COPY_16_TO_8_ADD 3    COPY_16_TO_8_ADD 3
400    ret    ret
401    
402  ;===========================================================================  ;-----------------------------------------------------------------------------
403  ;  ;
404  ; void transfer8x8_copy_3dne(uint8_t * const dst,  ; void transfer8x8_copy_3dne(uint8_t * const dst,
405  ;                                       const uint8_t * const src,  ;                                       const uint8_t * const src,
406  ;                                       const uint32_t stride);  ;                                       const uint32_t stride);
407  ;  ;
408  ;  ;
409  ;===========================================================================  ;-----------------------------------------------------------------------------
410    
411  %macro COPY_8_TO_8 0  %macro COPY_8_TO_8 0
412    movq mm0, [byte  eax]    movq mm0, [byte  eax]
# Line 415  Line 416 
416    movq [ecx+edx], mm1    movq [ecx+edx], mm1
417  %endmacro  %endmacro
418    
419  align 16  ALIGN 16
420  transfer8x8_copy_3dne:  transfer8x8_copy_3dne:
421    mov eax, [esp+ 8] ; Src    mov eax, [esp+ 8] ; Src
422    mov edx, [esp+12] ; Stride    mov edx, [esp+12] ; Stride

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5

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