[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 655, Sun Nov 17 00:57:58 2002 UTC revision 1839, Tue Dec 2 13:44:55 2008 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 file is part of XviD, a free MPEG-4 video encoder/decoder  ; *  Copyright (C) 2002 Daniel Smith <danielsmith@astroboymail.com>
7    ; *                2002 Pascal Massimino <skal@planet-d.net>
8  ; *  ; *
9  ; *  XviD is free software; you can redistribute it and/or modify it  ; *  This program is free software ; you can redistribute it and/or modify
10  ; *  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
11  ; *  the Free Software Foundation; either version 2 of the License, or  ; *  the Free Software Foundation; either version 2 of the License, or
12  ; *  (at your option) any later version.  ; *  (at your option) any later version.
13  ; *  ; *
# Line 19  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  ; *  Under section 8 of the GNU General Public License, the copyright  ; * $Id: cbp_sse2.asm,v 1.12 2008-12-02 13:44:55 Isibaar Exp $
24  ; *  holders of XVID explicitly forbid distribution in the following  ; *
25  ; *  countries:  ; ***************************************************************************/
 ; *  
 ; *    - Japan  
 ; *    - United States of America  
 ; *  
 ; *  Linking XviD statically or dynamically with other modules is making a  
 ; *  combined work based on XviD.  Thus, the terms and conditions of the  
 ; *  GNU General Public License cover the whole combination.  
 ; *  
 ; *  As a special exception, the copyright holders of XviD give you  
 ; *  permission to link XviD with independent modules that communicate with  
 ; *  XviD solely through the VFW1.1 and DShow interfaces, regardless of the  
 ; *  license terms of these independent modules, and to copy and distribute  
 ; *  the resulting combined work under terms of your choice, provided that  
 ; *  every copy of the combined work is accompanied by a complete copy of  
 ; *  the source code of XviD (the version of XviD used to produce the  
 ; *  combined work), being distributed under the terms of the GNU General  
 ; *  Public License plus this exception.  An independent module is a module  
 ; *  which is not derived from or based on XviD.  
 ; *  
 ; *  Note that people who make modified versions of XviD are not obligated  
 ; *  to grant this special exception for their modified versions; it is  
 ; *  their choice whether to do so.  The GNU General Public License gives  
 ; *  permission to release a modified version without this exception; this  
 ; *  exception also makes it possible to release a modified version which  
 ; *  carries forward this exception.  
 ; *  
 ; * $Id: cbp_sse2.asm,v 1.2 2002-11-17 00:57:58 edgomez Exp $  
 ; *  
 ; *************************************************************************/  
   
 bits 32  
   
 section .data  
   
 %macro cglobal 1  
         %ifdef PREFIX  
                 global _%1  
                 %define %1 _%1  
         %else  
                 global %1  
         %endif  
 %endmacro  
   
 align 16  
   
 ignore_dc       dw              0, -1, -1, -1, -1, -1, -1, -1  
   
 section .text  
   
 cglobal calc_cbp_sse2  
26    
27  ;===========================================================================  ;=============================================================================
28  ;  ; Macros
29  ; uint32_t calc_cbp_sse2(const int16_t coeff[6][64]);  ;=============================================================================
30  ;  
31  ; not enabled - slower than mmx?  %include "nasm.inc"
32  ;  
33  ;===========================================================================  %macro LOOP_SSE2 2
34      movdqa xmm0, [%2+(%1)*128]
35  %macro LOOP_SSE2 1    pand xmm0, xmm3
36      movdqa      xmm0, [edx+(%1)*128]    movdqa xmm1, [%2+(%1)*128+16]
37          pand    xmm0, xmm7  
38          movdqa  xmm1, [edx+(%1)*128+16]    por xmm0, [%2+(%1)*128+32]
39      por xmm1, [%2+(%1)*128+48]
40          por             xmm0, [edx+(%1)*128+32]    por xmm0, [%2+(%1)*128+64]
41          por             xmm1, [edx+(%1)*128+48]    por xmm1, [%2+(%1)*128+80]
42          por             xmm0, [edx+(%1)*128+64]    por xmm0, [%2+(%1)*128+96]
43          por             xmm1, [edx+(%1)*128+80]    por xmm1, [%2+(%1)*128+112]
         por             xmm0, [edx+(%1)*128+96]  
         por             xmm1, [edx+(%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, xmm2     ; 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    SECTION .rotext align=SECTION_ALIGN
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          movdqu  xmm7, [ignore_dc]       ; mask to ignore dc value    movdqu xmm3, [ignore_dc] ; mask to ignore dc value
80          pxor    xmm6, xmm6          ; zero    pxor xmm2, xmm2          ; 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  .blk2  
86    LOOP_SSE2 1  .blk2:
87          test ecx, ecx    LOOP_SSE2 1, _EDX
88          jz              .blk3          jz              .blk3
89    or eax, (1<<4)    or _EAX, (1<<4)
90  .blk3  
91    LOOP_SSE2 2  .blk3:
92          test ecx, ecx    LOOP_SSE2 2, _EDX
93          jz              .blk4          jz              .blk4
94    or eax, (1<<3)    or _EAX, (1<<3)
95  .blk4  
96    LOOP_SSE2 3  .blk4:
97          test ecx, ecx    LOOP_SSE2 3, _EDX
98          jz              .blk5          jz              .blk5
99    or eax, (1<<2)    or _EAX, (1<<2)
100  .blk5  
101    LOOP_SSE2 4  .blk5:
102          test ecx, ecx    LOOP_SSE2 4, _EDX
103          jz              .blk6          jz              .blk6
104    or eax, (1<<1)    or _EAX, (1<<1)
105  .blk6  
106    LOOP_SSE2 5  .blk6:
107          test ecx, ecx    LOOP_SSE2 5, _EDX
108          jz              .finished          jz              .finished
109    or eax, (1<<0)    or _EAX, (1<<0)
110  .finished  
111    .finished:
112    
113    ret    ret
114    ENDFUNC
115    
116    
117    %ifidn __OUTPUT_FORMAT__,elf
118    section ".note.GNU-stack" noalloc noexec nowrite progbits
119    %endif
120    

Legend:
Removed from v.655  
changed lines
  Added in v.1839

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