Mercurial > libavcodec.hg
annotate i386/dsputil_mmx_rnd.h @ 1439:a4d00b1f0271 libavcodec
initial commit for Id RoQ and Interplay MVE multimedia subsystems
author | tmmm |
---|---|
date | Tue, 02 Sep 2003 04:32:02 +0000 |
parents | b32afefe7d33 |
children | 07a484280a82 |
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 |
1064 | 25 static void DEF(put, pixels8_x2)(uint8_t *block, const uint8_t *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( | |
985 | 61 "testl $1, %0 \n\t" |
984 | 62 " jz 1f \n\t" |
63 "movq (%1), %%mm0 \n\t" | |
64 "movq (%2), %%mm1 \n\t" | |
65 "addl %4, %1 \n\t" | |
66 "addl $8, %2 \n\t" | |
67 PAVGB(%%mm0, %%mm1, %%mm4, %%mm6) | |
68 "movq %%mm4, (%3) \n\t" | |
69 "addl %5, %3 \n\t" | |
70 "decl %0 \n\t" | |
954 | 71 ".balign 8 \n\t" |
72 "1: \n\t" | |
73 "movq (%1), %%mm0 \n\t" | |
74 "movq (%2), %%mm1 \n\t" | |
75 "addl %4, %1 \n\t" | |
76 "movq (%1), %%mm2 \n\t" | |
77 "movq 8(%2), %%mm3 \n\t" | |
78 "addl %4, %1 \n\t" | |
79 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
80 "movq %%mm4, (%3) \n\t" | |
81 "addl %5, %3 \n\t" | |
82 "movq %%mm5, (%3) \n\t" | |
83 "addl %5, %3 \n\t" | |
84 "movq (%1), %%mm0 \n\t" | |
85 "movq 16(%2), %%mm1 \n\t" | |
86 "addl %4, %1 \n\t" | |
87 "movq (%1), %%mm2 \n\t" | |
88 "movq 24(%2), %%mm3 \n\t" | |
89 "addl %4, %1 \n\t" | |
90 "addl $32, %2 \n\t" | |
91 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
92 "movq %%mm4, (%3) \n\t" | |
93 "addl %5, %3 \n\t" | |
94 "movq %%mm5, (%3) \n\t" | |
95 "addl %5, %3 \n\t" | |
96 "subl $4, %0 \n\t" | |
97 "jnz 1b \n\t" | |
967 | 98 #ifdef PIC //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cant be used |
99 :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |
100 #else | |
101 :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |
102 #endif | |
966 | 103 :"S"(src1Stride), "D"(dstStride) |
954 | 104 :"memory"); |
105 } | |
106 | |
1064 | 107 static void DEF(put, pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
651 | 108 { |
109 MOVQ_BFE(mm6); | |
110 __asm __volatile( | |
111 "lea (%3, %3), %%eax \n\t" | |
112 ".balign 8 \n\t" | |
113 "1: \n\t" | |
114 "movq (%1), %%mm0 \n\t" | |
115 "movq 1(%1), %%mm1 \n\t" | |
116 "movq (%1, %3), %%mm2 \n\t" | |
117 "movq 1(%1, %3), %%mm3 \n\t" | |
118 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
119 "movq %%mm4, (%2) \n\t" | |
120 "movq %%mm5, (%2, %3) \n\t" | |
121 "movq 8(%1), %%mm0 \n\t" | |
122 "movq 9(%1), %%mm1 \n\t" | |
123 "movq 8(%1, %3), %%mm2 \n\t" | |
124 "movq 9(%1, %3), %%mm3 \n\t" | |
125 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
126 "movq %%mm4, 8(%2) \n\t" | |
127 "movq %%mm5, 8(%2, %3) \n\t" | |
128 "addl %%eax, %1 \n\t" | |
129 "addl %%eax, %2 \n\t" | |
130 "movq (%1), %%mm0 \n\t" | |
131 "movq 1(%1), %%mm1 \n\t" | |
132 "movq (%1, %3), %%mm2 \n\t" | |
133 "movq 1(%1, %3), %%mm3 \n\t" | |
134 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
135 "movq %%mm4, (%2) \n\t" | |
136 "movq %%mm5, (%2, %3) \n\t" | |
137 "movq 8(%1), %%mm0 \n\t" | |
138 "movq 9(%1), %%mm1 \n\t" | |
139 "movq 8(%1, %3), %%mm2 \n\t" | |
140 "movq 9(%1, %3), %%mm3 \n\t" | |
141 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
142 "movq %%mm4, 8(%2) \n\t" | |
954 | 143 "movq %%mm5, 8(%2, %3) \n\t" |
651 | 144 "addl %%eax, %1 \n\t" |
145 "addl %%eax, %2 \n\t" | |
146 "subl $4, %0 \n\t" | |
147 "jnz 1b \n\t" | |
148 :"+g"(h), "+S"(pixels), "+D"(block) | |
149 :"r"(line_size) | |
150 :"eax", "memory"); | |
151 } | |
152 | |
954 | 153 static void DEF(put, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) |
154 { | |
155 MOVQ_BFE(mm6); | |
156 __asm __volatile( | |
985 | 157 "testl $1, %0 \n\t" |
984 | 158 " jz 1f \n\t" |
159 "movq (%1), %%mm0 \n\t" | |
160 "movq (%2), %%mm1 \n\t" | |
161 "movq 8(%1), %%mm2 \n\t" | |
162 "movq 8(%2), %%mm3 \n\t" | |
163 "addl %4, %1 \n\t" | |
164 "addl $16, %2 \n\t" | |
165 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
166 "movq %%mm4, (%3) \n\t" | |
167 "movq %%mm5, 8(%3) \n\t" | |
168 "addl %5, %3 \n\t" | |
169 "decl %0 \n\t" | |
954 | 170 ".balign 8 \n\t" |
171 "1: \n\t" | |
172 "movq (%1), %%mm0 \n\t" | |
173 "movq (%2), %%mm1 \n\t" | |
174 "movq 8(%1), %%mm2 \n\t" | |
175 "movq 8(%2), %%mm3 \n\t" | |
176 "addl %4, %1 \n\t" | |
177 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
178 "movq %%mm4, (%3) \n\t" | |
179 "movq %%mm5, 8(%3) \n\t" | |
180 "addl %5, %3 \n\t" | |
181 "movq (%1), %%mm0 \n\t" | |
182 "movq 16(%2), %%mm1 \n\t" | |
183 "movq 8(%1), %%mm2 \n\t" | |
184 "movq 24(%2), %%mm3 \n\t" | |
185 "addl %4, %1 \n\t" | |
186 PAVGBP(%%mm0, %%mm1, %%mm4, %%mm2, %%mm3, %%mm5) | |
187 "movq %%mm4, (%3) \n\t" | |
188 "movq %%mm5, 8(%3) \n\t" | |
189 "addl %5, %3 \n\t" | |
190 "addl $32, %2 \n\t" | |
191 "subl $2, %0 \n\t" | |
192 "jnz 1b \n\t" | |
967 | 193 #ifdef PIC //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cant be used |
194 :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |
195 #else | |
196 :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst) | |
197 #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
|
198 :"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
|
199 :"memory"); |
954 | 200 } |
201 | |
1064 | 202 static void DEF(put, pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
203 { |
448 | 204 MOVQ_BFE(mm6); |
205 __asm __volatile( | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
206 "lea (%3, %3), %%eax \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
207 "movq (%1), %%mm0 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
208 ".balign 8 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
209 "1: \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
210 "movq (%1, %3), %%mm1 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
211 "movq (%1, %%eax),%%mm2 \n\t" |
448 | 212 PAVGBP(%%mm1, %%mm0, %%mm4, %%mm2, %%mm1, %%mm5) |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
213 "movq %%mm4, (%2) \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
214 "movq %%mm5, (%2, %3) \n\t" |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
215 "addl %%eax, %1 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
216 "addl %%eax, %2 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
217 "movq (%1, %3), %%mm1 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
218 "movq (%1, %%eax),%%mm0 \n\t" |
448 | 219 PAVGBP(%%mm1, %%mm2, %%mm4, %%mm0, %%mm1, %%mm5) |
220 "movq %%mm4, (%2) \n\t" | |
221 "movq %%mm5, (%2, %3) \n\t" | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
222 "addl %%eax, %1 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
223 "addl %%eax, %2 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
224 "subl $4, %0 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
225 "jnz 1b \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
226 :"+g"(h), "+S"(pixels), "+D"(block) |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
227 :"r"(line_size) |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
228 :"eax", "memory"); |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
229 } |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
230 |
1064 | 231 static void DEF(put, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
232 { |
448 | 233 MOVQ_ZERO(mm7); |
234 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
|
235 __asm __volatile( |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
236 "movq (%1), %%mm0 \n\t" |
448 | 237 "movq 1(%1), %%mm4 \n\t" |
238 "movq %%mm0, %%mm1 \n\t" | |
239 "movq %%mm4, %%mm5 \n\t" | |
240 "punpcklbw %%mm7, %%mm0 \n\t" | |
241 "punpcklbw %%mm7, %%mm4 \n\t" | |
242 "punpckhbw %%mm7, %%mm1 \n\t" | |
243 "punpckhbw %%mm7, %%mm5 \n\t" | |
244 "paddusw %%mm0, %%mm4 \n\t" | |
245 "paddusw %%mm1, %%mm5 \n\t" | |
246 "xorl %%eax, %%eax \n\t" | |
247 "addl %3, %1 \n\t" | |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
248 ".balign 8 \n\t" |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
249 "1: \n\t" |
448 | 250 "movq (%1, %%eax), %%mm0 \n\t" |
251 "movq 1(%1, %%eax), %%mm2 \n\t" | |
252 "movq %%mm0, %%mm1 \n\t" | |
253 "movq %%mm2, %%mm3 \n\t" | |
254 "punpcklbw %%mm7, %%mm0 \n\t" | |
255 "punpcklbw %%mm7, %%mm2 \n\t" | |
256 "punpckhbw %%mm7, %%mm1 \n\t" | |
257 "punpckhbw %%mm7, %%mm3 \n\t" | |
258 "paddusw %%mm2, %%mm0 \n\t" | |
259 "paddusw %%mm3, %%mm1 \n\t" | |
260 "paddusw %%mm6, %%mm4 \n\t" | |
261 "paddusw %%mm6, %%mm5 \n\t" | |
262 "paddusw %%mm0, %%mm4 \n\t" | |
263 "paddusw %%mm1, %%mm5 \n\t" | |
264 "psrlw $2, %%mm4 \n\t" | |
265 "psrlw $2, %%mm5 \n\t" | |
266 "packuswb %%mm5, %%mm4 \n\t" | |
267 "movq %%mm4, (%2, %%eax) \n\t" | |
268 "addl %3, %%eax \n\t" | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
269 |
448 | 270 "movq (%1, %%eax), %%mm2 \n\t" // 0 <-> 2 1 <-> 3 |
271 "movq 1(%1, %%eax), %%mm4 \n\t" | |
272 "movq %%mm2, %%mm3 \n\t" | |
273 "movq %%mm4, %%mm5 \n\t" | |
274 "punpcklbw %%mm7, %%mm2 \n\t" | |
275 "punpcklbw %%mm7, %%mm4 \n\t" | |
276 "punpckhbw %%mm7, %%mm3 \n\t" | |
277 "punpckhbw %%mm7, %%mm5 \n\t" | |
278 "paddusw %%mm2, %%mm4 \n\t" | |
279 "paddusw %%mm3, %%mm5 \n\t" | |
280 "paddusw %%mm6, %%mm0 \n\t" | |
281 "paddusw %%mm6, %%mm1 \n\t" | |
282 "paddusw %%mm4, %%mm0 \n\t" | |
283 "paddusw %%mm5, %%mm1 \n\t" | |
284 "psrlw $2, %%mm0 \n\t" | |
285 "psrlw $2, %%mm1 \n\t" | |
286 "packuswb %%mm1, %%mm0 \n\t" | |
287 "movq %%mm0, (%2, %%eax) \n\t" | |
288 "addl %3, %%eax \n\t" | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
289 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
290 "subl $2, %0 \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
291 "jnz 1b \n\t" |
448 | 292 :"+g"(h), "+S"(pixels) |
293 :"D"(block), "r"(line_size) | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
294 :"eax", "memory"); |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
295 } |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
296 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
diff
changeset
|
297 // avg_pixels |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
298 // in case more speed is needed - unroling would certainly help |
1064 | 299 static void DEF(avg, pixels8)(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
300 { |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
301 MOVQ_BFE(mm6); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
302 JUMPALIGN(); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
303 do { |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
304 __asm __volatile( |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
305 "movq %0, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
306 "movq %1, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
307 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
308 "movq %%mm2, %0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
309 :"+m"(*block) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
310 :"m"(*pixels) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
311 :"memory"); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
312 pixels += line_size; |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
313 block += line_size; |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
314 } |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
315 while (--h); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
316 } |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
317 |
1064 | 318 static void DEF(avg, pixels16)(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
651 | 319 { |
320 MOVQ_BFE(mm6); | |
321 JUMPALIGN(); | |
322 do { | |
323 __asm __volatile( | |
324 "movq %0, %%mm0 \n\t" | |
325 "movq %1, %%mm1 \n\t" | |
326 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) | |
327 "movq %%mm2, %0 \n\t" | |
328 "movq 8%0, %%mm0 \n\t" | |
329 "movq 8%1, %%mm1 \n\t" | |
330 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) | |
331 "movq %%mm2, 8%0 \n\t" | |
332 :"+m"(*block) | |
333 :"m"(*pixels) | |
334 :"memory"); | |
335 pixels += line_size; | |
336 block += line_size; | |
337 } | |
338 while (--h); | |
339 } | |
340 | |
1064 | 341 static void DEF(avg, pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
342 { |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
343 MOVQ_BFE(mm6); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
344 JUMPALIGN(); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
345 do { |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
346 __asm __volatile( |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
347 "movq %1, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
348 "movq 1%1, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
349 "movq %0, %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
350 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
351 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
352 "movq %%mm0, %0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
353 :"+m"(*block) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
354 :"m"(*pixels) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
355 :"memory"); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
356 pixels += line_size; |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
357 block += line_size; |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
358 } while (--h); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
359 } |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
360 |
954 | 361 static void DEF(avg, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) |
362 { | |
363 MOVQ_BFE(mm6); | |
364 JUMPALIGN(); | |
365 do { | |
366 __asm __volatile( | |
367 "movq %1, %%mm0 \n\t" | |
368 "movq %2, %%mm1 \n\t" | |
369 "movq %0, %%mm3 \n\t" | |
370 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) | |
371 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6) | |
372 "movq %%mm0, %0 \n\t" | |
373 :"+m"(*dst) | |
374 :"m"(*src1), "m"(*src2) | |
375 :"memory"); | |
376 dst += dstStride; | |
377 src1 += src1Stride; | |
378 src2 += 8; | |
379 } while (--h); | |
380 } | |
381 | |
1064 | 382 static void DEF(avg, pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
651 | 383 { |
384 MOVQ_BFE(mm6); | |
385 JUMPALIGN(); | |
386 do { | |
387 __asm __volatile( | |
388 "movq %1, %%mm0 \n\t" | |
389 "movq 1%1, %%mm1 \n\t" | |
390 "movq %0, %%mm3 \n\t" | |
391 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) | |
392 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6) | |
393 "movq %%mm0, %0 \n\t" | |
394 "movq 8%1, %%mm0 \n\t" | |
395 "movq 9%1, %%mm1 \n\t" | |
396 "movq 8%0, %%mm3 \n\t" | |
397 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) | |
398 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6) | |
399 "movq %%mm0, 8%0 \n\t" | |
400 :"+m"(*block) | |
401 :"m"(*pixels) | |
402 :"memory"); | |
403 pixels += line_size; | |
404 block += line_size; | |
405 } while (--h); | |
406 } | |
407 | |
954 | 408 static void DEF(avg, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) |
409 { | |
410 MOVQ_BFE(mm6); | |
411 JUMPALIGN(); | |
412 do { | |
413 __asm __volatile( | |
414 "movq %1, %%mm0 \n\t" | |
415 "movq %2, %%mm1 \n\t" | |
416 "movq %0, %%mm3 \n\t" | |
417 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) | |
418 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6) | |
419 "movq %%mm0, %0 \n\t" | |
420 "movq 8%1, %%mm0 \n\t" | |
421 "movq 8%2, %%mm1 \n\t" | |
422 "movq 8%0, %%mm3 \n\t" | |
423 PAVGB(%%mm0, %%mm1, %%mm2, %%mm6) | |
424 PAVGB(%%mm3, %%mm2, %%mm0, %%mm6) | |
425 "movq %%mm0, 8%0 \n\t" | |
426 :"+m"(*dst) | |
427 :"m"(*src1), "m"(*src2) | |
428 :"memory"); | |
429 dst += dstStride; | |
430 src1 += src1Stride; | |
431 src2 += 16; | |
432 } while (--h); | |
433 } | |
434 | |
1064 | 435 static void DEF(avg, pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
436 { |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
437 MOVQ_BFE(mm6); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
438 __asm __volatile( |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
439 "lea (%3, %3), %%eax \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
440 "movq (%1), %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
441 ".balign 8 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
442 "1: \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
443 "movq (%1, %3), %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
444 "movq (%1, %%eax), %%mm2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
445 PAVGBP(%%mm1, %%mm0, %%mm4, %%mm2, %%mm1, %%mm5) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
446 "movq (%2), %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
447 PAVGB(%%mm3, %%mm4, %%mm0, %%mm6) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
448 "movq (%2, %3), %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
449 PAVGB(%%mm3, %%mm5, %%mm1, %%mm6) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
450 "movq %%mm0, (%2) \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
451 "movq %%mm1, (%2, %3) \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
452 "addl %%eax, %1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
453 "addl %%eax, %2 \n\t" |
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 "movq (%1, %3), %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
456 "movq (%1, %%eax), %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
457 PAVGBP(%%mm1, %%mm2, %%mm4, %%mm0, %%mm1, %%mm5) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
458 "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
|
459 PAVGB(%%mm3, %%mm4, %%mm2, %%mm6) |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
460 "movq (%2, %3), %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
461 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
|
462 "movq %%mm2, (%2) \n\t" |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
463 "movq %%mm1, (%2, %3) \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
464 "addl %%eax, %1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
465 "addl %%eax, %2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
466 |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
467 "subl $4, %0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
468 "jnz 1b \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
469 :"+g"(h), "+S"(pixels), "+D"(block) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
470 :"r"(line_size) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
471 :"eax", "memory"); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
472 } |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
473 |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
474 // this routine is 'slightly' suboptimal but mostly unused |
1064 | 475 static void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
470
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
476 { |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
477 MOVQ_ZERO(mm7); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
478 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
|
479 __asm __volatile( |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
480 "movq (%1), %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
481 "movq 1(%1), %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
482 "movq %%mm0, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
483 "movq %%mm4, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
484 "punpcklbw %%mm7, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
485 "punpcklbw %%mm7, %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
486 "punpckhbw %%mm7, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
487 "punpckhbw %%mm7, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
488 "paddusw %%mm0, %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
489 "paddusw %%mm1, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
490 "xorl %%eax, %%eax \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
491 "addl %3, %1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
492 ".balign 8 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
493 "1: \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
494 "movq (%1, %%eax), %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
495 "movq 1(%1, %%eax), %%mm2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
496 "movq %%mm0, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
497 "movq %%mm2, %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
498 "punpcklbw %%mm7, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
499 "punpcklbw %%mm7, %%mm2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
500 "punpckhbw %%mm7, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
501 "punpckhbw %%mm7, %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
502 "paddusw %%mm2, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
503 "paddusw %%mm3, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
504 "paddusw %%mm6, %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
505 "paddusw %%mm6, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
506 "paddusw %%mm0, %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
507 "paddusw %%mm1, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
508 "psrlw $2, %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
509 "psrlw $2, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
510 "movq (%2, %%eax), %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
511 "packuswb %%mm5, %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
512 "pcmpeqd %%mm2, %%mm2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
513 "paddb %%mm2, %%mm2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
514 PAVGB(%%mm3, %%mm4, %%mm5, %%mm2) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
515 "movq %%mm5, (%2, %%eax) \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
516 "addl %3, %%eax \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
517 |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
518 "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
|
519 "movq 1(%1, %%eax), %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
520 "movq %%mm2, %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
521 "movq %%mm4, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
522 "punpcklbw %%mm7, %%mm2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
523 "punpcklbw %%mm7, %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
524 "punpckhbw %%mm7, %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
525 "punpckhbw %%mm7, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
526 "paddusw %%mm2, %%mm4 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
527 "paddusw %%mm3, %%mm5 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
528 "paddusw %%mm6, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
529 "paddusw %%mm6, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
530 "paddusw %%mm4, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
531 "paddusw %%mm5, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
532 "psrlw $2, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
533 "psrlw $2, %%mm1 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
534 "movq (%2, %%eax), %%mm3 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
535 "packuswb %%mm1, %%mm0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
536 "pcmpeqd %%mm2, %%mm2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
537 "paddb %%mm2, %%mm2 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
538 PAVGB(%%mm3, %%mm0, %%mm1, %%mm2) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
539 "movq %%mm1, (%2, %%eax) \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
540 "addl %3, %%eax \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
541 |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
542 "subl $2, %0 \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
543 "jnz 1b \n\t" |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
544 :"+g"(h), "+S"(pixels) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
545 :"D"(block), "r"(line_size) |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
546 :"eax", "memory"); |
b94e82d31b06
* implemented remaing avg_ pixel functions (these are not used offen)
kabi
parents:
448
diff
changeset
|
547 } |
651 | 548 |
549 //FIXME optimize | |
1064 | 550 static void DEF(put, pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){ |
651 | 551 DEF(put, pixels8_y2)(block , pixels , line_size, h); |
552 DEF(put, pixels8_y2)(block+8, pixels+8, line_size, h); | |
553 } | |
554 | |
1064 | 555 static void DEF(put, pixels16_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){ |
651 | 556 DEF(put, pixels8_xy2)(block , pixels , line_size, h); |
557 DEF(put, pixels8_xy2)(block+8, pixels+8, line_size, h); | |
558 } | |
559 | |
1064 | 560 static void DEF(avg, pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){ |
651 | 561 DEF(avg, pixels8_y2)(block , pixels , line_size, h); |
562 DEF(avg, pixels8_y2)(block+8, pixels+8, line_size, h); | |
563 } | |
564 | |
1064 | 565 static void DEF(avg, pixels16_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){ |
651 | 566 DEF(avg, pixels8_xy2)(block , pixels , line_size, h); |
567 DEF(avg, pixels8_xy2)(block+8, pixels+8, line_size, h); | |
568 } | |
569 | |
570 |