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

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

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

revision 1794, Fri Nov 14 15:43:28 2008 UTC revision 1795, Wed Nov 26 01:04:34 2008 UTC
# Line 20  Line 20 
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  ; *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22  ; *  ; *
23  ; * $Id: cbp_sse2.asm,v 1.9 2008-11-11 20:46:24 Isibaar Exp $  ; * $Id: cbp_sse2.asm,v 1.10 2008-11-26 01:04:34 Isibaar Exp $
24  ; *  ; *
25  ; ***************************************************************************/  ; ***************************************************************************/
26    
 BITS 32  
   
27  ;=============================================================================  ;=============================================================================
28  ; Macros  ; Macros
29  ;=============================================================================  ;=============================================================================
30    
31  %macro cglobal 1  %include "nasm.inc"
         %ifdef PREFIX  
                 %ifdef MARK_FUNCS  
                         global _%1:function %1.endfunc-%1  
                         %define %1 _%1:function %1.endfunc-%1  
                         %define ENDFUNC .endfunc  
                 %else  
                         global _%1  
                         %define %1 _%1  
                         %define ENDFUNC  
                 %endif  
         %else  
                 %ifdef MARK_FUNCS  
                         global %1:function %1.endfunc-%1  
                         %define ENDFUNC .endfunc  
                 %else  
                         global %1  
                         %define ENDFUNC  
                 %endif  
         %endif  
 %endmacro  
32    
33  %macro LOOP_SSE2 1  %macro LOOP_SSE2 2
34    movdqa xmm0, [edx+(%1)*128]    movdqa xmm0, [%2+(%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  ;=============================================================================  ;=============================================================================
54  ; Data (Read Only)  ; Data (Read Only)
55  ;=============================================================================  ;=============================================================================
56    
57  %ifdef FORMAT_COFF  DATA
 SECTION .rodata  
 %else  
 SECTION .rodata align=16  
 %endif  
58    
59  ALIGN 16  ALIGN SECTION_ALIGN
60  ignore_dc:  ignore_dc:
61    dw 0, -1, -1, -1, -1, -1, -1, -1    dw 0, -1, -1, -1, -1, -1, -1, -1
62    
# Line 90  Line 64 
64  ; Code  ; Code
65  ;=============================================================================  ;=============================================================================
66    
67  SECTION .text  SECTION .rotext align=SECTION_ALIGN
68    
69  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
70  ; uint32_t calc_cbp_sse2(const int16_t coeff[6*64]);  ; uint32_t calc_cbp_sse2(const int16_t coeff[6*64]);
71  ;-----------------------------------------------------------------------------  ;-----------------------------------------------------------------------------
72    
73  ALIGN 16  ALIGN SECTION_ALIGN
74  cglobal calc_cbp_sse2  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    movdqu xmm7, [ignore_dc] ; mask to ignore dc value    movdqu xmm7, [ignore_dc] ; mask to ignore dc value
80    pxor xmm6, xmm6          ; zero    pxor xmm6, xmm6          ; zero
81    
82    LOOP_SSE2 0    LOOP_SSE2 0, _EDX
   test ecx, ecx  
83    jz .blk2    jz .blk2
84    or eax, (1<<5)    or _EAX, (1<<5)
85    
86  .blk2:  .blk2:
87    LOOP_SSE2 1    LOOP_SSE2 1, _EDX
   test ecx, ecx  
88    jz .blk3    jz .blk3
89    or eax, (1<<4)    or _EAX, (1<<4)
90    
91  .blk3:  .blk3:
92    LOOP_SSE2 2    LOOP_SSE2 2, _EDX
   test ecx, ecx  
93    jz .blk4    jz .blk4
94    or eax, (1<<3)    or _EAX, (1<<3)
95    
96  .blk4:  .blk4:
97    LOOP_SSE2 3    LOOP_SSE2 3, _EDX
   test ecx, ecx  
98    jz .blk5    jz .blk5
99    or eax, (1<<2)    or _EAX, (1<<2)
100    
101  .blk5:  .blk5:
102    LOOP_SSE2 4    LOOP_SSE2 4, _EDX
   test ecx, ecx  
103    jz .blk6    jz .blk6
104    or eax, (1<<1)    or _EAX, (1<<1)
105    
106  .blk6:  .blk6:
107    LOOP_SSE2 5    LOOP_SSE2 5, _EDX
   test ecx, ecx  
108    jz .finished    jz .finished
109    or eax, (1<<0)    or _EAX, (1<<0)
110    
111  .finished:  .finished:
112          ret          ret

Legend:
Removed from v.1794  
changed lines
  Added in v.1795

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