Mercurial > libavcodec.hg
annotate i386/dsputil_mmx_rnd.h @ 967:274b518c4ecb libavcodec
PIC / ebx fix
author | michaelni |
---|---|
date | Tue, 07 Jan 2003 13:00:38 +0000 |
parents | 7ef9226f430e |
children | e162c09efbe7 |
rev | line source |
---|---|
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
1 /* |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
2 * DSP utils mmx functions are compiled twice for rnd/no_rnd |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
3 * Copyright (c) 2000, 2001 Fabrice Bellard. |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
4 * |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
5 * This library is free software; you can redistribute it and/or |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
6 * modify it under the terms of the GNU Lesser General Public |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
7 * License as published by the Free Software Foundation; either |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
8 * version 2 of the License, or (at your option) any later version. |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
9 * |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
10 * This library is distributed in the hope that it will be useful, |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
13 * Lesser General Public License for more details. |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
14 * |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
15 * You should have received a copy of the GNU Lesser General Public |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
16 * License along with this library; if not, write to the Free Software |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
18 * |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
19 * MMX optimization by Nick Kurshev <nickols_k@mail.ru> |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
20 * mostly rewritten by Michael Niedermayer <michaelni@gmx.at> |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
21 * and improved by Zdenek Kabelac <kabi@users.sf.net> |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
22 */ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
23 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
24 // put_pixels |
651 | 25 static void DEF(put, pixels8_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h) |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
26 { |
448 | 27 MOVQ_BFE(mm6); |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
28 __asm __volatile( |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
29 "lea (%3, %3), %%eax \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
30 ".balign 8 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
31 "1: \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
32 "movq (%1), %%mm0 \n\t" |
447 | 33 "movq 1(%1), %%mm1 \n\t" |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
34 "movq (%1, %3), %%mm2 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
35 "movq 1(%1, %3), %%mm3 \n\t" |
448 | 36 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) |
37 "movq %%mm4, (%2) \n\t" | |
38 "movq %%mm5, (%2, %3) \n\t" | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
39 "addl %%eax, %1 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
40 "addl %%eax, %2 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
41 "movq (%1), %%mm0 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
42 "movq 1(%1), %%mm1 \n\t" |
447 | 43 "movq (%1, %3), %%mm2 \n\t" |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
44 "movq 1(%1, %3), %%mm3 \n\t" |
448 | 45 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) |
46 "movq %%mm4, (%2) \n\t" | |
47 "movq %%mm5, (%2, %3) \n\t" | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
48 "addl %%eax, %1 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
49 "addl %%eax, %2 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
50 "subl $4, %0 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
51 "jnz 1b \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
52 :"+g"(h), "+S"(pixels), "+D"(block) |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
53 :"r"(line_size) |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
54 :"eax", "memory"); |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
55 } |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
56 |
954 | 57 static void DEF(put, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) |
58 { | |
59 MOVQ_BFE(mm6); | |
60 __asm __volatile( | |
61 ".balign 8 \n\t" | |
62 "1: \n\t" | |
63 "movq (%1), %%mm0 \n\t" | |
64 "movq (%2), %%mm1 \n\t" | |
65 "addl %4, %1 \n\t" | |
66 "movq (%1), %%mm2 \n\t" | |
67 "movq 8(%2), %%mm3 \n\t" | |
68 "addl %4, %1 \n\t" | |
69 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
70 "movq %%mm4, (%3) \n\t" | |
71 "addl %5, %3 \n\t" | |
72 "movq %%mm5, (%3) \n\t" | |
73 "addl %5, %3 \n\t" | |
74 "movq (%1), %%mm0 \n\t" | |
75 "movq 16(%2), %%mm1 \n\t" | |
76 "addl %4, %1 \n\t" | |
77 "movq (%1), %%mm2 \n\t" | |
78 "movq 24(%2), %%mm3 \n\t" | |
79 "addl %4, %1 \n\t" | |
80 "addl $32, %2 \n\t" | |
81 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
82 "movq %%mm4, (%3) \n\t" | |
83 "addl %5, %3 \n\t" | |
84 "movq %%mm5, (%3) \n\t" | |
85 "addl %5, %3 \n\t" | |
86 "subl $4, %0 \n\t" | |
87 "jnz 1b \n\t" | |
967 | 88 #ifdef PIC //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cant be used |
89 :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |
90 #else | |
91 :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |
92 #endif | |
966 | 93 :"S"(src1Stride), "D"(dstStride) |
954 | 94 :"memory"); |
95 } | |
96 | |
651 | 97 static void DEF(put, pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h) |
98 { | |
99 MOVQ_BFE(mm6); | |
100 __asm __volatile( | |
101 "lea (%3, %3), %%eax \n\t" | |
102 ".balign 8 \n\t" | |
103 "1: \n\t" | |
104 "movq (%1), %%mm0 \n\t" | |
105 "movq 1(%1), %%mm1 \n\t" | |
106 "movq (%1, %3), %%mm2 \n\t" | |
107 "movq 1(%1, %3), %%mm3 \n\t" | |
108 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
109 "movq %%mm4, (%2) \n\t" | |
110 "movq %%mm5, (%2, %3) \n\t" | |
111 "movq 8(%1), %%mm0 \n\t" | |
112 "movq 9(%1), %%mm1 \n\t" | |
113 "movq 8(%1, %3), %%mm2 \n\t" | |
114 "movq 9(%1, %3), %%mm3 \n\t" | |
115 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
116 "movq %%mm4, 8(%2) \n\t" | |
117 "movq %%mm5, 8(%2, %3) \n\t" | |
118 "addl %%eax, %1 \n\t" | |
119 "addl %%eax, %2 \n\t" | |
120 "movq (%1), %%mm0 \n\t" | |
121 "movq 1(%1), %%mm1 \n\t" | |
122 "movq (%1, %3), %%mm2 \n\t" | |
123 "movq 1(%1, %3), %%mm3 \n\t" | |
124 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
125 "movq %%mm4, (%2) \n\t" | |
126 "movq %%mm5, (%2, %3) \n\t" | |
127 "movq 8(%1), %%mm0 \n\t" | |
128 "movq 9(%1), %%mm1 \n\t" | |
129 "movq 8(%1, %3), %%mm2 \n\t" | |
130 "movq 9(%1, %3), %%mm3 \n\t" | |
131 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
132 "movq %%mm4, 8(%2) \n\t" | |
954 | 133 "movq %%mm5, 8(%2, %3) \n\t" |
651 | 134 "addl %%eax, %1 \n\t" |
135 "addl %%eax, %2 \n\t" | |
136 "subl $4, %0 \n\t" | |
137 "jnz 1b \n\t" | |
138 :"+g"(h), "+S"(pixels), "+D"(block) | |
139 :"r"(line_size) | |
140 :"eax", "memory"); | |
141 } | |
142 | |
954 | 143 static void DEF(put, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) |
144 { | |
145 MOVQ_BFE(mm6); | |
146 __asm __volatile( | |
147 ".balign 8 \n\t" | |
148 "1: \n\t" | |
149 "movq (%1), %%mm0 \n\t" | |
150 "movq (%2), %%mm1 \n\t" | |
151 "movq 8(%1), %%mm2 \n\t" | |
152 "movq 8(%2), %%mm3 \n\t" | |
153 "addl %4, %1 \n\t" | |
154 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
155 "movq %%mm4, (%3) \n\t" | |
156 "movq %%mm5, 8(%3) \n\t" | |
157 "addl %5, %3 \n\t" | |
158 "movq (%1), %%mm0 \n\t" | |
159 "movq 16(%2), %%mm1 \n\t" | |
160 "movq 8(%1), %%mm2 \n\t" | |
161 "movq 24(%2), %%mm3 \n\t" | |
162 "addl %4, %1 \n\t" | |
163 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
164 "movq %%mm4, (%3) \n\t" | |
165 "movq %%mm5, 8(%3) \n\t" | |
166 "addl %5, %3 \n\t" | |
167 "addl $32, %2 \n\t" | |
168 "subl $2, %0 \n\t" | |
169 "jnz 1b \n\t" | |
967 | 170 #ifdef PIC //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cant be used |
171 :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |
172 #else | |
173 :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |
174 #endif | |
965
e149203f4a0d
gcc 3.2.2 -O3 bug workaround (older gcc are very likely affected too but didnt check)
michaelni
parents:
959
diff
changeset
|
175 :"S"(src1Stride), "D"(dstStride) |
e149203f4a0d
gcc 3.2.2 -O3 bug workaround (older gcc are very likely affected too but didnt check)
michaelni
parents:
959
diff
changeset
|
176 :"memory"); |
954 | 177 } |
178 | |
651 | 179 static void DEF(put, pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h) |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
180 { |
448 | 181 MOVQ_BFE(mm6); |
182 __asm __volatile( | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
183 "lea (%3, %3), %%eax \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
184 "movq (%1), %%mm0 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
185 ".balign 8 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
186 "1: \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
187 "movq (%1, %3), %%mm1 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
188 "movq (%1, %%eax),%%mm2 \n\t" |
448 | 189 PAVGBP(%%mm1, %%mm0, %%mm4, %%mm2, %%mm1, %%mm5) |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
190 "movq %%mm4, (%2) \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
191 "movq %%mm5, (%2, %3) \n\t" |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
192 "addl %%eax, %1 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
193 "addl %%eax, %2 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
194 "movq (%1, %3), %%mm1 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
195 "movq (%1, %%eax),%%mm0 \n\t" |
448 | 196 PAVGBP(%%mm1, %%mm2, %%mm4, %%mm0, %%mm1, %%mm5) |
197 "movq %%mm4, (%2) \n\t" | |
198 "movq %%mm5, (%2, %3) \n\t" | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
199 "addl %%eax, %1 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
200 "addl %%eax, %2 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
201 "subl $4, %0 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
202 "jnz 1b \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
203 :"+g"(h), "+S"(pixels), "+D"(block) |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
204 :"r"(line_size) |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
205 :"eax", "memory"); |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
206 } |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
207 |
651 | 208 static void DEF(put, pixels8_xy2)(UINT8 *block, const UINT8 *pixels, int line_size, int h) |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
209 { |
448 | 210 MOVQ_ZERO(mm7); |
211 SET_RND(mm6); // =2 for rnd and =1 for no_rnd version | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
212 __asm __volatile( |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
213 "movq (%1), %%mm0 \n\t" |
448 | 214 "movq 1(%1), %%mm4 \n\t" |
215 "movq %%mm0, %%mm1 \n\t" | |
216 "movq %%mm4, %%mm5 \n\t" | |
217 "punpcklbw %%mm7, %%mm0 \n\t" | |
218 "punpcklbw %%mm7, %%mm4 \n\t" | |
219 "punpckhbw %%mm7, %%mm1 \n\t" | |
220 "punpckhbw %%mm7, %%mm5 \n\t" | |
221 "paddusw %%mm0, %%mm4 \n\t" | |
222 "paddusw %%mm1, %%mm5 \n\t" | |
223 "xorl %%eax, %%eax \n\t" | |
224 "addl %3, %1 \n\t" | |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
225 ".balign 8 \n\t" |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
226 "1: \n\t" |
448 | 227 "movq (%1, %%eax), %%mm0 \n\t" |
228 "movq 1(%1, %%eax), %%mm2 \n\t" | |
229 "movq %%mm0, %%mm1 \n\t" | |
230 "movq %%mm2, %%mm3 \n\t" | |
231 "punpcklbw %%mm7, %%mm0 \n\t" | |
232 "punpcklbw %%mm7, %%mm2 \n\t" | |
233 "punpckhbw %%mm7, %%mm1 \n\t" | |
234 "punpckhbw %%mm7, %%mm3 \n\t" | |
235 "paddusw %%mm2, %%mm0 \n\t" | |
236 "paddusw %%mm3, %%mm1 \n\t" | |
237 "paddusw %%mm6, %%mm4 \n\t" | |
238 "paddusw %%mm6, %%mm5 \n\t" | |
239 "paddusw %%mm0, %%mm4 \n\t" | |
240 "paddusw %%mm1, %%mm5 \n\t" | |
241 "psrlw $2, %%mm4 \n\t" | |
242 "psrlw $2, %%mm5 \n\t" | |
243 "packuswb %%mm5, %%mm4 \n\t" | |
244 "movq %%mm4, (%2, %%eax) \n\t" | |
245 "addl %3, %%eax \n\t" | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
246 |
448 | 247 "movq (%1, %%eax), %%mm2 \n\t" // 0 <-> 2 1 <-> 3 |
248 "movq 1(%1, %%eax), %%mm4 \n\t" | |
249 "movq %%mm2, %%mm3 \n\t" | |
250 "movq %%mm4, %%mm5 \n\t" | |
251 "punpcklbw %%mm7, %%mm2 \n\t" | |
252 "punpcklbw %%mm7, %%mm4 \n\t" | |
253 "punpckhbw %%mm7, %%mm3 \n\t" | |
254 "punpckhbw %%mm7, %%mm5 \n\t" | |
255 "paddusw %%mm2, %%mm4 \n\t" | |
256 "paddusw %%mm3, %%mm5 \n\t" | |
257 "paddusw %%mm6, %%mm0 \n\t" | |
258 "paddusw %%mm6, %%mm1 \n\t" | |
259 "paddusw %%mm4, %%mm0 \n\t" | |
260 "paddusw %%mm5, %%mm1 \n\t" | |
261 "psrlw $2, %%mm0 \n\t" | |
262 "psrlw $2, %%mm1 \n\t" | |
263 "packuswb %%mm1, %%mm0 \n\t" | |
264 "movq %%mm0, (%2, %%eax) \n\t" | |
265 "addl %3, %%eax \n\t" | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
266 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
267 "subl $2, %0 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
268 "jnz 1b \n\t" |
448 | 269 :"+g"(h), "+S"(pixels) |
270 :"D"(block), "r"(line_size) | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
271 :"eax", "memory"); |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
272 } |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
273 |
954 | 274 static void DEF(put, pixels8_l4)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int stride, int h) |
275 { | |
276 MOVQ_ZERO(mm7); | |
277 SET_RND(mm6); // =2 for rnd and =1 for no_rnd version | |
278 __asm __volatile( | |
279 ".balign 8 \n\t" | |
280 "1: \n\t" | |
281 "movq (%1), %%mm0 \n\t" | |
282 "movq (%2), %%mm1 \n\t" | |
283 "movq 64(%2), %%mm2 \n\t" | |
284 "movq 136(%2), %%mm3 \n\t" | |
285 "punpcklbw %%mm7, %%mm0 \n\t" | |
286 "punpcklbw %%mm7, %%mm1 \n\t" | |
287 "punpcklbw %%mm7, %%mm2 \n\t" | |
288 "punpcklbw %%mm7, %%mm3 \n\t" | |
289 "paddusw %%mm6, %%mm0 \n\t" | |
290 "paddusw %%mm0, %%mm1 \n\t" | |
291 "paddusw %%mm2, %%mm3 \n\t" | |
292 "paddusw %%mm1, %%mm3 \n\t" | |
293 "psrlw $2, %%mm3 \n\t" | |
294 "movq (%1), %%mm0 \n\t" | |
295 "movq (%2), %%mm1 \n\t" | |
296 "movq 64(%2), %%mm2 \n\t" | |
297 "movq 136(%2), %%mm4 \n\t" | |
298 "punpckhbw %%mm7, %%mm0 \n\t" | |
299 "punpckhbw %%mm7, %%mm1 \n\t" | |
300 "punpckhbw %%mm7, %%mm2 \n\t" | |
301 "punpckhbw %%mm7, %%mm4 \n\t" | |
302 "paddusw %%mm6, %%mm0 \n\t" | |
303 "paddusw %%mm0, %%mm1 \n\t" | |
304 "paddusw %%mm2, %%mm4 \n\t" | |
305 "paddusw %%mm1, %%mm4 \n\t" | |
306 "psrlw $2, %%mm4 \n\t" | |
307 "packuswb %%mm4, %%mm3 \n\t" | |
308 "movq %%mm3, (%0) \n\t" | |
309 "addl %4, %0 \n\t" | |
310 "addl %4, %1 \n\t" | |
311 "addl $8, %2 \n\t" | |
312 "decl %3 \n\t" | |
313 "jnz 1b \n\t" | |
314 :"+r"(dst), "+r"(src1), "+r"(src2), "+r"(h) | |
315 :"r"(stride) | |
316 :"memory"); | |
317 } | |
318 | |
319 static void DEF(put, pixels16_l4)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int stride, int h) | |
320 { | |
321 MOVQ_ZERO(mm7); | |
322 SET_RND(mm6); // =2 for rnd and =1 for no_rnd version | |
323 __asm __volatile( | |
324 ".balign 8 \n\t" | |
325 "1: \n\t" | |
326 "movq (%1), %%mm0 \n\t" | |
327 "movq (%2), %%mm1 \n\t" | |
328 "movq 256(%2), %%mm2 \n\t" | |
329 "movq 528(%2), %%mm3 \n\t" | |
330 "punpcklbw %%mm7, %%mm0 \n\t" | |
331 "punpcklbw %%mm7, %%mm1 \n\t" | |
332 "punpcklbw %%mm7, %%mm2 \n\t" | |
333 "punpcklbw %%mm7, %%mm3 \n\t" | |
334 "paddusw %%mm6, %%mm0 \n\t" | |
335 "paddusw %%mm0, %%mm1 \n\t" | |
336 "paddusw %%mm2, %%mm3 \n\t" | |
337 "paddusw %%mm1, %%mm3 \n\t" | |
338 "psrlw $2, %%mm3 \n\t" | |
339 "movq (%1), %%mm0 \n\t" | |
340 "movq (%2), %%mm1 \n\t" | |
341 "movq 256(%2), %%mm2 \n\t" | |
342 "movq 528(%2), %%mm4 \n\t" | |
343 "punpckhbw %%mm7, %%mm0 \n\t" | |
344 "punpckhbw %%mm7, %%mm1 \n\t" | |
345 "punpckhbw %%mm7, %%mm2 \n\t" | |
346 "punpckhbw %%mm7, %%mm4 \n\t" | |
347 "paddusw %%mm6, %%mm0 \n\t" | |
348 "paddusw %%mm0, %%mm1 \n\t" | |
349 "paddusw %%mm2, %%mm4 \n\t" | |
350 "paddusw %%mm1, %%mm4 \n\t" | |
351 "psrlw $2, %%mm4 \n\t" | |
352 "packuswb %%mm4, %%mm3 \n\t" | |
353 "movq %%mm3, (%0) \n\t" | |
354 "movq 8(%1), %%mm0 \n\t" | |
355 "movq 8(%2), %%mm1 \n\t" | |
356 "movq 264(%2), %%mm2 \n\t" | |
357 "movq 536(%2), %%mm3 \n\t" | |
358 "punpcklbw %%mm7, %%mm0 \n\t" | |
359 "punpcklbw %%mm7, %%mm1 \n\t" | |
360 "punpcklbw %%mm7, %%mm2 \n\t" | |
361 "punpcklbw %%mm7, %%mm3 \n\t" | |
362 "paddusw %%mm6, %%mm0 \n\t" | |
363 "paddusw %%mm0, %%mm1 \n\t" | |
364 "paddusw %%mm2, %%mm3 \n\t" | |
365 "paddusw %%mm1, %%mm3 \n\t" | |
366 "psrlw $2, %%mm3 \n\t" | |
367 "movq 8(%1), %%mm0 \n\t" | |
368 "movq 8(%2), %%mm1 \n\t" | |
369 "movq 264(%2), %%mm2 \n\t" | |
370 "movq 536(%2), %%mm4 \n\t" | |
371 "punpckhbw %%mm7, %%mm0 \n\t" | |
372 "punpckhbw %%mm7, %%mm1 \n\t" | |
373 "punpckhbw %%mm7, %%mm2 \n\t" | |
374 "punpckhbw %%mm7, %%mm4 \n\t" | |
375 "paddusw %%mm6, %%mm0 \n\t" | |
376 "paddusw %%mm0, %%mm1 \n\t" | |
377 "paddusw %%mm2, %%mm4 \n\t" | |
378 "paddusw %%mm1, %%mm4 \n\t" | |
379 "psrlw $2, %%mm4 \n\t" | |
380 "packuswb %%mm4, %%mm3 \n\t" | |
381 "movq %%mm3, 8(%0) \n\t" | |
382 "addl %4, %0 \n\t" | |
383 "addl %4, %1 \n\t" | |
384 "addl $16, %2 \n\t" | |
385 "decl %3 \n\t" | |
386 "jnz 1b \n\t" | |
387 :"+r"(dst), "+r"(src1), "+r"(src2), "+r"(h) | |
388 :"r"(stride) | |
389 :"memory"); | |
390 } | |
391 | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
392 // avg_pixels |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
393 // in case more speed is needed - unroling would certainly help |
651 | 394 static void DEF(avg, pixels8)(UINT8 *block, const UINT8 *pixels, int line_size, int h) |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
395 { |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
396 MOVQ_BFE(mm6); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
397 JUMPALIGN(); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
398 do { |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
399 __asm __volatile( |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
400 "movq %0, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
401 "movq %1, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
402 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
403 "movq %%mm2, %0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
404 :"+m"(*block) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
405 :"m"(*pixels) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
406 :"memory"); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
407 pixels += line_size; |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
408 block += line_size; |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
409 } |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
410 while (--h); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
411 } |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
412 |
651 | 413 static void DEF(avg, pixels16)(UINT8 *block, const UINT8 *pixels, int line_size, int h) |
414 { | |
415 MOVQ_BFE(mm6); | |
416 JUMPALIGN(); | |
417 do { | |
418 __asm __volatile( | |
419 "movq %0, %%mm0 \n\t" | |
420 "movq %1, %%mm1 \n\t" | |
421 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) | |
422 "movq %%mm2, %0 \n\t" | |
423 "movq 8%0, %%mm0 \n\t" | |
424 "movq 8%1, %%mm1 \n\t" | |
425 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) | |
426 "movq %%mm2, 8%0 \n\t" | |
427 :"+m"(*block) | |
428 :"m"(*pixels) | |
429 :"memory"); | |
430 pixels += line_size; | |
431 block += line_size; | |
432 } | |
433 while (--h); | |
434 } | |
435 | |
436 static void DEF(avg, pixels8_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h) | |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
437 { |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
438 MOVQ_BFE(mm6); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
439 JUMPALIGN(); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
440 do { |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
441 __asm __volatile( |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
442 "movq %1, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
443 "movq 1%1, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
444 "movq %0, %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
445 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
446 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
447 "movq %%mm0, %0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
448 :"+m"(*block) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
449 :"m"(*pixels) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
450 :"memory"); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
451 pixels += line_size; |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
452 block += line_size; |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
453 } while (--h); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
454 } |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
455 |
954 | 456 static void DEF(avg, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) |
457 { | |
458 MOVQ_BFE(mm6); | |
459 JUMPALIGN(); | |
460 do { | |
461 __asm __volatile( | |
462 "movq %1, %%mm0 \n\t" | |
463 "movq %2, %%mm1 \n\t" | |
464 "movq %0, %%mm3 \n\t" | |
465 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) | |
466 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6) | |
467 "movq %%mm0, %0 \n\t" | |
468 :"+m"(*dst) | |
469 :"m"(*src1), "m"(*src2) | |
470 :"memory"); | |
471 dst += dstStride; | |
472 src1 += src1Stride; | |
473 src2 += 8; | |
474 } while (--h); | |
475 } | |
476 | |
651 | 477 static void DEF(avg, pixels16_x2)(UINT8 *block, const UINT8 *pixels, int line_size, int h) |
478 { | |
479 MOVQ_BFE(mm6); | |
480 JUMPALIGN(); | |
481 do { | |
482 __asm __volatile( | |
483 "movq %1, %%mm0 \n\t" | |
484 "movq 1%1, %%mm1 \n\t" | |
485 "movq %0, %%mm3 \n\t" | |
486 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) | |
487 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6) | |
488 "movq %%mm0, %0 \n\t" | |
489 "movq 8%1, %%mm0 \n\t" | |
490 "movq 9%1, %%mm1 \n\t" | |
491 "movq 8%0, %%mm3 \n\t" | |
492 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) | |
493 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6) | |
494 "movq %%mm0, 8%0 \n\t" | |
495 :"+m"(*block) | |
496 :"m"(*pixels) | |
497 :"memory"); | |
498 pixels += line_size; | |
499 block += line_size; | |
500 } while (--h); | |
501 } | |
502 | |
954 | 503 static void DEF(avg, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) |
504 { | |
505 MOVQ_BFE(mm6); | |
506 JUMPALIGN(); | |
507 do { | |
508 __asm __volatile( | |
509 "movq %1, %%mm0 \n\t" | |
510 "movq %2, %%mm1 \n\t" | |
511 "movq %0, %%mm3 \n\t" | |
512 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) | |
513 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6) | |
514 "movq %%mm0, %0 \n\t" | |
515 "movq 8%1, %%mm0 \n\t" | |
516 "movq 8%2, %%mm1 \n\t" | |
517 "movq 8%0, %%mm3 \n\t" | |
518 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) | |
519 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6) | |
520 "movq %%mm0, 8%0 \n\t" | |
521 :"+m"(*dst) | |
522 :"m"(*src1), "m"(*src2) | |
523 :"memory"); | |
524 dst += dstStride; | |
525 src1 += src1Stride; | |
526 src2 += 16; | |
527 } while (--h); | |
528 } | |
529 | |
651 | 530 static void DEF(avg, pixels8_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h) |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
531 { |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
532 MOVQ_BFE(mm6); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
533 __asm __volatile( |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
534 "lea (%3, %3), %%eax \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
535 "movq (%1), %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
536 ".balign 8 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
537 "1: \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
538 "movq (%1, %3), %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
539 "movq (%1, %%eax), %%mm2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
540 PAVGBP(%%mm1, %%mm0, %%mm4, %%mm2, %%mm1, %%mm5) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
541 "movq (%2), %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
542 PAVGB(%%mm3, %%mm4, %%mm0, %%mm6) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
543 "movq (%2, %3), %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
544 PAVGB(%%mm3, %%mm5, %%mm1, %%mm6) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
545 "movq %%mm0, (%2) \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
546 "movq %%mm1, (%2, %3) \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
547 "addl %%eax, %1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
548 "addl %%eax, %2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
549 |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
550 "movq (%1, %3), %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
551 "movq (%1, %%eax), %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
552 PAVGBP(%%mm1, %%mm2, %%mm4, %%mm0, %%mm1, %%mm5) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
553 "movq (%2), %%mm3 \n\t" |
606
72d9661683f2
dont trash mm0, its still used in the next iteration of the loop (fixes strange horizontal lines on some blocks in b frames on mmx only cpus)
michaelni
parents:
470
diff
changeset
|
554 PAVGB(%%mm3, %%mm4, %%mm2, %%mm6) |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
555 "movq (%2, %3), %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
556 PAVGB(%%mm3, %%mm5, %%mm1, %%mm6) |
606
72d9661683f2
dont trash mm0, its still used in the next iteration of the loop (fixes strange horizontal lines on some blocks in b frames on mmx only cpus)
michaelni
parents:
470
diff
changeset
|
557 "movq %%mm2, (%2) \n\t" |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
558 "movq %%mm1, (%2, %3) \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
559 "addl %%eax, %1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
560 "addl %%eax, %2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
561 |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
562 "subl $4, %0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
563 "jnz 1b \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
564 :"+g"(h), "+S"(pixels), "+D"(block) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
565 :"r"(line_size) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
566 :"eax", "memory"); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
567 } |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
568 |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
569 // this routine is 'slightly' suboptimal but mostly unused |
651 | 570 static void DEF(avg, pixels8_xy2)(UINT8 *block, const UINT8 *pixels, int line_size, int h) |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
571 { |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
572 MOVQ_ZERO(mm7); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
573 SET_RND(mm6); // =2 for rnd and =1 for no_rnd version |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
574 __asm __volatile( |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
575 "movq (%1), %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
576 "movq 1(%1), %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
577 "movq %%mm0, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
578 "movq %%mm4, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
579 "punpcklbw %%mm7, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
580 "punpcklbw %%mm7, %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
581 "punpckhbw %%mm7, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
582 "punpckhbw %%mm7, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
583 "paddusw %%mm0, %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
584 "paddusw %%mm1, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
585 "xorl %%eax, %%eax \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
586 "addl %3, %1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
587 ".balign 8 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
588 "1: \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
589 "movq (%1, %%eax), %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
590 "movq 1(%1, %%eax), %%mm2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
591 "movq %%mm0, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
592 "movq %%mm2, %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
593 "punpcklbw %%mm7, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
594 "punpcklbw %%mm7, %%mm2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
595 "punpckhbw %%mm7, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
596 "punpckhbw %%mm7, %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
597 "paddusw %%mm2, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
598 "paddusw %%mm3, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
599 "paddusw %%mm6, %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
600 "paddusw %%mm6, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
601 "paddusw %%mm0, %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
602 "paddusw %%mm1, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
603 "psrlw $2, %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
604 "psrlw $2, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
605 "movq (%2, %%eax), %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
606 "packuswb %%mm5, %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
607 "pcmpeqd %%mm2, %%mm2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
608 "paddb %%mm2, %%mm2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
609 PAVGB(%%mm3, %%mm4, %%mm5, %%mm2) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
610 "movq %%mm5, (%2, %%eax) \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
611 "addl %3, %%eax \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
612 |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
613 "movq (%1, %%eax), %%mm2 \n\t" // 0 <-> 2 1 <-> 3 |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
614 "movq 1(%1, %%eax), %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
615 "movq %%mm2, %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
616 "movq %%mm4, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
617 "punpcklbw %%mm7, %%mm2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
618 "punpcklbw %%mm7, %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
619 "punpckhbw %%mm7, %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
620 "punpckhbw %%mm7, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
621 "paddusw %%mm2, %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
622 "paddusw %%mm3, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
623 "paddusw %%mm6, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
624 "paddusw %%mm6, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
625 "paddusw %%mm4, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
626 "paddusw %%mm5, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
627 "psrlw $2, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
628 "psrlw $2, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
629 "movq (%2, %%eax), %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
630 "packuswb %%mm1, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
631 "pcmpeqd %%mm2, %%mm2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
632 "paddb %%mm2, %%mm2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
633 PAVGB(%%mm3, %%mm0, %%mm1, %%mm2) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
634 "movq %%mm1, (%2, %%eax) \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
635 "addl %3, %%eax \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
636 |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
637 "subl $2, %0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
638 "jnz 1b \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
639 :"+g"(h), "+S"(pixels) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
640 :"D"(block), "r"(line_size) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
641 :"eax", "memory"); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
642 } |
651 | 643 |
954 | 644 static void DEF(avg, pixels8_l4)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int stride, int h) |
645 { | |
646 MOVQ_ZERO(mm7); | |
647 SET_RND(mm6); // =2 for rnd and =1 for no_rnd version | |
648 MOVQ_BFE(mm5); | |
649 __asm __volatile( | |
650 ".balign 8 \n\t" | |
651 "1: \n\t" | |
652 "movq (%1), %%mm0 \n\t" | |
653 "movq (%2), %%mm1 \n\t" | |
654 "movq 64(%2), %%mm2 \n\t" | |
655 "movq 136(%2), %%mm3 \n\t" | |
656 "punpcklbw %%mm7, %%mm0 \n\t" | |
657 "punpcklbw %%mm7, %%mm1 \n\t" | |
658 "punpcklbw %%mm7, %%mm2 \n\t" | |
659 "punpcklbw %%mm7, %%mm3 \n\t" | |
660 "paddusw %%mm6, %%mm0 \n\t" | |
661 "paddusw %%mm0, %%mm1 \n\t" | |
662 "paddusw %%mm2, %%mm3 \n\t" | |
663 "paddusw %%mm1, %%mm3 \n\t" | |
664 "psrlw $2, %%mm3 \n\t" | |
665 "movq (%1), %%mm0 \n\t" | |
666 "movq (%2), %%mm1 \n\t" | |
667 "movq 64(%2), %%mm2 \n\t" | |
959 | 668 "movq 136(%2), %%mm4 \n\t" |
954 | 669 "punpckhbw %%mm7, %%mm0 \n\t" |
670 "punpckhbw %%mm7, %%mm1 \n\t" | |
671 "punpckhbw %%mm7, %%mm2 \n\t" | |
672 "punpckhbw %%mm7, %%mm4 \n\t" | |
673 "paddusw %%mm6, %%mm0 \n\t" | |
674 "paddusw %%mm0, %%mm1 \n\t" | |
675 "paddusw %%mm2, %%mm4 \n\t" | |
676 "paddusw %%mm1, %%mm4 \n\t" | |
677 "psrlw $2, %%mm4 \n\t" | |
678 "packuswb %%mm4, %%mm3 \n\t" | |
679 "movq (%0), %%mm4 \n\t" | |
680 PAVGB(%%mm3, %%mm4, %%mm0, %%mm5) | |
959 | 681 "movq %%mm0, (%0) \n\t" |
954 | 682 "addl %4, %0 \n\t" |
683 "addl %4, %1 \n\t" | |
684 "addl $8, %2 \n\t" | |
685 "decl %3 \n\t" | |
686 "jnz 1b \n\t" | |
687 :"+r"(dst), "+r"(src1), "+r"(src2), "+r"(h) | |
688 :"r"(stride) | |
689 :"memory"); | |
690 } | |
691 | |
692 static void DEF(avg, pixels16_l4)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int stride, int h) | |
693 { | |
694 MOVQ_ZERO(mm7); | |
695 SET_RND(mm6); // =2 for rnd and =1 for no_rnd version | |
696 MOVQ_BFE(mm5); | |
697 __asm __volatile( | |
698 ".balign 8 \n\t" | |
699 "1: \n\t" | |
700 "movq (%1), %%mm0 \n\t" | |
701 "movq (%2), %%mm1 \n\t" | |
702 "movq 256(%2), %%mm2 \n\t" | |
703 "movq 528(%2), %%mm3 \n\t" | |
704 "punpcklbw %%mm7, %%mm0 \n\t" | |
705 "punpcklbw %%mm7, %%mm1 \n\t" | |
706 "punpcklbw %%mm7, %%mm2 \n\t" | |
707 "punpcklbw %%mm7, %%mm3 \n\t" | |
708 "paddusw %%mm6, %%mm0 \n\t" | |
709 "paddusw %%mm0, %%mm1 \n\t" | |
710 "paddusw %%mm2, %%mm3 \n\t" | |
711 "paddusw %%mm1, %%mm3 \n\t" | |
712 "psrlw $2, %%mm3 \n\t" | |
713 "movq (%1), %%mm0 \n\t" | |
714 "movq (%2), %%mm1 \n\t" | |
715 "movq 256(%2), %%mm2 \n\t" | |
959 | 716 "movq 528(%2), %%mm4 \n\t" |
954 | 717 "punpckhbw %%mm7, %%mm0 \n\t" |
718 "punpckhbw %%mm7, %%mm1 \n\t" | |
719 "punpckhbw %%mm7, %%mm2 \n\t" | |
720 "punpckhbw %%mm7, %%mm4 \n\t" | |
721 "paddusw %%mm6, %%mm0 \n\t" | |
722 "paddusw %%mm0, %%mm1 \n\t" | |
723 "paddusw %%mm2, %%mm4 \n\t" | |
724 "paddusw %%mm1, %%mm4 \n\t" | |
725 "psrlw $2, %%mm4 \n\t" | |
726 "packuswb %%mm4, %%mm3 \n\t" | |
727 "movq (%0), %%mm4 \n\t" | |
728 PAVGB(%%mm3, %%mm4, %%mm0, %%mm5) | |
959 | 729 "movq %%mm0, (%0) \n\t" |
954 | 730 "movq 8(%1), %%mm0 \n\t" |
731 "movq 8(%2), %%mm1 \n\t" | |
732 "movq 264(%2), %%mm2 \n\t" | |
733 "movq 536(%2), %%mm3 \n\t" | |
734 "punpcklbw %%mm7, %%mm0 \n\t" | |
735 "punpcklbw %%mm7, %%mm1 \n\t" | |
736 "punpcklbw %%mm7, %%mm2 \n\t" | |
737 "punpcklbw %%mm7, %%mm3 \n\t" | |
738 "paddusw %%mm6, %%mm0 \n\t" | |
739 "paddusw %%mm0, %%mm1 \n\t" | |
740 "paddusw %%mm2, %%mm3 \n\t" | |
741 "paddusw %%mm1, %%mm3 \n\t" | |
742 "psrlw $2, %%mm3 \n\t" | |
743 "movq 8(%1), %%mm0 \n\t" | |
744 "movq 8(%2), %%mm1 \n\t" | |
745 "movq 264(%2), %%mm2 \n\t" | |
959 | 746 "movq 536(%2), %%mm4 \n\t" |
954 | 747 "punpckhbw %%mm7, %%mm0 \n\t" |
748 "punpckhbw %%mm7, %%mm1 \n\t" | |
749 "punpckhbw %%mm7, %%mm2 \n\t" | |
750 "punpckhbw %%mm7, %%mm4 \n\t" | |
751 "paddusw %%mm6, %%mm0 \n\t" | |
752 "paddusw %%mm0, %%mm1 \n\t" | |
753 "paddusw %%mm2, %%mm4 \n\t" | |
754 "paddusw %%mm1, %%mm4 \n\t" | |
755 "psrlw $2, %%mm4 \n\t" | |
756 "packuswb %%mm4, %%mm3 \n\t" | |
757 "movq 8(%0), %%mm4 \n\t" | |
758 PAVGB(%%mm3, %%mm4, %%mm0, %%mm5) | |
959 | 759 "movq %%mm0, 8(%0) \n\t" |
954 | 760 "addl %4, %0 \n\t" |
761 "addl %4, %1 \n\t" | |
762 "addl $16, %2 \n\t" | |
763 "decl %3 \n\t" | |
764 "jnz 1b \n\t" | |
765 :"+r"(dst), "+r"(src1), "+r"(src2), "+r"(h) | |
766 :"r"(stride) | |
767 :"memory"); | |
768 } | |
769 | |
770 | |
651 | 771 //FIXME optimize |
772 static void DEF(put, pixels16_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){ | |
773 DEF(put, pixels8_y2)(block , pixels , line_size, h); | |
774 DEF(put, pixels8_y2)(block+8, pixels+8, line_size, h); | |
775 } | |
776 | |
777 static void DEF(put, pixels16_xy2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){ | |
778 DEF(put, pixels8_xy2)(block , pixels , line_size, h); | |
779 DEF(put, pixels8_xy2)(block+8, pixels+8, line_size, h); | |
780 } | |
781 | |
782 static void DEF(avg, pixels16_y2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){ | |
783 DEF(avg, pixels8_y2)(block , pixels , line_size, h); | |
784 DEF(avg, pixels8_y2)(block+8, pixels+8, line_size, h); | |
785 } | |
786 | |
787 static void DEF(avg, pixels16_xy2)(UINT8 *block, const UINT8 *pixels, int line_size, int h){ | |
788 DEF(avg, pixels8_xy2)(block , pixels , line_size, h); | |
789 DEF(avg, pixels8_xy2)(block+8, pixels+8, line_size, h); | |
790 } | |
791 | |
792 |