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

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

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

revision 1381, Thu Mar 18 16:11:28 2004 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) 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: mem_transfer_3dne.asm,v 1.3 2004-03-22 22:36:24 edgomez Exp $
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
# Line 57  Line 36 
36                  global %1                  global %1
37          %endif          %endif
38  %endmacro  %endmacro
39    
40    ;=============================================================================
41    ; Read only data
42    ;=============================================================================
43    
44    %ifdef FORMAT_COFF
45    SECTION .rodata data
46    %else
47    SECTION .rodata data align=16
48    %endif
49    
50    ALIGN 8
51    mm_zero:
52            dd 0,0
53    ;=============================================================================
54    ; Macros
55    ;=============================================================================
56    
57  %macro nop4 0  %macro nop4 0
58  DB 08Dh,074h,026h,0          db 08Dh, 074h, 026h, 0
59  %endmacro  %endmacro
60    
61  section .text  ;=============================================================================
62    ; Code
63    ;=============================================================================
64    
65    SECTION .text
66    
67  cglobal transfer_8to16copy_3dne  cglobal transfer_8to16copy_3dne
68  cglobal transfer_16to8copy_3dne  cglobal transfer_16to8copy_3dne
# Line 71  Line 72 
72  cglobal transfer_16to8add_3dne  cglobal transfer_16to8add_3dne
73  cglobal transfer8x8_copy_3dne  cglobal transfer8x8_copy_3dne
74    
75  ;===========================================================================  ;-----------------------------------------------------------------------------
76  ;  ;
77  ; void transfer_8to16copy_3dne(int16_t * const dst,  ; void transfer_8to16copy_3dne(int16_t * const dst,
78  ;                                                       const uint8_t * const src,  ;                                                       const uint8_t * const src,
79  ;                                                       uint32_t stride);  ;                                                       uint32_t stride);
80  ;  ;
81  ;===========================================================================  ;-----------------------------------------------------------------------------
82    
83  align 16  ALIGN 16
84  transfer_8to16copy_3dne:  transfer_8to16copy_3dne:
85    
86    mov eax, [esp+ 8] ; Src    mov eax, [esp+ 8] ; Src
# Line 141  Line 142 
142    
143    
144    
145  ;===========================================================================  ;-----------------------------------------------------------------------------
146  ;  ;
147  ; void transfer_16to8copy_3dne(uint8_t * const dst,  ; void transfer_16to8copy_3dne(uint8_t * const dst,
148  ;                                                       const int16_t * const src,  ;                                                       const int16_t * const src,
149  ;                                                       uint32_t stride);  ;                                                       uint32_t stride);
150  ;  ;
151  ;===========================================================================  ;-----------------------------------------------------------------------------
152    
153  align 16  ALIGN 16
154  transfer_16to8copy_3dne:  transfer_16to8copy_3dne:
155    
156    mov eax, [esp+ 8] ; Src    mov eax, [esp+ 8] ; Src
# Line 185  Line 186 
186    movq [ecx+2*edx], mm6    movq [ecx+2*edx], mm6
187    ret    ret
188    
189  ;===========================================================================  ;-----------------------------------------------------------------------------
190  ;  ;
191  ; void transfer_8to16sub_3dne(int16_t * const dct,  ; void transfer_8to16sub_3dne(int16_t * const dct,
192  ;                               uint8_t * const cur,  ;                               uint8_t * const cur,
193  ;                               const uint8_t * const ref,  ;                               const uint8_t * const ref,
194  ;                               const uint32_t stride);  ;                               const uint32_t stride);
195  ;  ;
196  ;===========================================================================  ;-----------------------------------------------------------------------------
 ;/**************************************************************************  
 ; *  
 ; *     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>  
 ; *  
 ; *************************************************************************/  
