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