Parent Directory | Revision Log
Revision 1793 - (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 : | Isibaar | 1793 | ; * $Id: cbp_sse2.asm,v 1.9 2008-11-11 20:46:24 Isibaar 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 : | edgomez | 1540 | global _%1:function %1.endfunc-%1 |
37 : | %define %1 _%1:function %1.endfunc-%1 | ||
38 : | Isibaar | 1793 | %define ENDFUNC .endfunc |
39 : | edgomez | 1535 | %else |
40 : | global _%1 | ||
41 : | %define %1 _%1 | ||
42 : | Isibaar | 1793 | %define ENDFUNC |
43 : | edgomez | 1535 | %endif |
44 : | Isibaar | 262 | %else |
45 : | edgomez | 1535 | %ifdef MARK_FUNCS |
46 : | edgomez | 1540 | global %1:function %1.endfunc-%1 |
47 : | Isibaar | 1793 | %define ENDFUNC .endfunc |
48 : | edgomez | 1535 | %else |
49 : | global %1 | ||
50 : | Isibaar | 1793 | %define ENDFUNC |
51 : | edgomez | 1535 | %endif |
52 : | Isibaar | 262 | %endif |
53 : | %endmacro | ||
54 : | |||
55 : | edgomez | 1382 | %macro LOOP_SSE2 1 |
56 : | movdqa xmm0, [edx+(%1)*128] | ||
57 : | pand xmm0, xmm7 | ||
58 : | movdqa xmm1, [edx+(%1)*128+16] | ||
59 : | Isibaar | 262 | |
60 : | edgomez | 1382 | por xmm0, [edx+(%1)*128+32] |
61 : | por xmm1, [edx+(%1)*128+48] | ||
62 : | por xmm0, [edx+(%1)*128+64] | ||
63 : | por xmm1, [edx+(%1)*128+80] | ||
64 : | por xmm0, [edx+(%1)*128+96] | ||
65 : | por xmm1, [edx+(%1)*128+112] | ||
66 : | Isibaar | 262 | |
67 : | edgomez | 1382 | por xmm0, xmm1 ; xmm0 = xmm1 = 128 bits worth of info |
68 : | psadbw xmm0, xmm6 ; contains 2 dwords with sums | ||
69 : | movhlps xmm1, xmm0 ; move high dword from xmm0 to low xmm1 | ||
70 : | por xmm0, xmm1 ; combine | ||
71 : | movd ecx, xmm0 ; if ecx set, values were found | ||
72 : | test ecx, ecx | ||
73 : | %endmacro | ||
74 : | Isibaar | 262 | |
75 : | edgomez | 1382 | ;============================================================================= |
76 : | ; Data (Read Only) | ||
77 : | ;============================================================================= | ||
78 : | Isibaar | 262 | |
79 : | edgomez | 1382 | %ifdef FORMAT_COFF |
80 : | edgomez | 1519 | SECTION .rodata |
81 : | edgomez | 1382 | %else |
82 : | edgomez | 1519 | SECTION .rodata align=16 |
83 : | edgomez | 1382 | %endif |
84 : | Isibaar | 262 | |
85 : | edgomez | 1382 | ALIGN 16 |
86 : | ignore_dc: | ||
87 : | dw 0, -1, -1, -1, -1, -1, -1, -1 | ||
88 : | Isibaar | 262 | |
89 : | edgomez | 1382 | ;============================================================================= |
90 : | ; Code | ||
91 : | ;============================================================================= | ||
92 : | Isibaar | 262 | |
93 : | edgomez | 1382 | SECTION .text |
94 : | Isibaar | 262 | |
95 : | edgomez | 1382 | ;----------------------------------------------------------------------------- |
96 : | ; uint32_t calc_cbp_sse2(const int16_t coeff[6*64]); | ||
97 : | ;----------------------------------------------------------------------------- | ||
98 : | Isibaar | 262 | |
99 : | edgomez | 1382 | ALIGN 16 |
100 : | cglobal calc_cbp_sse2 | ||
101 : | Isibaar | 262 | calc_cbp_sse2: |
102 : | edgomez | 1382 | mov edx, [esp+4] ; coeff[] |
103 : | xor eax, eax ; cbp = 0 | ||
104 : | Isibaar | 262 | |
105 : | edgomez | 1382 | movdqu xmm7, [ignore_dc] ; mask to ignore dc value |
106 : | pxor xmm6, xmm6 ; zero | ||
107 : | Isibaar | 262 | |
108 : | LOOP_SSE2 0 | ||
109 : | edgomez | 1382 | test ecx, ecx |
110 : | jz .blk2 | ||
111 : | or eax, (1<<5) | ||
112 : | |||
113 : | Isibaar | 1793 | .blk2: |
114 : | Isibaar | 262 | LOOP_SSE2 1 |
115 : | edgomez | 1382 | test ecx, ecx |
116 : | jz .blk3 | ||
117 : | Isibaar | 262 | or eax, (1<<4) |
118 : | edgomez | 1382 | |
119 : | Isibaar | 1793 | .blk3: |
120 : | Isibaar | 262 | LOOP_SSE2 2 |
121 : | edgomez | 1382 | test ecx, ecx |
122 : | jz .blk4 | ||
123 : | Isibaar | 262 | or eax, (1<<3) |
124 : | edgomez | 1382 | |
125 : | Isibaar | 1793 | .blk4: |
126 : | Isibaar | 262 | LOOP_SSE2 3 |
127 : | edgomez | 1382 | test ecx, ecx |
128 : | jz .blk5 | ||
129 : | Isibaar | 262 | or eax, (1<<2) |
130 : | edgomez | 1382 | |
131 : | Isibaar | 1793 | .blk5: |
132 : | Isibaar | 262 | LOOP_SSE2 4 |
133 : | edgomez | 1382 | test ecx, ecx |
134 : | jz .blk6 | ||
135 : | Isibaar | 262 | or eax, (1<<1) |
136 : | edgomez | 1382 | |
137 : | Isibaar | 1793 | .blk6: |
138 : | Isibaar | 262 | LOOP_SSE2 5 |
139 : | edgomez | 1382 | test ecx, ecx |
140 : | jz .finished | ||
141 : | Isibaar | 262 | or eax, (1<<0) |
142 : | edgomez | 1382 | |
143 : | Isibaar | 1793 | .finished: |
144 : | edgomez | 1382 | ret |
145 : | Isibaar | 1793 | ENDFUNC |
146 : | edgomez | 1540 | |
147 : | Isibaar | 1790 | |
148 : | %ifidn __OUTPUT_FORMAT__,elf | ||
149 : | section ".note.GNU-stack" noalloc noexec nowrite progbits | ||
150 : | %endif | ||
151 : |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |