[cvs] / xvidcore / src / bitstream / x86_asm / cbp_sse2.asm Repository:
ViewVC logotype

Diff of /xvidcore/src/bitstream/x86_asm/cbp_sse2.asm

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

revision 1.1, Sun Jul 7 09:42:23 2002 UTC revision 1.10.2.3, Wed Sep 16 17:11:39 2009 UTC
# Line 1  Line 1 
1  ;/**************************************************************************  ;/****************************************************************************
2  ; *  ; *
3  ; *     XVID MPEG-4 VIDEO CODEC  ; *     XVID MPEG-4 VIDEO CODEC
4  ; *     sse2 cbp calc  ; *  - SSE2 CBP computation -
5  ; *  ; *
6  ; *     This program is an implementation of a part of one or more MPEG-4  ; *  Copyright (C) 2002 Daniel Smith <danielsmith@astroboymail.com>
7  ; *     Video tools as specified in ISO/IEC 14496-2 standard.  Those intending  ; *                2002 Pascal Massimino <skal@planet-d.net>
 ; *     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.  
8  ; *  ; *
9  ; *     This program is free software; you can redistribute it and/or modify  ; *     This program is free software; you can redistribute it and/or modify
10  ; *     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 18 
18  ; *  ; *
19  ; *     You should have received a copy of the GNU General Public License  ; *     You should have received a copy of the GNU General Public License
20  ; *     along with this program; if not, write to the Free Software  ; *     along with this program; if not, write to the Free Software
21  ; *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  ; *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22  ; *  ; *
23  ; *************************************************************************/  ; * $Id$
   
 ;/**************************************************************************  
 ; *  
 ; *     History:  
24  ; *  ; *
25  ; * 14.06.2002  cleanup -Skal-  ; ***************************************************************************/
 ; * 24.04.2002  had to use sse2's movdqu instead of movdqa (???)  
 ; * 17.04.2002  initial version (c) 2002 Daniel Smith  
 ; *  
 ; *************************************************************************/  
   
26    
27  bits 32  ;=============================================================================
28    ; Macros
29  section .data  ;=============================================================================
   
 %macro cglobal 1  
         %ifdef PREFIX  
                 global _%1  
                 %define %1 _%1  
         %else  
                 global %1  
         %endif  
 %endmacro  
30    
31  align 16  %include "nasm.inc"
32    
33  ignore_dc       dw              0, -1, -1, -1, -1, -1, -1, -1  %macro LOOP_SSE2 2
34      movdqa xmm0, [%2+(%1)*128]
 section .text  
   
 cglobal calc_cbp_sse2  
   
 ;===========================================================================  
 ;  
 ; uint32_t calc_cbp_sse2(const int16_t coeff[6][64]);  
 ;  
 ; not enabled - slower than mmx?  
 ;  
 ;===========================================================================  
   
 %macro LOOP_SSE2 1  
     movdqa      xmm0, [edx+(%1)*128]  
35          pand    xmm0, xmm7          pand    xmm0, xmm7
36          movdqa  xmm1, [edx+(%1)*128+16]    movdqa xmm1, [%2+(%1)*128+16]
37    
38          por             xmm0, [edx+(%1)*128+32]    por xmm0, [%2+(%1)*128+32]
39          por             xmm1, [edx+(%1)*128+48]    por xmm1, [%2+(%1)*128+48]
40          por             xmm0, [edx+(%1)*128+64]    por xmm0, [%2+(%1)*128+64]
41          por             xmm1, [edx+(%1)*128+80]    por xmm1, [%2+(%1)*128+80]
42          por             xmm0, [edx+(%1)*128+96]    por xmm0, [%2+(%1)*128+96]
43          por             xmm1, [edx+(%1)*128+112]    por xmm1, [%2+(%1)*128+112]
44    
45          por             xmm0, xmm1     ; xmm0 = xmm1 = 128 bits worth of info          por             xmm0, xmm1     ; xmm0 = xmm1 = 128 bits worth of info
46          psadbw  xmm0, xmm6     ; contains 2 dwords with sums          psadbw  xmm0, xmm6     ; contains 2 dwords with sums
47          movhlps xmm1, xmm0     ; move high dword from xmm0 to low xmm1          movhlps xmm1, xmm0     ; move high dword from xmm0 to low xmm1
48          por             xmm0, xmm1     ; combine          por             xmm0, xmm1     ; combine
49          movd    ecx, xmm0      ; if ecx set, values were found          movd    ecx, xmm0      ; if ecx set, values were found
50          test    ecx, ecx    test _ECX, _ECX
51  %endmacro  %endmacro
52    
53  align 16  ;=============================================================================
54    ; Data (Read Only)
55    ;=============================================================================
56    
57    DATA
58    
59    ALIGN SECTION_ALIGN
60    ignore_dc:
61      dw 0, -1, -1, -1, -1, -1, -1, -1
62    
63    ;=============================================================================
64    ; Code
65    ;=============================================================================
66    
67    TEXT
68    
69    ;-----------------------------------------------------------------------------
70    ; uint32_t calc_cbp_sse2(const int16_t coeff[6*64]);
71    ;-----------------------------------------------------------------------------
72    
73    ALIGN SECTION_ALIGN
74    cglobal calc_cbp_sse2
75  calc_cbp_sse2:  calc_cbp_sse2:
76      mov     edx, [esp+4]        ; coeff[]    mov _EDX, prm1           ; coeff[]
77      xor         eax, eax                    ; cbp = 0    xor _EAX, _EAX           ; cbp = 0
78    
79      PUSH_XMM6_XMM7
80    
81          movdqu  xmm7, [ignore_dc]       ; mask to ignore dc value          movdqu  xmm7, [ignore_dc]       ; mask to ignore dc value
82          pxor    xmm6, xmm6          ; zero          pxor    xmm6, xmm6          ; zero
83    
84    LOOP_SSE2 0    LOOP_SSE2 0, _EDX
         test ecx, ecx  
85          jz              .blk2          jz              .blk2
86      or eax, (1<<5)    or _EAX, (1<<5)
87  .blk2  
88    LOOP_SSE2 1  .blk2:
89          test ecx, ecx    LOOP_SSE2 1, _EDX
90          jz              .blk3          jz              .blk3
91    or eax, (1<<4)    or _EAX, (1<<4)
92  .blk3  
93    LOOP_SSE2 2  .blk3:
94          test ecx, ecx    LOOP_SSE2 2, _EDX
95          jz              .blk4          jz              .blk4
96    or eax, (1<<3)    or _EAX, (1<<3)
97  .blk4  
98    LOOP_SSE2 3  .blk4:
99          test ecx, ecx    LOOP_SSE2 3, _EDX
100          jz              .blk5          jz              .blk5
101    or eax, (1<<2)    or _EAX, (1<<2)
102  .blk5  
103    LOOP_SSE2 4  .blk5:
104          test ecx, ecx    LOOP_SSE2 4, _EDX
105          jz              .blk6          jz              .blk6
106    or eax, (1<<1)    or _EAX, (1<<1)
107  .blk6  
108    LOOP_SSE2 5  .blk6:
109          test ecx, ecx    LOOP_SSE2 5, _EDX
110          jz              .finished          jz              .finished
111    or eax, (1<<0)    or _EAX, (1<<0)
112  .finished  
113    .finished:
114    
115      POP_XMM6_XMM7
116    ret    ret
117    ENDFUNC
118    
119    NON_EXEC_STACK

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.10.2.3

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