Mercurial > libavcodec.hg
annotate i386/dsputil_mmx.c @ 324:9c6f056f0e41 libavcodec
fixed mpeg4 time stuff on encoding
mpeg4 b-frame enoding support
removed old, out-commented ratecontrol
reuse motion compensation code between encoding & decoding
prefix newly added global functions with ff_ to reduce namespace polution
b-frame ME (unfinished, but working)
added some comments to mpegvideo.h
do MC on encoding only once if possible
bugs? ;)
author | michaelni |
---|---|
date | Wed, 17 Apr 2002 04:32:12 +0000 |
parents | c1a8a1b4a24b |
children | 8635a7036395 |
rev | line source |
---|---|
0 | 1 /* |
2 * MMX optimized DSP utils | |
3 * Copyright (c) 2000, 2001 Gerard Lantau. | |
4 * | |
5 * This program is free software; you can redistribute it and/or modify | |
6 * it under the terms of the GNU General Public License as published by | |
7 * the Free Software Foundation; either version 2 of the License, or | |
8 * (at your option) any later version. | |
9 * | |
10 * This program is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 * GNU General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU General Public License | |
16 * along with this program; if not, write to the Free Software | |
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
18 * | |
19 * MMX optimization by Nick Kurshev <nickols_k@mail.ru> | |
20 */ | |
21 | |
22 #include "../dsputil.h" | |
174
ac5075a55488
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
151
diff
changeset
|
23 #include "../simple_idct.h" |
0 | 24 |
5 | 25 int mm_flags; /* multimedia extension flags */ |
26 | |
294 | 27 int pix_abs16x16_mmx(UINT8 *blk1, UINT8 *blk2, int lx); |
28 int pix_abs16x16_x2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |
29 int pix_abs16x16_y2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |
30 int pix_abs16x16_xy2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |
31 | |
32 int pix_abs16x16_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |
33 int pix_abs16x16_x2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |
34 int pix_abs16x16_y2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |
35 int pix_abs16x16_xy2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |
36 | |
37 int pix_abs8x8_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |
38 int pix_abs8x8_x2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |
39 int pix_abs8x8_y2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |
40 int pix_abs8x8_xy2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |
41 | |
42 int pix_abs8x8_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |
43 int pix_abs8x8_x2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |
44 int pix_abs8x8_y2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |
45 int pix_abs8x8_xy2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |
46 | |
42 | 47 /* external functions, from idct_mmx.c */ |
48 void ff_mmx_idct(DCTELEM *block); | |
49 void ff_mmxext_idct(DCTELEM *block); | |
19
82d4c9be9873
MMX/MMXEXT iDCT support, using external functions currently defined in libmpeg2
arpi_esp
parents:
8
diff
changeset
|
50 |
0 | 51 /* pixel operations */ |
294 | 52 static const unsigned long long int mm_wone __attribute__ ((aligned(8))) = 0x0001000100010001LL; |
53 static const unsigned long long int mm_wtwo __attribute__ ((aligned(8))) = 0x0002000200020002LL; | |
8 | 54 //static const unsigned short mm_wone[4] __attribute__ ((aligned(8))) = { 0x1, 0x1, 0x1, 0x1 }; |
55 //static const unsigned short mm_wtwo[4] __attribute__ ((aligned(8))) = { 0x2, 0x2, 0x2, 0x2 }; | |
0 | 56 |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
57 #define JUMPALIGN() __asm __volatile (".balign 8"::) |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
58 #define MOVQ_ZERO(regd) __asm __volatile ("pxor %%" #regd ", %%" #regd ::) |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
59 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
60 #ifndef PIC |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
61 #define MOVQ_WONE(regd) __asm __volatile ("movq %0, %%" #regd " \n\t" ::"m"(mm_wone)) |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
62 #define MOVQ_WTWO(regd) __asm __volatile ("movq %0, %%" #regd " \n\t" ::"m"(mm_wtwo)) |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
63 #else |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
64 // for shared library it's better to use this way for accessing constants |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
65 // pcmpeqd -> -1 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
66 #define MOVQ_WONE(regd) \ |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
67 __asm __volatile ( \ |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
68 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
69 "psrlw $15, %%" #regd ::) |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
70 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
71 #define MOVQ_WTWO(regd) \ |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
72 __asm __volatile ( \ |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
73 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
74 "psrlw $15, %%" #regd " \n\t" \ |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
75 "psllw $1, %%" #regd ::) |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
76 #endif |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
77 |
0 | 78 /***********************************/ |
79 /* 3Dnow specific */ | |
80 | |
81 #define DEF(x) x ## _3dnow | |
82 /* for Athlons PAVGUSB is prefered */ | |
83 #define PAVGB "pavgusb" | |
84 | |
85 #include "dsputil_mmx_avg.h" | |
86 | |
87 #undef DEF | |
88 #undef PAVGB | |
89 | |
90 /***********************************/ | |
91 /* MMX2 specific */ | |
92 | |
93 #define DEF(x) x ## _sse | |
94 | |
95 /* Introduced only in MMX2 set */ | |
96 #define PAVGB "pavgb" | |
97 | |
98 #include "dsputil_mmx_avg.h" | |
99 | |
100 #undef DEF | |
101 #undef PAVGB | |
102 | |
103 /***********************************/ | |
104 /* standard MMX */ | |
105 | |
106 static void get_pixels_mmx(DCTELEM *block, const UINT8 *pixels, int line_size) | |
107 { | |
108 DCTELEM *p; | |
109 const UINT8 *pix; | |
110 int i; | |
111 | |
112 /* read the pixels */ | |
113 p = block; | |
114 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
115 MOVQ_ZERO(mm7); |
0 | 116 for(i=0;i<4;i++) { |
117 __asm __volatile( | |
118 "movq %1, %%mm0\n\t" | |
119 "movq %2, %%mm1\n\t" | |
120 "movq %%mm0, %%mm2\n\t" | |
121 "movq %%mm1, %%mm3\n\t" | |
122 "punpcklbw %%mm7, %%mm0\n\t" | |
123 "punpckhbw %%mm7, %%mm2\n\t" | |
124 "punpcklbw %%mm7, %%mm1\n\t" | |
125 "punpckhbw %%mm7, %%mm3\n\t" | |
126 "movq %%mm0, %0\n\t" | |
127 "movq %%mm2, 8%0\n\t" | |
128 "movq %%mm1, 16%0\n\t" | |
129 "movq %%mm3, 24%0\n\t" | |
130 :"=m"(*p) | |
131 :"m"(*pix), "m"(*(pix+line_size)) | |
132 :"memory"); | |
133 pix += line_size*2; | |
134 p += 16; | |
135 } | |
136 } | |
137 | |
324 | 138 static void diff_pixels_mmx(DCTELEM *block, const UINT8 *s1, const UINT8 *s2, int stride) |
139 { | |
140 asm volatile( | |
141 ".balign 16 \n\t" | |
142 "movl $-128, %%eax \n\t" | |
143 "1: \n\t" | |
144 "movq (%0), %%mm0 \n\t" | |
145 "movq (%1), %%mm2 \n\t" | |
146 "movq %%mm0, %%mm1 \n\t" | |
147 "movq %%mm2, %%mm3 \n\t" | |
148 "punpcklbw %%mm7, %%mm0 \n\t" | |
149 "punpckhbw %%mm7, %%mm1 \n\t" | |
150 "punpcklbw %%mm7, %%mm2 \n\t" | |
151 "punpckhbw %%mm7, %%mm3 \n\t" | |
152 "psubw %%mm2, %%mm0 \n\t" | |
153 "psubw %%mm3, %%mm1 \n\t" | |
154 "movq %%mm0, (%2, %%eax)\n\t" | |
155 "movq %%mm1, 8(%2, %%eax)\n\t" | |
156 "addl %3, %0 \n\t" | |
157 "addl %3, %1 \n\t" | |
158 "addl $16, %%eax \n\t" | |
159 "jnz 1b \n\t" | |
160 : "+r" (s1), "+r" (s2) | |
161 : "r" (block+64), "r" (stride) | |
162 : "%eax" | |
163 ); | |
164 } | |
165 | |
0 | 166 static void put_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size) |
167 { | |
168 const DCTELEM *p; | |
169 UINT8 *pix; | |
170 | |
171 /* read the pixels */ | |
172 p = block; | |
173 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
174 /* unrolled loop */ |
0 | 175 __asm __volatile( |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
176 "movq %3, %%mm0\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
177 "movq 8%3, %%mm1\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
178 "movq 16%3, %%mm2\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
179 "movq 24%3, %%mm3\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
180 "movq 32%3, %%mm4\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
181 "movq 40%3, %%mm5\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
182 "movq 48%3, %%mm6\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
183 "movq 56%3, %%mm7\n\t" |
0 | 184 "packuswb %%mm1, %%mm0\n\t" |
185 "packuswb %%mm3, %%mm2\n\t" | |
186 "packuswb %%mm5, %%mm4\n\t" | |
187 "packuswb %%mm7, %%mm6\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
188 "movq %%mm0, (%0)\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
189 "movq %%mm2, (%0, %1)\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
190 "movq %%mm4, (%0, %1, 2)\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
191 "movq %%mm6, (%0, %2)\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
192 ::"r" (pix), "r" (line_size), "r" (line_size*3), "m"(*p) |
0 | 193 :"memory"); |
194 pix += line_size*4; | |
195 p += 32; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
196 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
197 // if here would be an exact copy of the code above |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
198 // compiler would generate some very strange code |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
199 // thus using "r" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
200 __asm __volatile( |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
201 "movq (%3), %%mm0\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
202 "movq 8(%3), %%mm1\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
203 "movq 16(%3), %%mm2\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
204 "movq 24(%3), %%mm3\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
205 "movq 32(%3), %%mm4\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
206 "movq 40(%3), %%mm5\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
207 "movq 48(%3), %%mm6\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
208 "movq 56(%3), %%mm7\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
209 "packuswb %%mm1, %%mm0\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
210 "packuswb %%mm3, %%mm2\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
211 "packuswb %%mm5, %%mm4\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
212 "packuswb %%mm7, %%mm6\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
213 "movq %%mm0, (%0)\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
214 "movq %%mm2, (%0, %1)\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
215 "movq %%mm4, (%0, %1, 2)\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
216 "movq %%mm6, (%0, %2)\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
217 ::"r" (pix), "r" (line_size), "r" (line_size*3), "r"(p) |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
218 :"memory"); |
0 | 219 } |
220 | |
221 static void add_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size) | |
222 { | |
223 const DCTELEM *p; | |
224 UINT8 *pix; | |
225 int i; | |
226 | |
227 /* read the pixels */ | |
228 p = block; | |
229 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
230 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
231 i = 4; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
232 while (i) { |
0 | 233 __asm __volatile( |
234 "movq %2, %%mm0\n\t" | |
235 "movq 8%2, %%mm1\n\t" | |
236 "movq 16%2, %%mm2\n\t" | |
237 "movq 24%2, %%mm3\n\t" | |
238 "movq %0, %%mm4\n\t" | |
239 "movq %1, %%mm6\n\t" | |
240 "movq %%mm4, %%mm5\n\t" | |
241 "punpcklbw %%mm7, %%mm4\n\t" | |
242 "punpckhbw %%mm7, %%mm5\n\t" | |
243 "paddsw %%mm4, %%mm0\n\t" | |
244 "paddsw %%mm5, %%mm1\n\t" | |
245 "movq %%mm6, %%mm5\n\t" | |
246 "punpcklbw %%mm7, %%mm6\n\t" | |
247 "punpckhbw %%mm7, %%mm5\n\t" | |
248 "paddsw %%mm6, %%mm2\n\t" | |
249 "paddsw %%mm5, %%mm3\n\t" | |
250 "packuswb %%mm1, %%mm0\n\t" | |
251 "packuswb %%mm3, %%mm2\n\t" | |
252 "movq %%mm0, %0\n\t" | |
253 "movq %%mm2, %1\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
254 :"+m"(*pix), "+m"(*(pix+line_size)) |
0 | 255 :"m"(*p) |
256 :"memory"); | |
257 pix += line_size*2; | |
258 p += 16; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
259 i--; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
260 }; |
0 | 261 } |
262 | |
263 static void put_pixels_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h) | |
264 { | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
265 int hh; |
0 | 266 UINT8 *p; |
267 const UINT8 *pix; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
268 |
0 | 269 p = block; |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
270 pix = pixels; // 2s |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
271 #if 0 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
272 do { |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
273 __asm __volatile( |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
274 "movq %1, %%mm0\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
275 "movq %%mm0, %0\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
276 :"=m"(*p) |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
277 :"m"(*pix) |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
278 :"memory"); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
279 pix += line_size; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
280 p += line_size; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
281 } while (--h); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
282 #else |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
283 // this optimized code is not very usefull |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
284 // the above loop is definitely faster |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
285 // at least on Celeron 500MHz |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
286 hh = h & 3; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
287 while (hh) { |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
288 __asm __volatile( |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
289 "movq %1, %%mm0\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
290 "movq %%mm0, %0\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
291 :"=m"(*p) |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
292 :"m"(*pix) |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
293 :"memory"); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
294 pix += line_size; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
295 p += line_size; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
296 hh--; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
297 } |
0 | 298 hh=h>>2; |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
299 while (hh) { |
0 | 300 __asm __volatile( |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
301 "movq (%1), %%mm0 \n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
302 "movq (%1, %2), %%mm1 \n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
303 "movq (%1, %2, 2), %%mm2 \n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
304 "movq (%1, %3), %%mm3 \n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
305 "movq %%mm0, (%0) \n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
306 "movq %%mm1, (%0, %2) \n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
307 "movq %%mm2, (%0, %2, 2) \n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
308 "movq %%mm3, (%0, %3) \n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
309 ::"r"(p), "r"(pix), "r"(line_size), "r"(line_size*3) |
0 | 310 :"memory"); |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
311 pix += line_size*4; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
312 p += line_size*4; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
313 hh--; |
0 | 314 } |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
315 #endif |
0 | 316 } |
317 | |
318 static void put_pixels_x2_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h) | |
319 { | |
320 UINT8 *p; | |
321 const UINT8 *pix; | |
322 p = block; | |
323 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
324 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
325 MOVQ_WONE(mm4); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
326 JUMPALIGN(); |
0 | 327 do { |
328 __asm __volatile( | |
329 "movq %1, %%mm0\n\t" | |
330 "movq 1%1, %%mm1\n\t" | |
331 "movq %%mm0, %%mm2\n\t" | |
332 "movq %%mm1, %%mm3\n\t" | |
333 "punpcklbw %%mm7, %%mm0\n\t" | |
334 "punpcklbw %%mm7, %%mm1\n\t" | |
335 "punpckhbw %%mm7, %%mm2\n\t" | |
336 "punpckhbw %%mm7, %%mm3\n\t" | |
337 "paddusw %%mm1, %%mm0\n\t" | |
338 "paddusw %%mm3, %%mm2\n\t" | |
339 "paddusw %%mm4, %%mm0\n\t" | |
340 "paddusw %%mm4, %%mm2\n\t" | |
341 "psrlw $1, %%mm0\n\t" | |
342 "psrlw $1, %%mm2\n\t" | |
343 "packuswb %%mm2, %%mm0\n\t" | |
344 "movq %%mm0, %0\n\t" | |
345 :"=m"(*p) | |
346 :"m"(*pix) | |
347 :"memory"); | |
348 pix += line_size; p += line_size; | |
349 } while (--h); | |
350 } | |
351 | |
352 static void put_pixels_y2_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h) | |
353 { | |
354 UINT8 *p; | |
355 const UINT8 *pix; | |
356 p = block; | |
357 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
358 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
359 MOVQ_WONE(mm4); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
360 JUMPALIGN(); |
0 | 361 do { |
362 __asm __volatile( | |
363 "movq %1, %%mm0\n\t" | |
364 "movq %2, %%mm1\n\t" | |
365 "movq %%mm0, %%mm2\n\t" | |
366 "movq %%mm1, %%mm3\n\t" | |
367 "punpcklbw %%mm7, %%mm0\n\t" | |
368 "punpcklbw %%mm7, %%mm1\n\t" | |
369 "punpckhbw %%mm7, %%mm2\n\t" | |
370 "punpckhbw %%mm7, %%mm3\n\t" | |
371 "paddusw %%mm1, %%mm0\n\t" | |
372 "paddusw %%mm3, %%mm2\n\t" | |
373 "paddusw %%mm4, %%mm0\n\t" | |
374 "paddusw %%mm4, %%mm2\n\t" | |
375 "psrlw $1, %%mm0\n\t" | |
376 "psrlw $1, %%mm2\n\t" | |
377 "packuswb %%mm2, %%mm0\n\t" | |
378 "movq %%mm0, %0\n\t" | |
379 :"=m"(*p) | |
380 :"m"(*pix), | |
381 "m"(*(pix+line_size)) | |
382 :"memory"); | |
383 pix += line_size; | |
384 p += line_size; | |
385 } while (--h); | |
386 } | |
387 | |
388 static void put_pixels_xy2_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h) | |
389 { | |
390 UINT8 *p; | |
391 const UINT8 *pix; | |
392 p = block; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
393 pix = pixels; // 1s |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
394 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
395 MOVQ_WTWO(mm6); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
396 JUMPALIGN(); |
0 | 397 do { |
398 __asm __volatile( | |
399 "movq %1, %%mm0\n\t" | |
400 "movq %2, %%mm1\n\t" | |
401 "movq 1%1, %%mm4\n\t" | |
402 "movq 1%2, %%mm5\n\t" | |
403 "movq %%mm0, %%mm2\n\t" | |
404 "movq %%mm1, %%mm3\n\t" | |
405 "punpcklbw %%mm7, %%mm0\n\t" | |
406 "punpcklbw %%mm7, %%mm1\n\t" | |
407 "punpckhbw %%mm7, %%mm2\n\t" | |
408 "punpckhbw %%mm7, %%mm3\n\t" | |
409 "paddusw %%mm1, %%mm0\n\t" | |
410 "paddusw %%mm3, %%mm2\n\t" | |
411 "movq %%mm4, %%mm1\n\t" | |
412 "movq %%mm5, %%mm3\n\t" | |
413 "punpcklbw %%mm7, %%mm4\n\t" | |
414 "punpcklbw %%mm7, %%mm5\n\t" | |
415 "punpckhbw %%mm7, %%mm1\n\t" | |
416 "punpckhbw %%mm7, %%mm3\n\t" | |
417 "paddusw %%mm5, %%mm4\n\t" | |
418 "paddusw %%mm3, %%mm1\n\t" | |
419 "paddusw %%mm6, %%mm4\n\t" | |
420 "paddusw %%mm6, %%mm1\n\t" | |
421 "paddusw %%mm4, %%mm0\n\t" | |
422 "paddusw %%mm1, %%mm2\n\t" | |
423 "psrlw $2, %%mm0\n\t" | |
424 "psrlw $2, %%mm2\n\t" | |
425 "packuswb %%mm2, %%mm0\n\t" | |
426 "movq %%mm0, %0\n\t" | |
427 :"=m"(*p) | |
428 :"m"(*pix), | |
429 "m"(*(pix+line_size)) | |
430 :"memory"); | |
431 pix += line_size; | |
432 p += line_size; | |
433 } while(--h); | |
434 } | |
435 | |
436 static void put_no_rnd_pixels_x2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h) | |
437 { | |
438 UINT8 *p; | |
439 const UINT8 *pix; | |
440 p = block; | |
441 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
442 MOVQ_ZERO(mm7); |
0 | 443 do { |
444 __asm __volatile( | |
445 "movq %1, %%mm0\n\t" | |
446 "movq 1%1, %%mm1\n\t" | |
447 "movq %%mm0, %%mm2\n\t" | |
448 "movq %%mm1, %%mm3\n\t" | |
449 "punpcklbw %%mm7, %%mm0\n\t" | |
450 "punpcklbw %%mm7, %%mm1\n\t" | |
451 "punpckhbw %%mm7, %%mm2\n\t" | |
452 "punpckhbw %%mm7, %%mm3\n\t" | |
453 "paddusw %%mm1, %%mm0\n\t" | |
454 "paddusw %%mm3, %%mm2\n\t" | |
455 "psrlw $1, %%mm0\n\t" | |
456 "psrlw $1, %%mm2\n\t" | |
457 "packuswb %%mm2, %%mm0\n\t" | |
458 "movq %%mm0, %0\n\t" | |
459 :"=m"(*p) | |
460 :"m"(*pix) | |
461 :"memory"); | |
462 pix += line_size; | |
463 p += line_size; | |
464 } while (--h); | |
465 } | |
466 | |
467 static void put_no_rnd_pixels_y2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h) | |
468 { | |
469 UINT8 *p; | |
470 const UINT8 *pix; | |
471 p = block; | |
472 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
473 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
474 JUMPALIGN(); |
0 | 475 do { |
476 __asm __volatile( | |
477 "movq %1, %%mm0\n\t" | |
478 "movq %2, %%mm1\n\t" | |
479 "movq %%mm0, %%mm2\n\t" | |
480 "movq %%mm1, %%mm3\n\t" | |
481 "punpcklbw %%mm7, %%mm0\n\t" | |
482 "punpcklbw %%mm7, %%mm1\n\t" | |
483 "punpckhbw %%mm7, %%mm2\n\t" | |
484 "punpckhbw %%mm7, %%mm3\n\t" | |
485 "paddusw %%mm1, %%mm0\n\t" | |
486 "paddusw %%mm3, %%mm2\n\t" | |
487 "psrlw $1, %%mm0\n\t" | |
488 "psrlw $1, %%mm2\n\t" | |
489 "packuswb %%mm2, %%mm0\n\t" | |
490 "movq %%mm0, %0\n\t" | |
491 :"=m"(*p) | |
492 :"m"(*pix), | |
493 "m"(*(pix+line_size)) | |
494 :"memory"); | |
495 pix += line_size; | |
496 p += line_size; | |
497 } while(--h); | |
498 } | |
499 | |
500 static void put_no_rnd_pixels_xy2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h) | |
501 { | |
502 UINT8 *p; | |
503 const UINT8 *pix; | |
504 p = block; | |
505 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
506 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
507 MOVQ_WONE(mm6); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
508 JUMPALIGN(); |
0 | 509 do { |
510 __asm __volatile( | |
511 "movq %1, %%mm0\n\t" | |
512 "movq %2, %%mm1\n\t" | |
513 "movq 1%1, %%mm4\n\t" | |
514 "movq 1%2, %%mm5\n\t" | |
515 "movq %%mm0, %%mm2\n\t" | |
516 "movq %%mm1, %%mm3\n\t" | |
517 "punpcklbw %%mm7, %%mm0\n\t" | |
518 "punpcklbw %%mm7, %%mm1\n\t" | |
519 "punpckhbw %%mm7, %%mm2\n\t" | |
520 "punpckhbw %%mm7, %%mm3\n\t" | |
521 "paddusw %%mm1, %%mm0\n\t" | |
522 "paddusw %%mm3, %%mm2\n\t" | |
523 "movq %%mm4, %%mm1\n\t" | |
524 "movq %%mm5, %%mm3\n\t" | |
525 "punpcklbw %%mm7, %%mm4\n\t" | |
526 "punpcklbw %%mm7, %%mm5\n\t" | |
527 "punpckhbw %%mm7, %%mm1\n\t" | |
528 "punpckhbw %%mm7, %%mm3\n\t" | |
529 "paddusw %%mm5, %%mm4\n\t" | |
530 "paddusw %%mm3, %%mm1\n\t" | |
531 "paddusw %%mm6, %%mm4\n\t" | |
532 "paddusw %%mm6, %%mm1\n\t" | |
533 "paddusw %%mm4, %%mm0\n\t" | |
534 "paddusw %%mm1, %%mm2\n\t" | |
535 "psrlw $2, %%mm0\n\t" | |
536 "psrlw $2, %%mm2\n\t" | |
537 "packuswb %%mm2, %%mm0\n\t" | |
538 "movq %%mm0, %0\n\t" | |
539 :"=m"(*p) | |
540 :"m"(*pix), | |
541 "m"(*(pix+line_size)) | |
542 :"memory"); | |
543 pix += line_size; | |
544 p += line_size; | |
545 } while(--h); | |
546 } | |
547 | |
548 static void avg_pixels_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h) | |
549 { | |
550 UINT8 *p; | |
551 const UINT8 *pix; | |
552 p = block; | |
553 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
554 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
555 MOVQ_WONE(mm6); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
556 JUMPALIGN(); |
0 | 557 do { |
558 __asm __volatile( | |
559 "movq %0, %%mm0\n\t" | |
560 "movq %1, %%mm1\n\t" | |
561 "movq %%mm0, %%mm2\n\t" | |
562 "movq %%mm1, %%mm3\n\t" | |
563 "punpcklbw %%mm7, %%mm0\n\t" | |
564 "punpcklbw %%mm7, %%mm1\n\t" | |
565 "punpckhbw %%mm7, %%mm2\n\t" | |
566 "punpckhbw %%mm7, %%mm3\n\t" | |
567 "paddusw %%mm1, %%mm0\n\t" | |
568 "paddusw %%mm3, %%mm2\n\t" | |
569 "paddusw %%mm6, %%mm0\n\t" | |
570 "paddusw %%mm6, %%mm2\n\t" | |
571 "psrlw $1, %%mm0\n\t" | |
572 "psrlw $1, %%mm2\n\t" | |
573 "packuswb %%mm2, %%mm0\n\t" | |
574 "movq %%mm0, %0\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
575 :"+m"(*p) |
0 | 576 :"m"(*pix) |
577 :"memory"); | |
578 pix += line_size; | |
579 p += line_size; | |
580 } | |
581 while (--h); | |
582 } | |
583 | |
584 static void avg_pixels_x2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h) | |
585 { | |
586 UINT8 *p; | |
587 const UINT8 *pix; | |
588 p = block; | |
589 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
590 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
591 MOVQ_WONE(mm6); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
592 JUMPALIGN(); |
0 | 593 do { |
594 __asm __volatile( | |
595 "movq %1, %%mm1\n\t" | |
596 "movq %0, %%mm0\n\t" | |
597 "movq 1%1, %%mm4\n\t" | |
598 "movq %%mm0, %%mm2\n\t" | |
599 "movq %%mm1, %%mm3\n\t" | |
600 "movq %%mm4, %%mm5\n\t" | |
601 "punpcklbw %%mm7, %%mm1\n\t" | |
602 "punpckhbw %%mm7, %%mm3\n\t" | |
603 "punpcklbw %%mm7, %%mm4\n\t" | |
604 "punpckhbw %%mm7, %%mm5\n\t" | |
605 "punpcklbw %%mm7, %%mm0\n\t" | |
606 "punpckhbw %%mm7, %%mm2\n\t" | |
607 "paddusw %%mm4, %%mm1\n\t" | |
608 "paddusw %%mm5, %%mm3\n\t" | |
609 "paddusw %%mm6, %%mm1\n\t" | |
610 "paddusw %%mm6, %%mm3\n\t" | |
611 "psrlw $1, %%mm1\n\t" | |
612 "psrlw $1, %%mm3\n\t" | |
613 "paddusw %%mm6, %%mm0\n\t" | |
614 "paddusw %%mm6, %%mm2\n\t" | |
615 "paddusw %%mm1, %%mm0\n\t" | |
616 "paddusw %%mm3, %%mm2\n\t" | |
617 "psrlw $1, %%mm0\n\t" | |
618 "psrlw $1, %%mm2\n\t" | |
619 "packuswb %%mm2, %%mm0\n\t" | |
620 "movq %%mm0, %0\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
621 :"+m"(*p) |
0 | 622 :"m"(*pix) |
623 :"memory"); | |
624 pix += line_size; | |
625 p += line_size; | |
626 } while (--h); | |
627 } | |
628 | |
629 static void avg_pixels_y2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h) | |
630 { | |
631 UINT8 *p; | |
632 const UINT8 *pix; | |
633 p = block; | |
634 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
635 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
636 MOVQ_WONE(mm6); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
637 JUMPALIGN(); |
0 | 638 do { |
639 __asm __volatile( | |
640 "movq %1, %%mm1\n\t" | |
641 "movq %0, %%mm0\n\t" | |
642 "movq %2, %%mm4\n\t" | |
643 "movq %%mm0, %%mm2\n\t" | |
644 "movq %%mm1, %%mm3\n\t" | |
645 "movq %%mm4, %%mm5\n\t" | |
646 "punpcklbw %%mm7, %%mm1\n\t" | |
647 "punpckhbw %%mm7, %%mm3\n\t" | |
648 "punpcklbw %%mm7, %%mm4\n\t" | |
649 "punpckhbw %%mm7, %%mm5\n\t" | |
650 "punpcklbw %%mm7, %%mm0\n\t" | |
651 "punpckhbw %%mm7, %%mm2\n\t" | |
652 "paddusw %%mm4, %%mm1\n\t" | |
653 "paddusw %%mm5, %%mm3\n\t" | |
654 "paddusw %%mm6, %%mm1\n\t" | |
655 "paddusw %%mm6, %%mm3\n\t" | |
656 "psrlw $1, %%mm1\n\t" | |
657 "psrlw $1, %%mm3\n\t" | |
658 "paddusw %%mm6, %%mm0\n\t" | |
659 "paddusw %%mm6, %%mm2\n\t" | |
660 "paddusw %%mm1, %%mm0\n\t" | |
661 "paddusw %%mm3, %%mm2\n\t" | |
662 "psrlw $1, %%mm0\n\t" | |
663 "psrlw $1, %%mm2\n\t" | |
664 "packuswb %%mm2, %%mm0\n\t" | |
665 "movq %%mm0, %0\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
666 :"+m"(*p) |
0 | 667 :"m"(*pix), "m"(*(pix+line_size)) |
668 :"memory"); | |
669 pix += line_size; | |
670 p += line_size ; | |
671 } while(--h); | |
672 } | |
673 | |
674 static void avg_pixels_xy2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h) | |
675 { | |
676 UINT8 *p; | |
677 const UINT8 *pix; | |
678 p = block; | |
679 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
680 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
681 // this doesn't seem to be used offten - so |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
682 // the inside usage of mm_wone is not optimized |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
683 MOVQ_WTWO(mm6); |
0 | 684 do { |
685 __asm __volatile( | |
686 "movq %1, %%mm0\n\t" | |
687 "movq %2, %%mm1\n\t" | |
688 "movq 1%1, %%mm4\n\t" | |
689 "movq 1%2, %%mm5\n\t" | |
690 "movq %%mm0, %%mm2\n\t" | |
691 "movq %%mm1, %%mm3\n\t" | |
692 "punpcklbw %%mm7, %%mm0\n\t" | |
693 "punpcklbw %%mm7, %%mm1\n\t" | |
694 "punpckhbw %%mm7, %%mm2\n\t" | |
695 "punpckhbw %%mm7, %%mm3\n\t" | |
696 "paddusw %%mm1, %%mm0\n\t" | |
697 "paddusw %%mm3, %%mm2\n\t" | |
698 "movq %%mm4, %%mm1\n\t" | |
699 "movq %%mm5, %%mm3\n\t" | |
700 "punpcklbw %%mm7, %%mm4\n\t" | |
701 "punpcklbw %%mm7, %%mm5\n\t" | |
702 "punpckhbw %%mm7, %%mm1\n\t" | |
703 "punpckhbw %%mm7, %%mm3\n\t" | |
704 "paddusw %%mm5, %%mm4\n\t" | |
705 "paddusw %%mm3, %%mm1\n\t" | |
706 "paddusw %%mm6, %%mm4\n\t" | |
707 "paddusw %%mm6, %%mm1\n\t" | |
708 "paddusw %%mm4, %%mm0\n\t" | |
709 "paddusw %%mm1, %%mm2\n\t" | |
710 "movq %3, %%mm5\n\t" | |
711 "psrlw $2, %%mm0\n\t" | |
712 "movq %0, %%mm1\n\t" | |
713 "psrlw $2, %%mm2\n\t" | |
714 "movq %%mm1, %%mm3\n\t" | |
715 "punpcklbw %%mm7, %%mm1\n\t" | |
716 "punpckhbw %%mm7, %%mm3\n\t" | |
717 "paddusw %%mm1, %%mm0\n\t" | |
718 "paddusw %%mm3, %%mm2\n\t" | |
719 "paddusw %%mm5, %%mm0\n\t" | |
720 "paddusw %%mm5, %%mm2\n\t" | |
721 "psrlw $1, %%mm0\n\t" | |
722 "psrlw $1, %%mm2\n\t" | |
723 "packuswb %%mm2, %%mm0\n\t" | |
724 "movq %%mm0, %0\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
725 :"+m"(*p) |
0 | 726 :"m"(*pix), |
8 | 727 "m"(*(pix+line_size)), "m"(mm_wone) |
0 | 728 :"memory"); |
729 pix += line_size; | |
730 p += line_size ; | |
731 } while(--h); | |
732 } | |
733 | |
734 static void avg_no_rnd_pixels_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h) | |
735 { | |
736 UINT8 *p; | |
737 const UINT8 *pix; | |
738 p = block; | |
739 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
740 MOVQ_ZERO(mm7); |
0 | 741 do { |
742 __asm __volatile( | |
743 "movq %1, %%mm0\n\t" | |
744 "movq %0, %%mm1\n\t" | |
745 "movq %%mm0, %%mm2\n\t" | |
746 "movq %%mm1, %%mm3\n\t" | |
747 "punpcklbw %%mm7, %%mm0\n\t" | |
748 "punpcklbw %%mm7, %%mm1\n\t" | |
749 "punpckhbw %%mm7, %%mm2\n\t" | |
750 "punpckhbw %%mm7, %%mm3\n\t" | |
751 "paddusw %%mm1, %%mm0\n\t" | |
752 "paddusw %%mm3, %%mm2\n\t" | |
753 "psrlw $1, %%mm0\n\t" | |
754 "psrlw $1, %%mm2\n\t" | |
755 "packuswb %%mm2, %%mm0\n\t" | |
756 "movq %%mm0, %0\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
757 :"+m"(*p) |
0 | 758 :"m"(*pix) |
759 :"memory"); | |
760 pix += line_size; | |
761 p += line_size ; | |
762 } while (--h); | |
763 } | |
764 | |
765 static void avg_no_rnd_pixels_x2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h) | |
766 { | |
767 UINT8 *p; | |
768 const UINT8 *pix; | |
769 p = block; | |
770 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
771 MOVQ_ZERO(mm7); |
0 | 772 do { |
773 __asm __volatile( | |
774 "movq %1, %%mm0\n\t" | |
775 "movq 1%1, %%mm1\n\t" | |
776 "movq %0, %%mm4\n\t" | |
777 "movq %%mm0, %%mm2\n\t" | |
778 "movq %%mm1, %%mm3\n\t" | |
779 "movq %%mm4, %%mm5\n\t" | |
780 "punpcklbw %%mm7, %%mm0\n\t" | |
781 "punpcklbw %%mm7, %%mm1\n\t" | |
782 "punpckhbw %%mm7, %%mm2\n\t" | |
783 "punpckhbw %%mm7, %%mm3\n\t" | |
784 "punpcklbw %%mm7, %%mm4\n\t" | |
785 "punpckhbw %%mm7, %%mm5\n\t" | |
786 "paddusw %%mm1, %%mm0\n\t" | |
787 "paddusw %%mm3, %%mm2\n\t" | |
788 "psrlw $1, %%mm0\n\t" | |
789 "psrlw $1, %%mm2\n\t" | |
790 "paddusw %%mm4, %%mm0\n\t" | |
791 "paddusw %%mm5, %%mm2\n\t" | |
792 "psrlw $1, %%mm0\n\t" | |
793 "psrlw $1, %%mm2\n\t" | |
794 "packuswb %%mm2, %%mm0\n\t" | |
795 "movq %%mm0, %0\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
796 :"+m"(*p) |
0 | 797 :"m"(*pix) |
798 :"memory"); | |
799 pix += line_size; | |
800 p += line_size; | |
801 } while (--h); | |
802 } | |
803 | |
804 static void avg_no_rnd_pixels_y2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h) | |
805 { | |
806 UINT8 *p; | |
807 const UINT8 *pix; | |
808 p = block; | |
809 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
810 MOVQ_ZERO(mm7); |
0 | 811 do { |
812 __asm __volatile( | |
813 "movq %1, %%mm0\n\t" | |
814 "movq %2, %%mm1\n\t" | |
815 "movq %0, %%mm4\n\t" | |
816 "movq %%mm0, %%mm2\n\t" | |
817 "movq %%mm1, %%mm3\n\t" | |
818 "movq %%mm4, %%mm5\n\t" | |
819 "punpcklbw %%mm7, %%mm0\n\t" | |
820 "punpcklbw %%mm7, %%mm1\n\t" | |
821 "punpckhbw %%mm7, %%mm2\n\t" | |
822 "punpckhbw %%mm7, %%mm3\n\t" | |
823 "punpcklbw %%mm7, %%mm4\n\t" | |
824 "punpckhbw %%mm7, %%mm5\n\t" | |
825 "paddusw %%mm1, %%mm0\n\t" | |
826 "paddusw %%mm3, %%mm2\n\t" | |
827 "psrlw $1, %%mm0\n\t" | |
828 "psrlw $1, %%mm2\n\t" | |
829 "paddusw %%mm4, %%mm0\n\t" | |
830 "paddusw %%mm5, %%mm2\n\t" | |
831 "psrlw $1, %%mm0\n\t" | |
832 "psrlw $1, %%mm2\n\t" | |
833 "packuswb %%mm2, %%mm0\n\t" | |
834 "movq %%mm0, %0\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
835 :"+m"(*p) |
0 | 836 :"m"(*pix), "m"(*(pix+line_size)) |
837 :"memory"); | |
838 pix += line_size; | |
839 p += line_size ; | |
840 } while(--h); | |
841 } | |
842 | |
843 static void avg_no_rnd_pixels_xy2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h) | |
844 { | |
845 UINT8 *p; | |
846 const UINT8 *pix; | |
847 p = block; | |
848 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
849 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
850 MOVQ_WONE(mm6); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
851 JUMPALIGN(); |
0 | 852 do { |
853 __asm __volatile( | |
854 "movq %1, %%mm0\n\t" | |
855 "movq %2, %%mm1\n\t" | |
856 "movq 1%1, %%mm4\n\t" | |
857 "movq 1%2, %%mm5\n\t" | |
858 "movq %%mm0, %%mm2\n\t" | |
859 "movq %%mm1, %%mm3\n\t" | |
860 "punpcklbw %%mm7, %%mm0\n\t" | |
861 "punpcklbw %%mm7, %%mm1\n\t" | |
862 "punpckhbw %%mm7, %%mm2\n\t" | |
863 "punpckhbw %%mm7, %%mm3\n\t" | |
864 "paddusw %%mm1, %%mm0\n\t" | |
865 "paddusw %%mm3, %%mm2\n\t" | |
866 "movq %%mm4, %%mm1\n\t" | |
867 "movq %%mm5, %%mm3\n\t" | |
868 "punpcklbw %%mm7, %%mm4\n\t" | |
869 "punpcklbw %%mm7, %%mm5\n\t" | |
870 "punpckhbw %%mm7, %%mm1\n\t" | |
871 "punpckhbw %%mm7, %%mm3\n\t" | |
872 "paddusw %%mm5, %%mm4\n\t" | |
873 "paddusw %%mm3, %%mm1\n\t" | |
874 "paddusw %%mm6, %%mm4\n\t" | |
875 "paddusw %%mm6, %%mm1\n\t" | |
876 "paddusw %%mm4, %%mm0\n\t" | |
877 "paddusw %%mm1, %%mm2\n\t" | |
878 "movq %0, %%mm1\n\t" | |
879 "psrlw $2, %%mm0\n\t" | |
880 "movq %%mm1, %%mm3\n\t" | |
881 "psrlw $2, %%mm2\n\t" | |
882 "punpcklbw %%mm7, %%mm1\n\t" | |
883 "punpckhbw %%mm7, %%mm3\n\t" | |
884 "paddusw %%mm1, %%mm0\n\t" | |
885 "paddusw %%mm3, %%mm2\n\t" | |
886 "psrlw $1, %%mm0\n\t" | |
887 "psrlw $1, %%mm2\n\t" | |
888 "packuswb %%mm2, %%mm0\n\t" | |
889 "movq %%mm0, %0\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
890 :"+m"(*p) |
0 | 891 :"m"(*pix), |
892 "m"(*(pix+line_size)) | |
893 :"memory"); | |
894 pix += line_size; | |
895 p += line_size; | |
896 } while(--h); | |
897 } | |
898 | |
899 static void sub_pixels_mmx( DCTELEM *block, const UINT8 *pixels, int line_size, int h) | |
900 { | |
901 DCTELEM *p; | |
902 const UINT8 *pix; | |
903 p = block; | |
904 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
905 MOVQ_ZERO(mm7); |
0 | 906 do { |
907 __asm __volatile( | |
908 "movq %0, %%mm0\n\t" | |
909 "movq %1, %%mm2\n\t" | |
910 "movq 8%0, %%mm1\n\t" | |
911 "movq %%mm2, %%mm3\n\t" | |
912 "punpcklbw %%mm7, %%mm2\n\t" | |
913 "punpckhbw %%mm7, %%mm3\n\t" | |
914 "psubsw %%mm2, %%mm0\n\t" | |
915 "psubsw %%mm3, %%mm1\n\t" | |
916 "movq %%mm0, %0\n\t" | |
917 "movq %%mm1, 8%0\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
918 :"+m"(*p) |
0 | 919 :"m"(*pix) |
920 :"memory"); | |
921 pix += line_size; | |
922 p += 8; | |
923 } while (--h); | |
924 } | |
925 | |
926 static void sub_pixels_x2_mmx( DCTELEM *block, const UINT8 *pixels, int line_size, int h) | |
927 { | |
928 DCTELEM *p; | |
929 const UINT8 *pix; | |
930 p = block; | |
931 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
932 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
933 MOVQ_WONE(mm6); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
934 JUMPALIGN(); |
0 | 935 do { |
936 __asm __volatile( | |
937 "movq %0, %%mm0\n\t" | |
938 "movq %1, %%mm2\n\t" | |
939 "movq 8%0, %%mm1\n\t" | |
940 "movq 1%1, %%mm4\n\t" | |
941 "movq %%mm2, %%mm3\n\t" | |
942 "movq %%mm4, %%mm5\n\t" | |
943 "punpcklbw %%mm7, %%mm2\n\t" | |
944 "punpckhbw %%mm7, %%mm3\n\t" | |
945 "punpcklbw %%mm7, %%mm4\n\t" | |
946 "punpckhbw %%mm7, %%mm5\n\t" | |
947 "paddusw %%mm4, %%mm2\n\t" | |
948 "paddusw %%mm5, %%mm3\n\t" | |
949 "paddusw %%mm6, %%mm2\n\t" | |
950 "paddusw %%mm6, %%mm3\n\t" | |
951 "psrlw $1, %%mm2\n\t" | |
952 "psrlw $1, %%mm3\n\t" | |
953 "psubsw %%mm2, %%mm0\n\t" | |
954 "psubsw %%mm3, %%mm1\n\t" | |
955 "movq %%mm0, %0\n\t" | |
956 "movq %%mm1, 8%0\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
957 :"+m"(*p) |
0 | 958 :"m"(*pix) |
959 :"memory"); | |
960 pix += line_size; | |
961 p += 8; | |
962 } while (--h); | |
963 } | |
964 | |
965 static void sub_pixels_y2_mmx( DCTELEM *block, const UINT8 *pixels, int line_size, int h) | |
966 { | |
967 DCTELEM *p; | |
968 const UINT8 *pix; | |
969 p = block; | |
970 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
971 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
972 MOVQ_WONE(mm6); |
0 | 973 do { |
974 __asm __volatile( | |
975 "movq %0, %%mm0\n\t" | |
976 "movq %1, %%mm2\n\t" | |
977 "movq 8%0, %%mm1\n\t" | |
978 "movq %2, %%mm4\n\t" | |
979 "movq %%mm2, %%mm3\n\t" | |
980 "movq %%mm4, %%mm5\n\t" | |
981 "punpcklbw %%mm7, %%mm2\n\t" | |
982 "punpckhbw %%mm7, %%mm3\n\t" | |
983 "punpcklbw %%mm7, %%mm4\n\t" | |
984 "punpckhbw %%mm7, %%mm5\n\t" | |
985 "paddusw %%mm4, %%mm2\n\t" | |
986 "paddusw %%mm5, %%mm3\n\t" | |
987 "paddusw %%mm6, %%mm2\n\t" | |
988 "paddusw %%mm6, %%mm3\n\t" | |
989 "psrlw $1, %%mm2\n\t" | |
990 "psrlw $1, %%mm3\n\t" | |
991 "psubsw %%mm2, %%mm0\n\t" | |
992 "psubsw %%mm3, %%mm1\n\t" | |
993 "movq %%mm0, %0\n\t" | |
994 "movq %%mm1, 8%0\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
995 :"+m"(*p) |
0 | 996 :"m"(*pix), "m"(*(pix+line_size)) |
997 :"memory"); | |
998 pix += line_size; | |
999 p += 8; | |
1000 } while (--h); | |
1001 } | |
1002 | |
1003 static void sub_pixels_xy2_mmx( DCTELEM *block, const UINT8 *pixels, int line_size, int h) | |
1004 { | |
1005 DCTELEM *p; | |
1006 const UINT8 *pix; | |
1007 p = block; | |
1008 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1009 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1010 MOVQ_WTWO(mm6); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1011 JUMPALIGN(); |
0 | 1012 do { |
1013 __asm __volatile( | |
1014 "movq %1, %%mm0\n\t" | |
1015 "movq %2, %%mm1\n\t" | |
1016 "movq 1%1, %%mm4\n\t" | |
1017 "movq 1%2, %%mm5\n\t" | |
1018 "movq %%mm0, %%mm2\n\t" | |
1019 "movq %%mm1, %%mm3\n\t" | |
1020 "punpcklbw %%mm7, %%mm0\n\t" | |
1021 "punpcklbw %%mm7, %%mm1\n\t" | |
1022 "punpckhbw %%mm7, %%mm2\n\t" | |
1023 "punpckhbw %%mm7, %%mm3\n\t" | |
1024 "paddusw %%mm1, %%mm0\n\t" | |
1025 "paddusw %%mm3, %%mm2\n\t" | |
1026 "movq %%mm4, %%mm1\n\t" | |
1027 "movq %%mm5, %%mm3\n\t" | |
1028 "punpcklbw %%mm7, %%mm4\n\t" | |
1029 "punpcklbw %%mm7, %%mm5\n\t" | |
1030 "punpckhbw %%mm7, %%mm1\n\t" | |
1031 "punpckhbw %%mm7, %%mm3\n\t" | |
1032 "paddusw %%mm5, %%mm4\n\t" | |
1033 "paddusw %%mm3, %%mm1\n\t" | |
1034 "paddusw %%mm6, %%mm4\n\t" | |
1035 "paddusw %%mm6, %%mm1\n\t" | |
1036 "paddusw %%mm4, %%mm0\n\t" | |
1037 "paddusw %%mm1, %%mm2\n\t" | |
1038 "movq %0, %%mm1\n\t" | |
1039 "movq 8%0, %%mm3\n\t" | |
1040 "psrlw $2, %%mm0\n\t" | |
1041 "psrlw $2, %%mm2\n\t" | |
1042 "psubsw %%mm0, %%mm1\n\t" | |
1043 "psubsw %%mm2, %%mm3\n\t" | |
1044 "movq %%mm1, %0\n\t" | |
1045 "movq %%mm3, 8%0\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
1046 :"+m"(*p) |
0 | 1047 :"m"(*pix), |
1048 "m"(*(pix+line_size)) | |
1049 :"memory"); | |
1050 pix += line_size; | |
1051 p += 8 ; | |
1052 } while(--h); | |
1053 } | |
1054 | |
296 | 1055 static void clear_blocks_mmx(DCTELEM *blocks) |
1056 { | |
1057 asm volatile( | |
1058 "pxor %%mm7, %%mm7 \n\t" | |
1059 "movl $-128*6, %%eax \n\t" | |
1060 "1: \n\t" | |
1061 "movq %%mm7, (%0, %%eax) \n\t" | |
1062 "movq %%mm7, 8(%0, %%eax) \n\t" | |
1063 "movq %%mm7, 16(%0, %%eax) \n\t" | |
1064 "movq %%mm7, 24(%0, %%eax) \n\t" | |
1065 "addl $32, %%eax \n\t" | |
1066 " js 1b \n\t" | |
1067 : : "r" (((int)blocks)+128*6) | |
1068 : "%eax" | |
1069 ); | |
1070 } | |
1071 | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1072 static void just_return() { return; } |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1073 |
0 | 1074 void dsputil_init_mmx(void) |
1075 { | |
1076 mm_flags = mm_support(); | |
188 | 1077 #if 1 |
1078 printf("libavcodec: CPU flags:"); | |
0 | 1079 if (mm_flags & MM_MMX) |
1080 printf(" mmx"); | |
1081 if (mm_flags & MM_MMXEXT) | |
1082 printf(" mmxext"); | |
1083 if (mm_flags & MM_3DNOW) | |
1084 printf(" 3dnow"); | |
1085 if (mm_flags & MM_SSE) | |
1086 printf(" sse"); | |
1087 if (mm_flags & MM_SSE2) | |
1088 printf(" sse2"); | |
1089 printf("\n"); | |
1090 #endif | |
1091 | |
1092 if (mm_flags & MM_MMX) { | |
1093 get_pixels = get_pixels_mmx; | |
324 | 1094 diff_pixels = diff_pixels_mmx; |
0 | 1095 put_pixels_clamped = put_pixels_clamped_mmx; |
1096 add_pixels_clamped = add_pixels_clamped_mmx; | |
296 | 1097 clear_blocks= clear_blocks_mmx; |
1098 | |
294 | 1099 pix_abs16x16 = pix_abs16x16_mmx; |
1100 pix_abs16x16_x2 = pix_abs16x16_x2_mmx; | |
1101 pix_abs16x16_y2 = pix_abs16x16_y2_mmx; | |
0 | 1102 pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx; |
294 | 1103 pix_abs8x8 = pix_abs8x8_mmx; |
1104 pix_abs8x8_x2 = pix_abs8x8_x2_mmx; | |
1105 pix_abs8x8_y2 = pix_abs8x8_y2_mmx; | |
1106 pix_abs8x8_xy2= pix_abs8x8_xy2_mmx; | |
0 | 1107 av_fdct = fdct_mmx; |
1108 | |
1109 put_pixels_tab[0] = put_pixels_mmx; | |
1110 put_pixels_tab[1] = put_pixels_x2_mmx; | |
1111 put_pixels_tab[2] = put_pixels_y2_mmx; | |
1112 put_pixels_tab[3] = put_pixels_xy2_mmx; | |
1113 | |
1114 put_no_rnd_pixels_tab[0] = put_pixels_mmx; | |
1115 put_no_rnd_pixels_tab[1] = put_no_rnd_pixels_x2_mmx; | |
1116 put_no_rnd_pixels_tab[2] = put_no_rnd_pixels_y2_mmx; | |
1117 put_no_rnd_pixels_tab[3] = put_no_rnd_pixels_xy2_mmx; | |
1118 | |
1119 avg_pixels_tab[0] = avg_pixels_mmx; | |
1120 avg_pixels_tab[1] = avg_pixels_x2_mmx; | |
1121 avg_pixels_tab[2] = avg_pixels_y2_mmx; | |
1122 avg_pixels_tab[3] = avg_pixels_xy2_mmx; | |
1123 | |
1124 avg_no_rnd_pixels_tab[0] = avg_no_rnd_pixels_mmx; | |
1125 avg_no_rnd_pixels_tab[1] = avg_no_rnd_pixels_x2_mmx; | |
1126 avg_no_rnd_pixels_tab[2] = avg_no_rnd_pixels_y2_mmx; | |
1127 avg_no_rnd_pixels_tab[3] = avg_no_rnd_pixels_xy2_mmx; | |
1128 | |
1129 sub_pixels_tab[0] = sub_pixels_mmx; | |
1130 sub_pixels_tab[1] = sub_pixels_x2_mmx; | |
1131 sub_pixels_tab[2] = sub_pixels_y2_mmx; | |
1132 sub_pixels_tab[3] = sub_pixels_xy2_mmx; | |
1133 | |
1134 if (mm_flags & MM_MMXEXT) { | |
294 | 1135 pix_abs16x16 = pix_abs16x16_mmx2; |
1136 pix_abs16x16_x2 = pix_abs16x16_x2_mmx2; | |
1137 pix_abs16x16_y2 = pix_abs16x16_y2_mmx2; | |
1138 pix_abs16x16_xy2= pix_abs16x16_xy2_mmx2; | |
1139 | |
1140 pix_abs8x8 = pix_abs8x8_mmx2; | |
1141 pix_abs8x8_x2 = pix_abs8x8_x2_mmx2; | |
1142 pix_abs8x8_y2 = pix_abs8x8_y2_mmx2; | |
1143 pix_abs8x8_xy2= pix_abs8x8_xy2_mmx2; | |
1144 | |
0 | 1145 put_pixels_tab[1] = put_pixels_x2_sse; |
1146 put_pixels_tab[2] = put_pixels_y2_sse; | |
1147 | |
1148 avg_pixels_tab[0] = avg_pixels_sse; | |
1149 avg_pixels_tab[1] = avg_pixels_x2_sse; | |
1150 avg_pixels_tab[2] = avg_pixels_y2_sse; | |
1151 avg_pixels_tab[3] = avg_pixels_xy2_sse; | |
1152 | |
1153 sub_pixels_tab[1] = sub_pixels_x2_sse; | |
1154 sub_pixels_tab[2] = sub_pixels_y2_sse; | |
1155 } else if (mm_flags & MM_3DNOW) { | |
1156 put_pixels_tab[1] = put_pixels_x2_3dnow; | |
1157 put_pixels_tab[2] = put_pixels_y2_3dnow; | |
1158 | |
1159 avg_pixels_tab[0] = avg_pixels_3dnow; | |
1160 avg_pixels_tab[1] = avg_pixels_x2_3dnow; | |
1161 avg_pixels_tab[2] = avg_pixels_y2_3dnow; | |
1162 avg_pixels_tab[3] = avg_pixels_xy2_3dnow; | |
1163 | |
1164 sub_pixels_tab[1] = sub_pixels_x2_3dnow; | |
1165 sub_pixels_tab[2] = sub_pixels_y2_3dnow; | |
1166 } | |
19
82d4c9be9873
MMX/MMXEXT iDCT support, using external functions currently defined in libmpeg2
arpi_esp
parents:
8
diff
changeset
|
1167 |
42 | 1168 /* idct */ |
1169 if (mm_flags & MM_MMXEXT) { | |
1170 ff_idct = ff_mmxext_idct; | |
1171 } else { | |
1172 ff_idct = ff_mmx_idct; | |
1173 } | |
174
ac5075a55488
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
151
diff
changeset
|
1174 #ifdef SIMPLE_IDCT |
ac5075a55488
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
151
diff
changeset
|
1175 // ff_idct = simple_idct; |
ac5075a55488
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
151
diff
changeset
|
1176 ff_idct = simple_idct_mmx; |
ac5075a55488
new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents:
151
diff
changeset
|
1177 #endif |
0 | 1178 } |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1179 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1180 #if 0 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1181 // for speed testing |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1182 get_pixels = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1183 put_pixels_clamped = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1184 add_pixels_clamped = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1185 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1186 pix_abs16x16 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1187 pix_abs16x16_x2 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1188 pix_abs16x16_y2 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1189 pix_abs16x16_xy2 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1190 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1191 put_pixels_tab[0] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1192 put_pixels_tab[1] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1193 put_pixels_tab[2] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1194 put_pixels_tab[3] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1195 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1196 put_no_rnd_pixels_tab[0] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1197 put_no_rnd_pixels_tab[1] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1198 put_no_rnd_pixels_tab[2] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1199 put_no_rnd_pixels_tab[3] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1200 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1201 avg_pixels_tab[0] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1202 avg_pixels_tab[1] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1203 avg_pixels_tab[2] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1204 avg_pixels_tab[3] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1205 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1206 avg_no_rnd_pixels_tab[0] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1207 avg_no_rnd_pixels_tab[1] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1208 avg_no_rnd_pixels_tab[2] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1209 avg_no_rnd_pixels_tab[3] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1210 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1211 sub_pixels_tab[0] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1212 sub_pixels_tab[1] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1213 sub_pixels_tab[2] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1214 sub_pixels_tab[3] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1215 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1216 //av_fdct = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1217 //ff_idct = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1218 #endif |
0 | 1219 } |