Parent Directory | Revision Log
Revision 1535 - (view) (download)
1 : | edgomez | 1382 | ;/**************************************************************************** |
2 : | Isibaar | 262 | ; * |
3 : | edgomez | 1382 | ; * XVID MPEG-4 VIDEO CODEC |
4 : | ; * - SSE2 optimized SAD operators - | ||
5 : | Isibaar | 262 | ; * |
6 : | edgomez | 1382 | ; * Copyright(C) 2003 Pascal Massimino <skal@planet-d.net> |
7 : | Isibaar | 262 | ; * |
8 : | ; * | ||
9 : | edgomez | 1382 | ; * This program is free software; you can redistribute it and/or modify it |
10 : | ; * 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: sad_sse2.asm,v 1.11 2004-08-22 11:46:10 edgomez Exp $ |
24 : | edgomez | 652 | ; * |
25 : | edgomez | 1382 | ; ***************************************************************************/ |
26 : | Isibaar | 262 | |
27 : | edgomez | 1382 | BITS 32 |
28 : | Isibaar | 262 | |
29 : | edgomez | 1382 | %macro cglobal 1 |
30 : | Isibaar | 262 | %ifdef PREFIX |
31 : | edgomez | 1535 | %ifdef MARK_FUNCS |
32 : | global _%1:function | ||
33 : | %define %1 _%1:function | ||
34 : | %else | ||
35 : | global _%1 | ||
36 : | %define %1 _%1 | ||
37 : | %endif | ||
38 : | Isibaar | 262 | %else |
39 : | edgomez | 1535 | %ifdef MARK_FUNCS |
40 : | global %1:function | ||
41 : | %else | ||
42 : | global %1 | ||
43 : | %endif | ||
44 : | Isibaar | 262 | %endif |
45 : | %endmacro | ||
46 : | |||
47 : | edgomez | 1382 | ;============================================================================= |
48 : | ; Read only data | ||
49 : | ;============================================================================= | ||
50 : | Isibaar | 262 | |
51 : | edgomez | 1382 | %ifdef FORMAT_COFF |
52 : | edgomez | 1519 | SECTION .rodata |
53 : | edgomez | 1382 | %else |
54 : | edgomez | 1519 | SECTION .rodata align=16 |
55 : | edgomez | 1382 | %endif |
56 : | Isibaar | 262 | |
57 : | edgomez | 1382 | ALIGN 64 |
58 : | Isibaar | 262 | zero times 4 dd 0 |
59 : | |||
60 : | edgomez | 1382 | ;============================================================================= |
61 : | ; Code | ||
62 : | ;============================================================================= | ||
63 : | Isibaar | 262 | |
64 : | edgomez | 1382 | SECTION .text |
65 : | |||
66 : | Isibaar | 262 | cglobal sad16_sse2 |
67 : | cglobal dev16_sse2 | ||
68 : | |||
69 : | edgomez | 1382 | ;----------------------------------------------------------------------------- |
70 : | ; uint32_t sad16_sse2 (const uint8_t * const cur, <- assumed aligned! | ||
71 : | ; const uint8_t * const ref, | ||
72 : | ; const uint32_t stride, | ||
73 : | ; const uint32_t /*ignored*/); | ||
74 : | ;----------------------------------------------------------------------------- | ||
75 : | Isibaar | 262 | |
76 : | |||
77 : | edgomez | 1382 | %macro SAD_16x16_SSE2 0 |
78 : | movdqu xmm0, [edx] | ||
79 : | movdqu xmm1, [edx+ecx] | ||
80 : | lea edx,[edx+2*ecx] | ||
81 : | movdqa xmm2, [eax] | ||
82 : | movdqa xmm3, [eax+ecx] | ||
83 : | lea eax,[eax+2*ecx] | ||
84 : | psadbw xmm0, xmm2 | ||
85 : | paddusw xmm6,xmm0 | ||
86 : | psadbw xmm1, xmm3 | ||
87 : | paddusw xmm6,xmm1 | ||
88 : | Isibaar | 262 | %endmacro |
89 : | |||
90 : | edgomez | 1382 | ALIGN 16 |
91 : | sad16_sse2: | ||
92 : | mov eax, [esp+ 4] ; cur (assumed aligned) | ||
93 : | mov edx, [esp+ 8] ; ref | ||
94 : | mov ecx, [esp+12] ; stride | ||
95 : | Isibaar | 262 | |
96 : | edgomez | 1382 | pxor xmm6, xmm6 ; accum |
97 : | Isibaar | 262 | |
98 : | edgomez | 1382 | SAD_16x16_SSE2 |
99 : | SAD_16x16_SSE2 | ||
100 : | SAD_16x16_SSE2 | ||
101 : | SAD_16x16_SSE2 | ||
102 : | SAD_16x16_SSE2 | ||
103 : | SAD_16x16_SSE2 | ||
104 : | SAD_16x16_SSE2 | ||
105 : | SAD_16x16_SSE2 | ||
106 : | Isibaar | 262 | |
107 : | edgomez | 1382 | pshufd xmm5, xmm6, 00000010b |
108 : | paddusw xmm6, xmm5 | ||
109 : | pextrw eax, xmm6, 0 | ||
110 : | ret | ||
111 : | Isibaar | 262 | |
112 : | |||
113 : | edgomez | 1382 | ;----------------------------------------------------------------------------- |
114 : | ; uint32_t dev16_sse2(const uint8_t * const cur, const uint32_t stride); | ||
115 : | ;----------------------------------------------------------------------------- | ||
116 : | Isibaar | 262 | |
117 : | edgomez | 1382 | %macro MEAN_16x16_SSE2 0 ; eax: src, ecx:stride, mm7: zero or mean => mm6: result |
118 : | movdqu xmm0, [eax] | ||
119 : | movdqu xmm1, [eax+ecx] | ||
120 : | lea eax, [eax+2*ecx] ; + 2*stride | ||
121 : | psadbw xmm0, xmm7 | ||
122 : | paddusw xmm6, xmm0 | ||
123 : | psadbw xmm1, xmm7 | ||
124 : | paddusw xmm6, xmm1 | ||
125 : | Isibaar | 262 | %endmacro |
126 : | |||
127 : | |||
128 : | edgomez | 1382 | ALIGN 16 |
129 : | dev16_sse2: | ||
130 : | mov eax, [esp+ 4] ; src | ||
131 : | mov ecx, [esp+ 8] ; stride | ||
132 : | Isibaar | 262 | |
133 : | edgomez | 1382 | pxor xmm6, xmm6 ; accum |
134 : | pxor xmm7, xmm7 ; zero | ||
135 : | Isibaar | 262 | |
136 : | edgomez | 1382 | MEAN_16x16_SSE2 |
137 : | MEAN_16x16_SSE2 | ||
138 : | MEAN_16x16_SSE2 | ||
139 : | MEAN_16x16_SSE2 | ||
140 : | Isibaar | 262 | |
141 : | edgomez | 1382 | MEAN_16x16_SSE2 |
142 : | MEAN_16x16_SSE2 | ||
143 : | MEAN_16x16_SSE2 | ||
144 : | MEAN_16x16_SSE2 | ||
145 : | Isibaar | 262 | |
146 : | edgomez | 1382 | mov eax, [esp+ 4] ; src again |
147 : | Isibaar | 262 | |
148 : | edgomez | 1382 | pshufd xmm7, xmm6, 10b |
149 : | paddusw xmm7, xmm6 | ||
150 : | pxor xmm6, xmm6 ; zero accum | ||
151 : | psrlw xmm7, 8 ; => Mean | ||
152 : | pshuflw xmm7, xmm7, 0 ; replicate Mean | ||
153 : | packuswb xmm7, xmm7 | ||
154 : | pshufd xmm7, xmm7, 00000000b | ||
155 : | Isibaar | 262 | |
156 : | edgomez | 1382 | MEAN_16x16_SSE2 |
157 : | MEAN_16x16_SSE2 | ||
158 : | MEAN_16x16_SSE2 | ||
159 : | MEAN_16x16_SSE2 | ||
160 : | Isibaar | 262 | |
161 : | edgomez | 1382 | MEAN_16x16_SSE2 |
162 : | MEAN_16x16_SSE2 | ||
163 : | MEAN_16x16_SSE2 | ||
164 : | MEAN_16x16_SSE2 | ||
165 : | Isibaar | 262 | |
166 : | edgomez | 1382 | pshufd xmm7, xmm6, 10b |
167 : | paddusw xmm7, xmm6 | ||
168 : | pextrw eax, xmm7, 0 | ||
169 : | ret |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |