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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1535 - (view) (download)

1 : edgomez 1382 ;/****************************************************************************
2 : Isibaar 262 ; *
3 : edgomez 1382 ; * XVID MPEG-4 VIDEO CODEC
4 :     ; * - SSE2 CBP computation -
5 : Isibaar 262 ; *
6 : edgomez 1382 ; * Copyright (C) 2002 Daniel Smith <danielsmith@astroboymail.com>
7 :     ; * 2002 Pascal Massimino <skal@planet-d.net>
8 : Isibaar 262 ; *
9 : edgomez 1382 ; * 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 : Isibaar 262 ; *
14 : edgomez 1382 ; * 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 : Isibaar 262 ; *
19 : edgomez 1382 ; * 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 262 ; *
23 : edgomez 1535 ; * $Id: cbp_sse2.asm,v 1.6 2004-08-22 11:46:09 edgomez Exp $
24 : Isibaar 262 ; *
25 : edgomez 1382 ; ***************************************************************************/
26 : Isibaar 262
27 : edgomez 1382 BITS 32
28 : edgomez 851
29 : edgomez 1382 ;=============================================================================
30 :     ; Macros
31 :     ;=============================================================================
32 : Isibaar 262
33 :     %macro cglobal 1
34 :     %ifdef PREFIX
35 : edgomez 1535 %ifdef MARK_FUNCS
36 :     global _%1:function
37 :     %define %1 _%1:function
38 :     %else
39 :     global _%1
40 :     %define %1 _%1
41 :     %endif
42 : Isibaar 262 %else
43 : edgomez 1535 %ifdef MARK_FUNCS
44 :     global %1:function
45 :     %else
46 :     global %1
47 :     %endif
48 : Isibaar 262 %endif
49 :     %endmacro
50 :    
51 : edgomez 1382 %macro LOOP_SSE2 1
52 :     movdqa xmm0, [edx+(%1)*128]
53 :     pand xmm0, xmm7
54 :     movdqa xmm1, [edx+(%1)*128+16]
55 : Isibaar 262
56 : edgomez 1382 por xmm0, [edx+(%1)*128+32]
57 :     por xmm1, [edx+(%1)*128+48]
58 :     por xmm0, [edx+(%1)*128+64]
59 :     por xmm1, [edx+(%1)*128+80]
60 :     por xmm0, [edx+(%1)*128+96]
61 :     por xmm1, [edx+(%1)*128+112]
62 : Isibaar 262
63 : edgomez 1382 por xmm0, xmm1 ; xmm0 = xmm1 = 128 bits worth of info
64 :     psadbw xmm0, xmm6 ; contains 2 dwords with sums
65 :     movhlps xmm1, xmm0 ; move high dword from xmm0 to low xmm1
66 :     por xmm0, xmm1 ; combine
67 :     movd ecx, xmm0 ; if ecx set, values were found
68 :     test ecx, ecx
69 :     %endmacro
70 : Isibaar 262
71 : edgomez 1382 ;=============================================================================
72 :     ; Data (Read Only)
73 :     ;=============================================================================
74 : Isibaar 262
75 : edgomez 1382 %ifdef FORMAT_COFF
76 : edgomez 1519 SECTION .rodata
77 : edgomez 1382 %else
78 : edgomez 1519 SECTION .rodata align=16
79 : edgomez 1382 %endif
80 : Isibaar 262
81 : edgomez 1382 ALIGN 16
82 :     ignore_dc:
83 :     dw 0, -1, -1, -1, -1, -1, -1, -1
84 : Isibaar 262
85 : edgomez 1382 ;=============================================================================
86 :     ; Code
87 :     ;=============================================================================
88 : Isibaar 262
89 : edgomez 1382 SECTION .text
90 : Isibaar 262
91 : edgomez 1382 ;-----------------------------------------------------------------------------
92 :     ; uint32_t calc_cbp_sse2(const int16_t coeff[6*64]);
93 :     ;-----------------------------------------------------------------------------
94 : Isibaar 262
95 : edgomez 1382 ALIGN 16
96 :     cglobal calc_cbp_sse2
97 : Isibaar 262 calc_cbp_sse2:
98 : edgomez 1382 mov edx, [esp+4] ; coeff[]
99 :     xor eax, eax ; cbp = 0
100 : Isibaar 262
101 : edgomez 1382 movdqu xmm7, [ignore_dc] ; mask to ignore dc value
102 :     pxor xmm6, xmm6 ; zero
103 : Isibaar 262
104 :     LOOP_SSE2 0
105 : edgomez 1382 test ecx, ecx
106 :     jz .blk2
107 :     or eax, (1<<5)
108 :    
109 : Isibaar 262 .blk2
110 :     LOOP_SSE2 1
111 : edgomez 1382 test ecx, ecx
112 :     jz .blk3
113 : Isibaar 262 or eax, (1<<4)
114 : edgomez 1382
115 : Isibaar 262 .blk3
116 :     LOOP_SSE2 2
117 : edgomez 1382 test ecx, ecx
118 :     jz .blk4
119 : Isibaar 262 or eax, (1<<3)
120 : edgomez 1382
121 : Isibaar 262 .blk4
122 :     LOOP_SSE2 3
123 : edgomez 1382 test ecx, ecx
124 :     jz .blk5
125 : Isibaar 262 or eax, (1<<2)
126 : edgomez 1382
127 : Isibaar 262 .blk5
128 :     LOOP_SSE2 4
129 : edgomez 1382 test ecx, ecx
130 :     jz .blk6
131 : Isibaar 262 or eax, (1<<1)
132 : edgomez 1382
133 : Isibaar 262 .blk6
134 :     LOOP_SSE2 5
135 : edgomez 1382 test ecx, ecx
136 :     jz .finished
137 : Isibaar 262 or eax, (1<<0)
138 : edgomez 1382
139 : Isibaar 262 .finished
140 : edgomez 1382 ret

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