197    
198  ; when second argument == 1, reference (ebx) block is to current (eax)  ; when second argument == 1, reference (ebx) block is to current (eax)
199  %macro COPY_8_TO_16_SUB 2  %macro COPY_8_TO_16_SUB 2
# Line 217  Line 207 
207    punpckhbw mm1, mm7    punpckhbw mm1, mm7
208    punpckhbw mm6, mm7    punpckhbw mm6, mm7
209    punpcklbw mm4, mm7    punpcklbw mm4, mm7
210  align 8  ALIGN 8
211    movq mm2, [byte eax+edx]    movq mm2, [byte eax+edx]
212    punpcklbw mm0, mm7    punpcklbw mm0, mm7
213    movq mm3, [byte eax+edx]    movq mm3, [byte eax+edx]
# Line 248  Line 238 
238    movq [edi+%1*32+24], mm3    movq [edi+%1*32+24], mm3
239  %endmacro  %endmacro
240    
241  align 16  ALIGN 16
242  transfer_8to16sub_3dne:  transfer_8to16sub_3dne:
243    mov eax, [esp + 8] ; Cur    mov eax, [esp + 8] ; Cur
244    mov ecx, [esp +12] ; Ref    mov ecx, [esp +12] ; Ref
# Line 257  Line 247 
247    mov edi, [esp+4+ 4] ; Dst    mov edi, [esp+4+ 4] ; Dst
248    pxor mm7, mm7    pxor mm7, mm7
249    nop    nop
250  align 4  ALIGN 4
251    COPY_8_TO_16_SUB 0, 1    COPY_8_TO_16_SUB 0, 1
252    COPY_8_TO_16_SUB 1, 1    COPY_8_TO_16_SUB 1, 1
253    COPY_8_TO_16_SUB 2, 1    COPY_8_TO_16_SUB 2, 1
# Line 265  Line 255 
255    mov edi,ecx    mov edi,ecx
256    ret    ret
257    
258  align 16  ALIGN 16
259  transfer_8to16subro_3dne:  transfer_8to16subro_3dne:
260    mov eax, [esp + 8] ; Cur    mov eax, [esp + 8] ; Cur
261    mov ecx, [esp +12] ; Ref    mov ecx, [esp +12] ; Ref
# Line 274  Line 264 
264    mov edi, [esp+4+ 4] ; Dst    mov edi, [esp+4+ 4] ; Dst
265    pxor mm7, mm7    pxor mm7, mm7
266    nop    nop
267  align 4  ALIGN 4
268    COPY_8_TO_16_SUB 0, 0    COPY_8_TO_16_SUB 0, 0
269    COPY_8_TO_16_SUB 1, 0    COPY_8_TO_16_SUB 1, 0
270    COPY_8_TO_16_SUB 2, 0    COPY_8_TO_16_SUB 2, 0
# Line 283  Line 273 
273    ret    ret
274    
275    
276  ;===========================================================================  ;-----------------------------------------------------------------------------
277  ;  ;
278  ; void transfer_8to16sub2_3dne(int16_t * const dct,  ; void transfer_8to16sub2_3dne(int16_t * const dct,
279  ;                               uint8_t * const cur,  ;                               uint8_t * const cur,
# Line 291  Line 281 
281  ;                               const uint8_t * ref2,  ;                               const uint8_t * ref2,
282  ;                               const uint32_t stride)  ;                               const uint32_t stride)
283  ;  ;
284  ;===========================================================================  ;-----------------------------------------------------------------------------
285    
286  %macro COPY_8_TO_16_SUB2_SSE 1  %macro COPY_8_TO_16_SUB2_SSE 1
287   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 295 
295    
296    movq mm4, [byte ebx]      ; ref1    movq mm4, [byte ebx]      ; ref1
297    pavgb mm4, [byte esi]     ; ref2    pavgb mm4, [byte esi]     ; ref2
298      movq [eax], mm4
299    movq mm5, [ebx+edx]  ; ref    movq mm5, [ebx+edx]  ; ref
300    pavgb mm5, [esi+edx] ; ref2    pavgb mm5, [esi+edx] ; ref2
301      movq [eax+edx], mm5
302    movq mm6, mm4    movq mm6, mm4
303    punpcklbw mm4, mm7    punpcklbw mm4, mm7
304    punpckhbw mm6, mm7    punpckhbw mm6, mm7
# Line 332  Line 324 
324    movq [ecx+%1*32+24], mm3    movq [ecx+%1*32+24], mm3
325  %endmacro  %endmacro
326    
327  align 16  ALIGN 16
328  transfer_8to16sub2_3dne:  transfer_8to16sub2_3dne:
329    mov edx, [esp +20] ; Stride    mov edx, [esp +20] ; Stride
330    mov ecx, [esp  + 4] ; Dst    mov ecx, [esp  + 4] ; Dst
# Line 352  Line 344 
344    ret    ret
345    
346    
347  ;===========================================================================  ;-----------------------------------------------------------------------------
348  ;  ;
349  ; void transfer_16to8add_3dne(uint8_t * const dst,  ; void transfer_16to8add_3dne(uint8_t * const dst,
350  ;                                               const int16_t * const src,  ;                                               const int16_t * const src,
351  ;                                               uint32_t stride);  ;                                               uint32_t stride);
352  ;  ;
353  ;===========================================================================  ;-----------------------------------------------------------------------------
354    
355  %macro COPY_16_TO_8_ADD 1  %macro COPY_16_TO_8_ADD 1
356    db 0Fh, 6Fh, 44h, 21h, 00 ;movq mm0, [byte ecx]    db 0Fh, 6Fh, 44h, 21h, 00 ;movq mm0, [byte ecx]
# Line 381  Line 373 
373  %endmacro  %endmacro
374    
375    
376  align 16  ALIGN 16
377  transfer_16to8add_3dne:  transfer_16to8add_3dne:
378    mov ecx, [esp+ 4] ; Dst    mov ecx, [esp+ 4] ; Dst
379    mov edx, [esp+12] ; Stride    mov edx, [esp+12] ; Stride
# Line 398  Line 390 
390    COPY_16_TO_8_ADD 3    COPY_16_TO_8_ADD 3
391    ret    ret
392    
393  ;===========================================================================  ;-----------------------------------------------------------------------------
394  ;  ;
395  ; void transfer8x8_copy_3dne(uint8_t * const dst,  ; void transfer8x8_copy_3dne(uint8_t * const dst,
396  ;                                       const uint8_t * const src,  ;                                       const uint8_t * const src,
397  ;                                       const uint32_t stride);  ;                                       const uint32_t stride);
398  ;  ;
399  ;  ;
400  ;===========================================================================  ;-----------------------------------------------------------------------------
401    
402  %macro COPY_8_TO_8 0  %macro COPY_8_TO_8 0
403    movq mm0, [byte  eax]    movq mm0, [byte  eax]
# Line 415  Line 407 
407    movq [ecx+edx], mm1    movq [ecx+edx], mm1
408  %endmacro  %endmacro
409    
410  align 16  ALIGN 16
411  transfer8x8_copy_3dne:  transfer8x8_copy_3dne:
412    mov eax, [esp+ 8] ; Src    mov eax, [esp+ 8] ; Src
413    mov edx, [esp+12] ; Stride    mov edx, [esp+12] ; Stride

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

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