Mercurial > libavcodec.hg
annotate i386/dsputil_mmx.c @ 1687:cdc3d4106fb6 libavcodec
cleanup
author | michael |
---|---|
date | Sat, 13 Dec 2003 20:41:33 +0000 |
parents | 68abbec33289 |
children | dea5b2946999 |
rev | line source |
---|---|
0 | 1 /* |
2 * MMX optimized DSP utils | |
429 | 3 * Copyright (c) 2000, 2001 Fabrice Bellard. |
0 | 4 * |
429 | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Lesser General Public | |
7 * License as published by the Free Software Foundation; either | |
8 * version 2 of the License, or (at your option) any later version. | |
0 | 9 * |
429 | 10 * This library is distributed in the hope that it will be useful, |
0 | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
429 | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Lesser General Public License for more details. | |
0 | 14 * |
429 | 15 * You should have received a copy of the GNU Lesser General Public |
16 * License along with this library; if not, write to the Free Software | |
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
0 | 18 * |
19 * MMX optimization by Nick Kurshev <nickols_k@mail.ru> | |
20 */ | |
21 | |
22 #include "../dsputil.h" | |
1092 | 23 #include "../simple_idct.h" |
0 | 24 |
1647 | 25 extern const uint8_t ff_h263_loop_filter_strength[32]; |
26 | |
5 | 27 int mm_flags; /* multimedia extension flags */ |
936 | 28 |
0 | 29 /* pixel operations */ |
387 | 30 static const uint64_t mm_bone __attribute__ ((aligned(8))) = 0x0101010101010101ULL; |
31 static const uint64_t mm_wone __attribute__ ((aligned(8))) = 0x0001000100010001ULL; | |
32 static const uint64_t mm_wtwo __attribute__ ((aligned(8))) = 0x0002000200020002ULL; | |
0 | 33 |
954 | 34 static const uint64_t ff_pw_20 __attribute__ ((aligned(8))) = 0x0014001400140014ULL; |
35 static const uint64_t ff_pw_3 __attribute__ ((aligned(8))) = 0x0003000300030003ULL; | |
36 static const uint64_t ff_pw_16 __attribute__ ((aligned(8))) = 0x0010001000100010ULL; | |
37 static const uint64_t ff_pw_15 __attribute__ ((aligned(8))) = 0x000F000F000F000FULL; | |
38 | |
1647 | 39 static const uint64_t ff_pb_FC __attribute__ ((aligned(8))) = 0xFCFCFCFCFCFCFCFCULL; |
40 | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
41 #define JUMPALIGN() __asm __volatile (".balign 8"::) |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
42 #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
|
43 |
448 | 44 #define MOVQ_WONE(regd) \ |
45 __asm __volatile ( \ | |
46 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ | |
47 "psrlw $15, %%" #regd ::) | |
48 | |
49 #define MOVQ_BFE(regd) \ | |
50 __asm __volatile ( \ | |
51 "pcmpeqd %%" #regd ", %%" #regd " \n\t"\ | |
52 "paddb %%" #regd ", %%" #regd " \n\t" ::) | |
53 | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
54 #ifndef PIC |
448 | 55 #define MOVQ_BONE(regd) __asm __volatile ("movq %0, %%" #regd " \n\t" ::"m"(mm_bone)) |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
56 #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
|
57 #else |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
58 // 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
|
59 // pcmpeqd -> -1 |
448 | 60 #define MOVQ_BONE(regd) \ |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
61 __asm __volatile ( \ |
448 | 62 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ |
63 "psrlw $15, %%" #regd " \n\t" \ | |
64 "packuswb %%" #regd ", %%" #regd " \n\t" ::) | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
65 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
66 #define MOVQ_WTWO(regd) \ |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
67 __asm __volatile ( \ |
448 | 68 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ |
69 "psrlw $15, %%" #regd " \n\t" \ | |
70 "psllw $1, %%" #regd " \n\t"::) | |
387 | 71 |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
72 #endif |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
73 |
448 | 74 // using regr as temporary and for the output result |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
75 // first argument is unmodifed and second is trashed |
471 | 76 // regfe is supposed to contain 0xfefefefefefefefe |
77 #define PAVGB_MMX_NO_RND(rega, regb, regr, regfe) \ | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
78 "movq " #rega ", " #regr " \n\t"\ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
79 "pand " #regb ", " #regr " \n\t"\ |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
80 "pxor " #rega ", " #regb " \n\t"\ |
471 | 81 "pand " #regfe "," #regb " \n\t"\ |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
82 "psrlq $1, " #regb " \n\t"\ |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
83 "paddb " #regb ", " #regr " \n\t" |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
84 |
471 | 85 #define PAVGB_MMX(rega, regb, regr, regfe) \ |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
86 "movq " #rega ", " #regr " \n\t"\ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
87 "por " #regb ", " #regr " \n\t"\ |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
88 "pxor " #rega ", " #regb " \n\t"\ |
471 | 89 "pand " #regfe "," #regb " \n\t"\ |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
90 "psrlq $1, " #regb " \n\t"\ |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
91 "psubb " #regb ", " #regr " \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
92 |
471 | 93 // mm6 is supposed to contain 0xfefefefefefefefe |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
94 #define PAVGBP_MMX_NO_RND(rega, regb, regr, regc, regd, regp) \ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
95 "movq " #rega ", " #regr " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
96 "movq " #regc ", " #regp " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
97 "pand " #regb ", " #regr " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
98 "pand " #regd ", " #regp " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
99 "pxor " #rega ", " #regb " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
100 "pxor " #regc ", " #regd " \n\t"\ |
448 | 101 "pand %%mm6, " #regb " \n\t"\ |
102 "pand %%mm6, " #regd " \n\t"\ | |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
103 "psrlq $1, " #regb " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
104 "psrlq $1, " #regd " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
105 "paddb " #regb ", " #regr " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
106 "paddb " #regd ", " #regp " \n\t" |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
107 |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
108 #define PAVGBP_MMX(rega, regb, regr, regc, regd, regp) \ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
109 "movq " #rega ", " #regr " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
110 "movq " #regc ", " #regp " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
111 "por " #regb ", " #regr " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
112 "por " #regd ", " #regp " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
113 "pxor " #rega ", " #regb " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
114 "pxor " #regc ", " #regd " \n\t"\ |
448 | 115 "pand %%mm6, " #regb " \n\t"\ |
116 "pand %%mm6, " #regd " \n\t"\ | |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
117 "psrlq $1, " #regd " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
118 "psrlq $1, " #regb " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
119 "psubb " #regb ", " #regr " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
120 "psubb " #regd ", " #regp " \n\t" |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
121 |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
122 /***********************************/ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
123 /* MMX no rounding */ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
124 #define DEF(x, y) x ## _no_rnd_ ## y ##_mmx |
448 | 125 #define SET_RND MOVQ_WONE |
126 #define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX_NO_RND(a, b, c, d, e, f) | |
471 | 127 #define PAVGB(a, b, c, e) PAVGB_MMX_NO_RND(a, b, c, e) |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
128 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
129 #include "dsputil_mmx_rnd.h" |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
130 |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
131 #undef DEF |
448 | 132 #undef SET_RND |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
133 #undef PAVGBP |
471 | 134 #undef PAVGB |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
135 /***********************************/ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
136 /* MMX rounding */ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
137 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
138 #define DEF(x, y) x ## _ ## y ##_mmx |
448 | 139 #define SET_RND MOVQ_WTWO |
140 #define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX(a, b, c, d, e, f) | |
471 | 141 #define PAVGB(a, b, c, e) PAVGB_MMX(a, b, c, e) |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
142 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
143 #include "dsputil_mmx_rnd.h" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
144 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
145 #undef DEF |
448 | 146 #undef SET_RND |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
147 #undef PAVGBP |
471 | 148 #undef PAVGB |
387 | 149 |
0 | 150 /***********************************/ |
151 /* 3Dnow specific */ | |
152 | |
153 #define DEF(x) x ## _3dnow | |
154 /* for Athlons PAVGUSB is prefered */ | |
155 #define PAVGB "pavgusb" | |
156 | |
157 #include "dsputil_mmx_avg.h" | |
158 | |
159 #undef DEF | |
160 #undef PAVGB | |
161 | |
162 /***********************************/ | |
163 /* MMX2 specific */ | |
164 | |
386 | 165 #define DEF(x) x ## _mmx2 |
0 | 166 |
167 /* Introduced only in MMX2 set */ | |
168 #define PAVGB "pavgb" | |
169 | |
170 #include "dsputil_mmx_avg.h" | |
171 | |
172 #undef DEF | |
173 #undef PAVGB | |
174 | |
175 /***********************************/ | |
176 /* standard MMX */ | |
177 | |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
178 #ifdef CONFIG_ENCODERS |
1064 | 179 static void get_pixels_mmx(DCTELEM *block, const uint8_t *pixels, int line_size) |
0 | 180 { |
386 | 181 asm volatile( |
182 "movl $-128, %%eax \n\t" | |
183 "pxor %%mm7, %%mm7 \n\t" | |
184 ".balign 16 \n\t" | |
185 "1: \n\t" | |
186 "movq (%0), %%mm0 \n\t" | |
187 "movq (%0, %2), %%mm2 \n\t" | |
188 "movq %%mm0, %%mm1 \n\t" | |
189 "movq %%mm2, %%mm3 \n\t" | |
190 "punpcklbw %%mm7, %%mm0 \n\t" | |
191 "punpckhbw %%mm7, %%mm1 \n\t" | |
192 "punpcklbw %%mm7, %%mm2 \n\t" | |
193 "punpckhbw %%mm7, %%mm3 \n\t" | |
194 "movq %%mm0, (%1, %%eax)\n\t" | |
195 "movq %%mm1, 8(%1, %%eax)\n\t" | |
196 "movq %%mm2, 16(%1, %%eax)\n\t" | |
197 "movq %%mm3, 24(%1, %%eax)\n\t" | |
198 "addl %3, %0 \n\t" | |
199 "addl $32, %%eax \n\t" | |
200 "js 1b \n\t" | |
201 : "+r" (pixels) | |
202 : "r" (block+64), "r" (line_size), "r" (line_size*2) | |
203 : "%eax" | |
204 ); | |
0 | 205 } |
206 | |
1064 | 207 static inline void diff_pixels_mmx(DCTELEM *block, const uint8_t *s1, const uint8_t *s2, int stride) |
324 | 208 { |
209 asm volatile( | |
386 | 210 "pxor %%mm7, %%mm7 \n\t" |
211 "movl $-128, %%eax \n\t" | |
324 | 212 ".balign 16 \n\t" |
213 "1: \n\t" | |
214 "movq (%0), %%mm0 \n\t" | |
215 "movq (%1), %%mm2 \n\t" | |
216 "movq %%mm0, %%mm1 \n\t" | |
217 "movq %%mm2, %%mm3 \n\t" | |
218 "punpcklbw %%mm7, %%mm0 \n\t" | |
219 "punpckhbw %%mm7, %%mm1 \n\t" | |
220 "punpcklbw %%mm7, %%mm2 \n\t" | |
221 "punpckhbw %%mm7, %%mm3 \n\t" | |
222 "psubw %%mm2, %%mm0 \n\t" | |
223 "psubw %%mm3, %%mm1 \n\t" | |
224 "movq %%mm0, (%2, %%eax)\n\t" | |
225 "movq %%mm1, 8(%2, %%eax)\n\t" | |
226 "addl %3, %0 \n\t" | |
227 "addl %3, %1 \n\t" | |
228 "addl $16, %%eax \n\t" | |
229 "jnz 1b \n\t" | |
230 : "+r" (s1), "+r" (s2) | |
231 : "r" (block+64), "r" (stride) | |
232 : "%eax" | |
233 ); | |
234 } | |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
235 #endif //CONFIG_ENCODERS |
324 | 236 |
1064 | 237 void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size) |
0 | 238 { |
239 const DCTELEM *p; | |
1064 | 240 uint8_t *pix; |
0 | 241 |
242 /* read the pixels */ | |
243 p = block; | |
244 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
245 /* unrolled loop */ |
0 | 246 __asm __volatile( |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
247 "movq %3, %%mm0\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
248 "movq 8%3, %%mm1\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
249 "movq 16%3, %%mm2\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
250 "movq 24%3, %%mm3\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
251 "movq 32%3, %%mm4\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
252 "movq 40%3, %%mm5\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
253 "movq 48%3, %%mm6\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
254 "movq 56%3, %%mm7\n\t" |
0 | 255 "packuswb %%mm1, %%mm0\n\t" |
256 "packuswb %%mm3, %%mm2\n\t" | |
257 "packuswb %%mm5, %%mm4\n\t" | |
258 "packuswb %%mm7, %%mm6\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
259 "movq %%mm0, (%0)\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
260 "movq %%mm2, (%0, %1)\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
261 "movq %%mm4, (%0, %1, 2)\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
262 "movq %%mm6, (%0, %2)\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
263 ::"r" (pix), "r" (line_size), "r" (line_size*3), "m"(*p) |
0 | 264 :"memory"); |
265 pix += line_size*4; | |
266 p += 32; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
267 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
268 // 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
|
269 // compiler would generate some very strange code |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
270 // thus using "r" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
271 __asm __volatile( |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
272 "movq (%3), %%mm0\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
273 "movq 8(%3), %%mm1\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
274 "movq 16(%3), %%mm2\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
275 "movq 24(%3), %%mm3\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
276 "movq 32(%3), %%mm4\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
277 "movq 40(%3), %%mm5\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
278 "movq 48(%3), %%mm6\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
279 "movq 56(%3), %%mm7\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
280 "packuswb %%mm1, %%mm0\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
281 "packuswb %%mm3, %%mm2\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
282 "packuswb %%mm5, %%mm4\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
283 "packuswb %%mm7, %%mm6\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
284 "movq %%mm0, (%0)\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
285 "movq %%mm2, (%0, %1)\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
286 "movq %%mm4, (%0, %1, 2)\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
287 "movq %%mm6, (%0, %2)\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
288 ::"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
|
289 :"memory"); |
0 | 290 } |
291 | |
1064 | 292 void add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size) |
0 | 293 { |
294 const DCTELEM *p; | |
1064 | 295 uint8_t *pix; |
0 | 296 int i; |
297 | |
298 /* read the pixels */ | |
299 p = block; | |
300 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
301 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
302 i = 4; |
342
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
303 do { |
0 | 304 __asm __volatile( |
342
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
305 "movq (%2), %%mm0\n\t" |
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
306 "movq 8(%2), %%mm1\n\t" |
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
307 "movq 16(%2), %%mm2\n\t" |
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
308 "movq 24(%2), %%mm3\n\t" |
0 | 309 "movq %0, %%mm4\n\t" |
310 "movq %1, %%mm6\n\t" | |
311 "movq %%mm4, %%mm5\n\t" | |
312 "punpcklbw %%mm7, %%mm4\n\t" | |
313 "punpckhbw %%mm7, %%mm5\n\t" | |
314 "paddsw %%mm4, %%mm0\n\t" | |
315 "paddsw %%mm5, %%mm1\n\t" | |
316 "movq %%mm6, %%mm5\n\t" | |
317 "punpcklbw %%mm7, %%mm6\n\t" | |
318 "punpckhbw %%mm7, %%mm5\n\t" | |
319 "paddsw %%mm6, %%mm2\n\t" | |
320 "paddsw %%mm5, %%mm3\n\t" | |
321 "packuswb %%mm1, %%mm0\n\t" | |
322 "packuswb %%mm3, %%mm2\n\t" | |
323 "movq %%mm0, %0\n\t" | |
324 "movq %%mm2, %1\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
325 :"+m"(*pix), "+m"(*(pix+line_size)) |
342
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
326 :"r"(p) |
0 | 327 :"memory"); |
328 pix += line_size*2; | |
329 p += 16; | |
342
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
330 } while (--i); |
0 | 331 } |
332 | |
1064 | 333 static void put_pixels8_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
0 | 334 { |
471 | 335 __asm __volatile( |
420 | 336 "lea (%3, %3), %%eax \n\t" |
422 | 337 ".balign 8 \n\t" |
420 | 338 "1: \n\t" |
339 "movq (%1), %%mm0 \n\t" | |
340 "movq (%1, %3), %%mm1 \n\t" | |
341 "movq %%mm0, (%2) \n\t" | |
342 "movq %%mm1, (%2, %3) \n\t" | |
343 "addl %%eax, %1 \n\t" | |
344 "addl %%eax, %2 \n\t" | |
345 "movq (%1), %%mm0 \n\t" | |
346 "movq (%1, %3), %%mm1 \n\t" | |
347 "movq %%mm0, (%2) \n\t" | |
348 "movq %%mm1, (%2, %3) \n\t" | |
349 "addl %%eax, %1 \n\t" | |
350 "addl %%eax, %2 \n\t" | |
351 "subl $4, %0 \n\t" | |
352 "jnz 1b \n\t" | |
353 : "+g"(h), "+r" (pixels), "+r" (block) | |
354 : "r"(line_size) | |
355 : "%eax", "memory" | |
356 ); | |
0 | 357 } |
358 | |
1064 | 359 static void put_pixels16_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
651 | 360 { |
361 __asm __volatile( | |
362 "lea (%3, %3), %%eax \n\t" | |
363 ".balign 8 \n\t" | |
364 "1: \n\t" | |
365 "movq (%1), %%mm0 \n\t" | |
366 "movq 8(%1), %%mm4 \n\t" | |
367 "movq (%1, %3), %%mm1 \n\t" | |
368 "movq 8(%1, %3), %%mm5 \n\t" | |
369 "movq %%mm0, (%2) \n\t" | |
370 "movq %%mm4, 8(%2) \n\t" | |
371 "movq %%mm1, (%2, %3) \n\t" | |
372 "movq %%mm5, 8(%2, %3) \n\t" | |
373 "addl %%eax, %1 \n\t" | |
374 "addl %%eax, %2 \n\t" | |
375 "movq (%1), %%mm0 \n\t" | |
376 "movq 8(%1), %%mm4 \n\t" | |
377 "movq (%1, %3), %%mm1 \n\t" | |
378 "movq 8(%1, %3), %%mm5 \n\t" | |
379 "movq %%mm0, (%2) \n\t" | |
380 "movq %%mm4, 8(%2) \n\t" | |
381 "movq %%mm1, (%2, %3) \n\t" | |
382 "movq %%mm5, 8(%2, %3) \n\t" | |
383 "addl %%eax, %1 \n\t" | |
384 "addl %%eax, %2 \n\t" | |
385 "subl $4, %0 \n\t" | |
386 "jnz 1b \n\t" | |
387 : "+g"(h), "+r" (pixels), "+r" (block) | |
388 : "r"(line_size) | |
389 : "%eax", "memory" | |
390 ); | |
391 } | |
392 | |
296 | 393 static void clear_blocks_mmx(DCTELEM *blocks) |
394 { | |
471 | 395 __asm __volatile( |
296 | 396 "pxor %%mm7, %%mm7 \n\t" |
397 "movl $-128*6, %%eax \n\t" | |
398 "1: \n\t" | |
399 "movq %%mm7, (%0, %%eax) \n\t" | |
400 "movq %%mm7, 8(%0, %%eax) \n\t" | |
401 "movq %%mm7, 16(%0, %%eax) \n\t" | |
402 "movq %%mm7, 24(%0, %%eax) \n\t" | |
403 "addl $32, %%eax \n\t" | |
404 " js 1b \n\t" | |
405 : : "r" (((int)blocks)+128*6) | |
406 : "%eax" | |
407 ); | |
408 } | |
409 | |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
410 #ifdef CONFIG_ENCODERS |
1064 | 411 static int pix_sum16_mmx(uint8_t * pix, int line_size){ |
688 | 412 const int h=16; |
413 int sum; | |
414 int index= -line_size*h; | |
415 | |
416 __asm __volatile( | |
417 "pxor %%mm7, %%mm7 \n\t" | |
418 "pxor %%mm6, %%mm6 \n\t" | |
419 "1: \n\t" | |
420 "movq (%2, %1), %%mm0 \n\t" | |
421 "movq (%2, %1), %%mm1 \n\t" | |
422 "movq 8(%2, %1), %%mm2 \n\t" | |
423 "movq 8(%2, %1), %%mm3 \n\t" | |
424 "punpcklbw %%mm7, %%mm0 \n\t" | |
425 "punpckhbw %%mm7, %%mm1 \n\t" | |
426 "punpcklbw %%mm7, %%mm2 \n\t" | |
427 "punpckhbw %%mm7, %%mm3 \n\t" | |
428 "paddw %%mm0, %%mm1 \n\t" | |
429 "paddw %%mm2, %%mm3 \n\t" | |
430 "paddw %%mm1, %%mm3 \n\t" | |
431 "paddw %%mm3, %%mm6 \n\t" | |
432 "addl %3, %1 \n\t" | |
433 " js 1b \n\t" | |
434 "movq %%mm6, %%mm5 \n\t" | |
435 "psrlq $32, %%mm6 \n\t" | |
436 "paddw %%mm5, %%mm6 \n\t" | |
437 "movq %%mm6, %%mm5 \n\t" | |
438 "psrlq $16, %%mm6 \n\t" | |
439 "paddw %%mm5, %%mm6 \n\t" | |
440 "movd %%mm6, %0 \n\t" | |
441 "andl $0xFFFF, %0 \n\t" | |
442 : "=&r" (sum), "+r" (index) | |
443 : "r" (pix - index), "r" (line_size) | |
444 ); | |
445 | |
446 return sum; | |
447 } | |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
448 #endif //CONFIG_ENCODERS |
688 | 449 |
866 | 450 static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w){ |
451 int i=0; | |
452 asm volatile( | |
453 "1: \n\t" | |
454 "movq (%1, %0), %%mm0 \n\t" | |
455 "movq (%2, %0), %%mm1 \n\t" | |
456 "paddb %%mm0, %%mm1 \n\t" | |
457 "movq %%mm1, (%2, %0) \n\t" | |
458 "movq 8(%1, %0), %%mm0 \n\t" | |
459 "movq 8(%2, %0), %%mm1 \n\t" | |
460 "paddb %%mm0, %%mm1 \n\t" | |
461 "movq %%mm1, 8(%2, %0) \n\t" | |
462 "addl $16, %0 \n\t" | |
463 "cmpl %3, %0 \n\t" | |
464 " jb 1b \n\t" | |
465 : "+r" (i) | |
466 : "r"(src), "r"(dst), "r"(w-15) | |
467 ); | |
468 for(; i<w; i++) | |
469 dst[i+0] += src[i+0]; | |
470 } | |
471 | |
1648 | 472 #define H263_LOOP_FILTER \ |
473 "pxor %%mm7, %%mm7 \n\t"\ | |
474 "movq %0, %%mm0 \n\t"\ | |
475 "movq %0, %%mm1 \n\t"\ | |
476 "movq %3, %%mm2 \n\t"\ | |
477 "movq %3, %%mm3 \n\t"\ | |
478 "punpcklbw %%mm7, %%mm0 \n\t"\ | |
479 "punpckhbw %%mm7, %%mm1 \n\t"\ | |
480 "punpcklbw %%mm7, %%mm2 \n\t"\ | |
481 "punpckhbw %%mm7, %%mm3 \n\t"\ | |
482 "psubw %%mm2, %%mm0 \n\t"\ | |
483 "psubw %%mm3, %%mm1 \n\t"\ | |
484 "movq %1, %%mm2 \n\t"\ | |
485 "movq %1, %%mm3 \n\t"\ | |
486 "movq %2, %%mm4 \n\t"\ | |
487 "movq %2, %%mm5 \n\t"\ | |
488 "punpcklbw %%mm7, %%mm2 \n\t"\ | |
489 "punpckhbw %%mm7, %%mm3 \n\t"\ | |
490 "punpcklbw %%mm7, %%mm4 \n\t"\ | |
491 "punpckhbw %%mm7, %%mm5 \n\t"\ | |
492 "psubw %%mm2, %%mm4 \n\t"\ | |
493 "psubw %%mm3, %%mm5 \n\t"\ | |
494 "psllw $2, %%mm4 \n\t"\ | |
495 "psllw $2, %%mm5 \n\t"\ | |
496 "paddw %%mm0, %%mm4 \n\t"\ | |
497 "paddw %%mm1, %%mm5 \n\t"\ | |
498 "pxor %%mm6, %%mm6 \n\t"\ | |
499 "pcmpgtw %%mm4, %%mm6 \n\t"\ | |
500 "pcmpgtw %%mm5, %%mm7 \n\t"\ | |
501 "pxor %%mm6, %%mm4 \n\t"\ | |
502 "pxor %%mm7, %%mm5 \n\t"\ | |
503 "psubw %%mm6, %%mm4 \n\t"\ | |
504 "psubw %%mm7, %%mm5 \n\t"\ | |
505 "psrlw $3, %%mm4 \n\t"\ | |
506 "psrlw $3, %%mm5 \n\t"\ | |
507 "packuswb %%mm5, %%mm4 \n\t"\ | |
508 "packsswb %%mm7, %%mm6 \n\t"\ | |
509 "pxor %%mm7, %%mm7 \n\t"\ | |
510 "movd %4, %%mm2 \n\t"\ | |
511 "punpcklbw %%mm2, %%mm2 \n\t"\ | |
512 "punpcklbw %%mm2, %%mm2 \n\t"\ | |
513 "punpcklbw %%mm2, %%mm2 \n\t"\ | |
514 "psubusb %%mm4, %%mm2 \n\t"\ | |
515 "movq %%mm2, %%mm3 \n\t"\ | |
516 "psubusb %%mm4, %%mm3 \n\t"\ | |
517 "psubb %%mm3, %%mm2 \n\t"\ | |
518 "movq %1, %%mm3 \n\t"\ | |
519 "movq %2, %%mm4 \n\t"\ | |
520 "pxor %%mm6, %%mm3 \n\t"\ | |
521 "pxor %%mm6, %%mm4 \n\t"\ | |
522 "paddusb %%mm2, %%mm3 \n\t"\ | |
523 "psubusb %%mm2, %%mm4 \n\t"\ | |
524 "pxor %%mm6, %%mm3 \n\t"\ | |
525 "pxor %%mm6, %%mm4 \n\t"\ | |
526 "paddusb %%mm2, %%mm2 \n\t"\ | |
527 "packsswb %%mm1, %%mm0 \n\t"\ | |
528 "pcmpgtb %%mm0, %%mm7 \n\t"\ | |
529 "pxor %%mm7, %%mm0 \n\t"\ | |
530 "psubb %%mm7, %%mm0 \n\t"\ | |
531 "movq %%mm0, %%mm1 \n\t"\ | |
532 "psubusb %%mm2, %%mm0 \n\t"\ | |
533 "psubb %%mm0, %%mm1 \n\t"\ | |
534 "pand %5, %%mm1 \n\t"\ | |
535 "psrlw $2, %%mm1 \n\t"\ | |
536 "pxor %%mm7, %%mm1 \n\t"\ | |
537 "psubb %%mm7, %%mm1 \n\t"\ | |
538 "movq %0, %%mm5 \n\t"\ | |
539 "movq %3, %%mm6 \n\t"\ | |
540 "psubb %%mm1, %%mm5 \n\t"\ | |
541 "paddb %%mm1, %%mm6 \n\t" | |
542 | |
1647 | 543 static void h263_v_loop_filter_mmx(uint8_t *src, int stride, int qscale){ |
544 const int strength= ff_h263_loop_filter_strength[qscale]; | |
545 | |
546 asm volatile( | |
1648 | 547 |
548 H263_LOOP_FILTER | |
549 | |
1647 | 550 "movq %%mm3, %1 \n\t" |
551 "movq %%mm4, %2 \n\t" | |
1648 | 552 "movq %%mm5, %0 \n\t" |
553 "movq %%mm6, %3 \n\t" | |
1647 | 554 : "+m" (*(uint64_t*)(src - 2*stride)), |
555 "+m" (*(uint64_t*)(src - 1*stride)), | |
556 "+m" (*(uint64_t*)(src + 0*stride)), | |
557 "+m" (*(uint64_t*)(src + 1*stride)) | |
558 : "g" (2*strength), "m"(ff_pb_FC) | |
559 ); | |
560 } | |
561 | |
1648 | 562 static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int src_stride){ |
563 asm volatile( //FIXME could save 1 instruction if done as 8x4 ... | |
564 "movd %4, %%mm0 \n\t" | |
565 "movd %5, %%mm1 \n\t" | |
566 "movd %6, %%mm2 \n\t" | |
567 "movd %7, %%mm3 \n\t" | |
568 "punpcklbw %%mm1, %%mm0 \n\t" | |
569 "punpcklbw %%mm3, %%mm2 \n\t" | |
570 "movq %%mm0, %%mm1 \n\t" | |
571 "punpcklwd %%mm2, %%mm0 \n\t" | |
572 "punpckhwd %%mm2, %%mm1 \n\t" | |
573 "movd %%mm0, %0 \n\t" | |
574 "punpckhdq %%mm0, %%mm0 \n\t" | |
575 "movd %%mm0, %1 \n\t" | |
576 "movd %%mm1, %2 \n\t" | |
577 "punpckhdq %%mm1, %%mm1 \n\t" | |
578 "movd %%mm1, %3 \n\t" | |
579 | |
580 : "=m" (*(uint32_t*)(dst + 0*dst_stride)), | |
581 "=m" (*(uint32_t*)(dst + 1*dst_stride)), | |
582 "=m" (*(uint32_t*)(dst + 2*dst_stride)), | |
583 "=m" (*(uint32_t*)(dst + 3*dst_stride)) | |
584 : "m" (*(uint32_t*)(src + 0*src_stride)), | |
585 "m" (*(uint32_t*)(src + 1*src_stride)), | |
586 "m" (*(uint32_t*)(src + 2*src_stride)), | |
587 "m" (*(uint32_t*)(src + 3*src_stride)) | |
588 ); | |
589 } | |
590 | |
591 static void h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale){ | |
592 const int strength= ff_h263_loop_filter_strength[qscale]; | |
593 uint64_t temp[4] __attribute__ ((aligned(8))); | |
594 uint8_t *btemp= (uint8_t*)temp; | |
595 | |
596 src -= 2; | |
597 | |
598 transpose4x4(btemp , src , 8, stride); | |
599 transpose4x4(btemp+4, src + 4*stride, 8, stride); | |
600 asm volatile( | |
601 H263_LOOP_FILTER // 5 3 4 6 | |
602 | |
603 : "+m" (temp[0]), | |
604 "+m" (temp[1]), | |
605 "+m" (temp[2]), | |
606 "+m" (temp[3]) | |
607 : "g" (2*strength), "m"(ff_pb_FC) | |
608 ); | |
609 | |
610 asm volatile( | |
611 "movq %%mm5, %%mm1 \n\t" | |
612 "movq %%mm4, %%mm0 \n\t" | |
613 "punpcklbw %%mm3, %%mm5 \n\t" | |
614 "punpcklbw %%mm6, %%mm4 \n\t" | |
615 "punpckhbw %%mm3, %%mm1 \n\t" | |
616 "punpckhbw %%mm6, %%mm0 \n\t" | |
617 "movq %%mm5, %%mm3 \n\t" | |
618 "movq %%mm1, %%mm6 \n\t" | |
619 "punpcklwd %%mm4, %%mm5 \n\t" | |
620 "punpcklwd %%mm0, %%mm1 \n\t" | |
621 "punpckhwd %%mm4, %%mm3 \n\t" | |
622 "punpckhwd %%mm0, %%mm6 \n\t" | |
623 "movd %%mm5, %0 \n\t" | |
624 "punpckhdq %%mm5, %%mm5 \n\t" | |
625 "movd %%mm5, %1 \n\t" | |
626 "movd %%mm3, %2 \n\t" | |
627 "punpckhdq %%mm3, %%mm3 \n\t" | |
628 "movd %%mm3, %3 \n\t" | |
629 "movd %%mm1, %4 \n\t" | |
630 "punpckhdq %%mm1, %%mm1 \n\t" | |
631 "movd %%mm1, %5 \n\t" | |
632 "movd %%mm6, %6 \n\t" | |
633 "punpckhdq %%mm6, %%mm6 \n\t" | |
634 "movd %%mm6, %7 \n\t" | |
635 : "=m" (*(uint32_t*)(src + 0*stride)), | |
636 "=m" (*(uint32_t*)(src + 1*stride)), | |
637 "=m" (*(uint32_t*)(src + 2*stride)), | |
638 "=m" (*(uint32_t*)(src + 3*stride)), | |
639 "=m" (*(uint32_t*)(src + 4*stride)), | |
640 "=m" (*(uint32_t*)(src + 5*stride)), | |
641 "=m" (*(uint32_t*)(src + 6*stride)), | |
642 "=m" (*(uint32_t*)(src + 7*stride)) | |
643 ); | |
644 } | |
645 | |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
646 #ifdef CONFIG_ENCODERS |
997
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
647 static int pix_norm1_mmx(uint8_t *pix, int line_size) { |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
648 int tmp; |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
649 asm volatile ( |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
650 "movl $16,%%ecx\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
651 "pxor %%mm0,%%mm0\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
652 "pxor %%mm7,%%mm7\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
653 "1:\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
654 "movq (%0),%%mm2\n" /* mm2 = pix[0-7] */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
655 "movq 8(%0),%%mm3\n" /* mm3 = pix[8-15] */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
656 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
657 "movq %%mm2,%%mm1\n" /* mm1 = mm2 = pix[0-7] */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
658 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
659 "punpckhbw %%mm0,%%mm1\n" /* mm1 = [pix4-7] */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
660 "punpcklbw %%mm0,%%mm2\n" /* mm2 = [pix0-3] */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
661 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
662 "movq %%mm3,%%mm4\n" /* mm4 = mm3 = pix[8-15] */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
663 "punpckhbw %%mm0,%%mm3\n" /* mm3 = [pix12-15] */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
664 "punpcklbw %%mm0,%%mm4\n" /* mm4 = [pix8-11] */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
665 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
666 "pmaddwd %%mm1,%%mm1\n" /* mm1 = (pix0^2+pix1^2,pix2^2+pix3^2) */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
667 "pmaddwd %%mm2,%%mm2\n" /* mm2 = (pix4^2+pix5^2,pix6^2+pix7^2) */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
668 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
669 "pmaddwd %%mm3,%%mm3\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
670 "pmaddwd %%mm4,%%mm4\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
671 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
672 "paddd %%mm1,%%mm2\n" /* mm2 = (pix0^2+pix1^2+pix4^2+pix5^2, |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
673 pix2^2+pix3^2+pix6^2+pix7^2) */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
674 "paddd %%mm3,%%mm4\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
675 "paddd %%mm2,%%mm7\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
676 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
677 "addl %2, %0\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
678 "paddd %%mm4,%%mm7\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
679 "dec %%ecx\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
680 "jnz 1b\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
681 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
682 "movq %%mm7,%%mm1\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
683 "psrlq $32, %%mm7\n" /* shift hi dword to lo */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
684 "paddd %%mm7,%%mm1\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
685 "movd %%mm1,%1\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
686 : "+r" (pix), "=r"(tmp) : "r" (line_size) : "%ecx" ); |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
687 return tmp; |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
688 } |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
689 |
1064 | 690 static int sse16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size) { |
997
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
691 int tmp; |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
692 asm volatile ( |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
693 "movl $16,%%ecx\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
694 "pxor %%mm0,%%mm0\n" /* mm0 = 0 */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
695 "pxor %%mm7,%%mm7\n" /* mm7 holds the sum */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
696 "1:\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
697 "movq (%0),%%mm1\n" /* mm1 = pix1[0-7] */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
698 "movq (%1),%%mm2\n" /* mm2 = pix2[0-7] */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
699 "movq 8(%0),%%mm3\n" /* mm3 = pix1[8-15] */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
700 "movq 8(%1),%%mm4\n" /* mm4 = pix2[8-15] */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
701 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
702 /* todo: mm1-mm2, mm3-mm4 */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
703 /* algo: substract mm1 from mm2 with saturation and vice versa */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
704 /* OR the results to get absolute difference */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
705 "movq %%mm1,%%mm5\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
706 "movq %%mm3,%%mm6\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
707 "psubusb %%mm2,%%mm1\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
708 "psubusb %%mm4,%%mm3\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
709 "psubusb %%mm5,%%mm2\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
710 "psubusb %%mm6,%%mm4\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
711 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
712 "por %%mm1,%%mm2\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
713 "por %%mm3,%%mm4\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
714 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
715 /* now convert to 16-bit vectors so we can square them */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
716 "movq %%mm2,%%mm1\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
717 "movq %%mm4,%%mm3\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
718 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
719 "punpckhbw %%mm0,%%mm2\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
720 "punpckhbw %%mm0,%%mm4\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
721 "punpcklbw %%mm0,%%mm1\n" /* mm1 now spread over (mm1,mm2) */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
722 "punpcklbw %%mm0,%%mm3\n" /* mm4 now spread over (mm3,mm4) */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
723 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
724 "pmaddwd %%mm2,%%mm2\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
725 "pmaddwd %%mm4,%%mm4\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
726 "pmaddwd %%mm1,%%mm1\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
727 "pmaddwd %%mm3,%%mm3\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
728 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
729 "addl %3,%0\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
730 "addl %3,%1\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
731 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
732 "paddd %%mm2,%%mm1\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
733 "paddd %%mm4,%%mm3\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
734 "paddd %%mm1,%%mm7\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
735 "paddd %%mm3,%%mm7\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
736 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
737 "decl %%ecx\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
738 "jnz 1b\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
739 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
740 "movq %%mm7,%%mm1\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
741 "psrlq $32, %%mm7\n" /* shift hi dword to lo */ |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
742 "paddd %%mm7,%%mm1\n" |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
743 "movd %%mm1,%2\n" |
1566 | 744 : "+r" (pix1), "+r" (pix2), "=r"(tmp) : "r" (line_size) : "%ecx"); |
997
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
745 return tmp; |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
746 } |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
747 |
866 | 748 static void diff_bytes_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){ |
749 int i=0; | |
750 asm volatile( | |
751 "1: \n\t" | |
752 "movq (%2, %0), %%mm0 \n\t" | |
753 "movq (%1, %0), %%mm1 \n\t" | |
754 "psubb %%mm0, %%mm1 \n\t" | |
755 "movq %%mm1, (%3, %0) \n\t" | |
756 "movq 8(%2, %0), %%mm0 \n\t" | |
757 "movq 8(%1, %0), %%mm1 \n\t" | |
758 "psubb %%mm0, %%mm1 \n\t" | |
759 "movq %%mm1, 8(%3, %0) \n\t" | |
760 "addl $16, %0 \n\t" | |
761 "cmpl %4, %0 \n\t" | |
762 " jb 1b \n\t" | |
763 : "+r" (i) | |
764 : "r"(src1), "r"(src2), "r"(dst), "r"(w-15) | |
765 ); | |
766 for(; i<w; i++) | |
767 dst[i+0] = src1[i+0]-src2[i+0]; | |
768 } | |
1527 | 769 |
770 static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w, int *left, int *left_top){ | |
771 int i=0; | |
772 uint8_t l, lt; | |
773 | |
774 asm volatile( | |
775 "1: \n\t" | |
776 "movq -1(%1, %0), %%mm0 \n\t" // LT | |
777 "movq (%1, %0), %%mm1 \n\t" // T | |
778 "movq -1(%2, %0), %%mm2 \n\t" // L | |
779 "movq (%2, %0), %%mm3 \n\t" // X | |
780 "movq %%mm2, %%mm4 \n\t" // L | |
781 "psubb %%mm0, %%mm2 \n\t" | |
782 "paddb %%mm1, %%mm2 \n\t" // L + T - LT | |
783 "movq %%mm4, %%mm5 \n\t" // L | |
784 "pmaxub %%mm1, %%mm4 \n\t" // max(T, L) | |
785 "pminub %%mm5, %%mm1 \n\t" // min(T, L) | |
786 "pminub %%mm2, %%mm4 \n\t" | |
787 "pmaxub %%mm1, %%mm4 \n\t" | |
788 "psubb %%mm4, %%mm3 \n\t" // dst - pred | |
789 "movq %%mm3, (%3, %0) \n\t" | |
790 "addl $8, %0 \n\t" | |
791 "cmpl %4, %0 \n\t" | |
792 " jb 1b \n\t" | |
793 : "+r" (i) | |
794 : "r"(src1), "r"(src2), "r"(dst), "r"(w) | |
795 ); | |
796 | |
797 l= *left; | |
798 lt= *left_top; | |
799 | |
800 dst[0]= src2[0] - mid_pred(l, src1[0], (l + src1[0] - lt)&0xFF); | |
801 | |
802 *left_top= src1[w-1]; | |
803 *left = src2[w-1]; | |
804 } | |
805 | |
1153 | 806 #define LBUTTERFLY2(a1,b1,a2,b2)\ |
807 "paddw " #b1 ", " #a1 " \n\t"\ | |
808 "paddw " #b2 ", " #a2 " \n\t"\ | |
809 "paddw " #b1 ", " #b1 " \n\t"\ | |
810 "paddw " #b2 ", " #b2 " \n\t"\ | |
811 "psubw " #a1 ", " #b1 " \n\t"\ | |
1186 | 812 "psubw " #a2 ", " #b2 " \n\t" |
866 | 813 |
936 | 814 #define HADAMARD48\ |
1153 | 815 LBUTTERFLY2(%%mm0, %%mm1, %%mm2, %%mm3)\ |
816 LBUTTERFLY2(%%mm4, %%mm5, %%mm6, %%mm7)\ | |
817 LBUTTERFLY2(%%mm0, %%mm2, %%mm1, %%mm3)\ | |
818 LBUTTERFLY2(%%mm4, %%mm6, %%mm5, %%mm7)\ | |
819 LBUTTERFLY2(%%mm0, %%mm4, %%mm1, %%mm5)\ | |
820 LBUTTERFLY2(%%mm2, %%mm6, %%mm3, %%mm7)\ | |
936 | 821 |
822 #define MMABS(a,z)\ | |
823 "pxor " #z ", " #z " \n\t"\ | |
824 "pcmpgtw " #a ", " #z " \n\t"\ | |
825 "pxor " #z ", " #a " \n\t"\ | |
826 "psubw " #z ", " #a " \n\t" | |
827 | |
828 #define MMABS_SUM(a,z, sum)\ | |
829 "pxor " #z ", " #z " \n\t"\ | |
830 "pcmpgtw " #a ", " #z " \n\t"\ | |
831 "pxor " #z ", " #a " \n\t"\ | |
832 "psubw " #z ", " #a " \n\t"\ | |
833 "paddusw " #a ", " #sum " \n\t" | |
834 | |
1153 | 835 #define MMABS_MMX2(a,z)\ |
836 "pxor " #z ", " #z " \n\t"\ | |
837 "psubw " #a ", " #z " \n\t"\ | |
838 "pmaxsw " #z ", " #a " \n\t" | |
839 | |
840 #define MMABS_SUM_MMX2(a,z, sum)\ | |
841 "pxor " #z ", " #z " \n\t"\ | |
842 "psubw " #a ", " #z " \n\t"\ | |
843 "pmaxsw " #z ", " #a " \n\t"\ | |
844 "paddusw " #a ", " #sum " \n\t" | |
845 | |
936 | 846 #define SBUTTERFLY(a,b,t,n)\ |
847 "movq " #a ", " #t " \n\t" /* abcd */\ | |
848 "punpckl" #n " " #b ", " #a " \n\t" /* aebf */\ | |
849 "punpckh" #n " " #b ", " #t " \n\t" /* cgdh */\ | |
1153 | 850 |
936 | 851 #define TRANSPOSE4(a,b,c,d,t)\ |
852 SBUTTERFLY(a,b,t,wd) /* a=aebf t=cgdh */\ | |
853 SBUTTERFLY(c,d,b,wd) /* c=imjn b=kolp */\ | |
854 SBUTTERFLY(a,c,d,dq) /* a=aeim d=bfjn */\ | |
855 SBUTTERFLY(t,b,c,dq) /* t=cgko c=dhlp */ | |
856 | |
857 #define LOAD4(o, a, b, c, d)\ | |
858 "movq "#o"(%1), " #a " \n\t"\ | |
859 "movq "#o"+16(%1), " #b " \n\t"\ | |
860 "movq "#o"+32(%1), " #c " \n\t"\ | |
861 "movq "#o"+48(%1), " #d " \n\t" | |
862 | |
863 #define STORE4(o, a, b, c, d)\ | |
864 "movq "#a", "#o"(%1) \n\t"\ | |
865 "movq "#b", "#o"+16(%1) \n\t"\ | |
866 "movq "#c", "#o"+32(%1) \n\t"\ | |
867 "movq "#d", "#o"+48(%1) \n\t"\ | |
868 | |
869 static int hadamard8_diff_mmx(void *s, uint8_t *src1, uint8_t *src2, int stride){ | |
870 uint64_t temp[16] __align8; | |
871 int sum=0; | |
872 | |
873 diff_pixels_mmx((DCTELEM*)temp, src1, src2, stride); | |
874 | |
875 asm volatile( | |
876 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3) | |
877 LOAD4(64, %%mm4, %%mm5, %%mm6, %%mm7) | |
878 | |
879 HADAMARD48 | |
880 | |
881 "movq %%mm7, 112(%1) \n\t" | |
882 | |
883 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7) | |
884 STORE4(0 , %%mm0, %%mm3, %%mm7, %%mm2) | |
885 | |
886 "movq 112(%1), %%mm7 \n\t" | |
887 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0) | |
888 STORE4(64, %%mm4, %%mm7, %%mm0, %%mm6) | |
889 | |
890 LOAD4(8 , %%mm0, %%mm1, %%mm2, %%mm3) | |
891 LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7) | |
892 | |
893 HADAMARD48 | |
894 | |
895 "movq %%mm7, 120(%1) \n\t" | |
896 | |
897 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7) | |
898 STORE4(8 , %%mm0, %%mm3, %%mm7, %%mm2) | |
899 | |
900 "movq 120(%1), %%mm7 \n\t" | |
901 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0) | |
902 "movq %%mm7, %%mm5 \n\t"//FIXME remove | |
903 "movq %%mm6, %%mm7 \n\t" | |
904 "movq %%mm0, %%mm6 \n\t" | |
905 // STORE4(72, %%mm4, %%mm7, %%mm0, %%mm6) //FIXME remove | |
906 | |
907 LOAD4(64, %%mm0, %%mm1, %%mm2, %%mm3) | |
908 // LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7) | |
909 | |
910 HADAMARD48 | |
911 "movq %%mm7, 64(%1) \n\t" | |
912 MMABS(%%mm0, %%mm7) | |
913 MMABS_SUM(%%mm1, %%mm7, %%mm0) | |
914 MMABS_SUM(%%mm2, %%mm7, %%mm0) | |
915 MMABS_SUM(%%mm3, %%mm7, %%mm0) | |
916 MMABS_SUM(%%mm4, %%mm7, %%mm0) | |
917 MMABS_SUM(%%mm5, %%mm7, %%mm0) | |
918 MMABS_SUM(%%mm6, %%mm7, %%mm0) | |
919 "movq 64(%1), %%mm1 \n\t" | |
920 MMABS_SUM(%%mm1, %%mm7, %%mm0) | |
921 "movq %%mm0, 64(%1) \n\t" | |
922 | |
923 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3) | |
924 LOAD4(8 , %%mm4, %%mm5, %%mm6, %%mm7) | |
925 | |
926 HADAMARD48 | |
927 "movq %%mm7, (%1) \n\t" | |
928 MMABS(%%mm0, %%mm7) | |
929 MMABS_SUM(%%mm1, %%mm7, %%mm0) | |
930 MMABS_SUM(%%mm2, %%mm7, %%mm0) | |
931 MMABS_SUM(%%mm3, %%mm7, %%mm0) | |
932 MMABS_SUM(%%mm4, %%mm7, %%mm0) | |
933 MMABS_SUM(%%mm5, %%mm7, %%mm0) | |
934 MMABS_SUM(%%mm6, %%mm7, %%mm0) | |
935 "movq (%1), %%mm1 \n\t" | |
936 MMABS_SUM(%%mm1, %%mm7, %%mm0) | |
937 "movq 64(%1), %%mm1 \n\t" | |
938 MMABS_SUM(%%mm1, %%mm7, %%mm0) | |
939 | |
940 "movq %%mm0, %%mm1 \n\t" | |
941 "psrlq $32, %%mm0 \n\t" | |
942 "paddusw %%mm1, %%mm0 \n\t" | |
943 "movq %%mm0, %%mm1 \n\t" | |
944 "psrlq $16, %%mm0 \n\t" | |
945 "paddusw %%mm1, %%mm0 \n\t" | |
946 "movd %%mm0, %0 \n\t" | |
947 | |
948 : "=r" (sum) | |
949 : "r"(temp) | |
950 ); | |
951 return sum&0xFFFF; | |
952 } | |
953 | |
1153 | 954 static int hadamard8_diff_mmx2(void *s, uint8_t *src1, uint8_t *src2, int stride){ |
955 uint64_t temp[16] __align8; | |
956 int sum=0; | |
957 | |
958 diff_pixels_mmx((DCTELEM*)temp, src1, src2, stride); | |
959 | |
960 asm volatile( | |
961 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3) | |
962 LOAD4(64, %%mm4, %%mm5, %%mm6, %%mm7) | |
963 | |
964 HADAMARD48 | |
965 | |
966 "movq %%mm7, 112(%1) \n\t" | |
967 | |
968 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7) | |
969 STORE4(0 , %%mm0, %%mm3, %%mm7, %%mm2) | |
970 | |
971 "movq 112(%1), %%mm7 \n\t" | |
972 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0) | |
973 STORE4(64, %%mm4, %%mm7, %%mm0, %%mm6) | |
974 | |
975 LOAD4(8 , %%mm0, %%mm1, %%mm2, %%mm3) | |
976 LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7) | |
977 | |
978 HADAMARD48 | |
979 | |
980 "movq %%mm7, 120(%1) \n\t" | |
981 | |
982 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7) | |
983 STORE4(8 , %%mm0, %%mm3, %%mm7, %%mm2) | |
984 | |
985 "movq 120(%1), %%mm7 \n\t" | |
986 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0) | |
987 "movq %%mm7, %%mm5 \n\t"//FIXME remove | |
988 "movq %%mm6, %%mm7 \n\t" | |
989 "movq %%mm0, %%mm6 \n\t" | |
990 // STORE4(72, %%mm4, %%mm7, %%mm0, %%mm6) //FIXME remove | |
991 | |
992 LOAD4(64, %%mm0, %%mm1, %%mm2, %%mm3) | |
993 // LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7) | |
994 | |
995 HADAMARD48 | |
996 "movq %%mm7, 64(%1) \n\t" | |
997 MMABS_MMX2(%%mm0, %%mm7) | |
998 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0) | |
999 MMABS_SUM_MMX2(%%mm2, %%mm7, %%mm0) | |
1000 MMABS_SUM_MMX2(%%mm3, %%mm7, %%mm0) | |
1001 MMABS_SUM_MMX2(%%mm4, %%mm7, %%mm0) | |
1002 MMABS_SUM_MMX2(%%mm5, %%mm7, %%mm0) | |
1003 MMABS_SUM_MMX2(%%mm6, %%mm7, %%mm0) | |
1004 "movq 64(%1), %%mm1 \n\t" | |
1005 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0) | |
1006 "movq %%mm0, 64(%1) \n\t" | |
1007 | |
1008 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3) | |
1009 LOAD4(8 , %%mm4, %%mm5, %%mm6, %%mm7) | |
1010 | |
1011 HADAMARD48 | |
1012 "movq %%mm7, (%1) \n\t" | |
1013 MMABS_MMX2(%%mm0, %%mm7) | |
1014 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0) | |
1015 MMABS_SUM_MMX2(%%mm2, %%mm7, %%mm0) | |
1016 MMABS_SUM_MMX2(%%mm3, %%mm7, %%mm0) | |
1017 MMABS_SUM_MMX2(%%mm4, %%mm7, %%mm0) | |
1018 MMABS_SUM_MMX2(%%mm5, %%mm7, %%mm0) | |
1019 MMABS_SUM_MMX2(%%mm6, %%mm7, %%mm0) | |
1020 "movq (%1), %%mm1 \n\t" | |
1021 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0) | |
1022 "movq 64(%1), %%mm1 \n\t" | |
1023 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0) | |
1024 | |
1025 "movq %%mm0, %%mm1 \n\t" | |
1026 "psrlq $32, %%mm0 \n\t" | |
1027 "paddusw %%mm1, %%mm0 \n\t" | |
1028 "movq %%mm0, %%mm1 \n\t" | |
1029 "psrlq $16, %%mm0 \n\t" | |
1030 "paddusw %%mm1, %%mm0 \n\t" | |
1031 "movd %%mm0, %0 \n\t" | |
1032 | |
1033 : "=r" (sum) | |
1034 : "r"(temp) | |
1035 ); | |
1036 return sum&0xFFFF; | |
1037 } | |
1038 | |
1039 | |
936 | 1040 WARPER88_1616(hadamard8_diff_mmx, hadamard8_diff16_mmx) |
1153 | 1041 WARPER88_1616(hadamard8_diff_mmx2, hadamard8_diff16_mmx2) |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
1042 #endif //CONFIG_ENCODERS |
866 | 1043 |
959 | 1044 #define put_no_rnd_pixels8_mmx(a,b,c,d) put_pixels8_mmx(a,b,c,d) |
1045 #define put_no_rnd_pixels16_mmx(a,b,c,d) put_pixels16_mmx(a,b,c,d) | |
1046 | |
954 | 1047 #define QPEL_V_LOW(m3,m4,m5,m6, pw_20, pw_3, rnd, in0, in1, in2, in7, out, OP)\ |
1048 "paddw " #m4 ", " #m3 " \n\t" /* x1 */\ | |
961 | 1049 "movq "MANGLE(ff_pw_20)", %%mm4 \n\t" /* 20 */\ |
954 | 1050 "pmullw " #m3 ", %%mm4 \n\t" /* 20x1 */\ |
1051 "movq "#in7", " #m3 " \n\t" /* d */\ | |
1052 "movq "#in0", %%mm5 \n\t" /* D */\ | |
1053 "paddw " #m3 ", %%mm5 \n\t" /* x4 */\ | |
1054 "psubw %%mm5, %%mm4 \n\t" /* 20x1 - x4 */\ | |
1055 "movq "#in1", %%mm5 \n\t" /* C */\ | |
1056 "movq "#in2", %%mm6 \n\t" /* B */\ | |
1057 "paddw " #m6 ", %%mm5 \n\t" /* x3 */\ | |
1058 "paddw " #m5 ", %%mm6 \n\t" /* x2 */\ | |
1059 "paddw %%mm6, %%mm6 \n\t" /* 2x2 */\ | |
1060 "psubw %%mm6, %%mm5 \n\t" /* -2x2 + x3 */\ | |
961 | 1061 "pmullw "MANGLE(ff_pw_3)", %%mm5 \n\t" /* -6x2 + 3x3 */\ |
954 | 1062 "paddw " #rnd ", %%mm4 \n\t" /* x2 */\ |
1063 "paddw %%mm4, %%mm5 \n\t" /* 20x1 - 6x2 + 3x3 - x4 */\ | |
1064 "psraw $5, %%mm5 \n\t"\ | |
1065 "packuswb %%mm5, %%mm5 \n\t"\ | |
1066 OP(%%mm5, out, %%mm7, d) | |
1067 | |
959 | 1068 #define QPEL_BASE(OPNAME, ROUNDER, RND, OP_MMX2, OP_3DNOW)\ |
1057 | 1069 static void OPNAME ## mpeg4_qpel16_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ |
954 | 1070 uint64_t temp;\ |
1071 \ | |
1072 asm volatile(\ | |
1073 "pxor %%mm7, %%mm7 \n\t"\ | |
1074 "1: \n\t"\ | |
1075 "movq (%0), %%mm0 \n\t" /* ABCDEFGH */\ | |
1076 "movq %%mm0, %%mm1 \n\t" /* ABCDEFGH */\ | |
1077 "movq %%mm0, %%mm2 \n\t" /* ABCDEFGH */\ | |
1078 "punpcklbw %%mm7, %%mm0 \n\t" /* 0A0B0C0D */\ | |
1079 "punpckhbw %%mm7, %%mm1 \n\t" /* 0E0F0G0H */\ | |
1080 "pshufw $0x90, %%mm0, %%mm5 \n\t" /* 0A0A0B0C */\ | |
1081 "pshufw $0x41, %%mm0, %%mm6 \n\t" /* 0B0A0A0B */\ | |
1082 "movq %%mm2, %%mm3 \n\t" /* ABCDEFGH */\ | |
1083 "movq %%mm2, %%mm4 \n\t" /* ABCDEFGH */\ | |
1084 "psllq $8, %%mm2 \n\t" /* 0ABCDEFG */\ | |
1085 "psllq $16, %%mm3 \n\t" /* 00ABCDEF */\ | |
1086 "psllq $24, %%mm4 \n\t" /* 000ABCDE */\ | |
1087 "punpckhbw %%mm7, %%mm2 \n\t" /* 0D0E0F0G */\ | |
1088 "punpckhbw %%mm7, %%mm3 \n\t" /* 0C0D0E0F */\ | |
1089 "punpckhbw %%mm7, %%mm4 \n\t" /* 0B0C0D0E */\ | |
1090 "paddw %%mm3, %%mm5 \n\t" /* b */\ | |
1091 "paddw %%mm2, %%mm6 \n\t" /* c */\ | |
1092 "paddw %%mm5, %%mm5 \n\t" /* 2b */\ | |
1093 "psubw %%mm5, %%mm6 \n\t" /* c - 2b */\ | |
1094 "pshufw $0x06, %%mm0, %%mm5 \n\t" /* 0C0B0A0A */\ | |
961 | 1095 "pmullw "MANGLE(ff_pw_3)", %%mm6 \n\t" /* 3c - 6b */\ |
954 | 1096 "paddw %%mm4, %%mm0 \n\t" /* a */\ |
1097 "paddw %%mm1, %%mm5 \n\t" /* d */\ | |
961 | 1098 "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" /* 20a */\ |
954 | 1099 "psubw %%mm5, %%mm0 \n\t" /* 20a - d */\ |
961 | 1100 "paddw %6, %%mm6 \n\t"\ |
954 | 1101 "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\ |
1102 "psraw $5, %%mm0 \n\t"\ | |
961 | 1103 "movq %%mm0, %5 \n\t"\ |
954 | 1104 /* mm1=EFGH, mm2=DEFG, mm3=CDEF, mm4=BCDE, mm7=0 */\ |
1105 \ | |
1106 "movq 5(%0), %%mm0 \n\t" /* FGHIJKLM */\ | |
1107 "movq %%mm0, %%mm5 \n\t" /* FGHIJKLM */\ | |
1108 "movq %%mm0, %%mm6 \n\t" /* FGHIJKLM */\ | |
1109 "psrlq $8, %%mm0 \n\t" /* GHIJKLM0 */\ | |
1110 "psrlq $16, %%mm5 \n\t" /* HIJKLM00 */\ | |
1111 "punpcklbw %%mm7, %%mm0 \n\t" /* 0G0H0I0J */\ | |
1112 "punpcklbw %%mm7, %%mm5 \n\t" /* 0H0I0J0K */\ | |
1113 "paddw %%mm0, %%mm2 \n\t" /* b */\ | |
1114 "paddw %%mm5, %%mm3 \n\t" /* c */\ | |
1115 "paddw %%mm2, %%mm2 \n\t" /* 2b */\ | |
1116 "psubw %%mm2, %%mm3 \n\t" /* c - 2b */\ | |
1117 "movq %%mm6, %%mm2 \n\t" /* FGHIJKLM */\ | |
1118 "psrlq $24, %%mm6 \n\t" /* IJKLM000 */\ | |
1119 "punpcklbw %%mm7, %%mm2 \n\t" /* 0F0G0H0I */\ | |
1120 "punpcklbw %%mm7, %%mm6 \n\t" /* 0I0J0K0L */\ | |
961 | 1121 "pmullw "MANGLE(ff_pw_3)", %%mm3 \n\t" /* 3c - 6b */\ |
954 | 1122 "paddw %%mm2, %%mm1 \n\t" /* a */\ |
1123 "paddw %%mm6, %%mm4 \n\t" /* d */\ | |
961 | 1124 "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" /* 20a */\ |
954 | 1125 "psubw %%mm4, %%mm3 \n\t" /* - 6b +3c - d */\ |
961 | 1126 "paddw %6, %%mm1 \n\t"\ |
954 | 1127 "paddw %%mm1, %%mm3 \n\t" /* 20a - 6b +3c - d */\ |
1128 "psraw $5, %%mm3 \n\t"\ | |
961 | 1129 "movq %5, %%mm1 \n\t"\ |
954 | 1130 "packuswb %%mm3, %%mm1 \n\t"\ |
959 | 1131 OP_MMX2(%%mm1, (%1),%%mm4, q)\ |
954 | 1132 /* mm0= GHIJ, mm2=FGHI, mm5=HIJK, mm6=IJKL, mm7=0 */\ |
1133 \ | |
1134 "movq 9(%0), %%mm1 \n\t" /* JKLMNOPQ */\ | |
1135 "movq %%mm1, %%mm4 \n\t" /* JKLMNOPQ */\ | |
1136 "movq %%mm1, %%mm3 \n\t" /* JKLMNOPQ */\ | |
1137 "psrlq $8, %%mm1 \n\t" /* KLMNOPQ0 */\ | |
1138 "psrlq $16, %%mm4 \n\t" /* LMNOPQ00 */\ | |
1139 "punpcklbw %%mm7, %%mm1 \n\t" /* 0K0L0M0N */\ | |
1140 "punpcklbw %%mm7, %%mm4 \n\t" /* 0L0M0N0O */\ | |
1141 "paddw %%mm1, %%mm5 \n\t" /* b */\ | |
1142 "paddw %%mm4, %%mm0 \n\t" /* c */\ | |
1143 "paddw %%mm5, %%mm5 \n\t" /* 2b */\ | |
1144 "psubw %%mm5, %%mm0 \n\t" /* c - 2b */\ | |
1145 "movq %%mm3, %%mm5 \n\t" /* JKLMNOPQ */\ | |
1146 "psrlq $24, %%mm3 \n\t" /* MNOPQ000 */\ | |
961 | 1147 "pmullw "MANGLE(ff_pw_3)", %%mm0 \n\t" /* 3c - 6b */\ |
954 | 1148 "punpcklbw %%mm7, %%mm3 \n\t" /* 0M0N0O0P */\ |
1149 "paddw %%mm3, %%mm2 \n\t" /* d */\ | |
1150 "psubw %%mm2, %%mm0 \n\t" /* -6b + 3c - d */\ | |
1151 "movq %%mm5, %%mm2 \n\t" /* JKLMNOPQ */\ | |
1152 "punpcklbw %%mm7, %%mm2 \n\t" /* 0J0K0L0M */\ | |
1153 "punpckhbw %%mm7, %%mm5 \n\t" /* 0N0O0P0Q */\ | |
1154 "paddw %%mm2, %%mm6 \n\t" /* a */\ | |
961 | 1155 "pmullw "MANGLE(ff_pw_20)", %%mm6 \n\t" /* 20a */\ |
1156 "paddw %6, %%mm0 \n\t"\ | |
954 | 1157 "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\ |
1158 "psraw $5, %%mm0 \n\t"\ | |
1159 /* mm1=KLMN, mm2=JKLM, mm3=MNOP, mm4=LMNO, mm5=NOPQ mm7=0 */\ | |
1160 \ | |
1161 "paddw %%mm5, %%mm3 \n\t" /* a */\ | |
1162 "pshufw $0xF9, %%mm5, %%mm6 \n\t" /* 0O0P0Q0Q */\ | |
1163 "paddw %%mm4, %%mm6 \n\t" /* b */\ | |
1164 "pshufw $0xBE, %%mm5, %%mm4 \n\t" /* 0P0Q0Q0P */\ | |
1165 "pshufw $0x6F, %%mm5, %%mm5 \n\t" /* 0Q0Q0P0O */\ | |
1166 "paddw %%mm1, %%mm4 \n\t" /* c */\ | |
1167 "paddw %%mm2, %%mm5 \n\t" /* d */\ | |
1168 "paddw %%mm6, %%mm6 \n\t" /* 2b */\ | |
1169 "psubw %%mm6, %%mm4 \n\t" /* c - 2b */\ | |
961 | 1170 "pmullw "MANGLE(ff_pw_20)", %%mm3 \n\t" /* 20a */\ |
1171 "pmullw "MANGLE(ff_pw_3)", %%mm4 \n\t" /* 3c - 6b */\ | |
954 | 1172 "psubw %%mm5, %%mm3 \n\t" /* -6b + 3c - d */\ |
961 | 1173 "paddw %6, %%mm4 \n\t"\ |
954 | 1174 "paddw %%mm3, %%mm4 \n\t" /* 20a - 6b + 3c - d */\ |
1175 "psraw $5, %%mm4 \n\t"\ | |
1176 "packuswb %%mm4, %%mm0 \n\t"\ | |
959 | 1177 OP_MMX2(%%mm0, 8(%1), %%mm4, q)\ |
954 | 1178 \ |
1179 "addl %3, %0 \n\t"\ | |
1180 "addl %4, %1 \n\t"\ | |
1181 "decl %2 \n\t"\ | |
1182 " jnz 1b \n\t"\ | |
967 | 1183 : "+a"(src), "+c"(dst), "+m"(h)\ |
966 | 1184 : "d"(srcStride), "S"(dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(temp), "m"(ROUNDER)\ |
1185 : "memory"\ | |
954 | 1186 );\ |
1187 }\ | |
1188 \ | |
1189 static void OPNAME ## mpeg4_qpel16_h_lowpass_3dnow(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ | |
1190 int i;\ | |
1191 int16_t temp[16];\ | |
1192 /* quick HACK, XXX FIXME MUST be optimized */\ | |
1193 for(i=0; i<h; i++)\ | |
1194 {\ | |
1195 temp[ 0]= (src[ 0]+src[ 1])*20 - (src[ 0]+src[ 2])*6 + (src[ 1]+src[ 3])*3 - (src[ 2]+src[ 4]);\ | |
1196 temp[ 1]= (src[ 1]+src[ 2])*20 - (src[ 0]+src[ 3])*6 + (src[ 0]+src[ 4])*3 - (src[ 1]+src[ 5]);\ | |
1197 temp[ 2]= (src[ 2]+src[ 3])*20 - (src[ 1]+src[ 4])*6 + (src[ 0]+src[ 5])*3 - (src[ 0]+src[ 6]);\ | |
1198 temp[ 3]= (src[ 3]+src[ 4])*20 - (src[ 2]+src[ 5])*6 + (src[ 1]+src[ 6])*3 - (src[ 0]+src[ 7]);\ | |
1199 temp[ 4]= (src[ 4]+src[ 5])*20 - (src[ 3]+src[ 6])*6 + (src[ 2]+src[ 7])*3 - (src[ 1]+src[ 8]);\ | |
1200 temp[ 5]= (src[ 5]+src[ 6])*20 - (src[ 4]+src[ 7])*6 + (src[ 3]+src[ 8])*3 - (src[ 2]+src[ 9]);\ | |
1201 temp[ 6]= (src[ 6]+src[ 7])*20 - (src[ 5]+src[ 8])*6 + (src[ 4]+src[ 9])*3 - (src[ 3]+src[10]);\ | |
1202 temp[ 7]= (src[ 7]+src[ 8])*20 - (src[ 6]+src[ 9])*6 + (src[ 5]+src[10])*3 - (src[ 4]+src[11]);\ | |
1203 temp[ 8]= (src[ 8]+src[ 9])*20 - (src[ 7]+src[10])*6 + (src[ 6]+src[11])*3 - (src[ 5]+src[12]);\ | |
1204 temp[ 9]= (src[ 9]+src[10])*20 - (src[ 8]+src[11])*6 + (src[ 7]+src[12])*3 - (src[ 6]+src[13]);\ | |
1205 temp[10]= (src[10]+src[11])*20 - (src[ 9]+src[12])*6 + (src[ 8]+src[13])*3 - (src[ 7]+src[14]);\ | |
1206 temp[11]= (src[11]+src[12])*20 - (src[10]+src[13])*6 + (src[ 9]+src[14])*3 - (src[ 8]+src[15]);\ | |
1207 temp[12]= (src[12]+src[13])*20 - (src[11]+src[14])*6 + (src[10]+src[15])*3 - (src[ 9]+src[16]);\ | |
1208 temp[13]= (src[13]+src[14])*20 - (src[12]+src[15])*6 + (src[11]+src[16])*3 - (src[10]+src[16]);\ | |
1209 temp[14]= (src[14]+src[15])*20 - (src[13]+src[16])*6 + (src[12]+src[16])*3 - (src[11]+src[15]);\ | |
1210 temp[15]= (src[15]+src[16])*20 - (src[14]+src[16])*6 + (src[13]+src[15])*3 - (src[12]+src[14]);\ | |
1211 asm volatile(\ | |
1212 "movq (%0), %%mm0 \n\t"\ | |
1213 "movq 8(%0), %%mm1 \n\t"\ | |
1214 "paddw %2, %%mm0 \n\t"\ | |
1215 "paddw %2, %%mm1 \n\t"\ | |
1216 "psraw $5, %%mm0 \n\t"\ | |
1217 "psraw $5, %%mm1 \n\t"\ | |
1218 "packuswb %%mm1, %%mm0 \n\t"\ | |
959 | 1219 OP_3DNOW(%%mm0, (%1), %%mm1, q)\ |
954 | 1220 "movq 16(%0), %%mm0 \n\t"\ |
1221 "movq 24(%0), %%mm1 \n\t"\ | |
1222 "paddw %2, %%mm0 \n\t"\ | |
1223 "paddw %2, %%mm1 \n\t"\ | |
1224 "psraw $5, %%mm0 \n\t"\ | |
1225 "psraw $5, %%mm1 \n\t"\ | |
1226 "packuswb %%mm1, %%mm0 \n\t"\ | |
959 | 1227 OP_3DNOW(%%mm0, 8(%1), %%mm1, q)\ |
954 | 1228 :: "r"(temp), "r"(dst), "m"(ROUNDER)\ |
966 | 1229 : "memory"\ |
954 | 1230 );\ |
1231 dst+=dstStride;\ | |
1232 src+=srcStride;\ | |
1233 }\ | |
1234 }\ | |
1235 \ | |
1057 | 1236 static void OPNAME ## mpeg4_qpel8_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ |
959 | 1237 uint64_t temp;\ |
1238 \ | |
1239 asm volatile(\ | |
1240 "pxor %%mm7, %%mm7 \n\t"\ | |
1241 "1: \n\t"\ | |
1242 "movq (%0), %%mm0 \n\t" /* ABCDEFGH */\ | |
1243 "movq %%mm0, %%mm1 \n\t" /* ABCDEFGH */\ | |
1244 "movq %%mm0, %%mm2 \n\t" /* ABCDEFGH */\ | |
1245 "punpcklbw %%mm7, %%mm0 \n\t" /* 0A0B0C0D */\ | |
1246 "punpckhbw %%mm7, %%mm1 \n\t" /* 0E0F0G0H */\ | |
1247 "pshufw $0x90, %%mm0, %%mm5 \n\t" /* 0A0A0B0C */\ | |
1248 "pshufw $0x41, %%mm0, %%mm6 \n\t" /* 0B0A0A0B */\ | |
1249 "movq %%mm2, %%mm3 \n\t" /* ABCDEFGH */\ | |
1250 "movq %%mm2, %%mm4 \n\t" /* ABCDEFGH */\ | |
1251 "psllq $8, %%mm2 \n\t" /* 0ABCDEFG */\ | |
1252 "psllq $16, %%mm3 \n\t" /* 00ABCDEF */\ | |
1253 "psllq $24, %%mm4 \n\t" /* 000ABCDE */\ | |
1254 "punpckhbw %%mm7, %%mm2 \n\t" /* 0D0E0F0G */\ | |
1255 "punpckhbw %%mm7, %%mm3 \n\t" /* 0C0D0E0F */\ | |
1256 "punpckhbw %%mm7, %%mm4 \n\t" /* 0B0C0D0E */\ | |
1257 "paddw %%mm3, %%mm5 \n\t" /* b */\ | |
1258 "paddw %%mm2, %%mm6 \n\t" /* c */\ | |
1259 "paddw %%mm5, %%mm5 \n\t" /* 2b */\ | |
1260 "psubw %%mm5, %%mm6 \n\t" /* c - 2b */\ | |
1261 "pshufw $0x06, %%mm0, %%mm5 \n\t" /* 0C0B0A0A */\ | |
961 | 1262 "pmullw "MANGLE(ff_pw_3)", %%mm6 \n\t" /* 3c - 6b */\ |
959 | 1263 "paddw %%mm4, %%mm0 \n\t" /* a */\ |
1264 "paddw %%mm1, %%mm5 \n\t" /* d */\ | |
961 | 1265 "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" /* 20a */\ |
959 | 1266 "psubw %%mm5, %%mm0 \n\t" /* 20a - d */\ |
961 | 1267 "paddw %6, %%mm6 \n\t"\ |
959 | 1268 "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\ |
1269 "psraw $5, %%mm0 \n\t"\ | |
1270 /* mm1=EFGH, mm2=DEFG, mm3=CDEF, mm4=BCDE, mm7=0 */\ | |
1271 \ | |
1272 "movd 5(%0), %%mm5 \n\t" /* FGHI */\ | |
1273 "punpcklbw %%mm7, %%mm5 \n\t" /* 0F0G0H0I */\ | |
1274 "pshufw $0xF9, %%mm5, %%mm6 \n\t" /* 0G0H0I0I */\ | |
1275 "paddw %%mm5, %%mm1 \n\t" /* a */\ | |
1276 "paddw %%mm6, %%mm2 \n\t" /* b */\ | |
1277 "pshufw $0xBE, %%mm5, %%mm6 \n\t" /* 0H0I0I0H */\ | |
1278 "pshufw $0x6F, %%mm5, %%mm5 \n\t" /* 0I0I0H0G */\ | |
1279 "paddw %%mm6, %%mm3 \n\t" /* c */\ | |
1280 "paddw %%mm5, %%mm4 \n\t" /* d */\ | |
1281 "paddw %%mm2, %%mm2 \n\t" /* 2b */\ | |
1282 "psubw %%mm2, %%mm3 \n\t" /* c - 2b */\ | |
961 | 1283 "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" /* 20a */\ |
1284 "pmullw "MANGLE(ff_pw_3)", %%mm3 \n\t" /* 3c - 6b */\ | |
959 | 1285 "psubw %%mm4, %%mm3 \n\t" /* -6b + 3c - d */\ |
961 | 1286 "paddw %6, %%mm1 \n\t"\ |
959 | 1287 "paddw %%mm1, %%mm3 \n\t" /* 20a - 6b + 3c - d */\ |
1288 "psraw $5, %%mm3 \n\t"\ | |
1289 "packuswb %%mm3, %%mm0 \n\t"\ | |
1290 OP_MMX2(%%mm0, (%1), %%mm4, q)\ | |
1291 \ | |
1292 "addl %3, %0 \n\t"\ | |
1293 "addl %4, %1 \n\t"\ | |
1294 "decl %2 \n\t"\ | |
961 | 1295 " jnz 1b \n\t"\ |
967 | 1296 : "+a"(src), "+c"(dst), "+m"(h)\ |
966 | 1297 : "S"(srcStride), "D"(dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(temp), "m"(ROUNDER)\ |
1298 : "memory"\ | |
959 | 1299 );\ |
1300 }\ | |
1301 \ | |
1302 static void OPNAME ## mpeg4_qpel8_h_lowpass_3dnow(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ | |
1303 int i;\ | |
1304 int16_t temp[8];\ | |
1305 /* quick HACK, XXX FIXME MUST be optimized */\ | |
1306 for(i=0; i<h; i++)\ | |
1307 {\ | |
1308 temp[ 0]= (src[ 0]+src[ 1])*20 - (src[ 0]+src[ 2])*6 + (src[ 1]+src[ 3])*3 - (src[ 2]+src[ 4]);\ | |
1309 temp[ 1]= (src[ 1]+src[ 2])*20 - (src[ 0]+src[ 3])*6 + (src[ 0]+src[ 4])*3 - (src[ 1]+src[ 5]);\ | |
1310 temp[ 2]= (src[ 2]+src[ 3])*20 - (src[ 1]+src[ 4])*6 + (src[ 0]+src[ 5])*3 - (src[ 0]+src[ 6]);\ | |
1311 temp[ 3]= (src[ 3]+src[ 4])*20 - (src[ 2]+src[ 5])*6 + (src[ 1]+src[ 6])*3 - (src[ 0]+src[ 7]);\ | |
1312 temp[ 4]= (src[ 4]+src[ 5])*20 - (src[ 3]+src[ 6])*6 + (src[ 2]+src[ 7])*3 - (src[ 1]+src[ 8]);\ | |
1313 temp[ 5]= (src[ 5]+src[ 6])*20 - (src[ 4]+src[ 7])*6 + (src[ 3]+src[ 8])*3 - (src[ 2]+src[ 8]);\ | |
1314 temp[ 6]= (src[ 6]+src[ 7])*20 - (src[ 5]+src[ 8])*6 + (src[ 4]+src[ 8])*3 - (src[ 3]+src[ 7]);\ | |
1315 temp[ 7]= (src[ 7]+src[ 8])*20 - (src[ 6]+src[ 8])*6 + (src[ 5]+src[ 7])*3 - (src[ 4]+src[ 6]);\ | |
1316 asm volatile(\ | |
1317 "movq (%0), %%mm0 \n\t"\ | |
1318 "movq 8(%0), %%mm1 \n\t"\ | |
1319 "paddw %2, %%mm0 \n\t"\ | |
1320 "paddw %2, %%mm1 \n\t"\ | |
1321 "psraw $5, %%mm0 \n\t"\ | |
1322 "psraw $5, %%mm1 \n\t"\ | |
1323 "packuswb %%mm1, %%mm0 \n\t"\ | |
1324 OP_3DNOW(%%mm0, (%1), %%mm1, q)\ | |
1325 :: "r"(temp), "r"(dst), "m"(ROUNDER)\ | |
966 | 1326 :"memory"\ |
959 | 1327 );\ |
1328 dst+=dstStride;\ | |
1329 src+=srcStride;\ | |
1330 }\ | |
1331 } | |
1332 | |
1333 #define QPEL_OP(OPNAME, ROUNDER, RND, OP, MMX)\ | |
1334 \ | |
1335 static void OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ | |
954 | 1336 uint64_t temp[17*4];\ |
1337 uint64_t *temp_ptr= temp;\ | |
1338 int count= 17;\ | |
1339 \ | |
1340 /*FIXME unroll */\ | |
1341 asm volatile(\ | |
1342 "pxor %%mm7, %%mm7 \n\t"\ | |
1343 "1: \n\t"\ | |
1344 "movq (%0), %%mm0 \n\t"\ | |
1345 "movq (%0), %%mm1 \n\t"\ | |
1346 "movq 8(%0), %%mm2 \n\t"\ | |
1347 "movq 8(%0), %%mm3 \n\t"\ | |
1348 "punpcklbw %%mm7, %%mm0 \n\t"\ | |
1349 "punpckhbw %%mm7, %%mm1 \n\t"\ | |
1350 "punpcklbw %%mm7, %%mm2 \n\t"\ | |
1351 "punpckhbw %%mm7, %%mm3 \n\t"\ | |
1352 "movq %%mm0, (%1) \n\t"\ | |
1353 "movq %%mm1, 17*8(%1) \n\t"\ | |
967 | 1354 "movq %%mm2, 2*17*8(%1) \n\t"\ |
1355 "movq %%mm3, 3*17*8(%1) \n\t"\ | |
954 | 1356 "addl $8, %1 \n\t"\ |
1357 "addl %3, %0 \n\t"\ | |
1358 "decl %2 \n\t"\ | |
1359 " jnz 1b \n\t"\ | |
1360 : "+r" (src), "+r" (temp_ptr), "+r"(count)\ | |
967 | 1361 : "r" (srcStride)\ |
966 | 1362 : "memory"\ |
954 | 1363 );\ |
1364 \ | |
1365 temp_ptr= temp;\ | |
1366 count=4;\ | |
1367 \ | |
1368 /*FIXME reorder for speed */\ | |
1369 asm volatile(\ | |
1370 /*"pxor %%mm7, %%mm7 \n\t"*/\ | |
1371 "1: \n\t"\ | |
1372 "movq (%0), %%mm0 \n\t"\ | |
1373 "movq 8(%0), %%mm1 \n\t"\ | |
1374 "movq 16(%0), %%mm2 \n\t"\ | |
1375 "movq 24(%0), %%mm3 \n\t"\ | |
961 | 1376 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 16(%0), 8(%0), (%0), 32(%0), (%1), OP)\ |
1377 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 8(%0), (%0), (%0), 40(%0), (%1, %3), OP)\ | |
954 | 1378 "addl %4, %1 \n\t"\ |
961 | 1379 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, (%0), (%0), 8(%0), 48(%0), (%1), OP)\ |
954 | 1380 \ |
961 | 1381 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, (%0), 8(%0), 16(%0), 56(%0), (%1, %3), OP)\ |
954 | 1382 "addl %4, %1 \n\t"\ |
961 | 1383 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 8(%0), 16(%0), 24(%0), 64(%0), (%1), OP)\ |
1384 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 72(%0), (%1, %3), OP)\ | |
954 | 1385 "addl %4, %1 \n\t"\ |
961 | 1386 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 24(%0), 32(%0), 40(%0), 80(%0), (%1), OP)\ |
1387 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 88(%0), (%1, %3), OP)\ | |
954 | 1388 "addl %4, %1 \n\t"\ |
961 | 1389 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 40(%0), 48(%0), 56(%0), 96(%0), (%1), OP)\ |
1390 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 48(%0), 56(%0), 64(%0),104(%0), (%1, %3), OP)\ | |
954 | 1391 "addl %4, %1 \n\t"\ |
961 | 1392 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 56(%0), 64(%0), 72(%0),112(%0), (%1), OP)\ |
1393 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 64(%0), 72(%0), 80(%0),120(%0), (%1, %3), OP)\ | |
954 | 1394 "addl %4, %1 \n\t"\ |
961 | 1395 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 72(%0), 80(%0), 88(%0),128(%0), (%1), OP)\ |
954 | 1396 \ |
961 | 1397 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 80(%0), 88(%0), 96(%0),128(%0), (%1, %3), OP)\ |
954 | 1398 "addl %4, %1 \n\t" \ |
961 | 1399 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 88(%0), 96(%0),104(%0),120(%0), (%1), OP)\ |
1400 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 96(%0),104(%0),112(%0),112(%0), (%1, %3), OP)\ | |
954 | 1401 \ |
1402 "addl $136, %0 \n\t"\ | |
961 | 1403 "addl %6, %1 \n\t"\ |
954 | 1404 "decl %2 \n\t"\ |
1405 " jnz 1b \n\t"\ | |
958
9bb668034ecf
slowdown / gcc 2.95.* bug workaround (this should be reversed as soon as gcc 2.95.* support is droped)
michaelni
parents:
954
diff
changeset
|
1406 \ |
967 | 1407 : "+r"(temp_ptr), "+r"(dst), "+g"(count)\ |
961 | 1408 : "r"(dstStride), "r"(2*dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER), "g"(4-14*dstStride)\ |
966 | 1409 :"memory"\ |
954 | 1410 );\ |
1411 }\ | |
1412 \ | |
1057 | 1413 static void OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ |
954 | 1414 uint64_t temp[9*4];\ |
1415 uint64_t *temp_ptr= temp;\ | |
1416 int count= 9;\ | |
1417 \ | |
1418 /*FIXME unroll */\ | |
1419 asm volatile(\ | |
1420 "pxor %%mm7, %%mm7 \n\t"\ | |
1421 "1: \n\t"\ | |
1422 "movq (%0), %%mm0 \n\t"\ | |
1423 "movq (%0), %%mm1 \n\t"\ | |
1424 "punpcklbw %%mm7, %%mm0 \n\t"\ | |
1425 "punpckhbw %%mm7, %%mm1 \n\t"\ | |
1426 "movq %%mm0, (%1) \n\t"\ | |
1427 "movq %%mm1, 9*8(%1) \n\t"\ | |
1428 "addl $8, %1 \n\t"\ | |
1429 "addl %3, %0 \n\t"\ | |
1430 "decl %2 \n\t"\ | |
1431 " jnz 1b \n\t"\ | |
1432 : "+r" (src), "+r" (temp_ptr), "+r"(count)\ | |
1433 : "r" (srcStride)\ | |
966 | 1434 : "memory"\ |
954 | 1435 );\ |
1436 \ | |
1437 temp_ptr= temp;\ | |
1438 count=2;\ | |
1439 \ | |
1440 /*FIXME reorder for speed */\ | |
1441 asm volatile(\ | |
1442 /*"pxor %%mm7, %%mm7 \n\t"*/\ | |
1443 "1: \n\t"\ | |
1444 "movq (%0), %%mm0 \n\t"\ | |
1445 "movq 8(%0), %%mm1 \n\t"\ | |
1446 "movq 16(%0), %%mm2 \n\t"\ | |
1447 "movq 24(%0), %%mm3 \n\t"\ | |
961 | 1448 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 16(%0), 8(%0), (%0), 32(%0), (%1), OP)\ |
1449 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 8(%0), (%0), (%0), 40(%0), (%1, %3), OP)\ | |
954 | 1450 "addl %4, %1 \n\t"\ |
961 | 1451 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, (%0), (%0), 8(%0), 48(%0), (%1), OP)\ |
954 | 1452 \ |
961 | 1453 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, (%0), 8(%0), 16(%0), 56(%0), (%1, %3), OP)\ |
954 | 1454 "addl %4, %1 \n\t"\ |
961 | 1455 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 8(%0), 16(%0), 24(%0), 64(%0), (%1), OP)\ |
954 | 1456 \ |
961 | 1457 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 64(%0), (%1, %3), OP)\ |
954 | 1458 "addl %4, %1 \n\t"\ |
961 | 1459 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 24(%0), 32(%0), 40(%0), 56(%0), (%1), OP)\ |
1460 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 48(%0), (%1, %3), OP)\ | |
954 | 1461 \ |
1462 "addl $72, %0 \n\t"\ | |
961 | 1463 "addl %6, %1 \n\t"\ |
954 | 1464 "decl %2 \n\t"\ |
1465 " jnz 1b \n\t"\ | |
1466 \ | |
961 | 1467 : "+r"(temp_ptr), "+r"(dst), "+g"(count)\ |
1468 : "r"(dstStride), "r"(2*dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER), "g"(4-6*dstStride)\ | |
966 | 1469 : "memory"\ |
1470 );\ | |
959 | 1471 }\ |
954 | 1472 \ |
1064 | 1473 static void OPNAME ## qpel8_mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\ |
959 | 1474 OPNAME ## pixels8_mmx(dst, src, stride, 8);\ |
954 | 1475 }\ |
1476 \ | |
1064 | 1477 static void OPNAME ## qpel8_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1478 uint64_t temp[8];\ |
954 | 1479 uint8_t * const half= (uint8_t*)temp;\ |
1480 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, stride, 8);\ | |
1481 OPNAME ## pixels8_l2_mmx(dst, src, half, stride, stride, 8);\ | |
1482 }\ | |
1483 \ | |
1064 | 1484 static void OPNAME ## qpel8_mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1485 OPNAME ## mpeg4_qpel8_h_lowpass_ ## MMX(dst, src, stride, stride, 8);\ |
1486 }\ | |
1487 \ | |
1064 | 1488 static void OPNAME ## qpel8_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1489 uint64_t temp[8];\ |
954 | 1490 uint8_t * const half= (uint8_t*)temp;\ |
1491 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, stride, 8);\ | |
1492 OPNAME ## pixels8_l2_mmx(dst, src+1, half, stride, stride, 8);\ | |
1493 }\ | |
1494 \ | |
1064 | 1495 static void OPNAME ## qpel8_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1496 uint64_t temp[8];\ |
954 | 1497 uint8_t * const half= (uint8_t*)temp;\ |
959 | 1498 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride);\ |
954 | 1499 OPNAME ## pixels8_l2_mmx(dst, src, half, stride, stride, 8);\ |
1500 }\ | |
1501 \ | |
1064 | 1502 static void OPNAME ## qpel8_mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
959 | 1503 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, src, stride, stride);\ |
954 | 1504 }\ |
1505 \ | |
1064 | 1506 static void OPNAME ## qpel8_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1507 uint64_t temp[8];\ |
954 | 1508 uint8_t * const half= (uint8_t*)temp;\ |
959 | 1509 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride);\ |
954 | 1510 OPNAME ## pixels8_l2_mmx(dst, src+stride, half, stride, stride, 8);\ |
1511 }\ | |
1064 | 1512 static void OPNAME ## qpel8_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1513 uint64_t half[8 + 9];\ |
1514 uint8_t * const halfH= ((uint8_t*)half) + 64;\ | |
1515 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 1516 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ |
984 | 1517 put ## RND ## pixels8_l2_mmx(halfH, src, halfH, 8, stride, 9);\ |
959 | 1518 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ |
984 | 1519 OPNAME ## pixels8_l2_mmx(dst, halfH, halfHV, stride, 8, 8);\ |
954 | 1520 }\ |
1064 | 1521 static void OPNAME ## qpel8_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1522 uint64_t half[8 + 9];\ |
1523 uint8_t * const halfH= ((uint8_t*)half) + 64;\ | |
1524 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 1525 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ |
984 | 1526 put ## RND ## pixels8_l2_mmx(halfH, src+1, halfH, 8, stride, 9);\ |
959 | 1527 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ |
984 | 1528 OPNAME ## pixels8_l2_mmx(dst, halfH, halfHV, stride, 8, 8);\ |
954 | 1529 }\ |
1064 | 1530 static void OPNAME ## qpel8_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1531 uint64_t half[8 + 9];\ |
1532 uint8_t * const halfH= ((uint8_t*)half) + 64;\ | |
1533 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 1534 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ |
984 | 1535 put ## RND ## pixels8_l2_mmx(halfH, src, halfH, 8, stride, 9);\ |
959 | 1536 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ |
984 | 1537 OPNAME ## pixels8_l2_mmx(dst, halfH+8, halfHV, stride, 8, 8);\ |
954 | 1538 }\ |
1064 | 1539 static void OPNAME ## qpel8_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1540 uint64_t half[8 + 9];\ |
1541 uint8_t * const halfH= ((uint8_t*)half) + 64;\ | |
1542 uint8_t * const halfHV= ((uint8_t*)half);\ | |
1543 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ | |
1544 put ## RND ## pixels8_l2_mmx(halfH, src+1, halfH, 8, stride, 9);\ | |
959 | 1545 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ |
984 | 1546 OPNAME ## pixels8_l2_mmx(dst, halfH+8, halfHV, stride, 8, 8);\ |
954 | 1547 }\ |
1064 | 1548 static void OPNAME ## qpel8_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1549 uint64_t half[8 + 9];\ |
954 | 1550 uint8_t * const halfH= ((uint8_t*)half) + 64;\ |
1551 uint8_t * const halfHV= ((uint8_t*)half);\ | |
1552 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ | |
959 | 1553 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ |
954 | 1554 OPNAME ## pixels8_l2_mmx(dst, halfH, halfHV, stride, 8, 8);\ |
1555 }\ | |
1064 | 1556 static void OPNAME ## qpel8_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1557 uint64_t half[8 + 9];\ |
954 | 1558 uint8_t * const halfH= ((uint8_t*)half) + 64;\ |
1559 uint8_t * const halfHV= ((uint8_t*)half);\ | |
1560 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ | |
959 | 1561 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ |
954 | 1562 OPNAME ## pixels8_l2_mmx(dst, halfH+8, halfHV, stride, 8, 8);\ |
1563 }\ | |
1064 | 1564 static void OPNAME ## qpel8_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1565 uint64_t half[8 + 9];\ |
1566 uint8_t * const halfH= ((uint8_t*)half);\ | |
954 | 1567 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ |
984 | 1568 put ## RND ## pixels8_l2_mmx(halfH, src, halfH, 8, stride, 9);\ |
1569 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\ | |
954 | 1570 }\ |
1064 | 1571 static void OPNAME ## qpel8_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1572 uint64_t half[8 + 9];\ |
1573 uint8_t * const halfH= ((uint8_t*)half);\ | |
954 | 1574 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ |
984 | 1575 put ## RND ## pixels8_l2_mmx(halfH, src+1, halfH, 8, stride, 9);\ |
1576 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\ | |
954 | 1577 }\ |
1064 | 1578 static void OPNAME ## qpel8_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1579 uint64_t half[9];\ |
954 | 1580 uint8_t * const halfH= ((uint8_t*)half);\ |
1581 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ | |
959 | 1582 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\ |
954 | 1583 }\ |
1064 | 1584 static void OPNAME ## qpel16_mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\ |
959 | 1585 OPNAME ## pixels16_mmx(dst, src, stride, 16);\ |
954 | 1586 }\ |
1587 \ | |
1064 | 1588 static void OPNAME ## qpel16_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1589 uint64_t temp[32];\ |
1590 uint8_t * const half= (uint8_t*)temp;\ | |
1591 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, stride, 16);\ | |
1592 OPNAME ## pixels16_l2_mmx(dst, src, half, stride, stride, 16);\ | |
1593 }\ | |
1594 \ | |
1064 | 1595 static void OPNAME ## qpel16_mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1596 OPNAME ## mpeg4_qpel16_h_lowpass_ ## MMX(dst, src, stride, stride, 16);\ |
1597 }\ | |
1598 \ | |
1064 | 1599 static void OPNAME ## qpel16_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1600 uint64_t temp[32];\ |
1601 uint8_t * const half= (uint8_t*)temp;\ | |
1602 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, stride, 16);\ | |
1603 OPNAME ## pixels16_l2_mmx(dst, src+1, half, stride, stride, 16);\ | |
1604 }\ | |
1605 \ | |
1064 | 1606 static void OPNAME ## qpel16_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1607 uint64_t temp[32];\ |
1608 uint8_t * const half= (uint8_t*)temp;\ | |
959 | 1609 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, stride);\ |
954 | 1610 OPNAME ## pixels16_l2_mmx(dst, src, half, stride, stride, 16);\ |
1611 }\ | |
1612 \ | |
1064 | 1613 static void OPNAME ## qpel16_mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
959 | 1614 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, src, stride, stride);\ |
954 | 1615 }\ |
1616 \ | |
1064 | 1617 static void OPNAME ## qpel16_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1618 uint64_t temp[32];\ |
1619 uint8_t * const half= (uint8_t*)temp;\ | |
959 | 1620 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, stride);\ |
954 | 1621 OPNAME ## pixels16_l2_mmx(dst, src+stride, half, stride, stride, 16);\ |
1622 }\ | |
1064 | 1623 static void OPNAME ## qpel16_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1624 uint64_t half[16*2 + 17*2];\ |
1625 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
1626 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 1627 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ |
984 | 1628 put ## RND ## pixels16_l2_mmx(halfH, src, halfH, 16, stride, 17);\ |
959 | 1629 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ |
984 | 1630 OPNAME ## pixels16_l2_mmx(dst, halfH, halfHV, stride, 16, 16);\ |
954 | 1631 }\ |
1064 | 1632 static void OPNAME ## qpel16_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1633 uint64_t half[16*2 + 17*2];\ |
1634 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
1635 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 1636 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ |
984 | 1637 put ## RND ## pixels16_l2_mmx(halfH, src+1, halfH, 16, stride, 17);\ |
959 | 1638 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ |
984 | 1639 OPNAME ## pixels16_l2_mmx(dst, halfH, halfHV, stride, 16, 16);\ |
954 | 1640 }\ |
1064 | 1641 static void OPNAME ## qpel16_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1642 uint64_t half[16*2 + 17*2];\ |
1643 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
1644 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 1645 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ |
984 | 1646 put ## RND ## pixels16_l2_mmx(halfH, src, halfH, 16, stride, 17);\ |
959 | 1647 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ |
984 | 1648 OPNAME ## pixels16_l2_mmx(dst, halfH+16, halfHV, stride, 16, 16);\ |
954 | 1649 }\ |
1064 | 1650 static void OPNAME ## qpel16_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1651 uint64_t half[16*2 + 17*2];\ |
1652 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
1653 uint8_t * const halfHV= ((uint8_t*)half);\ | |
1654 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ | |
1655 put ## RND ## pixels16_l2_mmx(halfH, src+1, halfH, 16, stride, 17);\ | |
959 | 1656 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ |
984 | 1657 OPNAME ## pixels16_l2_mmx(dst, halfH+16, halfHV, stride, 16, 16);\ |
954 | 1658 }\ |
1064 | 1659 static void OPNAME ## qpel16_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1660 uint64_t half[16*2 + 17*2];\ |
1661 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
1662 uint8_t * const halfHV= ((uint8_t*)half);\ | |
1663 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ | |
959 | 1664 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ |
954 | 1665 OPNAME ## pixels16_l2_mmx(dst, halfH, halfHV, stride, 16, 16);\ |
1666 }\ | |
1064 | 1667 static void OPNAME ## qpel16_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1668 uint64_t half[16*2 + 17*2];\ |
1669 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
1670 uint8_t * const halfHV= ((uint8_t*)half);\ | |
1671 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ | |
959 | 1672 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ |
954 | 1673 OPNAME ## pixels16_l2_mmx(dst, halfH+16, halfHV, stride, 16, 16);\ |
1674 }\ | |
1064 | 1675 static void OPNAME ## qpel16_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1676 uint64_t half[17*2];\ |
1677 uint8_t * const halfH= ((uint8_t*)half);\ | |
954 | 1678 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ |
984 | 1679 put ## RND ## pixels16_l2_mmx(halfH, src, halfH, 16, stride, 17);\ |
1680 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\ | |
954 | 1681 }\ |
1064 | 1682 static void OPNAME ## qpel16_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1683 uint64_t half[17*2];\ |
1684 uint8_t * const halfH= ((uint8_t*)half);\ | |
954 | 1685 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ |
984 | 1686 put ## RND ## pixels16_l2_mmx(halfH, src+1, halfH, 16, stride, 17);\ |
1687 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\ | |
954 | 1688 }\ |
1064 | 1689 static void OPNAME ## qpel16_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1690 uint64_t half[17*2];\ |
1691 uint8_t * const halfH= ((uint8_t*)half);\ | |
1692 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ | |
959 | 1693 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\ |
954 | 1694 } |
1695 | |
1696 | |
1697 #define PUT_OP(a,b,temp, size) "mov" #size " " #a ", " #b " \n\t" | |
959 | 1698 #define AVG_3DNOW_OP(a,b,temp, size) \ |
954 | 1699 "mov" #size " " #b ", " #temp " \n\t"\ |
1700 "pavgusb " #temp ", " #a " \n\t"\ | |
1701 "mov" #size " " #a ", " #b " \n\t" | |
959 | 1702 #define AVG_MMX2_OP(a,b,temp, size) \ |
954 | 1703 "mov" #size " " #b ", " #temp " \n\t"\ |
1704 "pavgb " #temp ", " #a " \n\t"\ | |
1705 "mov" #size " " #a ", " #b " \n\t" | |
959 | 1706 |
1707 QPEL_BASE(put_ , ff_pw_16, _ , PUT_OP, PUT_OP) | |
1708 QPEL_BASE(avg_ , ff_pw_16, _ , AVG_MMX2_OP, AVG_3DNOW_OP) | |
1709 QPEL_BASE(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, PUT_OP) | |
1710 QPEL_OP(put_ , ff_pw_16, _ , PUT_OP, 3dnow) | |
1711 QPEL_OP(avg_ , ff_pw_16, _ , AVG_3DNOW_OP, 3dnow) | |
1712 QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, 3dnow) | |
954 | 1713 QPEL_OP(put_ , ff_pw_16, _ , PUT_OP, mmx2) |
959 | 1714 QPEL_OP(avg_ , ff_pw_16, _ , AVG_MMX2_OP, mmx2) |
954 | 1715 QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, mmx2) |
1716 | |
393 | 1717 #if 0 |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1718 static void just_return() { return; } |
393 | 1719 #endif |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1720 |
954 | 1721 #define SET_QPEL_FUNC(postfix1, postfix2) \ |
1722 c->put_ ## postfix1 = put_ ## postfix2;\ | |
1723 c->put_no_rnd_ ## postfix1 = put_no_rnd_ ## postfix2;\ | |
1724 c->avg_ ## postfix1 = avg_ ## postfix2; | |
1092 | 1725 |
1726 /* external functions, from idct_mmx.c */ | |
1727 void ff_mmx_idct(DCTELEM *block); | |
1728 void ff_mmxext_idct(DCTELEM *block); | |
1729 | |
1730 /* XXX: those functions should be suppressed ASAP when all IDCTs are | |
1731 converted */ | |
1732 static void ff_libmpeg2mmx_idct_put(uint8_t *dest, int line_size, DCTELEM *block) | |
1733 { | |
1734 ff_mmx_idct (block); | |
1735 put_pixels_clamped_mmx(block, dest, line_size); | |
1736 } | |
1737 static void ff_libmpeg2mmx_idct_add(uint8_t *dest, int line_size, DCTELEM *block) | |
1738 { | |
1739 ff_mmx_idct (block); | |
1740 add_pixels_clamped_mmx(block, dest, line_size); | |
1741 } | |
1742 static void ff_libmpeg2mmx2_idct_put(uint8_t *dest, int line_size, DCTELEM *block) | |
1743 { | |
1744 ff_mmxext_idct (block); | |
1745 put_pixels_clamped_mmx(block, dest, line_size); | |
1746 } | |
1747 static void ff_libmpeg2mmx2_idct_add(uint8_t *dest, int line_size, DCTELEM *block) | |
1748 { | |
1749 ff_mmxext_idct (block); | |
1750 add_pixels_clamped_mmx(block, dest, line_size); | |
1751 } | |
954 | 1752 |
1092 | 1753 void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) |
0 | 1754 { |
1755 mm_flags = mm_support(); | |
1115 | 1756 |
1122 | 1757 if (avctx->dsp_mask) { |
1758 if (avctx->dsp_mask & FF_MM_FORCE) | |
1759 mm_flags |= (avctx->dsp_mask & 0xffff); | |
1760 else | |
1761 mm_flags &= ~(avctx->dsp_mask & 0xffff); | |
1762 } | |
1115 | 1763 |
631
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
1764 #if 0 |
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
1765 fprintf(stderr, "libavcodec: CPU flags:"); |
0 | 1766 if (mm_flags & MM_MMX) |
631
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
1767 fprintf(stderr, " mmx"); |
0 | 1768 if (mm_flags & MM_MMXEXT) |
631
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
1769 fprintf(stderr, " mmxext"); |
0 | 1770 if (mm_flags & MM_3DNOW) |
631
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
1771 fprintf(stderr, " 3dnow"); |
0 | 1772 if (mm_flags & MM_SSE) |
631
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
1773 fprintf(stderr, " sse"); |
0 | 1774 if (mm_flags & MM_SSE2) |
631
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
1775 fprintf(stderr, " sse2"); |
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
1776 fprintf(stderr, "\n"); |
0 | 1777 #endif |
1778 | |
1779 if (mm_flags & MM_MMX) { | |
1092 | 1780 const int dct_algo = avctx->dct_algo; |
1781 const int idct_algo= avctx->idct_algo; | |
1782 | |
1232
e88d3b1fb2a1
more #ifdef CONFIG_ENCODERS by (Wolfgang Hesseler <qv at multimediaware dot com>)
michaelni
parents:
1186
diff
changeset
|
1783 #ifdef CONFIG_ENCODERS |
1565 | 1784 if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){ |
1785 if(mm_flags & MM_MMXEXT){ | |
1786 c->fdct = ff_fdct_mmx2; | |
1787 }else{ | |
1788 c->fdct = ff_fdct_mmx; | |
1789 } | |
1790 } | |
1232
e88d3b1fb2a1
more #ifdef CONFIG_ENCODERS by (Wolfgang Hesseler <qv at multimediaware dot com>)
michaelni
parents:
1186
diff
changeset
|
1791 #endif //CONFIG_ENCODERS |
1092 | 1792 |
1793 if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SIMPLEMMX){ | |
1794 c->idct_put= ff_simple_idct_put_mmx; | |
1795 c->idct_add= ff_simple_idct_add_mmx; | |
1324
7d328fd9d8a5
the return of the idct with 16bit output by ("Ivan Kalvachev" <ivan at cacad dot com>)
michaelni
parents:
1232
diff
changeset
|
1796 c->idct = ff_simple_idct_mmx; |
1092 | 1797 c->idct_permutation_type= FF_SIMPLE_IDCT_PERM; |
1798 }else if(idct_algo==FF_IDCT_LIBMPEG2MMX){ | |
1799 if(mm_flags & MM_MMXEXT){ | |
1800 c->idct_put= ff_libmpeg2mmx2_idct_put; | |
1801 c->idct_add= ff_libmpeg2mmx2_idct_add; | |
1324
7d328fd9d8a5
the return of the idct with 16bit output by ("Ivan Kalvachev" <ivan at cacad dot com>)
michaelni
parents:
1232
diff
changeset
|
1802 c->idct = ff_mmxext_idct; |
1092 | 1803 }else{ |
1804 c->idct_put= ff_libmpeg2mmx_idct_put; | |
1805 c->idct_add= ff_libmpeg2mmx_idct_add; | |
1324
7d328fd9d8a5
the return of the idct with 16bit output by ("Ivan Kalvachev" <ivan at cacad dot com>)
michaelni
parents:
1232
diff
changeset
|
1806 c->idct = ff_mmx_idct; |
1092 | 1807 } |
1808 c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; | |
1809 } | |
1810 | |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
1811 #ifdef CONFIG_ENCODERS |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1812 c->get_pixels = get_pixels_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1813 c->diff_pixels = diff_pixels_mmx; |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
1814 #endif //CONFIG_ENCODERS |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1815 c->put_pixels_clamped = put_pixels_clamped_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1816 c->add_pixels_clamped = add_pixels_clamped_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1817 c->clear_blocks = clear_blocks_mmx; |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
1818 #ifdef CONFIG_ENCODERS |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1819 c->pix_sum = pix_sum16_mmx; |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
1820 #endif //CONFIG_ENCODERS |
415 | 1821 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1822 c->put_pixels_tab[0][0] = put_pixels16_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1823 c->put_pixels_tab[0][1] = put_pixels16_x2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1824 c->put_pixels_tab[0][2] = put_pixels16_y2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1825 c->put_pixels_tab[0][3] = put_pixels16_xy2_mmx; |
0 | 1826 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1827 c->put_no_rnd_pixels_tab[0][0] = put_pixels16_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1828 c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1829 c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1830 c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_mmx; |
651 | 1831 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1832 c->avg_pixels_tab[0][0] = avg_pixels16_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1833 c->avg_pixels_tab[0][1] = avg_pixels16_x2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1834 c->avg_pixels_tab[0][2] = avg_pixels16_y2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1835 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx; |
415 | 1836 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1837 c->avg_no_rnd_pixels_tab[0][0] = avg_no_rnd_pixels16_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1838 c->avg_no_rnd_pixels_tab[0][1] = avg_no_rnd_pixels16_x2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1839 c->avg_no_rnd_pixels_tab[0][2] = avg_no_rnd_pixels16_y2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1840 c->avg_no_rnd_pixels_tab[0][3] = avg_no_rnd_pixels16_xy2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1841 |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1842 c->put_pixels_tab[1][0] = put_pixels8_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1843 c->put_pixels_tab[1][1] = put_pixels8_x2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1844 c->put_pixels_tab[1][2] = put_pixels8_y2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1845 c->put_pixels_tab[1][3] = put_pixels8_xy2_mmx; |
0 | 1846 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1847 c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1848 c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1849 c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1850 c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_mmx; |
651 | 1851 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1852 c->avg_pixels_tab[1][0] = avg_pixels8_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1853 c->avg_pixels_tab[1][1] = avg_pixels8_x2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1854 c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1855 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx; |
651 | 1856 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1857 c->avg_no_rnd_pixels_tab[1][0] = avg_no_rnd_pixels8_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1858 c->avg_no_rnd_pixels_tab[1][1] = avg_no_rnd_pixels8_x2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1859 c->avg_no_rnd_pixels_tab[1][2] = avg_no_rnd_pixels8_y2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1860 c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy2_mmx; |
954 | 1861 |
866 | 1862 c->add_bytes= add_bytes_mmx; |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
1863 #ifdef CONFIG_ENCODERS |
866 | 1864 c->diff_bytes= diff_bytes_mmx; |
936 | 1865 |
1866 c->hadamard8_diff[0]= hadamard8_diff16_mmx; | |
1867 c->hadamard8_diff[1]= hadamard8_diff_mmx; | |
1868 | |
997
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
1869 c->pix_norm1 = pix_norm1_mmx; |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
1870 c->sse[0] = sse16_mmx; |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
1871 #endif //CONFIG_ENCODERS |
1647 | 1872 |
1873 c->h263_v_loop_filter= h263_v_loop_filter_mmx; | |
1648 | 1874 c->h263_h_loop_filter= h263_h_loop_filter_mmx; |
936 | 1875 |
0 | 1876 if (mm_flags & MM_MMXEXT) { |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1877 c->put_pixels_tab[0][1] = put_pixels16_x2_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1878 c->put_pixels_tab[0][2] = put_pixels16_y2_mmx2; |
651 | 1879 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1880 c->avg_pixels_tab[0][0] = avg_pixels16_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1881 c->avg_pixels_tab[0][1] = avg_pixels16_x2_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1882 c->avg_pixels_tab[0][2] = avg_pixels16_y2_mmx2; |
415 | 1883 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1884 c->put_pixels_tab[1][1] = put_pixels8_x2_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1885 c->put_pixels_tab[1][2] = put_pixels8_y2_mmx2; |
651 | 1886 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1887 c->avg_pixels_tab[1][0] = avg_pixels8_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1888 c->avg_pixels_tab[1][1] = avg_pixels8_x2_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1889 c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx2; |
1092 | 1890 |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
1891 #ifdef CONFIG_ENCODERS |
1153 | 1892 c->hadamard8_diff[0]= hadamard8_diff16_mmx2; |
1893 c->hadamard8_diff[1]= hadamard8_diff_mmx2; | |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
1894 #endif //CONFIG_ENCODERS |
1153 | 1895 |
1092 | 1896 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ |
1897 c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx2; | |
1898 c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmx2; | |
1899 c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx2; | |
1900 c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx2; | |
1901 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx2; | |
1902 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx2; | |
1903 } | |
959 | 1904 |
961 | 1905 #if 1 |
954 | 1906 SET_QPEL_FUNC(qpel_pixels_tab[0][ 0], qpel16_mc00_mmx2) |
1907 SET_QPEL_FUNC(qpel_pixels_tab[0][ 1], qpel16_mc10_mmx2) | |
1908 SET_QPEL_FUNC(qpel_pixels_tab[0][ 2], qpel16_mc20_mmx2) | |
1909 SET_QPEL_FUNC(qpel_pixels_tab[0][ 3], qpel16_mc30_mmx2) | |
1910 SET_QPEL_FUNC(qpel_pixels_tab[0][ 4], qpel16_mc01_mmx2) | |
1911 SET_QPEL_FUNC(qpel_pixels_tab[0][ 5], qpel16_mc11_mmx2) | |
1912 SET_QPEL_FUNC(qpel_pixels_tab[0][ 6], qpel16_mc21_mmx2) | |
1913 SET_QPEL_FUNC(qpel_pixels_tab[0][ 7], qpel16_mc31_mmx2) | |
1914 SET_QPEL_FUNC(qpel_pixels_tab[0][ 8], qpel16_mc02_mmx2) | |
1915 SET_QPEL_FUNC(qpel_pixels_tab[0][ 9], qpel16_mc12_mmx2) | |
1916 SET_QPEL_FUNC(qpel_pixels_tab[0][10], qpel16_mc22_mmx2) | |
1917 SET_QPEL_FUNC(qpel_pixels_tab[0][11], qpel16_mc32_mmx2) | |
1918 SET_QPEL_FUNC(qpel_pixels_tab[0][12], qpel16_mc03_mmx2) | |
1919 SET_QPEL_FUNC(qpel_pixels_tab[0][13], qpel16_mc13_mmx2) | |
1920 SET_QPEL_FUNC(qpel_pixels_tab[0][14], qpel16_mc23_mmx2) | |
1921 SET_QPEL_FUNC(qpel_pixels_tab[0][15], qpel16_mc33_mmx2) | |
1922 SET_QPEL_FUNC(qpel_pixels_tab[1][ 0], qpel8_mc00_mmx2) | |
1923 SET_QPEL_FUNC(qpel_pixels_tab[1][ 1], qpel8_mc10_mmx2) | |
1924 SET_QPEL_FUNC(qpel_pixels_tab[1][ 2], qpel8_mc20_mmx2) | |
1925 SET_QPEL_FUNC(qpel_pixels_tab[1][ 3], qpel8_mc30_mmx2) | |
1926 SET_QPEL_FUNC(qpel_pixels_tab[1][ 4], qpel8_mc01_mmx2) | |
1927 SET_QPEL_FUNC(qpel_pixels_tab[1][ 5], qpel8_mc11_mmx2) | |
1928 SET_QPEL_FUNC(qpel_pixels_tab[1][ 6], qpel8_mc21_mmx2) | |
1929 SET_QPEL_FUNC(qpel_pixels_tab[1][ 7], qpel8_mc31_mmx2) | |
1930 SET_QPEL_FUNC(qpel_pixels_tab[1][ 8], qpel8_mc02_mmx2) | |
1931 SET_QPEL_FUNC(qpel_pixels_tab[1][ 9], qpel8_mc12_mmx2) | |
1932 SET_QPEL_FUNC(qpel_pixels_tab[1][10], qpel8_mc22_mmx2) | |
1933 SET_QPEL_FUNC(qpel_pixels_tab[1][11], qpel8_mc32_mmx2) | |
1934 SET_QPEL_FUNC(qpel_pixels_tab[1][12], qpel8_mc03_mmx2) | |
1935 SET_QPEL_FUNC(qpel_pixels_tab[1][13], qpel8_mc13_mmx2) | |
1936 SET_QPEL_FUNC(qpel_pixels_tab[1][14], qpel8_mc23_mmx2) | |
1937 SET_QPEL_FUNC(qpel_pixels_tab[1][15], qpel8_mc33_mmx2) | |
961 | 1938 #endif |
1527 | 1939 |
1686
68abbec33289
Here are juste two added #ifdef CONFIG_ENCODERS to allow
michael
parents:
1648
diff
changeset
|
1940 #ifdef CONFIG_ENCODERS |
1527 | 1941 c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_mmx2; |
1686
68abbec33289
Here are juste two added #ifdef CONFIG_ENCODERS to allow
michael
parents:
1648
diff
changeset
|
1942 #endif //CONFIG_ENCODERS |
0 | 1943 } else if (mm_flags & MM_3DNOW) { |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1944 c->put_pixels_tab[0][1] = put_pixels16_x2_3dnow; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1945 c->put_pixels_tab[0][2] = put_pixels16_y2_3dnow; |
393 | 1946 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1947 c->avg_pixels_tab[0][0] = avg_pixels16_3dnow; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1948 c->avg_pixels_tab[0][1] = avg_pixels16_x2_3dnow; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1949 c->avg_pixels_tab[0][2] = avg_pixels16_y2_3dnow; |
651 | 1950 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1951 c->put_pixels_tab[1][1] = put_pixels8_x2_3dnow; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1952 c->put_pixels_tab[1][2] = put_pixels8_y2_3dnow; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1953 |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1954 c->avg_pixels_tab[1][0] = avg_pixels8_3dnow; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1955 c->avg_pixels_tab[1][1] = avg_pixels8_x2_3dnow; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
1956 c->avg_pixels_tab[1][2] = avg_pixels8_y2_3dnow; |
1092 | 1957 |
1958 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ | |
1959 c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_3dnow; | |
1960 c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_3dnow; | |
1961 c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_3dnow; | |
1962 c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_3dnow; | |
1963 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_3dnow; | |
1964 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_3dnow; | |
1965 } | |
984 | 1966 |
954 | 1967 SET_QPEL_FUNC(qpel_pixels_tab[0][ 0], qpel16_mc00_3dnow) |
1968 SET_QPEL_FUNC(qpel_pixels_tab[0][ 1], qpel16_mc10_3dnow) | |
1969 SET_QPEL_FUNC(qpel_pixels_tab[0][ 2], qpel16_mc20_3dnow) | |
1970 SET_QPEL_FUNC(qpel_pixels_tab[0][ 3], qpel16_mc30_3dnow) | |
1971 SET_QPEL_FUNC(qpel_pixels_tab[0][ 4], qpel16_mc01_3dnow) | |
1972 SET_QPEL_FUNC(qpel_pixels_tab[0][ 5], qpel16_mc11_3dnow) | |
1973 SET_QPEL_FUNC(qpel_pixels_tab[0][ 6], qpel16_mc21_3dnow) | |
1974 SET_QPEL_FUNC(qpel_pixels_tab[0][ 7], qpel16_mc31_3dnow) | |
1975 SET_QPEL_FUNC(qpel_pixels_tab[0][ 8], qpel16_mc02_3dnow) | |
1976 SET_QPEL_FUNC(qpel_pixels_tab[0][ 9], qpel16_mc12_3dnow) | |
1977 SET_QPEL_FUNC(qpel_pixels_tab[0][10], qpel16_mc22_3dnow) | |
1978 SET_QPEL_FUNC(qpel_pixels_tab[0][11], qpel16_mc32_3dnow) | |
1979 SET_QPEL_FUNC(qpel_pixels_tab[0][12], qpel16_mc03_3dnow) | |
1980 SET_QPEL_FUNC(qpel_pixels_tab[0][13], qpel16_mc13_3dnow) | |
1981 SET_QPEL_FUNC(qpel_pixels_tab[0][14], qpel16_mc23_3dnow) | |
1982 SET_QPEL_FUNC(qpel_pixels_tab[0][15], qpel16_mc33_3dnow) | |
1983 SET_QPEL_FUNC(qpel_pixels_tab[1][ 0], qpel8_mc00_3dnow) | |
1984 SET_QPEL_FUNC(qpel_pixels_tab[1][ 1], qpel8_mc10_3dnow) | |
1985 SET_QPEL_FUNC(qpel_pixels_tab[1][ 2], qpel8_mc20_3dnow) | |
1986 SET_QPEL_FUNC(qpel_pixels_tab[1][ 3], qpel8_mc30_3dnow) | |
1987 SET_QPEL_FUNC(qpel_pixels_tab[1][ 4], qpel8_mc01_3dnow) | |
1988 SET_QPEL_FUNC(qpel_pixels_tab[1][ 5], qpel8_mc11_3dnow) | |
1989 SET_QPEL_FUNC(qpel_pixels_tab[1][ 6], qpel8_mc21_3dnow) | |
1990 SET_QPEL_FUNC(qpel_pixels_tab[1][ 7], qpel8_mc31_3dnow) | |
1991 SET_QPEL_FUNC(qpel_pixels_tab[1][ 8], qpel8_mc02_3dnow) | |
1992 SET_QPEL_FUNC(qpel_pixels_tab[1][ 9], qpel8_mc12_3dnow) | |
1993 SET_QPEL_FUNC(qpel_pixels_tab[1][10], qpel8_mc22_3dnow) | |
1994 SET_QPEL_FUNC(qpel_pixels_tab[1][11], qpel8_mc32_3dnow) | |
1995 SET_QPEL_FUNC(qpel_pixels_tab[1][12], qpel8_mc03_3dnow) | |
1996 SET_QPEL_FUNC(qpel_pixels_tab[1][13], qpel8_mc13_3dnow) | |
1997 SET_QPEL_FUNC(qpel_pixels_tab[1][14], qpel8_mc23_3dnow) | |
1998 SET_QPEL_FUNC(qpel_pixels_tab[1][15], qpel8_mc33_3dnow) | |
0 | 1999 } |
2000 } | |
1092 | 2001 |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
2002 #ifdef CONFIG_ENCODERS |
1092 | 2003 dsputil_init_pix_mmx(c, avctx); |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
2004 #endif //CONFIG_ENCODERS |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2005 #if 0 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2006 // for speed testing |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2007 get_pixels = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2008 put_pixels_clamped = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2009 add_pixels_clamped = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2010 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2011 pix_abs16x16 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2012 pix_abs16x16_x2 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2013 pix_abs16x16_y2 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2014 pix_abs16x16_xy2 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2015 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2016 put_pixels_tab[0] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2017 put_pixels_tab[1] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2018 put_pixels_tab[2] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2019 put_pixels_tab[3] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2020 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2021 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
|
2022 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
|
2023 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
|
2024 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
|
2025 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2026 avg_pixels_tab[0] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2027 avg_pixels_tab[1] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2028 avg_pixels_tab[2] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2029 avg_pixels_tab[3] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2030 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2031 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
|
2032 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
|
2033 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
|
2034 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
|
2035 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2036 //av_fdct = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2037 //ff_idct = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2038 #endif |
0 | 2039 } |