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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3.2.2 - (view) (download)

1 : edgomez 1.3.2.1 ;/****************************************************************************
2 : Isibaar 1.1 ; *
3 : edgomez 1.3.2.1 ; * XVID MPEG-4 VIDEO CODEC
4 :     ; * - SSE2 CBP computation -
5 : Isibaar 1.1 ; *
6 : edgomez 1.3.2.1 ; * Copyright (C) 2002 Daniel Smith <danielsmith@astroboymail.com>
7 :     ; * 2002 Pascal Massimino <skal@planet-d.net>
8 : edgomez 1.3 ; *
9 : edgomez 1.3.2.1 ; * 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
11 :     ; * the Free Software Foundation ; either version 2 of the License, or
12 :     ; * (at your option) any later version.
13 : edgomez 1.3 ; *
14 : edgomez 1.3.2.1 ; * This program is distributed in the hope that it will be useful,
15 :     ; * but WITHOUT ANY WARRANTY ; without even the implied warranty of
16 :     ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 :     ; * GNU General Public License for more details.
18 : edgomez 1.3 ; *
19 : edgomez 1.3.2.1 ; * You should have received a copy of the GNU General Public License
20 :     ; * along with this program ; if not, write to the Free Software
21 :     ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 : Isibaar 1.1 ; *
23 : edgomez 1.3.2.1 ; * $Id$
24 : Isibaar 1.1 ; *
25 : edgomez 1.3.2.1 ; ***************************************************************************/
26 : Isibaar 1.1
27 : edgomez 1.3.2.1 BITS 32
28 : Isibaar 1.1
29 : edgomez 1.3.2.1 ;=============================================================================
30 :     ; Macros
31 :     ;=============================================================================
32 : Isibaar 1.1
33 :     %macro cglobal 1
34 :     %ifdef PREFIX
35 :     global _%1
36 :     %define %1 _%1
37 :     %else
38 :     global %1
39 :     %endif
40 :     %endmacro
41 :    
42 : edgomez 1.3.2.1 %macro LOOP_SSE2 1
43 :     movdqa xmm0, [edx+(%1)*128]
44 :     pand xmm0, xmm7
45 :     movdqa xmm1, [edx+(%1)*128+16]
46 :    
47 :     por xmm0, [edx+(%1)*128+32]
48 :     por xmm1, [edx+(%1)*128+48]
49 :     por xmm0, [edx+(%1)*128+64]
50 :     por xmm1, [edx+(%1)*128+80]
51 :     por xmm0, [edx+(%1)*128+96]
52 :     por xmm1, [edx+(%1)*128+112]
53 :    
54 :     por xmm0, xmm1 ; xmm0 = xmm1 = 128 bits worth of info
55 :     psadbw xmm0, xmm6 ; contains 2 dwords with sums
56 :     movhlps xmm1, xmm0 ; move high dword from xmm0 to low xmm1
57 :     por xmm0, xmm1 ; combine
58 :     movd ecx, xmm0 ; if ecx set, values were found
59 :     test ecx, ecx
60 :     %endmacro
61 : Isibaar 1.1
62 : edgomez 1.3.2.1 ;=============================================================================
63 :     ; Data (Read Only)
64 :     ;=============================================================================
65 : Isibaar 1.1
66 : edgomez 1.3.2.2 %ifdef FORMAT_COFF
67 :     SECTION .rodata data
68 :     %else
69 :     SECTION .rodata data align=16
70 :     %endif
71 : Isibaar 1.1
72 : edgomez 1.3.2.1 ALIGN 16
73 :     ignore_dc:
74 :     dw 0, -1, -1, -1, -1, -1, -1, -1
75 : Isibaar 1.1
76 : edgomez 1.3.2.1 ;=============================================================================
77 :     ; Code
78 :     ;=============================================================================
79 : Isibaar 1.1
80 : edgomez 1.3.2.1 SECTION .text
81 : Isibaar 1.1
82 : edgomez 1.3.2.1 ;-----------------------------------------------------------------------------
83 :     ; uint32_t calc_cbp_sse2(const int16_t coeff[6*64]);
84 :     ;-----------------------------------------------------------------------------
85 : Isibaar 1.1
86 : edgomez 1.3.2.1 ALIGN 16
87 :     cglobal calc_cbp_sse2
88 : Isibaar 1.1 calc_cbp_sse2:
89 : edgomez 1.3.2.1 mov edx, [esp+4] ; coeff[]
90 :     xor eax, eax ; cbp = 0
91 : Isibaar 1.1
92 : edgomez 1.3.2.1 movdqu xmm7, [ignore_dc] ; mask to ignore dc value
93 :     pxor xmm6, xmm6 ; zero
94 : Isibaar 1.1
95 :     LOOP_SSE2 0
96 : edgomez 1.3.2.1 test ecx, ecx
97 :     jz .blk2
98 :     or eax, (1<<5)
99 :    
100 : Isibaar 1.1 .blk2
101 :     LOOP_SSE2 1
102 : edgomez 1.3.2.1 test ecx, ecx
103 :     jz .blk3
104 : Isibaar 1.1 or eax, (1<<4)
105 : edgomez 1.3.2.1
106 : Isibaar 1.1 .blk3
107 :     LOOP_SSE2 2
108 : edgomez 1.3.2.1 test ecx, ecx
109 :     jz .blk4
110 : Isibaar 1.1 or eax, (1<<3)
111 : edgomez 1.3.2.1
112 : Isibaar 1.1 .blk4
113 :     LOOP_SSE2 3
114 : edgomez 1.3.2.1 test ecx, ecx
115 :     jz .blk5
116 : Isibaar 1.1 or eax, (1<<2)
117 : edgomez 1.3.2.1
118 : Isibaar 1.1 .blk5
119 :     LOOP_SSE2 4
120 : edgomez 1.3.2.1 test ecx, ecx
121 :     jz .blk6
122 : Isibaar 1.1 or eax, (1<<1)
123 : edgomez 1.3.2.1
124 : Isibaar 1.1 .blk6
125 :     LOOP_SSE2 5
126 : edgomez 1.3.2.1 test ecx, ecx
127 :     jz .finished
128 : Isibaar 1.1 or eax, (1<<0)
129 : edgomez 1.3.2.1
130 : Isibaar 1.1 .finished
131 : edgomez 1.3.2.1 ret

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