Mercurial > libavcodec.hg
annotate i386/snowdsp_mmx.c @ 5602:3b21f3268707 libavcodec
CONFIG_7REGS has been renamed to HAVE_7REGS
author | ramiro |
---|---|
date | Sun, 26 Aug 2007 16:10:53 +0000 |
parents | b26025b9586d |
children | a9eb858ecee4 |
rev | line source |
---|---|
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
1 /* |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
2 * MMX and SSE2 optimized snow DSP utils |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
3 * Copyright (c) 2005-2006 Robert Edele <yartrebo@earthlink.net> |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
4 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3566
diff
changeset
|
5 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3566
diff
changeset
|
6 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3566
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
9 * License as published by the Free Software Foundation; either |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3566
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
11 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3566
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
16 * |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3566
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
20 */ |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
21 |
5010
d5ba514e3f4a
Add libavcodec to compiler include flags in order to simplify header
diego
parents:
4436
diff
changeset
|
22 #include "avcodec.h" |
d5ba514e3f4a
Add libavcodec to compiler include flags in order to simplify header
diego
parents:
4436
diff
changeset
|
23 #include "snow.h" |
3398
e0927bc44a10
Move REG_* macros from libavcodec/i386/mmx.h to libavutil/x86_cpu.h
lucabe
parents:
3265
diff
changeset
|
24 #include "x86_cpu.h" |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
25 |
5591 | 26 void ff_snow_horizontal_compose97i_sse2(IDWTELEM *b, int width){ |
3210 | 27 const int w2= (width+1)>>1; |
28 // SSE2 code runs faster with pointers aligned on a 32-byte boundary. | |
5591 | 29 IDWTELEM temp_buf[(width>>1) + 4]; |
30 IDWTELEM * const temp = temp_buf + 4 - (((int)temp_buf & 0xF) >> 2); | |
3210 | 31 const int w_l= (width>>1); |
32 const int w_r= w2 - 1; | |
33 int i; | |
34 | |
35 { // Lift 0 | |
5591 | 36 IDWTELEM * const ref = b + w2 - 1; |
37 IDWTELEM b_0 = b[0]; //By allowing the first entry in b[0] to be calculated twice | |
3210 | 38 // (the first time erroneously), we allow the SSE2 code to run an extra pass. |
39 // The savings in code and time are well worth having to store this value and | |
40 // calculate b[0] correctly afterwards. | |
41 | |
42 i = 0; | |
43 asm volatile( | |
44 "pcmpeqd %%xmm7, %%xmm7 \n\t" | |
5599 | 45 "pcmpeqd %%xmm3, %%xmm3 \n\t" |
46 "psllw $1, %%xmm3 \n\t" | |
47 "paddw %%xmm7, %%xmm3 \n\t" | |
48 "psrlw $13, %%xmm3 \n\t" | |
3210 | 49 ::); |
5591 | 50 for(; i<w_l-15; i+=16){ |
3210 | 51 asm volatile( |
52 "movdqu (%1), %%xmm1 \n\t" | |
53 "movdqu 16(%1), %%xmm5 \n\t" | |
5591 | 54 "movdqu 2(%1), %%xmm2 \n\t" |
55 "movdqu 18(%1), %%xmm6 \n\t" | |
56 "paddw %%xmm1, %%xmm2 \n\t" | |
57 "paddw %%xmm5, %%xmm6 \n\t" | |
58 "paddw %%xmm7, %%xmm2 \n\t" | |
59 "paddw %%xmm7, %%xmm6 \n\t" | |
5599 | 60 "pmulhw %%xmm3, %%xmm2 \n\t" |
61 "pmulhw %%xmm3, %%xmm6 \n\t" | |
62 "paddw (%0), %%xmm2 \n\t" | |
63 "paddw 16(%0), %%xmm6 \n\t" | |
64 "movdqa %%xmm2, (%0) \n\t" | |
65 "movdqa %%xmm6, 16(%0) \n\t" | |
3210 | 66 :: "r"(&b[i]), "r"(&ref[i]) |
67 : "memory" | |
68 ); | |
69 } | |
70 snow_horizontal_compose_lift_lead_out(i, b, b, ref, width, w_l, 0, W_DM, W_DO, W_DS); | |
71 b[0] = b_0 - ((W_DM * 2 * ref[1]+W_DO)>>W_DS); | |
72 } | |
73 | |
74 { // Lift 1 | |
5591 | 75 IDWTELEM * const dst = b+w2; |
3210 | 76 |
77 i = 0; | |
5591 | 78 for(; (((long)&dst[i]) & 0x1F) && i<w_r; i++){ |
3210 | 79 dst[i] = dst[i] - (b[i] + b[i + 1]); |
80 } | |
5591 | 81 for(; i<w_r-15; i+=16){ |
3210 | 82 asm volatile( |
83 "movdqu (%1), %%xmm1 \n\t" | |
84 "movdqu 16(%1), %%xmm5 \n\t" | |
5591 | 85 "movdqu 2(%1), %%xmm2 \n\t" |
86 "movdqu 18(%1), %%xmm6 \n\t" | |
87 "paddw %%xmm1, %%xmm2 \n\t" | |
88 "paddw %%xmm5, %%xmm6 \n\t" | |
3210 | 89 "movdqa (%0), %%xmm0 \n\t" |
90 "movdqa 16(%0), %%xmm4 \n\t" | |
5591 | 91 "psubw %%xmm2, %%xmm0 \n\t" |
92 "psubw %%xmm6, %%xmm4 \n\t" | |
3210 | 93 "movdqa %%xmm0, (%0) \n\t" |
94 "movdqa %%xmm4, 16(%0) \n\t" | |
95 :: "r"(&dst[i]), "r"(&b[i]) | |
96 : "memory" | |
97 ); | |
98 } | |
99 snow_horizontal_compose_lift_lead_out(i, dst, dst, b, width, w_r, 1, W_CM, W_CO, W_CS); | |
100 } | |
101 | |
102 { // Lift 2 | |
5591 | 103 IDWTELEM * const ref = b+w2 - 1; |
104 IDWTELEM b_0 = b[0]; | |
3210 | 105 |
106 i = 0; | |
107 asm volatile( | |
5599 | 108 "psllw $15, %%xmm7 \n\t" |
5594
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
109 "pcmpeqw %%xmm6, %%xmm6 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
110 "psrlw $13, %%xmm6 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
111 "paddw %%xmm7, %%xmm6 \n\t" |
3210 | 112 ::); |
5591 | 113 for(; i<w_l-15; i+=16){ |
3210 | 114 asm volatile( |
5594
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
115 "movdqu (%1), %%xmm0 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
116 "movdqu 16(%1), %%xmm4 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
117 "movdqu 2(%1), %%xmm1 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
118 "movdqu 18(%1), %%xmm5 \n\t" //FIXME try aligned reads and shifts |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
119 "paddw %%xmm6, %%xmm0 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
120 "paddw %%xmm6, %%xmm4 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
121 "paddw %%xmm7, %%xmm1 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
122 "paddw %%xmm7, %%xmm5 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
123 "pavgw %%xmm1, %%xmm0 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
124 "pavgw %%xmm5, %%xmm4 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
125 "psubw %%xmm7, %%xmm0 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
126 "psubw %%xmm7, %%xmm4 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
127 "psraw $1, %%xmm0 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
128 "psraw $1, %%xmm4 \n\t" |
5555
0790af6d0028
remove idiotc double subtraction from the sse2 code (untested, no sse2 here)
michael
parents:
5554
diff
changeset
|
129 "movdqa (%0), %%xmm1 \n\t" |
0790af6d0028
remove idiotc double subtraction from the sse2 code (untested, no sse2 here)
michael
parents:
5554
diff
changeset
|
130 "movdqa 16(%0), %%xmm5 \n\t" |
5591 | 131 "paddw %%xmm1, %%xmm0 \n\t" |
132 "paddw %%xmm5, %%xmm4 \n\t" | |
133 "psraw $2, %%xmm0 \n\t" | |
134 "psraw $2, %%xmm4 \n\t" | |
135 "paddw %%xmm1, %%xmm0 \n\t" | |
136 "paddw %%xmm5, %%xmm4 \n\t" | |
3210 | 137 "movdqa %%xmm0, (%0) \n\t" |
138 "movdqa %%xmm4, 16(%0) \n\t" | |
139 :: "r"(&b[i]), "r"(&ref[i]) | |
140 : "memory" | |
141 ); | |
142 } | |
143 snow_horizontal_compose_liftS_lead_out(i, b, b, ref, width, w_l); | |
5555
0790af6d0028
remove idiotc double subtraction from the sse2 code (untested, no sse2 here)
michael
parents:
5554
diff
changeset
|
144 b[0] = b_0 + ((2 * ref[1] + W_BO-1 + 4 * b_0) >> W_BS); |
3210 | 145 } |
146 | |
147 { // Lift 3 | |
5591 | 148 IDWTELEM * const src = b+w2; |
3210 | 149 |
150 i = 0; | |
5591 | 151 for(; (((long)&temp[i]) & 0x1F) && i<w_r; i++){ |
3210 | 152 temp[i] = src[i] - ((-W_AM*(b[i] + b[i+1]))>>W_AS); |
153 } | |
154 for(; i<w_r-7; i+=8){ | |
155 asm volatile( | |
5591 | 156 "movdqu 2(%1), %%xmm2 \n\t" |
157 "movdqu 18(%1), %%xmm6 \n\t" | |
158 "paddw (%1), %%xmm2 \n\t" | |
159 "paddw 16(%1), %%xmm6 \n\t" | |
5565
93082c591c8b
Change rounding of the horizontal DWT to match the vertical one.
michael
parents:
5563
diff
changeset
|
160 "movdqu (%0), %%xmm0 \n\t" |
93082c591c8b
Change rounding of the horizontal DWT to match the vertical one.
michael
parents:
5563
diff
changeset
|
161 "movdqu 16(%0), %%xmm4 \n\t" |
5591 | 162 "paddw %%xmm2, %%xmm0 \n\t" |
163 "paddw %%xmm6, %%xmm4 \n\t" | |
164 "psraw $1, %%xmm2 \n\t" | |
165 "psraw $1, %%xmm6 \n\t" | |
166 "paddw %%xmm0, %%xmm2 \n\t" | |
167 "paddw %%xmm4, %%xmm6 \n\t" | |
3210 | 168 "movdqa %%xmm2, (%2) \n\t" |
169 "movdqa %%xmm6, 16(%2) \n\t" | |
170 :: "r"(&src[i]), "r"(&b[i]), "r"(&temp[i]) | |
171 : "memory" | |
172 ); | |
173 } | |
5565
93082c591c8b
Change rounding of the horizontal DWT to match the vertical one.
michael
parents:
5563
diff
changeset
|
174 snow_horizontal_compose_lift_lead_out(i, temp, src, b, width, w_r, 1, -W_AM, W_AO+1, W_AS); |
3210 | 175 } |
176 | |
177 { | |
178 snow_interleave_line_header(&i, width, b, temp); | |
179 | |
5591 | 180 for (; (i & 0x3E) != 0x3E; i-=2){ |
181 b[i+1] = temp[i>>1]; | |
182 b[i] = b[i>>1]; | |
183 } | |
184 for (i-=62; i>=0; i-=64){ | |
185 asm volatile( | |
186 "movdqa (%1), %%xmm0 \n\t" | |
187 "movdqa 16(%1), %%xmm2 \n\t" | |
188 "movdqa 32(%1), %%xmm4 \n\t" | |
189 "movdqa 48(%1), %%xmm6 \n\t" | |
190 "movdqa (%1), %%xmm1 \n\t" | |
191 "movdqa 16(%1), %%xmm3 \n\t" | |
192 "movdqa 32(%1), %%xmm5 \n\t" | |
193 "movdqa 48(%1), %%xmm7 \n\t" | |
194 "punpcklwd (%2), %%xmm0 \n\t" | |
195 "punpcklwd 16(%2), %%xmm2 \n\t" | |
196 "punpcklwd 32(%2), %%xmm4 \n\t" | |
197 "punpcklwd 48(%2), %%xmm6 \n\t" | |
198 "movdqa %%xmm0, (%0) \n\t" | |
199 "movdqa %%xmm2, 32(%0) \n\t" | |
200 "movdqa %%xmm4, 64(%0) \n\t" | |
201 "movdqa %%xmm6, 96(%0) \n\t" | |
202 "punpckhwd (%2), %%xmm1 \n\t" | |
203 "punpckhwd 16(%2), %%xmm3 \n\t" | |
204 "punpckhwd 32(%2), %%xmm5 \n\t" | |
205 "punpckhwd 48(%2), %%xmm7 \n\t" | |
206 "movdqa %%xmm1, 16(%0) \n\t" | |
207 "movdqa %%xmm3, 48(%0) \n\t" | |
208 "movdqa %%xmm5, 80(%0) \n\t" | |
209 "movdqa %%xmm7, 112(%0) \n\t" | |
210 :: "r"(&(b)[i]), "r"(&(b)[i>>1]), "r"(&(temp)[i>>1]) | |
211 : "memory" | |
212 ); | |
213 } | |
214 } | |
215 } | |
216 | |
217 void ff_snow_horizontal_compose97i_mmx(IDWTELEM *b, int width){ | |
218 const int w2= (width+1)>>1; | |
219 IDWTELEM temp[width >> 1]; | |
220 const int w_l= (width>>1); | |
221 const int w_r= w2 - 1; | |
222 int i; | |
223 | |
224 { // Lift 0 | |
225 IDWTELEM * const ref = b + w2 - 1; | |
226 | |
227 i = 1; | |
228 b[0] = b[0] - ((W_DM * 2 * ref[1]+W_DO)>>W_DS); | |
229 asm volatile( | |
230 "pcmpeqw %%mm7, %%mm7 \n\t" | |
5599 | 231 "pcmpeqw %%mm3, %%mm3 \n\t" |
232 "psllw $1, %%mm3 \n\t" | |
233 "paddw %%mm7, %%mm3 \n\t" | |
234 "psllw $13, %%mm3 \n\t" | |
5591 | 235 ::); |
236 for(; i<w_l-7; i+=8){ | |
237 asm volatile( | |
238 "movq (%1), %%mm2 \n\t" | |
239 "movq 8(%1), %%mm6 \n\t" | |
240 "paddw 2(%1), %%mm2 \n\t" | |
241 "paddw 10(%1), %%mm6 \n\t" | |
242 "paddw %%mm7, %%mm2 \n\t" | |
243 "paddw %%mm7, %%mm6 \n\t" | |
5599 | 244 "pmulhw %%mm3, %%mm2 \n\t" |
245 "pmulhw %%mm3, %%mm6 \n\t" | |
246 "paddw (%0), %%mm2 \n\t" | |
247 "paddw 8(%0), %%mm6 \n\t" | |
248 "movq %%mm2, (%0) \n\t" | |
249 "movq %%mm6, 8(%0) \n\t" | |
5591 | 250 :: "r"(&b[i]), "r"(&ref[i]) |
251 : "memory" | |
252 ); | |
253 } | |
254 snow_horizontal_compose_lift_lead_out(i, b, b, ref, width, w_l, 0, W_DM, W_DO, W_DS); | |
255 } | |
256 | |
257 { // Lift 1 | |
258 IDWTELEM * const dst = b+w2; | |
259 | |
260 i = 0; | |
261 for(; i<w_r-7; i+=8){ | |
262 asm volatile( | |
263 "movq (%1), %%mm2 \n\t" | |
264 "movq 8(%1), %%mm6 \n\t" | |
265 "paddw 2(%1), %%mm2 \n\t" | |
266 "paddw 10(%1), %%mm6 \n\t" | |
267 "movq (%0), %%mm0 \n\t" | |
268 "movq 8(%0), %%mm4 \n\t" | |
269 "psubw %%mm2, %%mm0 \n\t" | |
270 "psubw %%mm6, %%mm4 \n\t" | |
271 "movq %%mm0, (%0) \n\t" | |
272 "movq %%mm4, 8(%0) \n\t" | |
273 :: "r"(&dst[i]), "r"(&b[i]) | |
274 : "memory" | |
275 ); | |
276 } | |
277 snow_horizontal_compose_lift_lead_out(i, dst, dst, b, width, w_r, 1, W_CM, W_CO, W_CS); | |
278 } | |
279 | |
280 { // Lift 2 | |
281 IDWTELEM * const ref = b+w2 - 1; | |
282 | |
283 i = 1; | |
284 b[0] = b[0] + (((2 * ref[1] + W_BO) + 4 * b[0]) >> W_BS); | |
285 asm volatile( | |
5599 | 286 "psllw $15, %%mm7 \n\t" |
5594
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
287 "pcmpeqw %%mm6, %%mm6 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
288 "psrlw $13, %%mm6 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
289 "paddw %%mm7, %%mm6 \n\t" |
5591 | 290 ::); |
291 for(; i<w_l-7; i+=8){ | |
292 asm volatile( | |
293 "movq (%1), %%mm0 \n\t" | |
294 "movq 8(%1), %%mm4 \n\t" | |
5594
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
295 "movq 2(%1), %%mm1 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
296 "movq 10(%1), %%mm5 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
297 "paddw %%mm6, %%mm0 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
298 "paddw %%mm6, %%mm4 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
299 "paddw %%mm7, %%mm1 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
300 "paddw %%mm7, %%mm5 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
301 "pavgw %%mm1, %%mm0 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
302 "pavgw %%mm5, %%mm4 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
303 "psubw %%mm7, %%mm0 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
304 "psubw %%mm7, %%mm4 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
305 "psraw $1, %%mm0 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
306 "psraw $1, %%mm4 \n\t" |
5591 | 307 "movq (%0), %%mm1 \n\t" |
308 "movq 8(%0), %%mm5 \n\t" | |
309 "paddw %%mm1, %%mm0 \n\t" | |
310 "paddw %%mm5, %%mm4 \n\t" | |
311 "psraw $2, %%mm0 \n\t" | |
312 "psraw $2, %%mm4 \n\t" | |
313 "paddw %%mm1, %%mm0 \n\t" | |
314 "paddw %%mm5, %%mm4 \n\t" | |
315 "movq %%mm0, (%0) \n\t" | |
316 "movq %%mm4, 8(%0) \n\t" | |
317 :: "r"(&b[i]), "r"(&ref[i]) | |
318 : "memory" | |
319 ); | |
320 } | |
321 snow_horizontal_compose_liftS_lead_out(i, b, b, ref, width, w_l); | |
322 } | |
323 | |
324 { // Lift 3 | |
325 IDWTELEM * const src = b+w2; | |
326 i = 0; | |
327 | |
328 for(; i<w_r-7; i+=8){ | |
329 asm volatile( | |
330 "movq 2(%1), %%mm2 \n\t" | |
331 "movq 10(%1), %%mm6 \n\t" | |
332 "paddw (%1), %%mm2 \n\t" | |
333 "paddw 8(%1), %%mm6 \n\t" | |
334 "movq (%0), %%mm0 \n\t" | |
335 "movq 8(%0), %%mm4 \n\t" | |
336 "paddw %%mm2, %%mm0 \n\t" | |
337 "paddw %%mm6, %%mm4 \n\t" | |
338 "psraw $1, %%mm2 \n\t" | |
339 "psraw $1, %%mm6 \n\t" | |
340 "paddw %%mm0, %%mm2 \n\t" | |
341 "paddw %%mm4, %%mm6 \n\t" | |
342 "movq %%mm2, (%2) \n\t" | |
343 "movq %%mm6, 8(%2) \n\t" | |
344 :: "r"(&src[i]), "r"(&b[i]), "r"(&temp[i]) | |
345 : "memory" | |
346 ); | |
347 } | |
348 snow_horizontal_compose_lift_lead_out(i, temp, src, b, width, w_r, 1, -W_AM, W_AO+1, W_AS); | |
349 } | |
350 | |
351 { | |
352 snow_interleave_line_header(&i, width, b, temp); | |
353 | |
3210 | 354 for (; (i & 0x1E) != 0x1E; i-=2){ |
355 b[i+1] = temp[i>>1]; | |
356 b[i] = b[i>>1]; | |
357 } | |
358 for (i-=30; i>=0; i-=32){ | |
359 asm volatile( | |
360 "movq (%1), %%mm0 \n\t" | |
361 "movq 8(%1), %%mm2 \n\t" | |
362 "movq 16(%1), %%mm4 \n\t" | |
363 "movq 24(%1), %%mm6 \n\t" | |
364 "movq (%1), %%mm1 \n\t" | |
365 "movq 8(%1), %%mm3 \n\t" | |
366 "movq 16(%1), %%mm5 \n\t" | |
367 "movq 24(%1), %%mm7 \n\t" | |
5591 | 368 "punpcklwd (%2), %%mm0 \n\t" |
369 "punpcklwd 8(%2), %%mm2 \n\t" | |
370 "punpcklwd 16(%2), %%mm4 \n\t" | |
371 "punpcklwd 24(%2), %%mm6 \n\t" | |
3210 | 372 "movq %%mm0, (%0) \n\t" |
373 "movq %%mm2, 16(%0) \n\t" | |
374 "movq %%mm4, 32(%0) \n\t" | |
375 "movq %%mm6, 48(%0) \n\t" | |
5591 | 376 "punpckhwd (%2), %%mm1 \n\t" |
377 "punpckhwd 8(%2), %%mm3 \n\t" | |
378 "punpckhwd 16(%2), %%mm5 \n\t" | |
379 "punpckhwd 24(%2), %%mm7 \n\t" | |
3210 | 380 "movq %%mm1, 8(%0) \n\t" |
381 "movq %%mm3, 24(%0) \n\t" | |
382 "movq %%mm5, 40(%0) \n\t" | |
383 "movq %%mm7, 56(%0) \n\t" | |
384 :: "r"(&b[i]), "r"(&b[i>>1]), "r"(&temp[i>>1]) | |
385 : "memory" | |
386 ); | |
387 } | |
388 } | |
389 } | |
390 | |
5602 | 391 #ifdef HAVE_7REGS |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
392 #define snow_vertical_compose_sse2_load_add(op,r,t0,t1,t2,t3)\ |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
393 ""op" ("r",%%"REG_d"), %%"t0" \n\t"\ |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
394 ""op" 16("r",%%"REG_d"), %%"t1" \n\t"\ |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
395 ""op" 32("r",%%"REG_d"), %%"t2" \n\t"\ |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
396 ""op" 48("r",%%"REG_d"), %%"t3" \n\t" |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
397 |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
398 #define snow_vertical_compose_sse2_load(r,t0,t1,t2,t3)\ |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
399 snow_vertical_compose_sse2_load_add("movdqa",r,t0,t1,t2,t3) |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
400 |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
401 #define snow_vertical_compose_sse2_add(r,t0,t1,t2,t3)\ |
5591 | 402 snow_vertical_compose_sse2_load_add("paddw",r,t0,t1,t2,t3) |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
403 |
5595 | 404 #define snow_vertical_compose_r2r_sub(s0,s1,s2,s3,t0,t1,t2,t3)\ |
5591 | 405 "psubw %%"s0", %%"t0" \n\t"\ |
406 "psubw %%"s1", %%"t1" \n\t"\ | |
407 "psubw %%"s2", %%"t2" \n\t"\ | |
408 "psubw %%"s3", %%"t3" \n\t" | |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
409 |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
410 #define snow_vertical_compose_sse2_store(w,s0,s1,s2,s3)\ |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
411 "movdqa %%"s0", ("w",%%"REG_d") \n\t"\ |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
412 "movdqa %%"s1", 16("w",%%"REG_d") \n\t"\ |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
413 "movdqa %%"s2", 32("w",%%"REG_d") \n\t"\ |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
414 "movdqa %%"s3", 48("w",%%"REG_d") \n\t" |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
415 |
5595 | 416 #define snow_vertical_compose_sra(n,t0,t1,t2,t3)\ |
5591 | 417 "psraw $"n", %%"t0" \n\t"\ |
418 "psraw $"n", %%"t1" \n\t"\ | |
419 "psraw $"n", %%"t2" \n\t"\ | |
420 "psraw $"n", %%"t3" \n\t" | |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
421 |
5595 | 422 #define snow_vertical_compose_r2r_add(s0,s1,s2,s3,t0,t1,t2,t3)\ |
5591 | 423 "paddw %%"s0", %%"t0" \n\t"\ |
424 "paddw %%"s1", %%"t1" \n\t"\ | |
425 "paddw %%"s2", %%"t2" \n\t"\ | |
426 "paddw %%"s3", %%"t3" \n\t" | |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
427 |
5600
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
428 #define snow_vertical_compose_r2r_pmulhw(s0,s1,s2,s3,t0,t1,t2,t3)\ |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
429 "pmulhw %%"s0", %%"t0" \n\t"\ |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
430 "pmulhw %%"s1", %%"t1" \n\t"\ |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
431 "pmulhw %%"s2", %%"t2" \n\t"\ |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
432 "pmulhw %%"s3", %%"t3" \n\t" |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
433 |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
434 #define snow_vertical_compose_sse2_move(s0,s1,s2,s3,t0,t1,t2,t3)\ |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
435 "movdqa %%"s0", %%"t0" \n\t"\ |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
436 "movdqa %%"s1", %%"t1" \n\t"\ |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
437 "movdqa %%"s2", %%"t2" \n\t"\ |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
438 "movdqa %%"s3", %%"t3" \n\t" |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
439 |
5591 | 440 void ff_snow_vertical_compose97i_sse2(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width){ |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
441 long i = width; |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
442 |
5591 | 443 while(i & 0x1F) |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
444 { |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
445 i--; |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
446 b4[i] -= (W_DM*(b3[i] + b5[i])+W_DO)>>W_DS; |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
447 b3[i] -= (W_CM*(b2[i] + b4[i])+W_CO)>>W_CS; |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
448 b2[i] += (W_BM*(b1[i] + b3[i])+4*b2[i]+W_BO)>>W_BS; |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
449 b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS; |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
450 } |
5596 | 451 i+=i; |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
452 |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
453 asm volatile ( |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
454 "jmp 2f \n\t" |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
455 "1: \n\t" |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
456 snow_vertical_compose_sse2_load("%4","xmm0","xmm2","xmm4","xmm6") |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
457 snow_vertical_compose_sse2_add("%6","xmm0","xmm2","xmm4","xmm6") |
5600
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
458 |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
459 |
5600
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
460 "pcmpeqw %%xmm0, %%xmm0 \n\t" |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
461 "pcmpeqw %%xmm2, %%xmm2 \n\t" |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
462 "paddw %%xmm2, %%xmm2 \n\t" |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
463 "paddw %%xmm0, %%xmm2 \n\t" |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
464 "psllw $13, %%xmm2 \n\t" |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
465 snow_vertical_compose_r2r_add("xmm0","xmm0","xmm0","xmm0","xmm1","xmm3","xmm5","xmm7") |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
466 snow_vertical_compose_r2r_pmulhw("xmm2","xmm2","xmm2","xmm2","xmm1","xmm3","xmm5","xmm7") |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
467 snow_vertical_compose_sse2_add("%5","xmm1","xmm3","xmm5","xmm7") |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
468 snow_vertical_compose_sse2_store("%5","xmm1","xmm3","xmm5","xmm7") |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
469 snow_vertical_compose_sse2_load("%4","xmm0","xmm2","xmm4","xmm6") |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
470 snow_vertical_compose_sse2_add("%3","xmm1","xmm3","xmm5","xmm7") |
5595 | 471 snow_vertical_compose_r2r_sub("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6") |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
472 snow_vertical_compose_sse2_store("%4","xmm0","xmm2","xmm4","xmm6") |
5594
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
473 |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
474 "pcmpeqw %%xmm7, %%xmm7 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
475 "pcmpeqw %%xmm5, %%xmm5 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
476 "psllw $15, %%xmm7 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
477 "psrlw $13, %%xmm5 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
478 "paddw %%xmm7, %%xmm5 \n\t" |
5595 | 479 snow_vertical_compose_r2r_add("xmm5","xmm5","xmm5","xmm5","xmm0","xmm2","xmm4","xmm6") |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
480 "movq (%2,%%"REG_d"), %%xmm1 \n\t" |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
481 "movq 8(%2,%%"REG_d"), %%xmm3 \n\t" |
5594
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
482 "paddw %%xmm7, %%xmm1 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
483 "paddw %%xmm7, %%xmm3 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
484 "pavgw %%xmm1, %%xmm0 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
485 "pavgw %%xmm3, %%xmm2 \n\t" |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
486 "movq 16(%2,%%"REG_d"), %%xmm1 \n\t" |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
487 "movq 24(%2,%%"REG_d"), %%xmm3 \n\t" |
5594
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
488 "paddw %%xmm7, %%xmm1 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
489 "paddw %%xmm7, %%xmm3 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
490 "pavgw %%xmm1, %%xmm4 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
491 "pavgw %%xmm3, %%xmm6 \n\t" |
5595 | 492 snow_vertical_compose_r2r_sub("xmm7","xmm7","xmm7","xmm7","xmm0","xmm2","xmm4","xmm6") |
493 snow_vertical_compose_sra("1","xmm0","xmm2","xmm4","xmm6") | |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
494 snow_vertical_compose_sse2_add("%3","xmm0","xmm2","xmm4","xmm6") |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
495 |
5595 | 496 snow_vertical_compose_sra("2","xmm0","xmm2","xmm4","xmm6") |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
497 snow_vertical_compose_sse2_add("%3","xmm0","xmm2","xmm4","xmm6") |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
498 snow_vertical_compose_sse2_store("%3","xmm0","xmm2","xmm4","xmm6") |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
499 snow_vertical_compose_sse2_add("%1","xmm0","xmm2","xmm4","xmm6") |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
500 snow_vertical_compose_sse2_move("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7") |
5595 | 501 snow_vertical_compose_sra("1","xmm0","xmm2","xmm4","xmm6") |
502 snow_vertical_compose_r2r_add("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6") | |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
503 snow_vertical_compose_sse2_add("%2","xmm0","xmm2","xmm4","xmm6") |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
504 snow_vertical_compose_sse2_store("%2","xmm0","xmm2","xmm4","xmm6") |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
505 |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
506 "2: \n\t" |
5596 | 507 "sub $64, %%"REG_d" \n\t" |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
508 "jge 1b \n\t" |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
509 :"+d"(i) |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
510 :"r"(b0),"r"(b1),"r"(b2),"r"(b3),"r"(b4),"r"(b5)); |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
511 } |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
512 |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
513 #define snow_vertical_compose_mmx_load_add(op,r,t0,t1,t2,t3)\ |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
514 ""op" ("r",%%"REG_d"), %%"t0" \n\t"\ |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
515 ""op" 8("r",%%"REG_d"), %%"t1" \n\t"\ |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
516 ""op" 16("r",%%"REG_d"), %%"t2" \n\t"\ |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
517 ""op" 24("r",%%"REG_d"), %%"t3" \n\t" |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
518 |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
519 #define snow_vertical_compose_mmx_load(r,t0,t1,t2,t3)\ |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
520 snow_vertical_compose_mmx_load_add("movq",r,t0,t1,t2,t3) |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
521 |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
522 #define snow_vertical_compose_mmx_add(r,t0,t1,t2,t3)\ |
5591 | 523 snow_vertical_compose_mmx_load_add("paddw",r,t0,t1,t2,t3) |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
524 |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
525 #define snow_vertical_compose_mmx_store(w,s0,s1,s2,s3)\ |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
526 "movq %%"s0", ("w",%%"REG_d") \n\t"\ |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
527 "movq %%"s1", 8("w",%%"REG_d") \n\t"\ |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
528 "movq %%"s2", 16("w",%%"REG_d") \n\t"\ |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
529 "movq %%"s3", 24("w",%%"REG_d") \n\t" |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
530 |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
531 #define snow_vertical_compose_mmx_move(s0,s1,s2,s3,t0,t1,t2,t3)\ |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
532 "movq %%"s0", %%"t0" \n\t"\ |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
533 "movq %%"s1", %%"t1" \n\t"\ |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
534 "movq %%"s2", %%"t2" \n\t"\ |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
535 "movq %%"s3", %%"t3" \n\t" |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
536 |
5600
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
537 |
5591 | 538 void ff_snow_vertical_compose97i_mmx(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width){ |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
539 long i = width; |
5591 | 540 while(i & 15) |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
541 { |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
542 i--; |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
543 b4[i] -= (W_DM*(b3[i] + b5[i])+W_DO)>>W_DS; |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
544 b3[i] -= (W_CM*(b2[i] + b4[i])+W_CO)>>W_CS; |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
545 b2[i] += (W_BM*(b1[i] + b3[i])+4*b2[i]+W_BO)>>W_BS; |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
546 b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS; |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
547 } |
5596 | 548 i+=i; |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
549 asm volatile( |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
550 "jmp 2f \n\t" |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
551 "1: \n\t" |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
552 |
5600
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
553 snow_vertical_compose_mmx_load("%4","mm1","mm3","mm5","mm7") |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
554 snow_vertical_compose_mmx_add("%6","mm1","mm3","mm5","mm7") |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
555 "pcmpeqw %%mm0, %%mm0 \n\t" |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
556 "pcmpeqw %%mm2, %%mm2 \n\t" |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
557 "paddw %%mm2, %%mm2 \n\t" |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
558 "paddw %%mm0, %%mm2 \n\t" |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
559 "psllw $13, %%mm2 \n\t" |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
560 snow_vertical_compose_r2r_add("mm0","mm0","mm0","mm0","mm1","mm3","mm5","mm7") |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
561 snow_vertical_compose_r2r_pmulhw("mm2","mm2","mm2","mm2","mm1","mm3","mm5","mm7") |
f302e395f552
optimize the first vertical lifting step, this also prevents another
michael
parents:
5599
diff
changeset
|
562 snow_vertical_compose_mmx_add("%5","mm1","mm3","mm5","mm7") |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
563 snow_vertical_compose_mmx_store("%5","mm1","mm3","mm5","mm7") |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
564 snow_vertical_compose_mmx_load("%4","mm0","mm2","mm4","mm6") |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
565 snow_vertical_compose_mmx_add("%3","mm1","mm3","mm5","mm7") |
5595 | 566 snow_vertical_compose_r2r_sub("mm1","mm3","mm5","mm7","mm0","mm2","mm4","mm6") |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
567 snow_vertical_compose_mmx_store("%4","mm0","mm2","mm4","mm6") |
5594
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
568 "pcmpeqw %%mm7, %%mm7 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
569 "pcmpeqw %%mm5, %%mm5 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
570 "psllw $15, %%mm7 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
571 "psrlw $13, %%mm5 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
572 "paddw %%mm7, %%mm5 \n\t" |
5595 | 573 snow_vertical_compose_r2r_add("mm5","mm5","mm5","mm5","mm0","mm2","mm4","mm6") |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
574 "movq (%2,%%"REG_d"), %%mm1 \n\t" |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
575 "movq 8(%2,%%"REG_d"), %%mm3 \n\t" |
5594
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
576 "paddw %%mm7, %%mm1 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
577 "paddw %%mm7, %%mm3 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
578 "pavgw %%mm1, %%mm0 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
579 "pavgw %%mm3, %%mm2 \n\t" |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
580 "movq 16(%2,%%"REG_d"), %%mm1 \n\t" |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
581 "movq 24(%2,%%"REG_d"), %%mm3 \n\t" |
5594
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
582 "paddw %%mm7, %%mm1 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
583 "paddw %%mm7, %%mm3 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
584 "pavgw %%mm1, %%mm4 \n\t" |
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5593
diff
changeset
|
585 "pavgw %%mm3, %%mm6 \n\t" |
5595 | 586 snow_vertical_compose_r2r_sub("mm7","mm7","mm7","mm7","mm0","mm2","mm4","mm6") |
587 snow_vertical_compose_sra("1","mm0","mm2","mm4","mm6") | |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
588 snow_vertical_compose_mmx_add("%3","mm0","mm2","mm4","mm6") |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
589 |
5595 | 590 snow_vertical_compose_sra("2","mm0","mm2","mm4","mm6") |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
591 snow_vertical_compose_mmx_add("%3","mm0","mm2","mm4","mm6") |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
592 snow_vertical_compose_mmx_store("%3","mm0","mm2","mm4","mm6") |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
593 snow_vertical_compose_mmx_add("%1","mm0","mm2","mm4","mm6") |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
594 snow_vertical_compose_mmx_move("mm0","mm2","mm4","mm6","mm1","mm3","mm5","mm7") |
5595 | 595 snow_vertical_compose_sra("1","mm0","mm2","mm4","mm6") |
596 snow_vertical_compose_r2r_add("mm1","mm3","mm5","mm7","mm0","mm2","mm4","mm6") | |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
597 snow_vertical_compose_mmx_add("%2","mm0","mm2","mm4","mm6") |
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
598 snow_vertical_compose_mmx_store("%2","mm0","mm2","mm4","mm6") |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
599 |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
600 "2: \n\t" |
5596 | 601 "sub $32, %%"REG_d" \n\t" |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
602 "jge 1b \n\t" |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
603 :"+d"(i) |
5597
d350b388a6ae
get rid of totally senseless "m" + read in register we have enough
michael
parents:
5596
diff
changeset
|
604 :"r"(b0),"r"(b1),"r"(b2),"r"(b3),"r"(b4),"r"(b5)); |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
diff
changeset
|
605 } |
5602 | 606 #endif //HAVE_7REGS |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
607 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
608 #define snow_inner_add_yblock_sse2_header \ |
5591 | 609 IDWTELEM * * dst_array = sb->line + src_y;\ |
3566
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
610 long tmp;\ |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
611 asm volatile(\ |
3566
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
612 "mov %7, %%"REG_c" \n\t"\ |
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
613 "mov %6, %2 \n\t"\ |
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
614 "mov %4, %%"REG_S" \n\t"\ |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
615 "pxor %%xmm7, %%xmm7 \n\t" /* 0 */\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
616 "pcmpeqd %%xmm3, %%xmm3 \n\t"\ |
5591 | 617 "psllw $15, %%xmm3 \n\t"\ |
618 "psrlw $12, %%xmm3 \n\t" /* FRAC_BITS >> 1 */\ | |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
619 "1: \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
620 "mov %1, %%"REG_D" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
621 "mov (%%"REG_D"), %%"REG_D" \n\t"\ |
3566
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
622 "add %3, %%"REG_D" \n\t" |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
623 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
624 #define snow_inner_add_yblock_sse2_start_8(out_reg1, out_reg2, ptr_offset, s_offset)\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
625 "mov "PTR_SIZE"*"ptr_offset"(%%"REG_a"), %%"REG_d"; \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
626 "movq (%%"REG_d"), %%"out_reg1" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
627 "movq (%%"REG_d", %%"REG_c"), %%"out_reg2" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
628 "punpcklbw %%xmm7, %%"out_reg1" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
629 "punpcklbw %%xmm7, %%"out_reg2" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
630 "movq "s_offset"(%%"REG_S"), %%xmm0 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
631 "movq "s_offset"+16(%%"REG_S"), %%xmm4 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
632 "punpcklbw %%xmm7, %%xmm0 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
633 "punpcklbw %%xmm7, %%xmm4 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
634 "pmullw %%xmm0, %%"out_reg1" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
635 "pmullw %%xmm4, %%"out_reg2" \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
636 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
637 #define snow_inner_add_yblock_sse2_start_16(out_reg1, out_reg2, ptr_offset, s_offset)\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
638 "mov "PTR_SIZE"*"ptr_offset"(%%"REG_a"), %%"REG_d"; \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
639 "movq (%%"REG_d"), %%"out_reg1" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
640 "movq 8(%%"REG_d"), %%"out_reg2" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
641 "punpcklbw %%xmm7, %%"out_reg1" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
642 "punpcklbw %%xmm7, %%"out_reg2" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
643 "movq "s_offset"(%%"REG_S"), %%xmm0 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
644 "movq "s_offset"+8(%%"REG_S"), %%xmm4 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
645 "punpcklbw %%xmm7, %%xmm0 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
646 "punpcklbw %%xmm7, %%xmm4 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
647 "pmullw %%xmm0, %%"out_reg1" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
648 "pmullw %%xmm4, %%"out_reg2" \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
649 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
650 #define snow_inner_add_yblock_sse2_accum_8(ptr_offset, s_offset) \ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
651 snow_inner_add_yblock_sse2_start_8("xmm2", "xmm6", ptr_offset, s_offset)\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
652 "paddusw %%xmm2, %%xmm1 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
653 "paddusw %%xmm6, %%xmm5 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
654 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
655 #define snow_inner_add_yblock_sse2_accum_16(ptr_offset, s_offset) \ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
656 snow_inner_add_yblock_sse2_start_16("xmm2", "xmm6", ptr_offset, s_offset)\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
657 "paddusw %%xmm2, %%xmm1 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
658 "paddusw %%xmm6, %%xmm5 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
659 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
660 #define snow_inner_add_yblock_sse2_end_common1\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
661 "add $32, %%"REG_S" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
662 "add %%"REG_c", %0 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
663 "add %%"REG_c", "PTR_SIZE"*3(%%"REG_a");\n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
664 "add %%"REG_c", "PTR_SIZE"*2(%%"REG_a");\n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
665 "add %%"REG_c", "PTR_SIZE"*1(%%"REG_a");\n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
666 "add %%"REG_c", (%%"REG_a") \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
667 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
668 #define snow_inner_add_yblock_sse2_end_common2\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
669 "jnz 1b \n\t"\ |
3566
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
670 :"+m"(dst8),"+m"(dst_array),"=&r"(tmp)\ |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
671 :\ |
5591 | 672 "rm"((long)(src_x<<1)),"m"(obmc),"a"(block),"m"((long)b_h),"m"((long)src_stride):\ |
3566
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
673 "%"REG_c"","%"REG_S"","%"REG_D"","%"REG_d""); |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
674 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
675 #define snow_inner_add_yblock_sse2_end_8\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
676 "sal $1, %%"REG_c" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
677 "add $"PTR_SIZE"*2, %1 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
678 snow_inner_add_yblock_sse2_end_common1\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
679 "sar $1, %%"REG_c" \n\t"\ |
3566
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
680 "sub $2, %2 \n\t"\ |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
681 snow_inner_add_yblock_sse2_end_common2 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
682 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
683 #define snow_inner_add_yblock_sse2_end_16\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
684 "add $"PTR_SIZE"*1, %1 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
685 snow_inner_add_yblock_sse2_end_common1\ |
3566
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
686 "dec %2 \n\t"\ |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
687 snow_inner_add_yblock_sse2_end_common2 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
688 |
4436
d3e389536b0a
Add the const specifier as needed to reduce the number of warnings.
takis
parents:
3947
diff
changeset
|
689 static void inner_add_yblock_bw_8_obmc_16_bh_even_sse2(const uint8_t *obmc, const long obmc_stride, uint8_t * * block, int b_w, long b_h, |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
690 int src_x, int src_y, long src_stride, slice_buffer * sb, int add, uint8_t * dst8){ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
691 snow_inner_add_yblock_sse2_header |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
692 snow_inner_add_yblock_sse2_start_8("xmm1", "xmm5", "3", "0") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
693 snow_inner_add_yblock_sse2_accum_8("2", "8") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
694 snow_inner_add_yblock_sse2_accum_8("1", "128") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
695 snow_inner_add_yblock_sse2_accum_8("0", "136") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
696 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
697 "mov %0, %%"REG_d" \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
698 "movdqa (%%"REG_D"), %%xmm0 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
699 "movdqa %%xmm1, %%xmm2 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
700 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
701 "punpckhwd %%xmm7, %%xmm1 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
702 "punpcklwd %%xmm7, %%xmm2 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
703 "paddd %%xmm2, %%xmm0 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
704 "movdqa 16(%%"REG_D"), %%xmm2 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
705 "paddd %%xmm1, %%xmm2 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
706 "paddd %%xmm3, %%xmm0 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
707 "paddd %%xmm3, %%xmm2 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
708 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
709 "mov %1, %%"REG_D" \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
710 "mov "PTR_SIZE"(%%"REG_D"), %%"REG_D";\n\t" |
3566
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
711 "add %3, %%"REG_D" \n\t" |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
712 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
713 "movdqa (%%"REG_D"), %%xmm4 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
714 "movdqa %%xmm5, %%xmm6 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
715 "punpckhwd %%xmm7, %%xmm5 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
716 "punpcklwd %%xmm7, %%xmm6 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
717 "paddd %%xmm6, %%xmm4 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
718 "movdqa 16(%%"REG_D"), %%xmm6 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
719 "paddd %%xmm5, %%xmm6 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
720 "paddd %%xmm3, %%xmm4 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
721 "paddd %%xmm3, %%xmm6 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
722 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
723 "psrad $8, %%xmm0 \n\t" /* FRAC_BITS. */ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
724 "psrad $8, %%xmm2 \n\t" /* FRAC_BITS. */ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
725 "packssdw %%xmm2, %%xmm0 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
726 "packuswb %%xmm7, %%xmm0 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
727 "movq %%xmm0, (%%"REG_d") \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
728 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
729 "psrad $8, %%xmm4 \n\t" /* FRAC_BITS. */ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
730 "psrad $8, %%xmm6 \n\t" /* FRAC_BITS. */ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
731 "packssdw %%xmm6, %%xmm4 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
732 "packuswb %%xmm7, %%xmm4 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
733 "movq %%xmm4, (%%"REG_d",%%"REG_c");\n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
734 snow_inner_add_yblock_sse2_end_8 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
735 } |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
736 |
4436
d3e389536b0a
Add the const specifier as needed to reduce the number of warnings.
takis
parents:
3947
diff
changeset
|
737 static void inner_add_yblock_bw_16_obmc_32_sse2(const uint8_t *obmc, const long obmc_stride, uint8_t * * block, int b_w, long b_h, |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
738 int src_x, int src_y, long src_stride, slice_buffer * sb, int add, uint8_t * dst8){ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
739 snow_inner_add_yblock_sse2_header |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
740 snow_inner_add_yblock_sse2_start_16("xmm1", "xmm5", "3", "0") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
741 snow_inner_add_yblock_sse2_accum_16("2", "16") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
742 snow_inner_add_yblock_sse2_accum_16("1", "512") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
743 snow_inner_add_yblock_sse2_accum_16("0", "528") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
744 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
745 "mov %0, %%"REG_d" \n\t" |
5591 | 746 "psrlw $4, %%xmm1 \n\t" |
747 "psrlw $4, %%xmm5 \n\t" | |
748 "paddw (%%"REG_D"), %%xmm1 \n\t" | |
749 "paddw 16(%%"REG_D"), %%xmm5 \n\t" | |
750 "paddw %%xmm3, %%xmm1 \n\t" | |
751 "paddw %%xmm3, %%xmm5 \n\t" | |
752 "psraw $4, %%xmm1 \n\t" /* FRAC_BITS. */ | |
753 "psraw $4, %%xmm5 \n\t" /* FRAC_BITS. */ | |
754 "packuswb %%xmm5, %%xmm1 \n\t" | |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
755 |
5591 | 756 "movdqu %%xmm1, (%%"REG_d") \n\t" |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
757 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
758 snow_inner_add_yblock_sse2_end_16 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
759 } |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
760 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
761 #define snow_inner_add_yblock_mmx_header \ |
5591 | 762 IDWTELEM * * dst_array = sb->line + src_y;\ |
3566
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
763 long tmp;\ |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
764 asm volatile(\ |
3566
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
765 "mov %7, %%"REG_c" \n\t"\ |
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
766 "mov %6, %2 \n\t"\ |
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
767 "mov %4, %%"REG_S" \n\t"\ |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
768 "pxor %%mm7, %%mm7 \n\t" /* 0 */\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
769 "pcmpeqd %%mm3, %%mm3 \n\t"\ |
5591 | 770 "psllw $15, %%mm3 \n\t"\ |
771 "psrlw $12, %%mm3 \n\t" /* FRAC_BITS >> 1 */\ | |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
772 "1: \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
773 "mov %1, %%"REG_D" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
774 "mov (%%"REG_D"), %%"REG_D" \n\t"\ |
3566
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
775 "add %3, %%"REG_D" \n\t" |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
776 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
777 #define snow_inner_add_yblock_mmx_start(out_reg1, out_reg2, ptr_offset, s_offset, d_offset)\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
778 "mov "PTR_SIZE"*"ptr_offset"(%%"REG_a"), %%"REG_d"; \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
779 "movd "d_offset"(%%"REG_d"), %%"out_reg1" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
780 "movd "d_offset"+4(%%"REG_d"), %%"out_reg2" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
781 "punpcklbw %%mm7, %%"out_reg1" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
782 "punpcklbw %%mm7, %%"out_reg2" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
783 "movd "s_offset"(%%"REG_S"), %%mm0 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
784 "movd "s_offset"+4(%%"REG_S"), %%mm4 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
785 "punpcklbw %%mm7, %%mm0 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
786 "punpcklbw %%mm7, %%mm4 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
787 "pmullw %%mm0, %%"out_reg1" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
788 "pmullw %%mm4, %%"out_reg2" \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
789 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
790 #define snow_inner_add_yblock_mmx_accum(ptr_offset, s_offset, d_offset) \ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
791 snow_inner_add_yblock_mmx_start("mm2", "mm6", ptr_offset, s_offset, d_offset)\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
792 "paddusw %%mm2, %%mm1 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
793 "paddusw %%mm6, %%mm5 \n\t" |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
794 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
795 #define snow_inner_add_yblock_mmx_mix(read_offset, write_offset)\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
796 "mov %0, %%"REG_d" \n\t"\ |
5591 | 797 "psrlw $4, %%mm1 \n\t"\ |
798 "psrlw $4, %%mm5 \n\t"\ | |
799 "paddw "read_offset"(%%"REG_D"), %%mm1 \n\t"\ | |
800 "paddw "read_offset"+8(%%"REG_D"), %%mm5 \n\t"\ | |
801 "paddw %%mm3, %%mm1 \n\t"\ | |
802 "paddw %%mm3, %%mm5 \n\t"\ | |
803 "psraw $4, %%mm1 \n\t"\ | |
804 "psraw $4, %%mm5 \n\t"\ | |
805 "packuswb %%mm5, %%mm1 \n\t"\ | |
806 "movq %%mm1, "write_offset"(%%"REG_d") \n\t" | |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
807 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
808 #define snow_inner_add_yblock_mmx_end(s_step)\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
809 "add $"s_step", %%"REG_S" \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
810 "add %%"REG_c", "PTR_SIZE"*3(%%"REG_a");\n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
811 "add %%"REG_c", "PTR_SIZE"*2(%%"REG_a");\n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
812 "add %%"REG_c", "PTR_SIZE"*1(%%"REG_a");\n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
813 "add %%"REG_c", (%%"REG_a") \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
814 "add $"PTR_SIZE"*1, %1 \n\t"\ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
815 "add %%"REG_c", %0 \n\t"\ |
3566
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
816 "dec %2 \n\t"\ |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
817 "jnz 1b \n\t"\ |
3566
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
818 :"+m"(dst8),"+m"(dst_array),"=&r"(tmp)\ |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
819 :\ |
5591 | 820 "rm"((long)(src_x<<1)),"m"(obmc),"a"(block),"m"((long)b_h),"m"((long)src_stride):\ |
3566
b63ef6fcbc70
Fix x86 SIMD asm and pic, patch from Martin von Gagern <Martin.vGagern@gmx.net>
lu_zero
parents:
3398
diff
changeset
|
821 "%"REG_c"","%"REG_S"","%"REG_D"","%"REG_d""); |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
822 |
4436
d3e389536b0a
Add the const specifier as needed to reduce the number of warnings.
takis
parents:
3947
diff
changeset
|
823 static void inner_add_yblock_bw_8_obmc_16_mmx(const uint8_t *obmc, const long obmc_stride, uint8_t * * block, int b_w, long b_h, |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
824 int src_x, int src_y, long src_stride, slice_buffer * sb, int add, uint8_t * dst8){ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
825 snow_inner_add_yblock_mmx_header |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
826 snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "0", "0") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
827 snow_inner_add_yblock_mmx_accum("2", "8", "0") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
828 snow_inner_add_yblock_mmx_accum("1", "128", "0") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
829 snow_inner_add_yblock_mmx_accum("0", "136", "0") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
830 snow_inner_add_yblock_mmx_mix("0", "0") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
831 snow_inner_add_yblock_mmx_end("16") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
832 } |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
833 |
4436
d3e389536b0a
Add the const specifier as needed to reduce the number of warnings.
takis
parents:
3947
diff
changeset
|
834 static void inner_add_yblock_bw_16_obmc_32_mmx(const uint8_t *obmc, const long obmc_stride, uint8_t * * block, int b_w, long b_h, |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
835 int src_x, int src_y, long src_stride, slice_buffer * sb, int add, uint8_t * dst8){ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
836 snow_inner_add_yblock_mmx_header |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
837 snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "0", "0") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
838 snow_inner_add_yblock_mmx_accum("2", "16", "0") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
839 snow_inner_add_yblock_mmx_accum("1", "512", "0") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
840 snow_inner_add_yblock_mmx_accum("0", "528", "0") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
841 snow_inner_add_yblock_mmx_mix("0", "0") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
842 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
843 snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "8", "8") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
844 snow_inner_add_yblock_mmx_accum("2", "24", "8") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
845 snow_inner_add_yblock_mmx_accum("1", "520", "8") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
846 snow_inner_add_yblock_mmx_accum("0", "536", "8") |
5591 | 847 snow_inner_add_yblock_mmx_mix("16", "8") |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
848 snow_inner_add_yblock_mmx_end("32") |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
849 } |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
850 |
4436
d3e389536b0a
Add the const specifier as needed to reduce the number of warnings.
takis
parents:
3947
diff
changeset
|
851 void ff_snow_inner_add_yblock_sse2(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
852 int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8){ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
853 |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
854 if (b_w == 16) |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
855 inner_add_yblock_bw_16_obmc_32_sse2(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8); |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
856 else if (b_w == 8 && obmc_stride == 16) { |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
857 if (!(b_h & 1)) |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
858 inner_add_yblock_bw_8_obmc_16_bh_even_sse2(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8); |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
859 else |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
860 inner_add_yblock_bw_8_obmc_16_mmx(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8); |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
861 } else |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
862 ff_snow_inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8); |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
863 } |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
864 |
4436
d3e389536b0a
Add the const specifier as needed to reduce the number of warnings.
takis
parents:
3947
diff
changeset
|
865 void ff_snow_inner_add_yblock_mmx(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
866 int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8){ |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
867 if (b_w == 16) |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
868 inner_add_yblock_bw_16_obmc_32_mmx(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8); |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
869 else if (b_w == 8 && obmc_stride == 16) |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
870 inner_add_yblock_bw_8_obmc_16_mmx(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8); |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
871 else |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
872 ff_snow_inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8); |
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
873 } |