[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.2, Sun Nov 17 00:57:58 2002 UTC revision 1.14, Wed Sep 16 17:07:58 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 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  ; *  ; *
 ; *  Under section 8 of the GNU General Public License, the copyright  
 ; *  holders of XVID explicitly forbid distribution in the following  
 ; *  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.  
 ; *  
23  ; * $Id$  ; * $Id$
24  ; *  ; *
25  ; *************************************************************************/  ; ***************************************************************************/
   
 bits 32  
26    
27  section .data  ;=============================================================================
28    ; Macros
29    ;=============================================================================
30    
31    %include "nasm.inc"
32    
33    %macro LOOP_SSE2 2
34      movdqa xmm0, [%2+(%1)*128]
35      pand xmm0, xmm3
36      movdqa xmm1, [%2+(%1)*128+16]
37    
38      por xmm0, [%2+(%1)*128+32]
39      por xmm1, [%2+(%1)*128+48]
40      por xmm0, [%2+(%1)*128+64]
41      por xmm1, [%2+(%1)*128+80]
42      por xmm0, [%2+(%1)*128+96]
43      por xmm1, [%2+(%1)*128+112]
44    
45  %macro cglobal 1    por xmm0, xmm1        ; xmm0 = xmm1 = 128 bits worth of info
46          %ifdef PREFIX    psadbw xmm0, xmm2     ; contains 2 dwords with sums
47                  global _%1    movhlps xmm1, xmm0    ; move high dword from xmm0 to low xmm1
48                  %define %1 _%1    por xmm0, xmm1        ; combine
49          %else    movd ecx, xmm0        ; if ecx set, values were found
50                  global %1    test _ECX, _ECX
         %endif  
51  %endmacro  %endmacro
52    
53  align 16  ;=============================================================================
54    ; Data (Read Only)
55    ;=============================================================================
56    
57  ignore_dc       dw              0, -1, -1, -1, -1, -1, -1, -1  DATA
58    
59  section .text  ALIGN SECTION_ALIGN
60    ignore_dc:
61      dw 0, -1, -1, -1, -1, -1, -1, -1
62    
63  cglobal calc_cbp_sse2  ;=============================================================================
64    ; Code
65    ;=============================================================================
66    
67  ;===========================================================================  TEXT
 ;  
 ; 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]  
         pand    xmm0, xmm7  
         movdqa  xmm1, [edx+(%1)*128+16]  
   
         por             xmm0, [edx+(%1)*128+32]  
         por             xmm1, [edx+(%1)*128+48]  
         por             xmm0, [edx+(%1)*128+64]  
         por             xmm1, [edx+(%1)*128+80]  
         por             xmm0, [edx+(%1)*128+96]  
         por             xmm1, [edx+(%1)*128+112]  
68    
69          por             xmm0, xmm1     ; xmm0 = xmm1 = 128 bits worth of info  ;-----------------------------------------------------------------------------
70          psadbw  xmm0, xmm6     ; contains 2 dwords with sums  ; uint32_t calc_cbp_sse2(const int16_t coeff[6*64]);
71          movhlps xmm1, xmm0     ; move high dword from xmm0 to low xmm1  ;-----------------------------------------------------------------------------
         por             xmm0, xmm1     ; combine  
         movd    ecx, xmm0      ; if ecx set, values were found  
         test    ecx, ecx  
 %endmacro  
   
 align 16  
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    NON_EXEC_STACK

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

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