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