Mercurial > libavcodec.hg
annotate i386/dsputil_mmx.c @ 3036:0b546eab515d libavcodec
Update licensing information: The FSF changed postal address.
author | diego |
---|---|
date | Thu, 12 Jan 2006 22:43:26 +0000 |
parents | bfabfdf9ce55 |
children | 072dbc669253 |
rev | line source |
---|---|
0 | 1 /* |
2 * MMX optimized DSP utils | |
429 | 3 * Copyright (c) 2000, 2001 Fabrice Bellard. |
1739
07a484280a82
copyright year update of the files i touched and remembered, things look annoyingly unmaintained otherwise
michael
parents:
1729
diff
changeset
|
4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> |
0 | 5 * |
429 | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Lesser General Public | |
8 * License as published by the Free Software Foundation; either | |
9 * version 2 of the License, or (at your option) any later version. | |
0 | 10 * |
429 | 11 * This library is distributed in the hope that it will be useful, |
0 | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
429 | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Lesser General Public License for more details. | |
0 | 15 * |
429 | 16 * You should have received a copy of the GNU Lesser General Public |
17 * License along with this library; if not, write to the Free Software | |
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2979
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 19 * |
20 * MMX optimization by Nick Kurshev <nickols_k@mail.ru> | |
21 */ | |
22 | |
23 #include "../dsputil.h" | |
1092 | 24 #include "../simple_idct.h" |
2067 | 25 #include "../mpegvideo.h" |
1984
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
26 #include "mmx.h" |
0 | 27 |
1729 | 28 //#undef NDEBUG |
29 //#include <assert.h> | |
30 | |
1647 | 31 extern const uint8_t ff_h263_loop_filter_strength[32]; |
2868 | 32 extern void ff_idct_xvid_mmx(short *block); |
33 extern void ff_idct_xvid_mmx2(short *block); | |
1647 | 34 |
5 | 35 int mm_flags; /* multimedia extension flags */ |
936 | 36 |
0 | 37 /* pixel operations */ |
1845
3054613980a8
attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents:
1784
diff
changeset
|
38 static const uint64_t mm_bone attribute_used __attribute__ ((aligned(8))) = 0x0101010101010101ULL; |
3054613980a8
attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents:
1784
diff
changeset
|
39 static const uint64_t mm_wone attribute_used __attribute__ ((aligned(8))) = 0x0001000100010001ULL; |
3054613980a8
attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents:
1784
diff
changeset
|
40 static const uint64_t mm_wtwo attribute_used __attribute__ ((aligned(8))) = 0x0002000200020002ULL; |
0 | 41 |
1845
3054613980a8
attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents:
1784
diff
changeset
|
42 static const uint64_t ff_pw_20 attribute_used __attribute__ ((aligned(8))) = 0x0014001400140014ULL; |
3054613980a8
attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents:
1784
diff
changeset
|
43 static const uint64_t ff_pw_3 attribute_used __attribute__ ((aligned(8))) = 0x0003000300030003ULL; |
2633 | 44 static const uint64_t ff_pw_4 attribute_used __attribute__ ((aligned(8))) = 0x0004000400040004ULL; |
2209 | 45 static const uint64_t ff_pw_5 attribute_used __attribute__ ((aligned(8))) = 0x0005000500050005ULL; |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2902
diff
changeset
|
46 static const uint64_t ff_pw_8 attribute_used __attribute__ ((aligned(8))) = 0x0008000800080008ULL; |
1845
3054613980a8
attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents:
1784
diff
changeset
|
47 static const uint64_t ff_pw_16 attribute_used __attribute__ ((aligned(8))) = 0x0010001000100010ULL; |
2209 | 48 static const uint64_t ff_pw_32 attribute_used __attribute__ ((aligned(8))) = 0x0020002000200020ULL; |
2754 | 49 static const uint64_t ff_pw_64 attribute_used __attribute__ ((aligned(8))) = 0x0040004000400040ULL; |
1845
3054613980a8
attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents:
1784
diff
changeset
|
50 static const uint64_t ff_pw_15 attribute_used __attribute__ ((aligned(8))) = 0x000F000F000F000FULL; |
954 | 51 |
2707
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
52 static const uint64_t ff_pb_3F attribute_used __attribute__ ((aligned(8))) = 0x3F3F3F3F3F3F3F3FULL; |
1845
3054613980a8
attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents:
1784
diff
changeset
|
53 static const uint64_t ff_pb_FC attribute_used __attribute__ ((aligned(8))) = 0xFCFCFCFCFCFCFCFCULL; |
1647 | 54 |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
55 #define JUMPALIGN() __asm __volatile (".balign 8"::) |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
56 #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
|
57 |
448 | 58 #define MOVQ_WONE(regd) \ |
59 __asm __volatile ( \ | |
60 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ | |
61 "psrlw $15, %%" #regd ::) | |
62 | |
63 #define MOVQ_BFE(regd) \ | |
64 __asm __volatile ( \ | |
65 "pcmpeqd %%" #regd ", %%" #regd " \n\t"\ | |
66 "paddb %%" #regd ", %%" #regd " \n\t" ::) | |
67 | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
68 #ifndef PIC |
448 | 69 #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
|
70 #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
|
71 #else |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
72 // 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
|
73 // pcmpeqd -> -1 |
448 | 74 #define MOVQ_BONE(regd) \ |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
75 __asm __volatile ( \ |
448 | 76 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ |
77 "psrlw $15, %%" #regd " \n\t" \ | |
78 "packuswb %%" #regd ", %%" #regd " \n\t" ::) | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
79 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
80 #define MOVQ_WTWO(regd) \ |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
81 __asm __volatile ( \ |
448 | 82 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ |
83 "psrlw $15, %%" #regd " \n\t" \ | |
84 "psllw $1, %%" #regd " \n\t"::) | |
387 | 85 |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
86 #endif |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
87 |
448 | 88 // 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
|
89 // first argument is unmodifed and second is trashed |
471 | 90 // regfe is supposed to contain 0xfefefefefefefefe |
91 #define PAVGB_MMX_NO_RND(rega, regb, regr, regfe) \ | |
2979 | 92 "movq " #rega ", " #regr " \n\t"\ |
93 "pand " #regb ", " #regr " \n\t"\ | |
94 "pxor " #rega ", " #regb " \n\t"\ | |
95 "pand " #regfe "," #regb " \n\t"\ | |
96 "psrlq $1, " #regb " \n\t"\ | |
97 "paddb " #regb ", " #regr " \n\t" | |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
98 |
471 | 99 #define PAVGB_MMX(rega, regb, regr, regfe) \ |
2979 | 100 "movq " #rega ", " #regr " \n\t"\ |
101 "por " #regb ", " #regr " \n\t"\ | |
102 "pxor " #rega ", " #regb " \n\t"\ | |
103 "pand " #regfe "," #regb " \n\t"\ | |
104 "psrlq $1, " #regb " \n\t"\ | |
105 "psubb " #regb ", " #regr " \n\t" | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
106 |
471 | 107 // mm6 is supposed to contain 0xfefefefefefefefe |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
108 #define PAVGBP_MMX_NO_RND(rega, regb, regr, regc, regd, regp) \ |
2979 | 109 "movq " #rega ", " #regr " \n\t"\ |
110 "movq " #regc ", " #regp " \n\t"\ | |
111 "pand " #regb ", " #regr " \n\t"\ | |
112 "pand " #regd ", " #regp " \n\t"\ | |
113 "pxor " #rega ", " #regb " \n\t"\ | |
114 "pxor " #regc ", " #regd " \n\t"\ | |
115 "pand %%mm6, " #regb " \n\t"\ | |
116 "pand %%mm6, " #regd " \n\t"\ | |
117 "psrlq $1, " #regb " \n\t"\ | |
118 "psrlq $1, " #regd " \n\t"\ | |
119 "paddb " #regb ", " #regr " \n\t"\ | |
120 "paddb " #regd ", " #regp " \n\t" | |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
121 |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
122 #define PAVGBP_MMX(rega, regb, regr, regc, regd, regp) \ |
2979 | 123 "movq " #rega ", " #regr " \n\t"\ |
124 "movq " #regc ", " #regp " \n\t"\ | |
125 "por " #regb ", " #regr " \n\t"\ | |
126 "por " #regd ", " #regp " \n\t"\ | |
127 "pxor " #rega ", " #regb " \n\t"\ | |
128 "pxor " #regc ", " #regd " \n\t"\ | |
129 "pand %%mm6, " #regb " \n\t"\ | |
130 "pand %%mm6, " #regd " \n\t"\ | |
131 "psrlq $1, " #regd " \n\t"\ | |
132 "psrlq $1, " #regb " \n\t"\ | |
133 "psubb " #regb ", " #regr " \n\t"\ | |
134 "psubb " #regd ", " #regp " \n\t" | |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
135 |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
136 /***********************************/ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
137 /* MMX no rounding */ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
138 #define DEF(x, y) x ## _no_rnd_ ## y ##_mmx |
448 | 139 #define SET_RND MOVQ_WONE |
2979 | 140 #define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX_NO_RND(a, b, c, d, e, f) |
141 #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
|
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" |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
144 |
445
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 |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
149 /***********************************/ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
150 /* MMX rounding */ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
151 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
152 #define DEF(x, y) x ## _ ## y ##_mmx |
448 | 153 #define SET_RND MOVQ_WTWO |
2979 | 154 #define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX(a, b, c, d, e, f) |
155 #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
|
156 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
157 #include "dsputil_mmx_rnd.h" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
158 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
159 #undef DEF |
448 | 160 #undef SET_RND |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
161 #undef PAVGBP |
471 | 162 #undef PAVGB |
387 | 163 |
0 | 164 /***********************************/ |
165 /* 3Dnow specific */ | |
166 | |
167 #define DEF(x) x ## _3dnow | |
168 /* for Athlons PAVGUSB is prefered */ | |
169 #define PAVGB "pavgusb" | |
170 | |
171 #include "dsputil_mmx_avg.h" | |
172 | |
173 #undef DEF | |
174 #undef PAVGB | |
175 | |
176 /***********************************/ | |
177 /* MMX2 specific */ | |
178 | |
386 | 179 #define DEF(x) x ## _mmx2 |
0 | 180 |
181 /* Introduced only in MMX2 set */ | |
182 #define PAVGB "pavgb" | |
183 | |
184 #include "dsputil_mmx_avg.h" | |
185 | |
186 #undef DEF | |
187 #undef PAVGB | |
188 | |
189 /***********************************/ | |
190 /* standard MMX */ | |
191 | |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
192 #ifdef CONFIG_ENCODERS |
1064 | 193 static void get_pixels_mmx(DCTELEM *block, const uint8_t *pixels, int line_size) |
0 | 194 { |
386 | 195 asm volatile( |
2979 | 196 "mov $-128, %%"REG_a" \n\t" |
197 "pxor %%mm7, %%mm7 \n\t" | |
198 ".balign 16 \n\t" | |
199 "1: \n\t" | |
200 "movq (%0), %%mm0 \n\t" | |
201 "movq (%0, %2), %%mm2 \n\t" | |
202 "movq %%mm0, %%mm1 \n\t" | |
203 "movq %%mm2, %%mm3 \n\t" | |
204 "punpcklbw %%mm7, %%mm0 \n\t" | |
205 "punpckhbw %%mm7, %%mm1 \n\t" | |
206 "punpcklbw %%mm7, %%mm2 \n\t" | |
207 "punpckhbw %%mm7, %%mm3 \n\t" | |
208 "movq %%mm0, (%1, %%"REG_a") \n\t" | |
209 "movq %%mm1, 8(%1, %%"REG_a") \n\t" | |
210 "movq %%mm2, 16(%1, %%"REG_a") \n\t" | |
211 "movq %%mm3, 24(%1, %%"REG_a") \n\t" | |
212 "add %3, %0 \n\t" | |
213 "add $32, %%"REG_a" \n\t" | |
214 "js 1b \n\t" | |
386 | 215 : "+r" (pixels) |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
216 : "r" (block+64), "r" ((long)line_size), "r" ((long)line_size*2) |
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
217 : "%"REG_a |
386 | 218 ); |
0 | 219 } |
220 | |
1064 | 221 static inline void diff_pixels_mmx(DCTELEM *block, const uint8_t *s1, const uint8_t *s2, int stride) |
324 | 222 { |
223 asm volatile( | |
2979 | 224 "pxor %%mm7, %%mm7 \n\t" |
225 "mov $-128, %%"REG_a" \n\t" | |
226 ".balign 16 \n\t" | |
227 "1: \n\t" | |
228 "movq (%0), %%mm0 \n\t" | |
229 "movq (%1), %%mm2 \n\t" | |
230 "movq %%mm0, %%mm1 \n\t" | |
231 "movq %%mm2, %%mm3 \n\t" | |
232 "punpcklbw %%mm7, %%mm0 \n\t" | |
233 "punpckhbw %%mm7, %%mm1 \n\t" | |
234 "punpcklbw %%mm7, %%mm2 \n\t" | |
235 "punpckhbw %%mm7, %%mm3 \n\t" | |
236 "psubw %%mm2, %%mm0 \n\t" | |
237 "psubw %%mm3, %%mm1 \n\t" | |
238 "movq %%mm0, (%2, %%"REG_a") \n\t" | |
239 "movq %%mm1, 8(%2, %%"REG_a") \n\t" | |
240 "add %3, %0 \n\t" | |
241 "add %3, %1 \n\t" | |
242 "add $16, %%"REG_a" \n\t" | |
243 "jnz 1b \n\t" | |
324 | 244 : "+r" (s1), "+r" (s2) |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
245 : "r" (block+64), "r" ((long)stride) |
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
246 : "%"REG_a |
324 | 247 ); |
248 } | |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
249 #endif //CONFIG_ENCODERS |
324 | 250 |
1064 | 251 void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size) |
0 | 252 { |
253 const DCTELEM *p; | |
1064 | 254 uint8_t *pix; |
0 | 255 |
256 /* read the pixels */ | |
257 p = block; | |
258 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
259 /* unrolled loop */ |
2979 | 260 __asm __volatile( |
261 "movq %3, %%mm0 \n\t" | |
262 "movq 8%3, %%mm1 \n\t" | |
263 "movq 16%3, %%mm2 \n\t" | |
264 "movq 24%3, %%mm3 \n\t" | |
265 "movq 32%3, %%mm4 \n\t" | |
266 "movq 40%3, %%mm5 \n\t" | |
267 "movq 48%3, %%mm6 \n\t" | |
268 "movq 56%3, %%mm7 \n\t" | |
269 "packuswb %%mm1, %%mm0 \n\t" | |
270 "packuswb %%mm3, %%mm2 \n\t" | |
271 "packuswb %%mm5, %%mm4 \n\t" | |
272 "packuswb %%mm7, %%mm6 \n\t" | |
273 "movq %%mm0, (%0) \n\t" | |
274 "movq %%mm2, (%0, %1) \n\t" | |
275 "movq %%mm4, (%0, %1, 2) \n\t" | |
276 "movq %%mm6, (%0, %2) \n\t" | |
277 ::"r" (pix), "r" ((long)line_size), "r" ((long)line_size*3), "m"(*p) | |
278 :"memory"); | |
0 | 279 pix += line_size*4; |
280 p += 32; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
281 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
282 // 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
|
283 // compiler would generate some very strange code |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
284 // thus using "r" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
285 __asm __volatile( |
2979 | 286 "movq (%3), %%mm0 \n\t" |
287 "movq 8(%3), %%mm1 \n\t" | |
288 "movq 16(%3), %%mm2 \n\t" | |
289 "movq 24(%3), %%mm3 \n\t" | |
290 "movq 32(%3), %%mm4 \n\t" | |
291 "movq 40(%3), %%mm5 \n\t" | |
292 "movq 48(%3), %%mm6 \n\t" | |
293 "movq 56(%3), %%mm7 \n\t" | |
294 "packuswb %%mm1, %%mm0 \n\t" | |
295 "packuswb %%mm3, %%mm2 \n\t" | |
296 "packuswb %%mm5, %%mm4 \n\t" | |
297 "packuswb %%mm7, %%mm6 \n\t" | |
298 "movq %%mm0, (%0) \n\t" | |
299 "movq %%mm2, (%0, %1) \n\t" | |
300 "movq %%mm4, (%0, %1, 2) \n\t" | |
301 "movq %%mm6, (%0, %2) \n\t" | |
302 ::"r" (pix), "r" ((long)line_size), "r" ((long)line_size*3), "r"(p) | |
303 :"memory"); | |
0 | 304 } |
305 | |
2753 | 306 static const unsigned char __align8 vector128[8] = |
1985
b2bc62fdecc0
move the 0x80 vector outside of the function, thus saving the compiler
melanson
parents:
1984
diff
changeset
|
307 { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }; |
b2bc62fdecc0
move the 0x80 vector outside of the function, thus saving the compiler
melanson
parents:
1984
diff
changeset
|
308 |
1984
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
309 void put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size) |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
310 { |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
311 int i; |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
312 |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
313 movq_m2r(*vector128, mm1); |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
314 for (i = 0; i < 8; i++) { |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
315 movq_m2r(*(block), mm0); |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
316 packsswb_m2r(*(block + 4), mm0); |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
317 block += 8; |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
318 paddb_r2r(mm1, mm0); |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
319 movq_r2m(mm0, *pixels); |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
320 pixels += line_size; |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
321 } |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
322 } |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
323 |
1064 | 324 void add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size) |
0 | 325 { |
326 const DCTELEM *p; | |
1064 | 327 uint8_t *pix; |
0 | 328 int i; |
329 | |
330 /* read the pixels */ | |
331 p = block; | |
332 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
333 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
334 i = 4; |
342
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
335 do { |
2979 | 336 __asm __volatile( |
337 "movq (%2), %%mm0 \n\t" | |
338 "movq 8(%2), %%mm1 \n\t" | |
339 "movq 16(%2), %%mm2 \n\t" | |
340 "movq 24(%2), %%mm3 \n\t" | |
341 "movq %0, %%mm4 \n\t" | |
342 "movq %1, %%mm6 \n\t" | |
343 "movq %%mm4, %%mm5 \n\t" | |
344 "punpcklbw %%mm7, %%mm4 \n\t" | |
345 "punpckhbw %%mm7, %%mm5 \n\t" | |
346 "paddsw %%mm4, %%mm0 \n\t" | |
347 "paddsw %%mm5, %%mm1 \n\t" | |
348 "movq %%mm6, %%mm5 \n\t" | |
349 "punpcklbw %%mm7, %%mm6 \n\t" | |
350 "punpckhbw %%mm7, %%mm5 \n\t" | |
351 "paddsw %%mm6, %%mm2 \n\t" | |
352 "paddsw %%mm5, %%mm3 \n\t" | |
353 "packuswb %%mm1, %%mm0 \n\t" | |
354 "packuswb %%mm3, %%mm2 \n\t" | |
355 "movq %%mm0, %0 \n\t" | |
356 "movq %%mm2, %1 \n\t" | |
357 :"+m"(*pix), "+m"(*(pix+line_size)) | |
358 :"r"(p) | |
359 :"memory"); | |
0 | 360 pix += line_size*2; |
361 p += 16; | |
342
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
362 } while (--i); |
0 | 363 } |
364 | |
2209 | 365 static void put_pixels4_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
366 { | |
367 __asm __volatile( | |
2979 | 368 "lea (%3, %3), %%"REG_a" \n\t" |
369 ".balign 8 \n\t" | |
370 "1: \n\t" | |
371 "movd (%1), %%mm0 \n\t" | |
372 "movd (%1, %3), %%mm1 \n\t" | |
373 "movd %%mm0, (%2) \n\t" | |
374 "movd %%mm1, (%2, %3) \n\t" | |
375 "add %%"REG_a", %1 \n\t" | |
376 "add %%"REG_a", %2 \n\t" | |
377 "movd (%1), %%mm0 \n\t" | |
378 "movd (%1, %3), %%mm1 \n\t" | |
379 "movd %%mm0, (%2) \n\t" | |
380 "movd %%mm1, (%2, %3) \n\t" | |
381 "add %%"REG_a", %1 \n\t" | |
382 "add %%"REG_a", %2 \n\t" | |
383 "subl $4, %0 \n\t" | |
384 "jnz 1b \n\t" | |
385 : "+g"(h), "+r" (pixels), "+r" (block) | |
386 : "r"((long)line_size) | |
387 : "%"REG_a, "memory" | |
388 ); | |
2209 | 389 } |
390 | |
1064 | 391 static void put_pixels8_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
0 | 392 { |
471 | 393 __asm __volatile( |
2979 | 394 "lea (%3, %3), %%"REG_a" \n\t" |
395 ".balign 8 \n\t" | |
396 "1: \n\t" | |
397 "movq (%1), %%mm0 \n\t" | |
398 "movq (%1, %3), %%mm1 \n\t" | |
399 "movq %%mm0, (%2) \n\t" | |
400 "movq %%mm1, (%2, %3) \n\t" | |
401 "add %%"REG_a", %1 \n\t" | |
402 "add %%"REG_a", %2 \n\t" | |
403 "movq (%1), %%mm0 \n\t" | |
404 "movq (%1, %3), %%mm1 \n\t" | |
405 "movq %%mm0, (%2) \n\t" | |
406 "movq %%mm1, (%2, %3) \n\t" | |
407 "add %%"REG_a", %1 \n\t" | |
408 "add %%"REG_a", %2 \n\t" | |
409 "subl $4, %0 \n\t" | |
410 "jnz 1b \n\t" | |
411 : "+g"(h), "+r" (pixels), "+r" (block) | |
412 : "r"((long)line_size) | |
413 : "%"REG_a, "memory" | |
414 ); | |
0 | 415 } |
416 | |
1064 | 417 static void put_pixels16_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
651 | 418 { |
419 __asm __volatile( | |
2979 | 420 "lea (%3, %3), %%"REG_a" \n\t" |
421 ".balign 8 \n\t" | |
422 "1: \n\t" | |
423 "movq (%1), %%mm0 \n\t" | |
424 "movq 8(%1), %%mm4 \n\t" | |
425 "movq (%1, %3), %%mm1 \n\t" | |
426 "movq 8(%1, %3), %%mm5 \n\t" | |
427 "movq %%mm0, (%2) \n\t" | |
428 "movq %%mm4, 8(%2) \n\t" | |
429 "movq %%mm1, (%2, %3) \n\t" | |
430 "movq %%mm5, 8(%2, %3) \n\t" | |
431 "add %%"REG_a", %1 \n\t" | |
432 "add %%"REG_a", %2 \n\t" | |
433 "movq (%1), %%mm0 \n\t" | |
434 "movq 8(%1), %%mm4 \n\t" | |
435 "movq (%1, %3), %%mm1 \n\t" | |
436 "movq 8(%1, %3), %%mm5 \n\t" | |
437 "movq %%mm0, (%2) \n\t" | |
438 "movq %%mm4, 8(%2) \n\t" | |
439 "movq %%mm1, (%2, %3) \n\t" | |
440 "movq %%mm5, 8(%2, %3) \n\t" | |
441 "add %%"REG_a", %1 \n\t" | |
442 "add %%"REG_a", %2 \n\t" | |
443 "subl $4, %0 \n\t" | |
444 "jnz 1b \n\t" | |
445 : "+g"(h), "+r" (pixels), "+r" (block) | |
446 : "r"((long)line_size) | |
447 : "%"REG_a, "memory" | |
448 ); | |
651 | 449 } |
450 | |
296 | 451 static void clear_blocks_mmx(DCTELEM *blocks) |
452 { | |
471 | 453 __asm __volatile( |
2979 | 454 "pxor %%mm7, %%mm7 \n\t" |
455 "mov $-128*6, %%"REG_a" \n\t" | |
456 "1: \n\t" | |
457 "movq %%mm7, (%0, %%"REG_a") \n\t" | |
458 "movq %%mm7, 8(%0, %%"REG_a") \n\t" | |
459 "movq %%mm7, 16(%0, %%"REG_a") \n\t" | |
460 "movq %%mm7, 24(%0, %%"REG_a") \n\t" | |
461 "add $32, %%"REG_a" \n\t" | |
462 " js 1b \n\t" | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
463 : : "r" (((uint8_t *)blocks)+128*6) |
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
464 : "%"REG_a |
296 | 465 ); |
466 } | |
467 | |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
468 #ifdef CONFIG_ENCODERS |
1064 | 469 static int pix_sum16_mmx(uint8_t * pix, int line_size){ |
688 | 470 const int h=16; |
471 int sum; | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
472 long index= -line_size*h; |
688 | 473 |
474 __asm __volatile( | |
2979 | 475 "pxor %%mm7, %%mm7 \n\t" |
476 "pxor %%mm6, %%mm6 \n\t" | |
477 "1: \n\t" | |
478 "movq (%2, %1), %%mm0 \n\t" | |
479 "movq (%2, %1), %%mm1 \n\t" | |
480 "movq 8(%2, %1), %%mm2 \n\t" | |
481 "movq 8(%2, %1), %%mm3 \n\t" | |
482 "punpcklbw %%mm7, %%mm0 \n\t" | |
483 "punpckhbw %%mm7, %%mm1 \n\t" | |
484 "punpcklbw %%mm7, %%mm2 \n\t" | |
485 "punpckhbw %%mm7, %%mm3 \n\t" | |
486 "paddw %%mm0, %%mm1 \n\t" | |
487 "paddw %%mm2, %%mm3 \n\t" | |
488 "paddw %%mm1, %%mm3 \n\t" | |
489 "paddw %%mm3, %%mm6 \n\t" | |
490 "add %3, %1 \n\t" | |
491 " js 1b \n\t" | |
492 "movq %%mm6, %%mm5 \n\t" | |
493 "psrlq $32, %%mm6 \n\t" | |
494 "paddw %%mm5, %%mm6 \n\t" | |
495 "movq %%mm6, %%mm5 \n\t" | |
496 "psrlq $16, %%mm6 \n\t" | |
497 "paddw %%mm5, %%mm6 \n\t" | |
498 "movd %%mm6, %0 \n\t" | |
499 "andl $0xFFFF, %0 \n\t" | |
688 | 500 : "=&r" (sum), "+r" (index) |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
501 : "r" (pix - index), "r" ((long)line_size) |
688 | 502 ); |
503 | |
504 return sum; | |
505 } | |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
506 #endif //CONFIG_ENCODERS |
688 | 507 |
866 | 508 static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w){ |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
509 long i=0; |
866 | 510 asm volatile( |
2979 | 511 "1: \n\t" |
512 "movq (%1, %0), %%mm0 \n\t" | |
513 "movq (%2, %0), %%mm1 \n\t" | |
514 "paddb %%mm0, %%mm1 \n\t" | |
515 "movq %%mm1, (%2, %0) \n\t" | |
516 "movq 8(%1, %0), %%mm0 \n\t" | |
517 "movq 8(%2, %0), %%mm1 \n\t" | |
518 "paddb %%mm0, %%mm1 \n\t" | |
519 "movq %%mm1, 8(%2, %0) \n\t" | |
520 "add $16, %0 \n\t" | |
521 "cmp %3, %0 \n\t" | |
522 " jb 1b \n\t" | |
866 | 523 : "+r" (i) |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
524 : "r"(src), "r"(dst), "r"((long)w-15) |
866 | 525 ); |
526 for(; i<w; i++) | |
527 dst[i+0] += src[i+0]; | |
528 } | |
529 | |
1648 | 530 #define H263_LOOP_FILTER \ |
2979 | 531 "pxor %%mm7, %%mm7 \n\t"\ |
532 "movq %0, %%mm0 \n\t"\ | |
533 "movq %0, %%mm1 \n\t"\ | |
534 "movq %3, %%mm2 \n\t"\ | |
535 "movq %3, %%mm3 \n\t"\ | |
536 "punpcklbw %%mm7, %%mm0 \n\t"\ | |
537 "punpckhbw %%mm7, %%mm1 \n\t"\ | |
538 "punpcklbw %%mm7, %%mm2 \n\t"\ | |
539 "punpckhbw %%mm7, %%mm3 \n\t"\ | |
540 "psubw %%mm2, %%mm0 \n\t"\ | |
541 "psubw %%mm3, %%mm1 \n\t"\ | |
542 "movq %1, %%mm2 \n\t"\ | |
543 "movq %1, %%mm3 \n\t"\ | |
544 "movq %2, %%mm4 \n\t"\ | |
545 "movq %2, %%mm5 \n\t"\ | |
546 "punpcklbw %%mm7, %%mm2 \n\t"\ | |
547 "punpckhbw %%mm7, %%mm3 \n\t"\ | |
548 "punpcklbw %%mm7, %%mm4 \n\t"\ | |
549 "punpckhbw %%mm7, %%mm5 \n\t"\ | |
550 "psubw %%mm2, %%mm4 \n\t"\ | |
551 "psubw %%mm3, %%mm5 \n\t"\ | |
552 "psllw $2, %%mm4 \n\t"\ | |
553 "psllw $2, %%mm5 \n\t"\ | |
554 "paddw %%mm0, %%mm4 \n\t"\ | |
555 "paddw %%mm1, %%mm5 \n\t"\ | |
556 "pxor %%mm6, %%mm6 \n\t"\ | |
557 "pcmpgtw %%mm4, %%mm6 \n\t"\ | |
558 "pcmpgtw %%mm5, %%mm7 \n\t"\ | |
559 "pxor %%mm6, %%mm4 \n\t"\ | |
560 "pxor %%mm7, %%mm5 \n\t"\ | |
561 "psubw %%mm6, %%mm4 \n\t"\ | |
562 "psubw %%mm7, %%mm5 \n\t"\ | |
563 "psrlw $3, %%mm4 \n\t"\ | |
564 "psrlw $3, %%mm5 \n\t"\ | |
565 "packuswb %%mm5, %%mm4 \n\t"\ | |
566 "packsswb %%mm7, %%mm6 \n\t"\ | |
567 "pxor %%mm7, %%mm7 \n\t"\ | |
568 "movd %4, %%mm2 \n\t"\ | |
569 "punpcklbw %%mm2, %%mm2 \n\t"\ | |
570 "punpcklbw %%mm2, %%mm2 \n\t"\ | |
571 "punpcklbw %%mm2, %%mm2 \n\t"\ | |
572 "psubusb %%mm4, %%mm2 \n\t"\ | |
573 "movq %%mm2, %%mm3 \n\t"\ | |
574 "psubusb %%mm4, %%mm3 \n\t"\ | |
575 "psubb %%mm3, %%mm2 \n\t"\ | |
576 "movq %1, %%mm3 \n\t"\ | |
577 "movq %2, %%mm4 \n\t"\ | |
578 "pxor %%mm6, %%mm3 \n\t"\ | |
579 "pxor %%mm6, %%mm4 \n\t"\ | |
580 "paddusb %%mm2, %%mm3 \n\t"\ | |
581 "psubusb %%mm2, %%mm4 \n\t"\ | |
582 "pxor %%mm6, %%mm3 \n\t"\ | |
583 "pxor %%mm6, %%mm4 \n\t"\ | |
584 "paddusb %%mm2, %%mm2 \n\t"\ | |
585 "packsswb %%mm1, %%mm0 \n\t"\ | |
586 "pcmpgtb %%mm0, %%mm7 \n\t"\ | |
587 "pxor %%mm7, %%mm0 \n\t"\ | |
588 "psubb %%mm7, %%mm0 \n\t"\ | |
589 "movq %%mm0, %%mm1 \n\t"\ | |
590 "psubusb %%mm2, %%mm0 \n\t"\ | |
591 "psubb %%mm0, %%mm1 \n\t"\ | |
592 "pand %5, %%mm1 \n\t"\ | |
593 "psrlw $2, %%mm1 \n\t"\ | |
594 "pxor %%mm7, %%mm1 \n\t"\ | |
595 "psubb %%mm7, %%mm1 \n\t"\ | |
596 "movq %0, %%mm5 \n\t"\ | |
597 "movq %3, %%mm6 \n\t"\ | |
598 "psubb %%mm1, %%mm5 \n\t"\ | |
599 "paddb %%mm1, %%mm6 \n\t" | |
1648 | 600 |
1647 | 601 static void h263_v_loop_filter_mmx(uint8_t *src, int stride, int qscale){ |
602 const int strength= ff_h263_loop_filter_strength[qscale]; | |
603 | |
604 asm volatile( | |
2967 | 605 |
1648 | 606 H263_LOOP_FILTER |
2967 | 607 |
2979 | 608 "movq %%mm3, %1 \n\t" |
609 "movq %%mm4, %2 \n\t" | |
610 "movq %%mm5, %0 \n\t" | |
611 "movq %%mm6, %3 \n\t" | |
1647 | 612 : "+m" (*(uint64_t*)(src - 2*stride)), |
613 "+m" (*(uint64_t*)(src - 1*stride)), | |
614 "+m" (*(uint64_t*)(src + 0*stride)), | |
615 "+m" (*(uint64_t*)(src + 1*stride)) | |
616 : "g" (2*strength), "m"(ff_pb_FC) | |
617 ); | |
618 } | |
619 | |
1648 | 620 static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int src_stride){ |
621 asm volatile( //FIXME could save 1 instruction if done as 8x4 ... | |
2979 | 622 "movd %4, %%mm0 \n\t" |
623 "movd %5, %%mm1 \n\t" | |
624 "movd %6, %%mm2 \n\t" | |
625 "movd %7, %%mm3 \n\t" | |
626 "punpcklbw %%mm1, %%mm0 \n\t" | |
627 "punpcklbw %%mm3, %%mm2 \n\t" | |
628 "movq %%mm0, %%mm1 \n\t" | |
629 "punpcklwd %%mm2, %%mm0 \n\t" | |
630 "punpckhwd %%mm2, %%mm1 \n\t" | |
631 "movd %%mm0, %0 \n\t" | |
632 "punpckhdq %%mm0, %%mm0 \n\t" | |
633 "movd %%mm0, %1 \n\t" | |
634 "movd %%mm1, %2 \n\t" | |
635 "punpckhdq %%mm1, %%mm1 \n\t" | |
636 "movd %%mm1, %3 \n\t" | |
2967 | 637 |
1648 | 638 : "=m" (*(uint32_t*)(dst + 0*dst_stride)), |
639 "=m" (*(uint32_t*)(dst + 1*dst_stride)), | |
640 "=m" (*(uint32_t*)(dst + 2*dst_stride)), | |
641 "=m" (*(uint32_t*)(dst + 3*dst_stride)) | |
642 : "m" (*(uint32_t*)(src + 0*src_stride)), | |
643 "m" (*(uint32_t*)(src + 1*src_stride)), | |
644 "m" (*(uint32_t*)(src + 2*src_stride)), | |
645 "m" (*(uint32_t*)(src + 3*src_stride)) | |
646 ); | |
647 } | |
648 | |
649 static void h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale){ | |
650 const int strength= ff_h263_loop_filter_strength[qscale]; | |
651 uint64_t temp[4] __attribute__ ((aligned(8))); | |
652 uint8_t *btemp= (uint8_t*)temp; | |
2967 | 653 |
1648 | 654 src -= 2; |
655 | |
656 transpose4x4(btemp , src , 8, stride); | |
657 transpose4x4(btemp+4, src + 4*stride, 8, stride); | |
658 asm volatile( | |
659 H263_LOOP_FILTER // 5 3 4 6 | |
2967 | 660 |
1648 | 661 : "+m" (temp[0]), |
662 "+m" (temp[1]), | |
663 "+m" (temp[2]), | |
664 "+m" (temp[3]) | |
665 : "g" (2*strength), "m"(ff_pb_FC) | |
666 ); | |
667 | |
668 asm volatile( | |
2979 | 669 "movq %%mm5, %%mm1 \n\t" |
670 "movq %%mm4, %%mm0 \n\t" | |
671 "punpcklbw %%mm3, %%mm5 \n\t" | |
672 "punpcklbw %%mm6, %%mm4 \n\t" | |
673 "punpckhbw %%mm3, %%mm1 \n\t" | |
674 "punpckhbw %%mm6, %%mm0 \n\t" | |
675 "movq %%mm5, %%mm3 \n\t" | |
676 "movq %%mm1, %%mm6 \n\t" | |
677 "punpcklwd %%mm4, %%mm5 \n\t" | |
678 "punpcklwd %%mm0, %%mm1 \n\t" | |
679 "punpckhwd %%mm4, %%mm3 \n\t" | |
680 "punpckhwd %%mm0, %%mm6 \n\t" | |
681 "movd %%mm5, (%0) \n\t" | |
682 "punpckhdq %%mm5, %%mm5 \n\t" | |
683 "movd %%mm5, (%0,%2) \n\t" | |
684 "movd %%mm3, (%0,%2,2) \n\t" | |
685 "punpckhdq %%mm3, %%mm3 \n\t" | |
686 "movd %%mm3, (%0,%3) \n\t" | |
687 "movd %%mm1, (%1) \n\t" | |
688 "punpckhdq %%mm1, %%mm1 \n\t" | |
689 "movd %%mm1, (%1,%2) \n\t" | |
690 "movd %%mm6, (%1,%2,2) \n\t" | |
691 "punpckhdq %%mm6, %%mm6 \n\t" | |
692 "movd %%mm6, (%1,%3) \n\t" | |
2505
86e2b1424801
optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents:
2293
diff
changeset
|
693 :: "r" (src), |
86e2b1424801
optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents:
2293
diff
changeset
|
694 "r" (src + 4*stride), |
86e2b1424801
optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents:
2293
diff
changeset
|
695 "r" ((long) stride ), |
86e2b1424801
optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents:
2293
diff
changeset
|
696 "r" ((long)(3*stride)) |
1648 | 697 ); |
698 } | |
699 | |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
700 #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
|
701 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
|
702 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
|
703 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
|
704 "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
|
705 "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
|
706 "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
|
707 "1:\n" |
2979 | 708 "movq (%0),%%mm2\n" /* mm2 = pix[0-7] */ |
709 "movq 8(%0),%%mm3\n" /* mm3 = pix[8-15] */ | |
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
|
710 |
2979 | 711 "movq %%mm2,%%mm1\n" /* mm1 = mm2 = pix[0-7] */ |
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
|
712 |
2979 | 713 "punpckhbw %%mm0,%%mm1\n" /* mm1 = [pix4-7] */ |
714 "punpcklbw %%mm0,%%mm2\n" /* mm2 = [pix0-3] */ | |
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
|
715 |
2979 | 716 "movq %%mm3,%%mm4\n" /* mm4 = mm3 = pix[8-15] */ |
717 "punpckhbw %%mm0,%%mm3\n" /* mm3 = [pix12-15] */ | |
718 "punpcklbw %%mm0,%%mm4\n" /* mm4 = [pix8-11] */ | |
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
|
719 |
2979 | 720 "pmaddwd %%mm1,%%mm1\n" /* mm1 = (pix0^2+pix1^2,pix2^2+pix3^2) */ |
721 "pmaddwd %%mm2,%%mm2\n" /* mm2 = (pix4^2+pix5^2,pix6^2+pix7^2) */ | |
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
|
722 |
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 "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
|
724 "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
|
725 |
2979 | 726 "paddd %%mm1,%%mm2\n" /* mm2 = (pix0^2+pix1^2+pix4^2+pix5^2, |
727 pix2^2+pix3^2+pix6^2+pix7^2) */ | |
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
|
728 "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
|
729 "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
|
730 |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
731 "add %2, %0\n" |
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
|
732 "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
|
733 "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
|
734 "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
|
735 |
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 "movq %%mm7,%%mm1\n" |
2979 | 737 "psrlq $32, %%mm7\n" /* shift hi dword to lo */ |
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
|
738 "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
|
739 "movd %%mm1,%1\n" |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
740 : "+r" (pix), "=r"(tmp) : "r" ((long)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
|
741 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
|
742 } |
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 |
2067 | 744 static int sse8_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) { |
745 int tmp; | |
746 asm volatile ( | |
747 "movl %4,%%ecx\n" | |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
748 "shr $1,%%ecx\n" |
2979 | 749 "pxor %%mm0,%%mm0\n" /* mm0 = 0 */ |
750 "pxor %%mm7,%%mm7\n" /* mm7 holds the sum */ | |
2067 | 751 "1:\n" |
2979 | 752 "movq (%0),%%mm1\n" /* mm1 = pix1[0][0-7] */ |
753 "movq (%1),%%mm2\n" /* mm2 = pix2[0][0-7] */ | |
754 "movq (%0,%3),%%mm3\n" /* mm3 = pix1[1][0-7] */ | |
755 "movq (%1,%3),%%mm4\n" /* mm4 = pix2[1][0-7] */ | |
2067 | 756 |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
757 /* todo: mm1-mm2, mm3-mm4 */ |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
758 /* algo: substract mm1 from mm2 with saturation and vice versa */ |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
759 /* OR the results to get absolute difference */ |
2067 | 760 "movq %%mm1,%%mm5\n" |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
761 "movq %%mm3,%%mm6\n" |
2067 | 762 "psubusb %%mm2,%%mm1\n" |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
763 "psubusb %%mm4,%%mm3\n" |
2067 | 764 "psubusb %%mm5,%%mm2\n" |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
765 "psubusb %%mm6,%%mm4\n" |
2067 | 766 |
767 "por %%mm1,%%mm2\n" | |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
768 "por %%mm3,%%mm4\n" |
2067 | 769 |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
770 /* now convert to 16-bit vectors so we can square them */ |
2067 | 771 "movq %%mm2,%%mm1\n" |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
772 "movq %%mm4,%%mm3\n" |
2067 | 773 |
774 "punpckhbw %%mm0,%%mm2\n" | |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
775 "punpckhbw %%mm0,%%mm4\n" |
2979 | 776 "punpcklbw %%mm0,%%mm1\n" /* mm1 now spread over (mm1,mm2) */ |
777 "punpcklbw %%mm0,%%mm3\n" /* mm4 now spread over (mm3,mm4) */ | |
2067 | 778 |
779 "pmaddwd %%mm2,%%mm2\n" | |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
780 "pmaddwd %%mm4,%%mm4\n" |
2067 | 781 "pmaddwd %%mm1,%%mm1\n" |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
782 "pmaddwd %%mm3,%%mm3\n" |
2067 | 783 |
2979 | 784 "lea (%0,%3,2), %0\n" /* pix1 += 2*line_size */ |
785 "lea (%1,%3,2), %1\n" /* pix2 += 2*line_size */ | |
2067 | 786 |
787 "paddd %%mm2,%%mm1\n" | |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
788 "paddd %%mm4,%%mm3\n" |
2067 | 789 "paddd %%mm1,%%mm7\n" |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
790 "paddd %%mm3,%%mm7\n" |
2067 | 791 |
792 "decl %%ecx\n" | |
793 "jnz 1b\n" | |
794 | |
795 "movq %%mm7,%%mm1\n" | |
2979 | 796 "psrlq $32, %%mm7\n" /* shift hi dword to lo */ |
2067 | 797 "paddd %%mm7,%%mm1\n" |
798 "movd %%mm1,%2\n" | |
2967 | 799 : "+r" (pix1), "+r" (pix2), "=r"(tmp) |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
800 : "r" ((long)line_size) , "m" (h) |
2067 | 801 : "%ecx"); |
802 return tmp; | |
803 } | |
804 | |
1708 | 805 static int sse16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) { |
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
|
806 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
|
807 asm volatile ( |
1708 | 808 "movl %4,%%ecx\n" |
2979 | 809 "pxor %%mm0,%%mm0\n" /* mm0 = 0 */ |
810 "pxor %%mm7,%%mm7\n" /* mm7 holds the sum */ | |
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
|
811 "1:\n" |
2979 | 812 "movq (%0),%%mm1\n" /* mm1 = pix1[0-7] */ |
813 "movq (%1),%%mm2\n" /* mm2 = pix2[0-7] */ | |
814 "movq 8(%0),%%mm3\n" /* mm3 = pix1[8-15] */ | |
815 "movq 8(%1),%%mm4\n" /* mm4 = pix2[8-15] */ | |
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
|
816 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
817 /* 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
|
818 /* 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
|
819 /* 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
|
820 "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
|
821 "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
|
822 "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
|
823 "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
|
824 "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
|
825 "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
|
826 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
827 "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
|
828 "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
|
829 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
830 /* 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
|
831 "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
|
832 "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
|
833 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
834 "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
|
835 "punpckhbw %%mm0,%%mm4\n" |
2979 | 836 "punpcklbw %%mm0,%%mm1\n" /* mm1 now spread over (mm1,mm2) */ |
837 "punpcklbw %%mm0,%%mm3\n" /* mm4 now spread over (mm3,mm4) */ | |
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
|
838 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
839 "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
|
840 "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
|
841 "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
|
842 "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
|
843 |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
844 "add %3,%0\n" |
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
845 "add %3,%1\n" |
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
|
846 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
847 "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
|
848 "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
|
849 "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
|
850 "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
|
851 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
852 "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
|
853 "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
|
854 |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
855 "movq %%mm7,%%mm1\n" |
2979 | 856 "psrlq $32, %%mm7\n" /* shift hi dword to lo */ |
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
|
857 "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
|
858 "movd %%mm1,%2\n" |
2967 | 859 : "+r" (pix1), "+r" (pix2), "=r"(tmp) |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
860 : "r" ((long)line_size) , "m" (h) |
1708 | 861 : "%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
|
862 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
|
863 } |
4dfe15ae0078
sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents:
984
diff
changeset
|
864 |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
865 static int sse16_sse2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) { |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
866 int tmp; |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
867 asm volatile ( |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
868 "shr $1,%2\n" |
2979 | 869 "pxor %%xmm0,%%xmm0\n" /* mm0 = 0 */ |
870 "pxor %%xmm7,%%xmm7\n" /* mm7 holds the sum */ | |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
871 "1:\n" |
2979 | 872 "movdqu (%0),%%xmm1\n" /* mm1 = pix1[0][0-15] */ |
873 "movdqu (%1),%%xmm2\n" /* mm2 = pix2[0][0-15] */ | |
874 "movdqu (%0,%4),%%xmm3\n" /* mm3 = pix1[1][0-15] */ | |
875 "movdqu (%1,%4),%%xmm4\n" /* mm4 = pix2[1][0-15] */ | |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
876 |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
877 /* todo: mm1-mm2, mm3-mm4 */ |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
878 /* algo: substract mm1 from mm2 with saturation and vice versa */ |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
879 /* OR the results to get absolute difference */ |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
880 "movdqa %%xmm1,%%xmm5\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
881 "movdqa %%xmm3,%%xmm6\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
882 "psubusb %%xmm2,%%xmm1\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
883 "psubusb %%xmm4,%%xmm3\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
884 "psubusb %%xmm5,%%xmm2\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
885 "psubusb %%xmm6,%%xmm4\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
886 |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
887 "por %%xmm1,%%xmm2\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
888 "por %%xmm3,%%xmm4\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
889 |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
890 /* now convert to 16-bit vectors so we can square them */ |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
891 "movdqa %%xmm2,%%xmm1\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
892 "movdqa %%xmm4,%%xmm3\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
893 |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
894 "punpckhbw %%xmm0,%%xmm2\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
895 "punpckhbw %%xmm0,%%xmm4\n" |
2979 | 896 "punpcklbw %%xmm0,%%xmm1\n" /* mm1 now spread over (mm1,mm2) */ |
897 "punpcklbw %%xmm0,%%xmm3\n" /* mm4 now spread over (mm3,mm4) */ | |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
898 |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
899 "pmaddwd %%xmm2,%%xmm2\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
900 "pmaddwd %%xmm4,%%xmm4\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
901 "pmaddwd %%xmm1,%%xmm1\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
902 "pmaddwd %%xmm3,%%xmm3\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
903 |
2979 | 904 "lea (%0,%4,2), %0\n" /* pix1 += 2*line_size */ |
905 "lea (%1,%4,2), %1\n" /* pix2 += 2*line_size */ | |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
906 |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
907 "paddd %%xmm2,%%xmm1\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
908 "paddd %%xmm4,%%xmm3\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
909 "paddd %%xmm1,%%xmm7\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
910 "paddd %%xmm3,%%xmm7\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
911 |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
912 "decl %2\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
913 "jnz 1b\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
914 |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
915 "movdqa %%xmm7,%%xmm1\n" |
2979 | 916 "psrldq $8, %%xmm7\n" /* shift hi qword to lo */ |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
917 "paddd %%xmm1,%%xmm7\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
918 "movdqa %%xmm7,%%xmm1\n" |
2979 | 919 "psrldq $4, %%xmm7\n" /* shift hi dword to lo */ |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
920 "paddd %%xmm1,%%xmm7\n" |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
921 "movd %%xmm7,%3\n" |
2967 | 922 : "+r" (pix1), "+r" (pix2), "+r"(h), "=r"(tmp) |
2899
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
923 : "r" ((long)line_size)); |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
924 return tmp; |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
925 } |
d3a726717baf
sse2 16x16 sum squared diff (306=>268 cycles on a K8)
lorenm
parents:
2892
diff
changeset
|
926 |
2067 | 927 static int hf_noise8_mmx(uint8_t * pix1, int line_size, int h) { |
928 int tmp; | |
929 asm volatile ( | |
930 "movl %3,%%ecx\n" | |
931 "pxor %%mm7,%%mm7\n" | |
932 "pxor %%mm6,%%mm6\n" | |
2967 | 933 |
2067 | 934 "movq (%0),%%mm0\n" |
935 "movq %%mm0, %%mm1\n" | |
936 "psllq $8, %%mm0\n" | |
937 "psrlq $8, %%mm1\n" | |
938 "psrlq $8, %%mm0\n" | |
939 "movq %%mm0, %%mm2\n" | |
940 "movq %%mm1, %%mm3\n" | |
941 "punpcklbw %%mm7,%%mm0\n" | |
942 "punpcklbw %%mm7,%%mm1\n" | |
943 "punpckhbw %%mm7,%%mm2\n" | |
944 "punpckhbw %%mm7,%%mm3\n" | |
945 "psubw %%mm1, %%mm0\n" | |
946 "psubw %%mm3, %%mm2\n" | |
2967 | 947 |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
948 "add %2,%0\n" |
2967 | 949 |
2067 | 950 "movq (%0),%%mm4\n" |
951 "movq %%mm4, %%mm1\n" | |
952 "psllq $8, %%mm4\n" | |
953 "psrlq $8, %%mm1\n" | |
954 "psrlq $8, %%mm4\n" | |
955 "movq %%mm4, %%mm5\n" | |
956 "movq %%mm1, %%mm3\n" | |
957 "punpcklbw %%mm7,%%mm4\n" | |
958 "punpcklbw %%mm7,%%mm1\n" | |
959 "punpckhbw %%mm7,%%mm5\n" | |
960 "punpckhbw %%mm7,%%mm3\n" | |
961 "psubw %%mm1, %%mm4\n" | |
962 "psubw %%mm3, %%mm5\n" | |
963 "psubw %%mm4, %%mm0\n" | |
964 "psubw %%mm5, %%mm2\n" | |
965 "pxor %%mm3, %%mm3\n" | |
966 "pxor %%mm1, %%mm1\n" | |
967 "pcmpgtw %%mm0, %%mm3\n\t" | |
968 "pcmpgtw %%mm2, %%mm1\n\t" | |
969 "pxor %%mm3, %%mm0\n" | |
970 "pxor %%mm1, %%mm2\n" | |
2967 | 971 "psubw %%mm3, %%mm0\n" |
2067 | 972 "psubw %%mm1, %%mm2\n" |
973 "paddw %%mm0, %%mm2\n" | |
974 "paddw %%mm2, %%mm6\n" | |
975 | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
976 "add %2,%0\n" |
2067 | 977 "1:\n" |
2967 | 978 |
2067 | 979 "movq (%0),%%mm0\n" |
980 "movq %%mm0, %%mm1\n" | |
981 "psllq $8, %%mm0\n" | |
982 "psrlq $8, %%mm1\n" | |
983 "psrlq $8, %%mm0\n" | |
984 "movq %%mm0, %%mm2\n" | |
985 "movq %%mm1, %%mm3\n" | |
986 "punpcklbw %%mm7,%%mm0\n" | |
987 "punpcklbw %%mm7,%%mm1\n" | |
988 "punpckhbw %%mm7,%%mm2\n" | |
989 "punpckhbw %%mm7,%%mm3\n" | |
990 "psubw %%mm1, %%mm0\n" | |
991 "psubw %%mm3, %%mm2\n" | |
992 "psubw %%mm0, %%mm4\n" | |
993 "psubw %%mm2, %%mm5\n" | |
994 "pxor %%mm3, %%mm3\n" | |
995 "pxor %%mm1, %%mm1\n" | |
996 "pcmpgtw %%mm4, %%mm3\n\t" | |
997 "pcmpgtw %%mm5, %%mm1\n\t" | |
998 "pxor %%mm3, %%mm4\n" | |
999 "pxor %%mm1, %%mm5\n" | |
2967 | 1000 "psubw %%mm3, %%mm4\n" |
2067 | 1001 "psubw %%mm1, %%mm5\n" |
1002 "paddw %%mm4, %%mm5\n" | |
1003 "paddw %%mm5, %%mm6\n" | |
2967 | 1004 |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1005 "add %2,%0\n" |
2967 | 1006 |
2067 | 1007 "movq (%0),%%mm4\n" |
1008 "movq %%mm4, %%mm1\n" | |
1009 "psllq $8, %%mm4\n" | |
1010 "psrlq $8, %%mm1\n" | |
1011 "psrlq $8, %%mm4\n" | |
1012 "movq %%mm4, %%mm5\n" | |
1013 "movq %%mm1, %%mm3\n" | |
1014 "punpcklbw %%mm7,%%mm4\n" | |
1015 "punpcklbw %%mm7,%%mm1\n" | |
1016 "punpckhbw %%mm7,%%mm5\n" | |
1017 "punpckhbw %%mm7,%%mm3\n" | |
1018 "psubw %%mm1, %%mm4\n" | |
1019 "psubw %%mm3, %%mm5\n" | |
1020 "psubw %%mm4, %%mm0\n" | |
1021 "psubw %%mm5, %%mm2\n" | |
1022 "pxor %%mm3, %%mm3\n" | |
1023 "pxor %%mm1, %%mm1\n" | |
1024 "pcmpgtw %%mm0, %%mm3\n\t" | |
1025 "pcmpgtw %%mm2, %%mm1\n\t" | |
1026 "pxor %%mm3, %%mm0\n" | |
1027 "pxor %%mm1, %%mm2\n" | |
2967 | 1028 "psubw %%mm3, %%mm0\n" |
2067 | 1029 "psubw %%mm1, %%mm2\n" |
1030 "paddw %%mm0, %%mm2\n" | |
1031 "paddw %%mm2, %%mm6\n" | |
1032 | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1033 "add %2,%0\n" |
2067 | 1034 "subl $2, %%ecx\n" |
1035 " jnz 1b\n" | |
1036 | |
1037 "movq %%mm6, %%mm0\n" | |
1038 "punpcklwd %%mm7,%%mm0\n" | |
1039 "punpckhwd %%mm7,%%mm6\n" | |
1040 "paddd %%mm0, %%mm6\n" | |
2967 | 1041 |
2067 | 1042 "movq %%mm6,%%mm0\n" |
1043 "psrlq $32, %%mm6\n" | |
1044 "paddd %%mm6,%%mm0\n" | |
1045 "movd %%mm0,%1\n" | |
2967 | 1046 : "+r" (pix1), "=r"(tmp) |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1047 : "r" ((long)line_size) , "g" (h-2) |
2067 | 1048 : "%ecx"); |
1049 return tmp; | |
1050 } | |
1051 | |
1052 static int hf_noise16_mmx(uint8_t * pix1, int line_size, int h) { | |
1053 int tmp; | |
1054 uint8_t * pix= pix1; | |
1055 asm volatile ( | |
1056 "movl %3,%%ecx\n" | |
1057 "pxor %%mm7,%%mm7\n" | |
1058 "pxor %%mm6,%%mm6\n" | |
2967 | 1059 |
2067 | 1060 "movq (%0),%%mm0\n" |
1061 "movq 1(%0),%%mm1\n" | |
1062 "movq %%mm0, %%mm2\n" | |
1063 "movq %%mm1, %%mm3\n" | |
1064 "punpcklbw %%mm7,%%mm0\n" | |
1065 "punpcklbw %%mm7,%%mm1\n" | |
1066 "punpckhbw %%mm7,%%mm2\n" | |
1067 "punpckhbw %%mm7,%%mm3\n" | |
1068 "psubw %%mm1, %%mm0\n" | |
1069 "psubw %%mm3, %%mm2\n" | |
2967 | 1070 |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1071 "add %2,%0\n" |
2967 | 1072 |
2067 | 1073 "movq (%0),%%mm4\n" |
1074 "movq 1(%0),%%mm1\n" | |
1075 "movq %%mm4, %%mm5\n" | |
1076 "movq %%mm1, %%mm3\n" | |
1077 "punpcklbw %%mm7,%%mm4\n" | |
1078 "punpcklbw %%mm7,%%mm1\n" | |
1079 "punpckhbw %%mm7,%%mm5\n" | |
1080 "punpckhbw %%mm7,%%mm3\n" | |
1081 "psubw %%mm1, %%mm4\n" | |
1082 "psubw %%mm3, %%mm5\n" | |
1083 "psubw %%mm4, %%mm0\n" | |
1084 "psubw %%mm5, %%mm2\n" | |
1085 "pxor %%mm3, %%mm3\n" | |
1086 "pxor %%mm1, %%mm1\n" | |
1087 "pcmpgtw %%mm0, %%mm3\n\t" | |
1088 "pcmpgtw %%mm2, %%mm1\n\t" | |
1089 "pxor %%mm3, %%mm0\n" | |
1090 "pxor %%mm1, %%mm2\n" | |
2967 | 1091 "psubw %%mm3, %%mm0\n" |
2067 | 1092 "psubw %%mm1, %%mm2\n" |
1093 "paddw %%mm0, %%mm2\n" | |
1094 "paddw %%mm2, %%mm6\n" | |
1095 | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1096 "add %2,%0\n" |
2067 | 1097 "1:\n" |
2967 | 1098 |
2067 | 1099 "movq (%0),%%mm0\n" |
1100 "movq 1(%0),%%mm1\n" | |
1101 "movq %%mm0, %%mm2\n" | |
1102 "movq %%mm1, %%mm3\n" | |
1103 "punpcklbw %%mm7,%%mm0\n" | |
1104 "punpcklbw %%mm7,%%mm1\n" | |
1105 "punpckhbw %%mm7,%%mm2\n" | |
1106 "punpckhbw %%mm7,%%mm3\n" | |
1107 "psubw %%mm1, %%mm0\n" | |
1108 "psubw %%mm3, %%mm2\n" | |
1109 "psubw %%mm0, %%mm4\n" | |
1110 "psubw %%mm2, %%mm5\n" | |
1111 "pxor %%mm3, %%mm3\n" | |
1112 "pxor %%mm1, %%mm1\n" | |
1113 "pcmpgtw %%mm4, %%mm3\n\t" | |
1114 "pcmpgtw %%mm5, %%mm1\n\t" | |
1115 "pxor %%mm3, %%mm4\n" | |
1116 "pxor %%mm1, %%mm5\n" | |
1117 "psubw %%mm3, %%mm4\n" | |
1118 "psubw %%mm1, %%mm5\n" | |
1119 "paddw %%mm4, %%mm5\n" | |
1120 "paddw %%mm5, %%mm6\n" | |
2967 | 1121 |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1122 "add %2,%0\n" |
2967 | 1123 |
2067 | 1124 "movq (%0),%%mm4\n" |
1125 "movq 1(%0),%%mm1\n" | |
1126 "movq %%mm4, %%mm5\n" | |
1127 "movq %%mm1, %%mm3\n" | |
1128 "punpcklbw %%mm7,%%mm4\n" | |
1129 "punpcklbw %%mm7,%%mm1\n" | |
1130 "punpckhbw %%mm7,%%mm5\n" | |
1131 "punpckhbw %%mm7,%%mm3\n" | |
1132 "psubw %%mm1, %%mm4\n" | |
1133 "psubw %%mm3, %%mm5\n" | |
1134 "psubw %%mm4, %%mm0\n" | |
1135 "psubw %%mm5, %%mm2\n" | |
1136 "pxor %%mm3, %%mm3\n" | |
1137 "pxor %%mm1, %%mm1\n" | |
1138 "pcmpgtw %%mm0, %%mm3\n\t" | |
1139 "pcmpgtw %%mm2, %%mm1\n\t" | |
1140 "pxor %%mm3, %%mm0\n" | |
1141 "pxor %%mm1, %%mm2\n" | |
2967 | 1142 "psubw %%mm3, %%mm0\n" |
2067 | 1143 "psubw %%mm1, %%mm2\n" |
1144 "paddw %%mm0, %%mm2\n" | |
1145 "paddw %%mm2, %%mm6\n" | |
1146 | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1147 "add %2,%0\n" |
2067 | 1148 "subl $2, %%ecx\n" |
1149 " jnz 1b\n" | |
1150 | |
1151 "movq %%mm6, %%mm0\n" | |
1152 "punpcklwd %%mm7,%%mm0\n" | |
1153 "punpckhwd %%mm7,%%mm6\n" | |
1154 "paddd %%mm0, %%mm6\n" | |
2967 | 1155 |
2067 | 1156 "movq %%mm6,%%mm0\n" |
1157 "psrlq $32, %%mm6\n" | |
1158 "paddd %%mm6,%%mm0\n" | |
1159 "movd %%mm0,%1\n" | |
2967 | 1160 : "+r" (pix1), "=r"(tmp) |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1161 : "r" ((long)line_size) , "g" (h-2) |
2067 | 1162 : "%ecx"); |
1163 return tmp + hf_noise8_mmx(pix+8, line_size, h); | |
1164 } | |
1165 | |
2864
95bac7109ff0
Kill some compiler warnings. Compiled code verified identical after changes.
mru
parents:
2754
diff
changeset
|
1166 static int nsse16_mmx(void *p, uint8_t * pix1, uint8_t * pix2, int line_size, int h) { |
95bac7109ff0
Kill some compiler warnings. Compiled code verified identical after changes.
mru
parents:
2754
diff
changeset
|
1167 MpegEncContext *c = p; |
2940 | 1168 int score1, score2; |
1169 | |
1170 if(c) score1 = c->dsp.sse[0](c, pix1, pix2, line_size, h); | |
1171 else score1 = sse16_mmx(c, pix1, pix2, line_size, h); | |
1172 score2= hf_noise16_mmx(pix1, line_size, h) - hf_noise16_mmx(pix2, line_size, h); | |
2067 | 1173 |
1174 if(c) return score1 + ABS(score2)*c->avctx->nsse_weight; | |
1175 else return score1 + ABS(score2)*8; | |
1176 } | |
1177 | |
2864
95bac7109ff0
Kill some compiler warnings. Compiled code verified identical after changes.
mru
parents:
2754
diff
changeset
|
1178 static int nsse8_mmx(void *p, uint8_t * pix1, uint8_t * pix2, int line_size, int h) { |
95bac7109ff0
Kill some compiler warnings. Compiled code verified identical after changes.
mru
parents:
2754
diff
changeset
|
1179 MpegEncContext *c = p; |
2067 | 1180 int score1= sse8_mmx(c, pix1, pix2, line_size, h); |
1181 int score2= hf_noise8_mmx(pix1, line_size, h) - hf_noise8_mmx(pix2, line_size, h); | |
1182 | |
1183 if(c) return score1 + ABS(score2)*c->avctx->nsse_weight; | |
1184 else return score1 + ABS(score2)*8; | |
1185 } | |
1186 | |
1729 | 1187 static int vsad_intra16_mmx(void *v, uint8_t * pix, uint8_t * dummy, int line_size, int h) { |
1188 int tmp; | |
2967 | 1189 |
1729 | 1190 assert( (((int)pix) & 7) == 0); |
1191 assert((line_size &7) ==0); | |
2967 | 1192 |
1729 | 1193 #define SUM(in0, in1, out0, out1) \ |
1194 "movq (%0), %%mm2\n"\ | |
1195 "movq 8(%0), %%mm3\n"\ | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1196 "add %2,%0\n"\ |
1729 | 1197 "movq %%mm2, " #out0 "\n"\ |
1198 "movq %%mm3, " #out1 "\n"\ | |
1199 "psubusb " #in0 ", %%mm2\n"\ | |
1200 "psubusb " #in1 ", %%mm3\n"\ | |
1201 "psubusb " #out0 ", " #in0 "\n"\ | |
1202 "psubusb " #out1 ", " #in1 "\n"\ | |
1203 "por %%mm2, " #in0 "\n"\ | |
1204 "por %%mm3, " #in1 "\n"\ | |
1205 "movq " #in0 ", %%mm2\n"\ | |
1206 "movq " #in1 ", %%mm3\n"\ | |
1207 "punpcklbw %%mm7, " #in0 "\n"\ | |
1208 "punpcklbw %%mm7, " #in1 "\n"\ | |
1209 "punpckhbw %%mm7, %%mm2\n"\ | |
1210 "punpckhbw %%mm7, %%mm3\n"\ | |
1211 "paddw " #in1 ", " #in0 "\n"\ | |
1212 "paddw %%mm3, %%mm2\n"\ | |
1213 "paddw %%mm2, " #in0 "\n"\ | |
1214 "paddw " #in0 ", %%mm6\n" | |
1215 | |
2967 | 1216 |
1729 | 1217 asm volatile ( |
1218 "movl %3,%%ecx\n" | |
1219 "pxor %%mm6,%%mm6\n" | |
1220 "pxor %%mm7,%%mm7\n" | |
1221 "movq (%0),%%mm0\n" | |
1222 "movq 8(%0),%%mm1\n" | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1223 "add %2,%0\n" |
1729 | 1224 "subl $2, %%ecx\n" |
1225 SUM(%%mm0, %%mm1, %%mm4, %%mm5) | |
1226 "1:\n" | |
2967 | 1227 |
1729 | 1228 SUM(%%mm4, %%mm5, %%mm0, %%mm1) |
2967 | 1229 |
1729 | 1230 SUM(%%mm0, %%mm1, %%mm4, %%mm5) |
2967 | 1231 |
1729 | 1232 "subl $2, %%ecx\n" |
1233 "jnz 1b\n" | |
1234 | |
1235 "movq %%mm6,%%mm0\n" | |
1236 "psrlq $32, %%mm6\n" | |
1237 "paddw %%mm6,%%mm0\n" | |
1238 "movq %%mm0,%%mm6\n" | |
1239 "psrlq $16, %%mm0\n" | |
1240 "paddw %%mm6,%%mm0\n" | |
1241 "movd %%mm0,%1\n" | |
2967 | 1242 : "+r" (pix), "=r"(tmp) |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1243 : "r" ((long)line_size) , "m" (h) |
1729 | 1244 : "%ecx"); |
1245 return tmp & 0xFFFF; | |
1246 } | |
1247 #undef SUM | |
1248 | |
1249 static int vsad_intra16_mmx2(void *v, uint8_t * pix, uint8_t * dummy, int line_size, int h) { | |
1250 int tmp; | |
2967 | 1251 |
1729 | 1252 assert( (((int)pix) & 7) == 0); |
1253 assert((line_size &7) ==0); | |
2967 | 1254 |
1729 | 1255 #define SUM(in0, in1, out0, out1) \ |
1256 "movq (%0), " #out0 "\n"\ | |
1257 "movq 8(%0), " #out1 "\n"\ | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1258 "add %2,%0\n"\ |
1729 | 1259 "psadbw " #out0 ", " #in0 "\n"\ |
1260 "psadbw " #out1 ", " #in1 "\n"\ | |
1261 "paddw " #in1 ", " #in0 "\n"\ | |
1262 "paddw " #in0 ", %%mm6\n" | |
1263 | |
1264 asm volatile ( | |
1265 "movl %3,%%ecx\n" | |
1266 "pxor %%mm6,%%mm6\n" | |
1267 "pxor %%mm7,%%mm7\n" | |
1268 "movq (%0),%%mm0\n" | |
1269 "movq 8(%0),%%mm1\n" | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1270 "add %2,%0\n" |
1729 | 1271 "subl $2, %%ecx\n" |
1272 SUM(%%mm0, %%mm1, %%mm4, %%mm5) | |
1273 "1:\n" | |
2967 | 1274 |
1729 | 1275 SUM(%%mm4, %%mm5, %%mm0, %%mm1) |
2967 | 1276 |
1729 | 1277 SUM(%%mm0, %%mm1, %%mm4, %%mm5) |
2967 | 1278 |
1729 | 1279 "subl $2, %%ecx\n" |
1280 "jnz 1b\n" | |
1281 | |
1282 "movd %%mm6,%1\n" | |
2967 | 1283 : "+r" (pix), "=r"(tmp) |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1284 : "r" ((long)line_size) , "m" (h) |
1729 | 1285 : "%ecx"); |
1286 return tmp; | |
1287 } | |
1288 #undef SUM | |
1289 | |
1290 static int vsad16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) { | |
1291 int tmp; | |
2967 | 1292 |
1729 | 1293 assert( (((int)pix1) & 7) == 0); |
1294 assert( (((int)pix2) & 7) == 0); | |
1295 assert((line_size &7) ==0); | |
2967 | 1296 |
1729 | 1297 #define SUM(in0, in1, out0, out1) \ |
1298 "movq (%0),%%mm2\n"\ | |
1299 "movq (%1)," #out0 "\n"\ | |
1300 "movq 8(%0),%%mm3\n"\ | |
1301 "movq 8(%1)," #out1 "\n"\ | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1302 "add %3,%0\n"\ |
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1303 "add %3,%1\n"\ |
1729 | 1304 "psubb " #out0 ", %%mm2\n"\ |
1305 "psubb " #out1 ", %%mm3\n"\ | |
1306 "pxor %%mm7, %%mm2\n"\ | |
1307 "pxor %%mm7, %%mm3\n"\ | |
1308 "movq %%mm2, " #out0 "\n"\ | |
1309 "movq %%mm3, " #out1 "\n"\ | |
1310 "psubusb " #in0 ", %%mm2\n"\ | |
1311 "psubusb " #in1 ", %%mm3\n"\ | |
1312 "psubusb " #out0 ", " #in0 "\n"\ | |
1313 "psubusb " #out1 ", " #in1 "\n"\ | |
1314 "por %%mm2, " #in0 "\n"\ | |
1315 "por %%mm3, " #in1 "\n"\ | |
1316 "movq " #in0 ", %%mm2\n"\ | |
1317 "movq " #in1 ", %%mm3\n"\ | |
1318 "punpcklbw %%mm7, " #in0 "\n"\ | |
1319 "punpcklbw %%mm7, " #in1 "\n"\ | |
1320 "punpckhbw %%mm7, %%mm2\n"\ | |
1321 "punpckhbw %%mm7, %%mm3\n"\ | |
1322 "paddw " #in1 ", " #in0 "\n"\ | |
1323 "paddw %%mm3, %%mm2\n"\ | |
1324 "paddw %%mm2, " #in0 "\n"\ | |
1325 "paddw " #in0 ", %%mm6\n" | |
1326 | |
2967 | 1327 |
1729 | 1328 asm volatile ( |
1329 "movl %4,%%ecx\n" | |
1330 "pxor %%mm6,%%mm6\n" | |
1331 "pcmpeqw %%mm7,%%mm7\n" | |
1332 "psllw $15, %%mm7\n" | |
1333 "packsswb %%mm7, %%mm7\n" | |
1334 "movq (%0),%%mm0\n" | |
1335 "movq (%1),%%mm2\n" | |
1336 "movq 8(%0),%%mm1\n" | |
1337 "movq 8(%1),%%mm3\n" | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1338 "add %3,%0\n" |
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1339 "add %3,%1\n" |
1729 | 1340 "subl $2, %%ecx\n" |
1341 "psubb %%mm2, %%mm0\n" | |
1342 "psubb %%mm3, %%mm1\n" | |
1343 "pxor %%mm7, %%mm0\n" | |
1344 "pxor %%mm7, %%mm1\n" | |
1345 SUM(%%mm0, %%mm1, %%mm4, %%mm5) | |
1346 "1:\n" | |
2967 | 1347 |
1729 | 1348 SUM(%%mm4, %%mm5, %%mm0, %%mm1) |
2967 | 1349 |
1729 | 1350 SUM(%%mm0, %%mm1, %%mm4, %%mm5) |
2967 | 1351 |
1729 | 1352 "subl $2, %%ecx\n" |
1353 "jnz 1b\n" | |
1354 | |
1355 "movq %%mm6,%%mm0\n" | |
1356 "psrlq $32, %%mm6\n" | |
1357 "paddw %%mm6,%%mm0\n" | |
1358 "movq %%mm0,%%mm6\n" | |
1359 "psrlq $16, %%mm0\n" | |
1360 "paddw %%mm6,%%mm0\n" | |
1361 "movd %%mm0,%2\n" | |
2967 | 1362 : "+r" (pix1), "+r" (pix2), "=r"(tmp) |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1363 : "r" ((long)line_size) , "m" (h) |
1729 | 1364 : "%ecx"); |
1365 return tmp & 0x7FFF; | |
1366 } | |
1367 #undef SUM | |
1368 | |
1369 static int vsad16_mmx2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) { | |
1370 int tmp; | |
2967 | 1371 |
1729 | 1372 assert( (((int)pix1) & 7) == 0); |
1373 assert( (((int)pix2) & 7) == 0); | |
1374 assert((line_size &7) ==0); | |
2967 | 1375 |
1729 | 1376 #define SUM(in0, in1, out0, out1) \ |
1377 "movq (%0)," #out0 "\n"\ | |
1378 "movq (%1),%%mm2\n"\ | |
1379 "movq 8(%0)," #out1 "\n"\ | |
1380 "movq 8(%1),%%mm3\n"\ | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1381 "add %3,%0\n"\ |
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1382 "add %3,%1\n"\ |
1729 | 1383 "psubb %%mm2, " #out0 "\n"\ |
1384 "psubb %%mm3, " #out1 "\n"\ | |
1385 "pxor %%mm7, " #out0 "\n"\ | |
1386 "pxor %%mm7, " #out1 "\n"\ | |
1387 "psadbw " #out0 ", " #in0 "\n"\ | |
1388 "psadbw " #out1 ", " #in1 "\n"\ | |
1389 "paddw " #in1 ", " #in0 "\n"\ | |
1390 "paddw " #in0 ", %%mm6\n" | |
1391 | |
1392 asm volatile ( | |
1393 "movl %4,%%ecx\n" | |
1394 "pxor %%mm6,%%mm6\n" | |
1395 "pcmpeqw %%mm7,%%mm7\n" | |
1396 "psllw $15, %%mm7\n" | |
1397 "packsswb %%mm7, %%mm7\n" | |
1398 "movq (%0),%%mm0\n" | |
1399 "movq (%1),%%mm2\n" | |
1400 "movq 8(%0),%%mm1\n" | |
1401 "movq 8(%1),%%mm3\n" | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1402 "add %3,%0\n" |
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1403 "add %3,%1\n" |
1729 | 1404 "subl $2, %%ecx\n" |
1405 "psubb %%mm2, %%mm0\n" | |
1406 "psubb %%mm3, %%mm1\n" | |
1407 "pxor %%mm7, %%mm0\n" | |
1408 "pxor %%mm7, %%mm1\n" | |
1409 SUM(%%mm0, %%mm1, %%mm4, %%mm5) | |
1410 "1:\n" | |
2967 | 1411 |
1729 | 1412 SUM(%%mm4, %%mm5, %%mm0, %%mm1) |
2967 | 1413 |
1729 | 1414 SUM(%%mm0, %%mm1, %%mm4, %%mm5) |
2967 | 1415 |
1729 | 1416 "subl $2, %%ecx\n" |
1417 "jnz 1b\n" | |
1418 | |
1419 "movd %%mm6,%2\n" | |
2967 | 1420 : "+r" (pix1), "+r" (pix2), "=r"(tmp) |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1421 : "r" ((long)line_size) , "m" (h) |
1729 | 1422 : "%ecx"); |
1423 return tmp; | |
1424 } | |
1425 #undef SUM | |
1426 | |
866 | 1427 static void diff_bytes_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){ |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1428 long i=0; |
866 | 1429 asm volatile( |
2979 | 1430 "1: \n\t" |
1431 "movq (%2, %0), %%mm0 \n\t" | |
1432 "movq (%1, %0), %%mm1 \n\t" | |
1433 "psubb %%mm0, %%mm1 \n\t" | |
1434 "movq %%mm1, (%3, %0) \n\t" | |
1435 "movq 8(%2, %0), %%mm0 \n\t" | |
1436 "movq 8(%1, %0), %%mm1 \n\t" | |
1437 "psubb %%mm0, %%mm1 \n\t" | |
1438 "movq %%mm1, 8(%3, %0) \n\t" | |
1439 "add $16, %0 \n\t" | |
1440 "cmp %4, %0 \n\t" | |
1441 " jb 1b \n\t" | |
866 | 1442 : "+r" (i) |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1443 : "r"(src1), "r"(src2), "r"(dst), "r"((long)w-15) |
866 | 1444 ); |
1445 for(; i<w; i++) | |
1446 dst[i+0] = src1[i+0]-src2[i+0]; | |
1447 } | |
1527 | 1448 |
1449 static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w, int *left, int *left_top){ | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1450 long i=0; |
1527 | 1451 uint8_t l, lt; |
2967 | 1452 |
1527 | 1453 asm volatile( |
2979 | 1454 "1: \n\t" |
1455 "movq -1(%1, %0), %%mm0 \n\t" // LT | |
1456 "movq (%1, %0), %%mm1 \n\t" // T | |
1457 "movq -1(%2, %0), %%mm2 \n\t" // L | |
1458 "movq (%2, %0), %%mm3 \n\t" // X | |
1459 "movq %%mm2, %%mm4 \n\t" // L | |
1460 "psubb %%mm0, %%mm2 \n\t" | |
1461 "paddb %%mm1, %%mm2 \n\t" // L + T - LT | |
1462 "movq %%mm4, %%mm5 \n\t" // L | |
1463 "pmaxub %%mm1, %%mm4 \n\t" // max(T, L) | |
1464 "pminub %%mm5, %%mm1 \n\t" // min(T, L) | |
1465 "pminub %%mm2, %%mm4 \n\t" | |
1466 "pmaxub %%mm1, %%mm4 \n\t" | |
1467 "psubb %%mm4, %%mm3 \n\t" // dst - pred | |
1468 "movq %%mm3, (%3, %0) \n\t" | |
1469 "add $8, %0 \n\t" | |
1470 "cmp %4, %0 \n\t" | |
1471 " jb 1b \n\t" | |
1527 | 1472 : "+r" (i) |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1473 : "r"(src1), "r"(src2), "r"(dst), "r"((long)w) |
1527 | 1474 ); |
1475 | |
1476 l= *left; | |
1477 lt= *left_top; | |
2967 | 1478 |
1527 | 1479 dst[0]= src2[0] - mid_pred(l, src1[0], (l + src1[0] - lt)&0xFF); |
2967 | 1480 |
1527 | 1481 *left_top= src1[w-1]; |
1482 *left = src2[w-1]; | |
1483 } | |
1484 | |
1153 | 1485 #define LBUTTERFLY2(a1,b1,a2,b2)\ |
2979 | 1486 "paddw " #b1 ", " #a1 " \n\t"\ |
1487 "paddw " #b2 ", " #a2 " \n\t"\ | |
1488 "paddw " #b1 ", " #b1 " \n\t"\ | |
1489 "paddw " #b2 ", " #b2 " \n\t"\ | |
1490 "psubw " #a1 ", " #b1 " \n\t"\ | |
1491 "psubw " #a2 ", " #b2 " \n\t" | |
866 | 1492 |
936 | 1493 #define HADAMARD48\ |
1153 | 1494 LBUTTERFLY2(%%mm0, %%mm1, %%mm2, %%mm3)\ |
1495 LBUTTERFLY2(%%mm4, %%mm5, %%mm6, %%mm7)\ | |
1496 LBUTTERFLY2(%%mm0, %%mm2, %%mm1, %%mm3)\ | |
1497 LBUTTERFLY2(%%mm4, %%mm6, %%mm5, %%mm7)\ | |
1498 LBUTTERFLY2(%%mm0, %%mm4, %%mm1, %%mm5)\ | |
1499 LBUTTERFLY2(%%mm2, %%mm6, %%mm3, %%mm7)\ | |
936 | 1500 |
1501 #define MMABS(a,z)\ | |
2979 | 1502 "pxor " #z ", " #z " \n\t"\ |
1503 "pcmpgtw " #a ", " #z " \n\t"\ | |
1504 "pxor " #z ", " #a " \n\t"\ | |
1505 "psubw " #z ", " #a " \n\t" | |
936 | 1506 |
1507 #define MMABS_SUM(a,z, sum)\ | |
2979 | 1508 "pxor " #z ", " #z " \n\t"\ |
1509 "pcmpgtw " #a ", " #z " \n\t"\ | |
1510 "pxor " #z ", " #a " \n\t"\ | |
1511 "psubw " #z ", " #a " \n\t"\ | |
1512 "paddusw " #a ", " #sum " \n\t" | |
936 | 1513 |
1153 | 1514 #define MMABS_MMX2(a,z)\ |
2979 | 1515 "pxor " #z ", " #z " \n\t"\ |
1516 "psubw " #a ", " #z " \n\t"\ | |
1517 "pmaxsw " #z ", " #a " \n\t" | |
1153 | 1518 |
1519 #define MMABS_SUM_MMX2(a,z, sum)\ | |
2979 | 1520 "pxor " #z ", " #z " \n\t"\ |
1521 "psubw " #a ", " #z " \n\t"\ | |
1522 "pmaxsw " #z ", " #a " \n\t"\ | |
1523 "paddusw " #a ", " #sum " \n\t" | |
2967 | 1524 |
936 | 1525 #define SBUTTERFLY(a,b,t,n)\ |
2979 | 1526 "movq " #a ", " #t " \n\t" /* abcd */\ |
1527 "punpckl" #n " " #b ", " #a " \n\t" /* aebf */\ | |
1528 "punpckh" #n " " #b ", " #t " \n\t" /* cgdh */\ | |
1153 | 1529 |
936 | 1530 #define TRANSPOSE4(a,b,c,d,t)\ |
1531 SBUTTERFLY(a,b,t,wd) /* a=aebf t=cgdh */\ | |
1532 SBUTTERFLY(c,d,b,wd) /* c=imjn b=kolp */\ | |
1533 SBUTTERFLY(a,c,d,dq) /* a=aeim d=bfjn */\ | |
1534 SBUTTERFLY(t,b,c,dq) /* t=cgko c=dhlp */ | |
1535 | |
1536 #define LOAD4(o, a, b, c, d)\ | |
2979 | 1537 "movq "#o"(%1), " #a " \n\t"\ |
1538 "movq "#o"+16(%1), " #b " \n\t"\ | |
1539 "movq "#o"+32(%1), " #c " \n\t"\ | |
1540 "movq "#o"+48(%1), " #d " \n\t" | |
936 | 1541 |
1542 #define STORE4(o, a, b, c, d)\ | |
2979 | 1543 "movq "#a", "#o"(%1) \n\t"\ |
1544 "movq "#b", "#o"+16(%1) \n\t"\ | |
1545 "movq "#c", "#o"+32(%1) \n\t"\ | |
1546 "movq "#d", "#o"+48(%1) \n\t"\ | |
936 | 1547 |
1708 | 1548 static int hadamard8_diff_mmx(void *s, uint8_t *src1, uint8_t *src2, int stride, int h){ |
936 | 1549 uint64_t temp[16] __align8; |
1550 int sum=0; | |
2967 | 1551 |
1708 | 1552 assert(h==8); |
936 | 1553 |
1554 diff_pixels_mmx((DCTELEM*)temp, src1, src2, stride); | |
1555 | |
1556 asm volatile( | |
1557 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3) | |
1558 LOAD4(64, %%mm4, %%mm5, %%mm6, %%mm7) | |
2967 | 1559 |
936 | 1560 HADAMARD48 |
2967 | 1561 |
2979 | 1562 "movq %%mm7, 112(%1) \n\t" |
2967 | 1563 |
936 | 1564 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7) |
1565 STORE4(0 , %%mm0, %%mm3, %%mm7, %%mm2) | |
2967 | 1566 |
2979 | 1567 "movq 112(%1), %%mm7 \n\t" |
936 | 1568 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0) |
1569 STORE4(64, %%mm4, %%mm7, %%mm0, %%mm6) | |
1570 | |
1571 LOAD4(8 , %%mm0, %%mm1, %%mm2, %%mm3) | |
1572 LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7) | |
2967 | 1573 |
936 | 1574 HADAMARD48 |
2967 | 1575 |
2979 | 1576 "movq %%mm7, 120(%1) \n\t" |
2967 | 1577 |
936 | 1578 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7) |
1579 STORE4(8 , %%mm0, %%mm3, %%mm7, %%mm2) | |
2967 | 1580 |
2979 | 1581 "movq 120(%1), %%mm7 \n\t" |
936 | 1582 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0) |
2979 | 1583 "movq %%mm7, %%mm5 \n\t"//FIXME remove |
1584 "movq %%mm6, %%mm7 \n\t" | |
1585 "movq %%mm0, %%mm6 \n\t" | |
936 | 1586 // STORE4(72, %%mm4, %%mm7, %%mm0, %%mm6) //FIXME remove |
2967 | 1587 |
936 | 1588 LOAD4(64, %%mm0, %%mm1, %%mm2, %%mm3) |
1589 // LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7) | |
2967 | 1590 |
936 | 1591 HADAMARD48 |
2979 | 1592 "movq %%mm7, 64(%1) \n\t" |
936 | 1593 MMABS(%%mm0, %%mm7) |
1594 MMABS_SUM(%%mm1, %%mm7, %%mm0) | |
1595 MMABS_SUM(%%mm2, %%mm7, %%mm0) | |
1596 MMABS_SUM(%%mm3, %%mm7, %%mm0) | |
1597 MMABS_SUM(%%mm4, %%mm7, %%mm0) | |
1598 MMABS_SUM(%%mm5, %%mm7, %%mm0) | |
1599 MMABS_SUM(%%mm6, %%mm7, %%mm0) | |
2979 | 1600 "movq 64(%1), %%mm1 \n\t" |
936 | 1601 MMABS_SUM(%%mm1, %%mm7, %%mm0) |
2979 | 1602 "movq %%mm0, 64(%1) \n\t" |
2967 | 1603 |
936 | 1604 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3) |
1605 LOAD4(8 , %%mm4, %%mm5, %%mm6, %%mm7) | |
2967 | 1606 |
936 | 1607 HADAMARD48 |
2979 | 1608 "movq %%mm7, (%1) \n\t" |
936 | 1609 MMABS(%%mm0, %%mm7) |
1610 MMABS_SUM(%%mm1, %%mm7, %%mm0) | |
1611 MMABS_SUM(%%mm2, %%mm7, %%mm0) | |
1612 MMABS_SUM(%%mm3, %%mm7, %%mm0) | |
1613 MMABS_SUM(%%mm4, %%mm7, %%mm0) | |
1614 MMABS_SUM(%%mm5, %%mm7, %%mm0) | |
1615 MMABS_SUM(%%mm6, %%mm7, %%mm0) | |
2979 | 1616 "movq (%1), %%mm1 \n\t" |
936 | 1617 MMABS_SUM(%%mm1, %%mm7, %%mm0) |
2979 | 1618 "movq 64(%1), %%mm1 \n\t" |
936 | 1619 MMABS_SUM(%%mm1, %%mm7, %%mm0) |
2967 | 1620 |
2979 | 1621 "movq %%mm0, %%mm1 \n\t" |
1622 "psrlq $32, %%mm0 \n\t" | |
1623 "paddusw %%mm1, %%mm0 \n\t" | |
1624 "movq %%mm0, %%mm1 \n\t" | |
1625 "psrlq $16, %%mm0 \n\t" | |
1626 "paddusw %%mm1, %%mm0 \n\t" | |
1627 "movd %%mm0, %0 \n\t" | |
2967 | 1628 |
936 | 1629 : "=r" (sum) |
1630 : "r"(temp) | |
1631 ); | |
1632 return sum&0xFFFF; | |
1633 } | |
1634 | |
1708 | 1635 static int hadamard8_diff_mmx2(void *s, uint8_t *src1, uint8_t *src2, int stride, int h){ |
1153 | 1636 uint64_t temp[16] __align8; |
1637 int sum=0; | |
2967 | 1638 |
1708 | 1639 assert(h==8); |
1153 | 1640 |
1641 diff_pixels_mmx((DCTELEM*)temp, src1, src2, stride); | |
1642 | |
1643 asm volatile( | |
1644 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3) | |
1645 LOAD4(64, %%mm4, %%mm5, %%mm6, %%mm7) | |
2967 | 1646 |
1153 | 1647 HADAMARD48 |
2967 | 1648 |
2979 | 1649 "movq %%mm7, 112(%1) \n\t" |
2967 | 1650 |
1153 | 1651 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7) |
1652 STORE4(0 , %%mm0, %%mm3, %%mm7, %%mm2) | |
2967 | 1653 |
2979 | 1654 "movq 112(%1), %%mm7 \n\t" |
1153 | 1655 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0) |
1656 STORE4(64, %%mm4, %%mm7, %%mm0, %%mm6) | |
1657 | |
1658 LOAD4(8 , %%mm0, %%mm1, %%mm2, %%mm3) | |
1659 LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7) | |
2967 | 1660 |
1153 | 1661 HADAMARD48 |
2967 | 1662 |
2979 | 1663 "movq %%mm7, 120(%1) \n\t" |
2967 | 1664 |
1153 | 1665 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7) |
1666 STORE4(8 , %%mm0, %%mm3, %%mm7, %%mm2) | |
2967 | 1667 |
2979 | 1668 "movq 120(%1), %%mm7 \n\t" |
1153 | 1669 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0) |
2979 | 1670 "movq %%mm7, %%mm5 \n\t"//FIXME remove |
1671 "movq %%mm6, %%mm7 \n\t" | |
1672 "movq %%mm0, %%mm6 \n\t" | |
1153 | 1673 // STORE4(72, %%mm4, %%mm7, %%mm0, %%mm6) //FIXME remove |
2967 | 1674 |
1153 | 1675 LOAD4(64, %%mm0, %%mm1, %%mm2, %%mm3) |
1676 // LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7) | |
2967 | 1677 |
1153 | 1678 HADAMARD48 |
2979 | 1679 "movq %%mm7, 64(%1) \n\t" |
1153 | 1680 MMABS_MMX2(%%mm0, %%mm7) |
1681 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0) | |
1682 MMABS_SUM_MMX2(%%mm2, %%mm7, %%mm0) | |
1683 MMABS_SUM_MMX2(%%mm3, %%mm7, %%mm0) | |
1684 MMABS_SUM_MMX2(%%mm4, %%mm7, %%mm0) | |
1685 MMABS_SUM_MMX2(%%mm5, %%mm7, %%mm0) | |
1686 MMABS_SUM_MMX2(%%mm6, %%mm7, %%mm0) | |
2979 | 1687 "movq 64(%1), %%mm1 \n\t" |
1153 | 1688 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0) |
2979 | 1689 "movq %%mm0, 64(%1) \n\t" |
2967 | 1690 |
1153 | 1691 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3) |
1692 LOAD4(8 , %%mm4, %%mm5, %%mm6, %%mm7) | |
2967 | 1693 |
1153 | 1694 HADAMARD48 |
2979 | 1695 "movq %%mm7, (%1) \n\t" |
1153 | 1696 MMABS_MMX2(%%mm0, %%mm7) |
1697 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0) | |
1698 MMABS_SUM_MMX2(%%mm2, %%mm7, %%mm0) | |
1699 MMABS_SUM_MMX2(%%mm3, %%mm7, %%mm0) | |
1700 MMABS_SUM_MMX2(%%mm4, %%mm7, %%mm0) | |
1701 MMABS_SUM_MMX2(%%mm5, %%mm7, %%mm0) | |
1702 MMABS_SUM_MMX2(%%mm6, %%mm7, %%mm0) | |
2979 | 1703 "movq (%1), %%mm1 \n\t" |
1153 | 1704 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0) |
2979 | 1705 "movq 64(%1), %%mm1 \n\t" |
1153 | 1706 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0) |
2967 | 1707 |
2892
41315d0120b3
replace a few mov + psrlq with pshufw, there are more cases which could benefit from this but they would require us to duplicate some functions ...
michael
parents:
2871
diff
changeset
|
1708 "pshufw $0x0E, %%mm0, %%mm1 \n\t" |
2979 | 1709 "paddusw %%mm1, %%mm0 \n\t" |
2892
41315d0120b3
replace a few mov + psrlq with pshufw, there are more cases which could benefit from this but they would require us to duplicate some functions ...
michael
parents:
2871
diff
changeset
|
1710 "pshufw $0x01, %%mm0, %%mm1 \n\t" |
2979 | 1711 "paddusw %%mm1, %%mm0 \n\t" |
1712 "movd %%mm0, %0 \n\t" | |
2967 | 1713 |
1153 | 1714 : "=r" (sum) |
1715 : "r"(temp) | |
1716 ); | |
1717 return sum&0xFFFF; | |
1718 } | |
1719 | |
1720 | |
1708 | 1721 WARPER8_16_SQ(hadamard8_diff_mmx, hadamard8_diff16_mmx) |
1722 WARPER8_16_SQ(hadamard8_diff_mmx2, hadamard8_diff16_mmx2) | |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
1723 #endif //CONFIG_ENCODERS |
866 | 1724 |
959 | 1725 #define put_no_rnd_pixels8_mmx(a,b,c,d) put_pixels8_mmx(a,b,c,d) |
1726 #define put_no_rnd_pixels16_mmx(a,b,c,d) put_pixels16_mmx(a,b,c,d) | |
1727 | |
954 | 1728 #define QPEL_V_LOW(m3,m4,m5,m6, pw_20, pw_3, rnd, in0, in1, in2, in7, out, OP)\ |
2979 | 1729 "paddw " #m4 ", " #m3 " \n\t" /* x1 */\ |
1730 "movq "MANGLE(ff_pw_20)", %%mm4 \n\t" /* 20 */\ | |
1731 "pmullw " #m3 ", %%mm4 \n\t" /* 20x1 */\ | |
1732 "movq "#in7", " #m3 " \n\t" /* d */\ | |
1733 "movq "#in0", %%mm5 \n\t" /* D */\ | |
1734 "paddw " #m3 ", %%mm5 \n\t" /* x4 */\ | |
1735 "psubw %%mm5, %%mm4 \n\t" /* 20x1 - x4 */\ | |
1736 "movq "#in1", %%mm5 \n\t" /* C */\ | |
1737 "movq "#in2", %%mm6 \n\t" /* B */\ | |
1738 "paddw " #m6 ", %%mm5 \n\t" /* x3 */\ | |
1739 "paddw " #m5 ", %%mm6 \n\t" /* x2 */\ | |
1740 "paddw %%mm6, %%mm6 \n\t" /* 2x2 */\ | |
1741 "psubw %%mm6, %%mm5 \n\t" /* -2x2 + x3 */\ | |
1742 "pmullw "MANGLE(ff_pw_3)", %%mm5 \n\t" /* -6x2 + 3x3 */\ | |
1743 "paddw " #rnd ", %%mm4 \n\t" /* x2 */\ | |
1744 "paddw %%mm4, %%mm5 \n\t" /* 20x1 - 6x2 + 3x3 - x4 */\ | |
1745 "psraw $5, %%mm5 \n\t"\ | |
1746 "packuswb %%mm5, %%mm5 \n\t"\ | |
954 | 1747 OP(%%mm5, out, %%mm7, d) |
1748 | |
959 | 1749 #define QPEL_BASE(OPNAME, ROUNDER, RND, OP_MMX2, OP_3DNOW)\ |
1057 | 1750 static void OPNAME ## mpeg4_qpel16_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ |
954 | 1751 uint64_t temp;\ |
1752 \ | |
1753 asm volatile(\ | |
2979 | 1754 "pxor %%mm7, %%mm7 \n\t"\ |
1755 "1: \n\t"\ | |
1756 "movq (%0), %%mm0 \n\t" /* ABCDEFGH */\ | |
1757 "movq %%mm0, %%mm1 \n\t" /* ABCDEFGH */\ | |
1758 "movq %%mm0, %%mm2 \n\t" /* ABCDEFGH */\ | |
1759 "punpcklbw %%mm7, %%mm0 \n\t" /* 0A0B0C0D */\ | |
1760 "punpckhbw %%mm7, %%mm1 \n\t" /* 0E0F0G0H */\ | |
1761 "pshufw $0x90, %%mm0, %%mm5 \n\t" /* 0A0A0B0C */\ | |
1762 "pshufw $0x41, %%mm0, %%mm6 \n\t" /* 0B0A0A0B */\ | |
1763 "movq %%mm2, %%mm3 \n\t" /* ABCDEFGH */\ | |
1764 "movq %%mm2, %%mm4 \n\t" /* ABCDEFGH */\ | |
1765 "psllq $8, %%mm2 \n\t" /* 0ABCDEFG */\ | |
1766 "psllq $16, %%mm3 \n\t" /* 00ABCDEF */\ | |
1767 "psllq $24, %%mm4 \n\t" /* 000ABCDE */\ | |
1768 "punpckhbw %%mm7, %%mm2 \n\t" /* 0D0E0F0G */\ | |
1769 "punpckhbw %%mm7, %%mm3 \n\t" /* 0C0D0E0F */\ | |
1770 "punpckhbw %%mm7, %%mm4 \n\t" /* 0B0C0D0E */\ | |
1771 "paddw %%mm3, %%mm5 \n\t" /* b */\ | |
1772 "paddw %%mm2, %%mm6 \n\t" /* c */\ | |
1773 "paddw %%mm5, %%mm5 \n\t" /* 2b */\ | |
1774 "psubw %%mm5, %%mm6 \n\t" /* c - 2b */\ | |
1775 "pshufw $0x06, %%mm0, %%mm5 \n\t" /* 0C0B0A0A */\ | |
1776 "pmullw "MANGLE(ff_pw_3)", %%mm6 \n\t" /* 3c - 6b */\ | |
1777 "paddw %%mm4, %%mm0 \n\t" /* a */\ | |
1778 "paddw %%mm1, %%mm5 \n\t" /* d */\ | |
1779 "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" /* 20a */\ | |
1780 "psubw %%mm5, %%mm0 \n\t" /* 20a - d */\ | |
1781 "paddw %6, %%mm6 \n\t"\ | |
1782 "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\ | |
1783 "psraw $5, %%mm0 \n\t"\ | |
1784 "movq %%mm0, %5 \n\t"\ | |
954 | 1785 /* mm1=EFGH, mm2=DEFG, mm3=CDEF, mm4=BCDE, mm7=0 */\ |
1786 \ | |
2979 | 1787 "movq 5(%0), %%mm0 \n\t" /* FGHIJKLM */\ |
1788 "movq %%mm0, %%mm5 \n\t" /* FGHIJKLM */\ | |
1789 "movq %%mm0, %%mm6 \n\t" /* FGHIJKLM */\ | |
1790 "psrlq $8, %%mm0 \n\t" /* GHIJKLM0 */\ | |
1791 "psrlq $16, %%mm5 \n\t" /* HIJKLM00 */\ | |
1792 "punpcklbw %%mm7, %%mm0 \n\t" /* 0G0H0I0J */\ | |
1793 "punpcklbw %%mm7, %%mm5 \n\t" /* 0H0I0J0K */\ | |
1794 "paddw %%mm0, %%mm2 \n\t" /* b */\ | |
1795 "paddw %%mm5, %%mm3 \n\t" /* c */\ | |
1796 "paddw %%mm2, %%mm2 \n\t" /* 2b */\ | |
1797 "psubw %%mm2, %%mm3 \n\t" /* c - 2b */\ | |
1798 "movq %%mm6, %%mm2 \n\t" /* FGHIJKLM */\ | |
1799 "psrlq $24, %%mm6 \n\t" /* IJKLM000 */\ | |
1800 "punpcklbw %%mm7, %%mm2 \n\t" /* 0F0G0H0I */\ | |
1801 "punpcklbw %%mm7, %%mm6 \n\t" /* 0I0J0K0L */\ | |
1802 "pmullw "MANGLE(ff_pw_3)", %%mm3 \n\t" /* 3c - 6b */\ | |
1803 "paddw %%mm2, %%mm1 \n\t" /* a */\ | |
1804 "paddw %%mm6, %%mm4 \n\t" /* d */\ | |
1805 "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" /* 20a */\ | |
1806 "psubw %%mm4, %%mm3 \n\t" /* - 6b +3c - d */\ | |
1807 "paddw %6, %%mm1 \n\t"\ | |
1808 "paddw %%mm1, %%mm3 \n\t" /* 20a - 6b +3c - d */\ | |
1809 "psraw $5, %%mm3 \n\t"\ | |
1810 "movq %5, %%mm1 \n\t"\ | |
1811 "packuswb %%mm3, %%mm1 \n\t"\ | |
959 | 1812 OP_MMX2(%%mm1, (%1),%%mm4, q)\ |
954 | 1813 /* mm0= GHIJ, mm2=FGHI, mm5=HIJK, mm6=IJKL, mm7=0 */\ |
1814 \ | |
2979 | 1815 "movq 9(%0), %%mm1 \n\t" /* JKLMNOPQ */\ |
1816 "movq %%mm1, %%mm4 \n\t" /* JKLMNOPQ */\ | |
1817 "movq %%mm1, %%mm3 \n\t" /* JKLMNOPQ */\ | |
1818 "psrlq $8, %%mm1 \n\t" /* KLMNOPQ0 */\ | |
1819 "psrlq $16, %%mm4 \n\t" /* LMNOPQ00 */\ | |
1820 "punpcklbw %%mm7, %%mm1 \n\t" /* 0K0L0M0N */\ | |
1821 "punpcklbw %%mm7, %%mm4 \n\t" /* 0L0M0N0O */\ | |
1822 "paddw %%mm1, %%mm5 \n\t" /* b */\ | |
1823 "paddw %%mm4, %%mm0 \n\t" /* c */\ | |
1824 "paddw %%mm5, %%mm5 \n\t" /* 2b */\ | |
1825 "psubw %%mm5, %%mm0 \n\t" /* c - 2b */\ | |
1826 "movq %%mm3, %%mm5 \n\t" /* JKLMNOPQ */\ | |
1827 "psrlq $24, %%mm3 \n\t" /* MNOPQ000 */\ | |
1828 "pmullw "MANGLE(ff_pw_3)", %%mm0 \n\t" /* 3c - 6b */\ | |
1829 "punpcklbw %%mm7, %%mm3 \n\t" /* 0M0N0O0P */\ | |
1830 "paddw %%mm3, %%mm2 \n\t" /* d */\ | |
1831 "psubw %%mm2, %%mm0 \n\t" /* -6b + 3c - d */\ | |
1832 "movq %%mm5, %%mm2 \n\t" /* JKLMNOPQ */\ | |
1833 "punpcklbw %%mm7, %%mm2 \n\t" /* 0J0K0L0M */\ | |
1834 "punpckhbw %%mm7, %%mm5 \n\t" /* 0N0O0P0Q */\ | |
1835 "paddw %%mm2, %%mm6 \n\t" /* a */\ | |
1836 "pmullw "MANGLE(ff_pw_20)", %%mm6 \n\t" /* 20a */\ | |
1837 "paddw %6, %%mm0 \n\t"\ | |
1838 "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\ | |
1839 "psraw $5, %%mm0 \n\t"\ | |
954 | 1840 /* mm1=KLMN, mm2=JKLM, mm3=MNOP, mm4=LMNO, mm5=NOPQ mm7=0 */\ |
1841 \ | |
2979 | 1842 "paddw %%mm5, %%mm3 \n\t" /* a */\ |
1843 "pshufw $0xF9, %%mm5, %%mm6 \n\t" /* 0O0P0Q0Q */\ | |
1844 "paddw %%mm4, %%mm6 \n\t" /* b */\ | |
1845 "pshufw $0xBE, %%mm5, %%mm4 \n\t" /* 0P0Q0Q0P */\ | |
1846 "pshufw $0x6F, %%mm5, %%mm5 \n\t" /* 0Q0Q0P0O */\ | |
1847 "paddw %%mm1, %%mm4 \n\t" /* c */\ | |
1848 "paddw %%mm2, %%mm5 \n\t" /* d */\ | |
1849 "paddw %%mm6, %%mm6 \n\t" /* 2b */\ | |
1850 "psubw %%mm6, %%mm4 \n\t" /* c - 2b */\ | |
1851 "pmullw "MANGLE(ff_pw_20)", %%mm3 \n\t" /* 20a */\ | |
1852 "pmullw "MANGLE(ff_pw_3)", %%mm4 \n\t" /* 3c - 6b */\ | |
1853 "psubw %%mm5, %%mm3 \n\t" /* -6b + 3c - d */\ | |
1854 "paddw %6, %%mm4 \n\t"\ | |
1855 "paddw %%mm3, %%mm4 \n\t" /* 20a - 6b + 3c - d */\ | |
1856 "psraw $5, %%mm4 \n\t"\ | |
1857 "packuswb %%mm4, %%mm0 \n\t"\ | |
959 | 1858 OP_MMX2(%%mm0, 8(%1), %%mm4, q)\ |
954 | 1859 \ |
2979 | 1860 "add %3, %0 \n\t"\ |
1861 "add %4, %1 \n\t"\ | |
1862 "decl %2 \n\t"\ | |
1863 " jnz 1b \n\t"\ | |
967 | 1864 : "+a"(src), "+c"(dst), "+m"(h)\ |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1865 : "d"((long)srcStride), "S"((long)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(temp), "m"(ROUNDER)\ |
966 | 1866 : "memory"\ |
954 | 1867 );\ |
1868 }\ | |
1869 \ | |
1870 static void OPNAME ## mpeg4_qpel16_h_lowpass_3dnow(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ | |
1871 int i;\ | |
1872 int16_t temp[16];\ | |
1873 /* quick HACK, XXX FIXME MUST be optimized */\ | |
1874 for(i=0; i<h; i++)\ | |
1875 {\ | |
1876 temp[ 0]= (src[ 0]+src[ 1])*20 - (src[ 0]+src[ 2])*6 + (src[ 1]+src[ 3])*3 - (src[ 2]+src[ 4]);\ | |
1877 temp[ 1]= (src[ 1]+src[ 2])*20 - (src[ 0]+src[ 3])*6 + (src[ 0]+src[ 4])*3 - (src[ 1]+src[ 5]);\ | |
1878 temp[ 2]= (src[ 2]+src[ 3])*20 - (src[ 1]+src[ 4])*6 + (src[ 0]+src[ 5])*3 - (src[ 0]+src[ 6]);\ | |
1879 temp[ 3]= (src[ 3]+src[ 4])*20 - (src[ 2]+src[ 5])*6 + (src[ 1]+src[ 6])*3 - (src[ 0]+src[ 7]);\ | |
1880 temp[ 4]= (src[ 4]+src[ 5])*20 - (src[ 3]+src[ 6])*6 + (src[ 2]+src[ 7])*3 - (src[ 1]+src[ 8]);\ | |
1881 temp[ 5]= (src[ 5]+src[ 6])*20 - (src[ 4]+src[ 7])*6 + (src[ 3]+src[ 8])*3 - (src[ 2]+src[ 9]);\ | |
1882 temp[ 6]= (src[ 6]+src[ 7])*20 - (src[ 5]+src[ 8])*6 + (src[ 4]+src[ 9])*3 - (src[ 3]+src[10]);\ | |
1883 temp[ 7]= (src[ 7]+src[ 8])*20 - (src[ 6]+src[ 9])*6 + (src[ 5]+src[10])*3 - (src[ 4]+src[11]);\ | |
1884 temp[ 8]= (src[ 8]+src[ 9])*20 - (src[ 7]+src[10])*6 + (src[ 6]+src[11])*3 - (src[ 5]+src[12]);\ | |
1885 temp[ 9]= (src[ 9]+src[10])*20 - (src[ 8]+src[11])*6 + (src[ 7]+src[12])*3 - (src[ 6]+src[13]);\ | |
1886 temp[10]= (src[10]+src[11])*20 - (src[ 9]+src[12])*6 + (src[ 8]+src[13])*3 - (src[ 7]+src[14]);\ | |
1887 temp[11]= (src[11]+src[12])*20 - (src[10]+src[13])*6 + (src[ 9]+src[14])*3 - (src[ 8]+src[15]);\ | |
1888 temp[12]= (src[12]+src[13])*20 - (src[11]+src[14])*6 + (src[10]+src[15])*3 - (src[ 9]+src[16]);\ | |
1889 temp[13]= (src[13]+src[14])*20 - (src[12]+src[15])*6 + (src[11]+src[16])*3 - (src[10]+src[16]);\ | |
1890 temp[14]= (src[14]+src[15])*20 - (src[13]+src[16])*6 + (src[12]+src[16])*3 - (src[11]+src[15]);\ | |
1891 temp[15]= (src[15]+src[16])*20 - (src[14]+src[16])*6 + (src[13]+src[15])*3 - (src[12]+src[14]);\ | |
1892 asm volatile(\ | |
2979 | 1893 "movq (%0), %%mm0 \n\t"\ |
1894 "movq 8(%0), %%mm1 \n\t"\ | |
1895 "paddw %2, %%mm0 \n\t"\ | |
1896 "paddw %2, %%mm1 \n\t"\ | |
1897 "psraw $5, %%mm0 \n\t"\ | |
1898 "psraw $5, %%mm1 \n\t"\ | |
1899 "packuswb %%mm1, %%mm0 \n\t"\ | |
959 | 1900 OP_3DNOW(%%mm0, (%1), %%mm1, q)\ |
2979 | 1901 "movq 16(%0), %%mm0 \n\t"\ |
1902 "movq 24(%0), %%mm1 \n\t"\ | |
1903 "paddw %2, %%mm0 \n\t"\ | |
1904 "paddw %2, %%mm1 \n\t"\ | |
1905 "psraw $5, %%mm0 \n\t"\ | |
1906 "psraw $5, %%mm1 \n\t"\ | |
1907 "packuswb %%mm1, %%mm0 \n\t"\ | |
959 | 1908 OP_3DNOW(%%mm0, 8(%1), %%mm1, q)\ |
954 | 1909 :: "r"(temp), "r"(dst), "m"(ROUNDER)\ |
966 | 1910 : "memory"\ |
954 | 1911 );\ |
1912 dst+=dstStride;\ | |
1913 src+=srcStride;\ | |
1914 }\ | |
1915 }\ | |
1916 \ | |
1057 | 1917 static void OPNAME ## mpeg4_qpel8_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ |
959 | 1918 uint64_t temp;\ |
1919 \ | |
1920 asm volatile(\ | |
2979 | 1921 "pxor %%mm7, %%mm7 \n\t"\ |
1922 "1: \n\t"\ | |
1923 "movq (%0), %%mm0 \n\t" /* ABCDEFGH */\ | |
1924 "movq %%mm0, %%mm1 \n\t" /* ABCDEFGH */\ | |
1925 "movq %%mm0, %%mm2 \n\t" /* ABCDEFGH */\ | |
1926 "punpcklbw %%mm7, %%mm0 \n\t" /* 0A0B0C0D */\ | |
1927 "punpckhbw %%mm7, %%mm1 \n\t" /* 0E0F0G0H */\ | |
1928 "pshufw $0x90, %%mm0, %%mm5 \n\t" /* 0A0A0B0C */\ | |
1929 "pshufw $0x41, %%mm0, %%mm6 \n\t" /* 0B0A0A0B */\ | |
1930 "movq %%mm2, %%mm3 \n\t" /* ABCDEFGH */\ | |
1931 "movq %%mm2, %%mm4 \n\t" /* ABCDEFGH */\ | |
1932 "psllq $8, %%mm2 \n\t" /* 0ABCDEFG */\ | |
1933 "psllq $16, %%mm3 \n\t" /* 00ABCDEF */\ | |
1934 "psllq $24, %%mm4 \n\t" /* 000ABCDE */\ | |
1935 "punpckhbw %%mm7, %%mm2 \n\t" /* 0D0E0F0G */\ | |
1936 "punpckhbw %%mm7, %%mm3 \n\t" /* 0C0D0E0F */\ | |
1937 "punpckhbw %%mm7, %%mm4 \n\t" /* 0B0C0D0E */\ | |
1938 "paddw %%mm3, %%mm5 \n\t" /* b */\ | |
1939 "paddw %%mm2, %%mm6 \n\t" /* c */\ | |
1940 "paddw %%mm5, %%mm5 \n\t" /* 2b */\ | |
1941 "psubw %%mm5, %%mm6 \n\t" /* c - 2b */\ | |
1942 "pshufw $0x06, %%mm0, %%mm5 \n\t" /* 0C0B0A0A */\ | |
1943 "pmullw "MANGLE(ff_pw_3)", %%mm6 \n\t" /* 3c - 6b */\ | |
1944 "paddw %%mm4, %%mm0 \n\t" /* a */\ | |
1945 "paddw %%mm1, %%mm5 \n\t" /* d */\ | |
1946 "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" /* 20a */\ | |
1947 "psubw %%mm5, %%mm0 \n\t" /* 20a - d */\ | |
1948 "paddw %6, %%mm6 \n\t"\ | |
1949 "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\ | |
1950 "psraw $5, %%mm0 \n\t"\ | |
959 | 1951 /* mm1=EFGH, mm2=DEFG, mm3=CDEF, mm4=BCDE, mm7=0 */\ |
1952 \ | |
2979 | 1953 "movd 5(%0), %%mm5 \n\t" /* FGHI */\ |
1954 "punpcklbw %%mm7, %%mm5 \n\t" /* 0F0G0H0I */\ | |
1955 "pshufw $0xF9, %%mm5, %%mm6 \n\t" /* 0G0H0I0I */\ | |
1956 "paddw %%mm5, %%mm1 \n\t" /* a */\ | |
1957 "paddw %%mm6, %%mm2 \n\t" /* b */\ | |
1958 "pshufw $0xBE, %%mm5, %%mm6 \n\t" /* 0H0I0I0H */\ | |
1959 "pshufw $0x6F, %%mm5, %%mm5 \n\t" /* 0I0I0H0G */\ | |
1960 "paddw %%mm6, %%mm3 \n\t" /* c */\ | |
1961 "paddw %%mm5, %%mm4 \n\t" /* d */\ | |
1962 "paddw %%mm2, %%mm2 \n\t" /* 2b */\ | |
1963 "psubw %%mm2, %%mm3 \n\t" /* c - 2b */\ | |
1964 "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" /* 20a */\ | |
1965 "pmullw "MANGLE(ff_pw_3)", %%mm3 \n\t" /* 3c - 6b */\ | |
1966 "psubw %%mm4, %%mm3 \n\t" /* -6b + 3c - d */\ | |
1967 "paddw %6, %%mm1 \n\t"\ | |
1968 "paddw %%mm1, %%mm3 \n\t" /* 20a - 6b + 3c - d */\ | |
1969 "psraw $5, %%mm3 \n\t"\ | |
1970 "packuswb %%mm3, %%mm0 \n\t"\ | |
959 | 1971 OP_MMX2(%%mm0, (%1), %%mm4, q)\ |
1972 \ | |
2979 | 1973 "add %3, %0 \n\t"\ |
1974 "add %4, %1 \n\t"\ | |
1975 "decl %2 \n\t"\ | |
1976 " jnz 1b \n\t"\ | |
967 | 1977 : "+a"(src), "+c"(dst), "+m"(h)\ |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
1978 : "S"((long)srcStride), "D"((long)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(temp), "m"(ROUNDER)\ |
966 | 1979 : "memory"\ |
959 | 1980 );\ |
1981 }\ | |
1982 \ | |
1983 static void OPNAME ## mpeg4_qpel8_h_lowpass_3dnow(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ | |
1984 int i;\ | |
1985 int16_t temp[8];\ | |
1986 /* quick HACK, XXX FIXME MUST be optimized */\ | |
1987 for(i=0; i<h; i++)\ | |
1988 {\ | |
1989 temp[ 0]= (src[ 0]+src[ 1])*20 - (src[ 0]+src[ 2])*6 + (src[ 1]+src[ 3])*3 - (src[ 2]+src[ 4]);\ | |
1990 temp[ 1]= (src[ 1]+src[ 2])*20 - (src[ 0]+src[ 3])*6 + (src[ 0]+src[ 4])*3 - (src[ 1]+src[ 5]);\ | |
1991 temp[ 2]= (src[ 2]+src[ 3])*20 - (src[ 1]+src[ 4])*6 + (src[ 0]+src[ 5])*3 - (src[ 0]+src[ 6]);\ | |
1992 temp[ 3]= (src[ 3]+src[ 4])*20 - (src[ 2]+src[ 5])*6 + (src[ 1]+src[ 6])*3 - (src[ 0]+src[ 7]);\ | |
1993 temp[ 4]= (src[ 4]+src[ 5])*20 - (src[ 3]+src[ 6])*6 + (src[ 2]+src[ 7])*3 - (src[ 1]+src[ 8]);\ | |
1994 temp[ 5]= (src[ 5]+src[ 6])*20 - (src[ 4]+src[ 7])*6 + (src[ 3]+src[ 8])*3 - (src[ 2]+src[ 8]);\ | |
1995 temp[ 6]= (src[ 6]+src[ 7])*20 - (src[ 5]+src[ 8])*6 + (src[ 4]+src[ 8])*3 - (src[ 3]+src[ 7]);\ | |
1996 temp[ 7]= (src[ 7]+src[ 8])*20 - (src[ 6]+src[ 8])*6 + (src[ 5]+src[ 7])*3 - (src[ 4]+src[ 6]);\ | |
1997 asm volatile(\ | |
2979 | 1998 "movq (%0), %%mm0 \n\t"\ |
1999 "movq 8(%0), %%mm1 \n\t"\ | |
2000 "paddw %2, %%mm0 \n\t"\ | |
2001 "paddw %2, %%mm1 \n\t"\ | |
2002 "psraw $5, %%mm0 \n\t"\ | |
2003 "psraw $5, %%mm1 \n\t"\ | |
2004 "packuswb %%mm1, %%mm0 \n\t"\ | |
959 | 2005 OP_3DNOW(%%mm0, (%1), %%mm1, q)\ |
2006 :: "r"(temp), "r"(dst), "m"(ROUNDER)\ | |
966 | 2007 :"memory"\ |
959 | 2008 );\ |
2009 dst+=dstStride;\ | |
2010 src+=srcStride;\ | |
2011 }\ | |
2012 } | |
2013 | |
2014 #define QPEL_OP(OPNAME, ROUNDER, RND, OP, MMX)\ | |
2015 \ | |
2016 static void OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ | |
954 | 2017 uint64_t temp[17*4];\ |
2018 uint64_t *temp_ptr= temp;\ | |
2019 int count= 17;\ | |
2020 \ | |
2021 /*FIXME unroll */\ | |
2022 asm volatile(\ | |
2979 | 2023 "pxor %%mm7, %%mm7 \n\t"\ |
2024 "1: \n\t"\ | |
2025 "movq (%0), %%mm0 \n\t"\ | |
2026 "movq (%0), %%mm1 \n\t"\ | |
2027 "movq 8(%0), %%mm2 \n\t"\ | |
2028 "movq 8(%0), %%mm3 \n\t"\ | |
2029 "punpcklbw %%mm7, %%mm0 \n\t"\ | |
2030 "punpckhbw %%mm7, %%mm1 \n\t"\ | |
2031 "punpcklbw %%mm7, %%mm2 \n\t"\ | |
2032 "punpckhbw %%mm7, %%mm3 \n\t"\ | |
2033 "movq %%mm0, (%1) \n\t"\ | |
2034 "movq %%mm1, 17*8(%1) \n\t"\ | |
2035 "movq %%mm2, 2*17*8(%1) \n\t"\ | |
2036 "movq %%mm3, 3*17*8(%1) \n\t"\ | |
2037 "add $8, %1 \n\t"\ | |
2038 "add %3, %0 \n\t"\ | |
2039 "decl %2 \n\t"\ | |
2040 " jnz 1b \n\t"\ | |
954 | 2041 : "+r" (src), "+r" (temp_ptr), "+r"(count)\ |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
2042 : "r" ((long)srcStride)\ |
966 | 2043 : "memory"\ |
954 | 2044 );\ |
2045 \ | |
2046 temp_ptr= temp;\ | |
2047 count=4;\ | |
2048 \ | |
2049 /*FIXME reorder for speed */\ | |
2050 asm volatile(\ | |
2979 | 2051 /*"pxor %%mm7, %%mm7 \n\t"*/\ |
2052 "1: \n\t"\ | |
2053 "movq (%0), %%mm0 \n\t"\ | |
2054 "movq 8(%0), %%mm1 \n\t"\ | |
2055 "movq 16(%0), %%mm2 \n\t"\ | |
2056 "movq 24(%0), %%mm3 \n\t"\ | |
961 | 2057 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 16(%0), 8(%0), (%0), 32(%0), (%1), OP)\ |
2058 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 8(%0), (%0), (%0), 40(%0), (%1, %3), OP)\ | |
2979 | 2059 "add %4, %1 \n\t"\ |
961 | 2060 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, (%0), (%0), 8(%0), 48(%0), (%1), OP)\ |
954 | 2061 \ |
961 | 2062 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, (%0), 8(%0), 16(%0), 56(%0), (%1, %3), OP)\ |
2979 | 2063 "add %4, %1 \n\t"\ |
961 | 2064 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 8(%0), 16(%0), 24(%0), 64(%0), (%1), OP)\ |
2065 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 72(%0), (%1, %3), OP)\ | |
2979 | 2066 "add %4, %1 \n\t"\ |
961 | 2067 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 24(%0), 32(%0), 40(%0), 80(%0), (%1), OP)\ |
2068 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 88(%0), (%1, %3), OP)\ | |
2979 | 2069 "add %4, %1 \n\t"\ |
961 | 2070 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 40(%0), 48(%0), 56(%0), 96(%0), (%1), OP)\ |
2071 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 48(%0), 56(%0), 64(%0),104(%0), (%1, %3), OP)\ | |
2979 | 2072 "add %4, %1 \n\t"\ |
961 | 2073 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 56(%0), 64(%0), 72(%0),112(%0), (%1), OP)\ |
2074 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 64(%0), 72(%0), 80(%0),120(%0), (%1, %3), OP)\ | |
2979 | 2075 "add %4, %1 \n\t"\ |
961 | 2076 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 72(%0), 80(%0), 88(%0),128(%0), (%1), OP)\ |
954 | 2077 \ |
961 | 2078 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 80(%0), 88(%0), 96(%0),128(%0), (%1, %3), OP)\ |
2979 | 2079 "add %4, %1 \n\t" \ |
961 | 2080 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 88(%0), 96(%0),104(%0),120(%0), (%1), OP)\ |
2081 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 96(%0),104(%0),112(%0),112(%0), (%1, %3), OP)\ | |
954 | 2082 \ |
2979 | 2083 "add $136, %0 \n\t"\ |
2084 "add %6, %1 \n\t"\ | |
2085 "decl %2 \n\t"\ | |
2086 " 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
|
2087 \ |
967 | 2088 : "+r"(temp_ptr), "+r"(dst), "+g"(count)\ |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
2089 : "r"((long)dstStride), "r"(2*(long)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER), "g"(4-14*(long)dstStride)\ |
966 | 2090 :"memory"\ |
954 | 2091 );\ |
2092 }\ | |
2093 \ | |
1057 | 2094 static void OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ |
2209 | 2095 uint64_t temp[9*2];\ |
954 | 2096 uint64_t *temp_ptr= temp;\ |
2097 int count= 9;\ | |
2098 \ | |
2099 /*FIXME unroll */\ | |
2100 asm volatile(\ | |
2979 | 2101 "pxor %%mm7, %%mm7 \n\t"\ |
2102 "1: \n\t"\ | |
2103 "movq (%0), %%mm0 \n\t"\ | |
2104 "movq (%0), %%mm1 \n\t"\ | |
2105 "punpcklbw %%mm7, %%mm0 \n\t"\ | |
2106 "punpckhbw %%mm7, %%mm1 \n\t"\ | |
2107 "movq %%mm0, (%1) \n\t"\ | |
2108 "movq %%mm1, 9*8(%1) \n\t"\ | |
2109 "add $8, %1 \n\t"\ | |
2110 "add %3, %0 \n\t"\ | |
2111 "decl %2 \n\t"\ | |
2112 " jnz 1b \n\t"\ | |
954 | 2113 : "+r" (src), "+r" (temp_ptr), "+r"(count)\ |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
2114 : "r" ((long)srcStride)\ |
966 | 2115 : "memory"\ |
954 | 2116 );\ |
2117 \ | |
2118 temp_ptr= temp;\ | |
2119 count=2;\ | |
2120 \ | |
2121 /*FIXME reorder for speed */\ | |
2122 asm volatile(\ | |
2979 | 2123 /*"pxor %%mm7, %%mm7 \n\t"*/\ |
2124 "1: \n\t"\ | |
2125 "movq (%0), %%mm0 \n\t"\ | |
2126 "movq 8(%0), %%mm1 \n\t"\ | |
2127 "movq 16(%0), %%mm2 \n\t"\ | |
2128 "movq 24(%0), %%mm3 \n\t"\ | |
961 | 2129 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 16(%0), 8(%0), (%0), 32(%0), (%1), OP)\ |
2130 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 8(%0), (%0), (%0), 40(%0), (%1, %3), OP)\ | |
2979 | 2131 "add %4, %1 \n\t"\ |
961 | 2132 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, (%0), (%0), 8(%0), 48(%0), (%1), OP)\ |
954 | 2133 \ |
961 | 2134 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, (%0), 8(%0), 16(%0), 56(%0), (%1, %3), OP)\ |
2979 | 2135 "add %4, %1 \n\t"\ |
961 | 2136 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 8(%0), 16(%0), 24(%0), 64(%0), (%1), OP)\ |
954 | 2137 \ |
961 | 2138 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 64(%0), (%1, %3), OP)\ |
2979 | 2139 "add %4, %1 \n\t"\ |
961 | 2140 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 24(%0), 32(%0), 40(%0), 56(%0), (%1), OP)\ |
2141 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 48(%0), (%1, %3), OP)\ | |
954 | 2142 \ |
2979 | 2143 "add $72, %0 \n\t"\ |
2144 "add %6, %1 \n\t"\ | |
2145 "decl %2 \n\t"\ | |
2146 " jnz 1b \n\t"\ | |
954 | 2147 \ |
961 | 2148 : "+r"(temp_ptr), "+r"(dst), "+g"(count)\ |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
2149 : "r"((long)dstStride), "r"(2*(long)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER), "g"(4-6*(long)dstStride)\ |
966 | 2150 : "memory"\ |
2151 );\ | |
959 | 2152 }\ |
954 | 2153 \ |
1064 | 2154 static void OPNAME ## qpel8_mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\ |
959 | 2155 OPNAME ## pixels8_mmx(dst, src, stride, 8);\ |
954 | 2156 }\ |
2157 \ | |
1064 | 2158 static void OPNAME ## qpel8_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2159 uint64_t temp[8];\ |
954 | 2160 uint8_t * const half= (uint8_t*)temp;\ |
2161 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, stride, 8);\ | |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2162 OPNAME ## pixels8_l2_ ## MMX(dst, src, half, stride, stride, 8);\ |
954 | 2163 }\ |
2164 \ | |
1064 | 2165 static void OPNAME ## qpel8_mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 2166 OPNAME ## mpeg4_qpel8_h_lowpass_ ## MMX(dst, src, stride, stride, 8);\ |
2167 }\ | |
2168 \ | |
1064 | 2169 static void OPNAME ## qpel8_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2170 uint64_t temp[8];\ |
954 | 2171 uint8_t * const half= (uint8_t*)temp;\ |
2172 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, stride, 8);\ | |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2173 OPNAME ## pixels8_l2_ ## MMX(dst, src+1, half, stride, stride, 8);\ |
954 | 2174 }\ |
2175 \ | |
1064 | 2176 static void OPNAME ## qpel8_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2177 uint64_t temp[8];\ |
954 | 2178 uint8_t * const half= (uint8_t*)temp;\ |
959 | 2179 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2180 OPNAME ## pixels8_l2_ ## MMX(dst, src, half, stride, stride, 8);\ |
954 | 2181 }\ |
2182 \ | |
1064 | 2183 static void OPNAME ## qpel8_mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
959 | 2184 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, src, stride, stride);\ |
954 | 2185 }\ |
2186 \ | |
1064 | 2187 static void OPNAME ## qpel8_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2188 uint64_t temp[8];\ |
954 | 2189 uint8_t * const half= (uint8_t*)temp;\ |
959 | 2190 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2191 OPNAME ## pixels8_l2_ ## MMX(dst, src+stride, half, stride, stride, 8);\ |
954 | 2192 }\ |
1064 | 2193 static void OPNAME ## qpel8_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2194 uint64_t half[8 + 9];\ |
2195 uint8_t * const halfH= ((uint8_t*)half) + 64;\ | |
2196 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 2197 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2198 put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\ |
959 | 2199 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2200 OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\ |
954 | 2201 }\ |
1064 | 2202 static void OPNAME ## qpel8_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2203 uint64_t half[8 + 9];\ |
2204 uint8_t * const halfH= ((uint8_t*)half) + 64;\ | |
2205 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 2206 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2207 put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\ |
959 | 2208 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2209 OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\ |
954 | 2210 }\ |
1064 | 2211 static void OPNAME ## qpel8_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2212 uint64_t half[8 + 9];\ |
2213 uint8_t * const halfH= ((uint8_t*)half) + 64;\ | |
2214 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 2215 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2216 put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\ |
959 | 2217 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2218 OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\ |
954 | 2219 }\ |
1064 | 2220 static void OPNAME ## qpel8_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2221 uint64_t half[8 + 9];\ |
2222 uint8_t * const halfH= ((uint8_t*)half) + 64;\ | |
2223 uint8_t * const halfHV= ((uint8_t*)half);\ | |
2224 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ | |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2225 put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\ |
959 | 2226 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2227 OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\ |
954 | 2228 }\ |
1064 | 2229 static void OPNAME ## qpel8_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2230 uint64_t half[8 + 9];\ |
954 | 2231 uint8_t * const halfH= ((uint8_t*)half) + 64;\ |
2232 uint8_t * const halfHV= ((uint8_t*)half);\ | |
2233 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ | |
959 | 2234 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2235 OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\ |
954 | 2236 }\ |
1064 | 2237 static void OPNAME ## qpel8_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2238 uint64_t half[8 + 9];\ |
954 | 2239 uint8_t * const halfH= ((uint8_t*)half) + 64;\ |
2240 uint8_t * const halfHV= ((uint8_t*)half);\ | |
2241 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ | |
959 | 2242 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2243 OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\ |
954 | 2244 }\ |
1064 | 2245 static void OPNAME ## qpel8_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2246 uint64_t half[8 + 9];\ |
2247 uint8_t * const halfH= ((uint8_t*)half);\ | |
954 | 2248 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2249 put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\ |
984 | 2250 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\ |
954 | 2251 }\ |
1064 | 2252 static void OPNAME ## qpel8_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2253 uint64_t half[8 + 9];\ |
2254 uint8_t * const halfH= ((uint8_t*)half);\ | |
954 | 2255 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2256 put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\ |
984 | 2257 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\ |
954 | 2258 }\ |
1064 | 2259 static void OPNAME ## qpel8_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2260 uint64_t half[9];\ |
954 | 2261 uint8_t * const halfH= ((uint8_t*)half);\ |
2262 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ | |
959 | 2263 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\ |
954 | 2264 }\ |
1064 | 2265 static void OPNAME ## qpel16_mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\ |
959 | 2266 OPNAME ## pixels16_mmx(dst, src, stride, 16);\ |
954 | 2267 }\ |
2268 \ | |
1064 | 2269 static void OPNAME ## qpel16_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 2270 uint64_t temp[32];\ |
2271 uint8_t * const half= (uint8_t*)temp;\ | |
2272 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, stride, 16);\ | |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2273 OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, stride, 16);\ |
954 | 2274 }\ |
2275 \ | |
1064 | 2276 static void OPNAME ## qpel16_mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 2277 OPNAME ## mpeg4_qpel16_h_lowpass_ ## MMX(dst, src, stride, stride, 16);\ |
2278 }\ | |
2279 \ | |
1064 | 2280 static void OPNAME ## qpel16_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 2281 uint64_t temp[32];\ |
2282 uint8_t * const half= (uint8_t*)temp;\ | |
2283 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, stride, 16);\ | |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2284 OPNAME ## pixels16_l2_ ## MMX(dst, src+1, half, stride, stride, 16);\ |
954 | 2285 }\ |
2286 \ | |
1064 | 2287 static void OPNAME ## qpel16_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 2288 uint64_t temp[32];\ |
2289 uint8_t * const half= (uint8_t*)temp;\ | |
959 | 2290 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, stride);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2291 OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, stride, 16);\ |
954 | 2292 }\ |
2293 \ | |
1064 | 2294 static void OPNAME ## qpel16_mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
959 | 2295 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, src, stride, stride);\ |
954 | 2296 }\ |
2297 \ | |
1064 | 2298 static void OPNAME ## qpel16_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 2299 uint64_t temp[32];\ |
2300 uint8_t * const half= (uint8_t*)temp;\ | |
959 | 2301 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, stride);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2302 OPNAME ## pixels16_l2_ ## MMX(dst, src+stride, half, stride, stride, 16);\ |
954 | 2303 }\ |
1064 | 2304 static void OPNAME ## qpel16_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2305 uint64_t half[16*2 + 17*2];\ |
2306 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
2307 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 2308 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2309 put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\ |
959 | 2310 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2311 OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\ |
954 | 2312 }\ |
1064 | 2313 static void OPNAME ## qpel16_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2314 uint64_t half[16*2 + 17*2];\ |
2315 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
2316 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 2317 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2318 put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\ |
959 | 2319 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2320 OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\ |
954 | 2321 }\ |
1064 | 2322 static void OPNAME ## qpel16_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2323 uint64_t half[16*2 + 17*2];\ |
2324 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
2325 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 2326 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2327 put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\ |
959 | 2328 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2329 OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\ |
954 | 2330 }\ |
1064 | 2331 static void OPNAME ## qpel16_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2332 uint64_t half[16*2 + 17*2];\ |
2333 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
2334 uint8_t * const halfHV= ((uint8_t*)half);\ | |
2335 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ | |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2336 put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\ |
959 | 2337 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2338 OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\ |
954 | 2339 }\ |
1064 | 2340 static void OPNAME ## qpel16_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 2341 uint64_t half[16*2 + 17*2];\ |
2342 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
2343 uint8_t * const halfHV= ((uint8_t*)half);\ | |
2344 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ | |
959 | 2345 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2346 OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\ |
954 | 2347 }\ |
1064 | 2348 static void OPNAME ## qpel16_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 2349 uint64_t half[16*2 + 17*2];\ |
2350 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
2351 uint8_t * const halfHV= ((uint8_t*)half);\ | |
2352 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ | |
959 | 2353 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2354 OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\ |
954 | 2355 }\ |
1064 | 2356 static void OPNAME ## qpel16_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2357 uint64_t half[17*2];\ |
2358 uint8_t * const halfH= ((uint8_t*)half);\ | |
954 | 2359 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2360 put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\ |
984 | 2361 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\ |
954 | 2362 }\ |
1064 | 2363 static void OPNAME ## qpel16_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 2364 uint64_t half[17*2];\ |
2365 uint8_t * const halfH= ((uint8_t*)half);\ | |
954 | 2366 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ |
2207
22b768f1261a
10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents:
2067
diff
changeset
|
2367 put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\ |
984 | 2368 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\ |
954 | 2369 }\ |
1064 | 2370 static void OPNAME ## qpel16_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 2371 uint64_t half[17*2];\ |
2372 uint8_t * const halfH= ((uint8_t*)half);\ | |
2373 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ | |
959 | 2374 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\ |
954 | 2375 } |
2376 | |
2979 | 2377 #define PUT_OP(a,b,temp, size) "mov" #size " " #a ", " #b " \n\t" |
959 | 2378 #define AVG_3DNOW_OP(a,b,temp, size) \ |
2979 | 2379 "mov" #size " " #b ", " #temp " \n\t"\ |
2380 "pavgusb " #temp ", " #a " \n\t"\ | |
2381 "mov" #size " " #a ", " #b " \n\t" | |
959 | 2382 #define AVG_MMX2_OP(a,b,temp, size) \ |
2979 | 2383 "mov" #size " " #b ", " #temp " \n\t"\ |
2384 "pavgb " #temp ", " #a " \n\t"\ | |
2385 "mov" #size " " #a ", " #b " \n\t" | |
959 | 2386 |
2387 QPEL_BASE(put_ , ff_pw_16, _ , PUT_OP, PUT_OP) | |
2388 QPEL_BASE(avg_ , ff_pw_16, _ , AVG_MMX2_OP, AVG_3DNOW_OP) | |
2389 QPEL_BASE(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, PUT_OP) | |
2390 QPEL_OP(put_ , ff_pw_16, _ , PUT_OP, 3dnow) | |
2391 QPEL_OP(avg_ , ff_pw_16, _ , AVG_3DNOW_OP, 3dnow) | |
2392 QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, 3dnow) | |
954 | 2393 QPEL_OP(put_ , ff_pw_16, _ , PUT_OP, mmx2) |
959 | 2394 QPEL_OP(avg_ , ff_pw_16, _ , AVG_MMX2_OP, mmx2) |
954 | 2395 QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, mmx2) |
2396 | |
393 | 2397 #if 0 |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2398 static void just_return() { return; } |
393 | 2399 #endif |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2400 |
954 | 2401 #define SET_QPEL_FUNC(postfix1, postfix2) \ |
2402 c->put_ ## postfix1 = put_ ## postfix2;\ | |
2403 c->put_no_rnd_ ## postfix1 = put_no_rnd_ ## postfix2;\ | |
2404 c->avg_ ## postfix1 = avg_ ## postfix2; | |
1092 | 2405 |
1784 | 2406 static int try_8x8basis_mmx(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){ |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
2407 long i=0; |
2967 | 2408 |
1784 | 2409 assert(ABS(scale) < 256); |
2410 scale<<= 16 + 1 - BASIS_SHIFT + RECON_SHIFT; | |
2411 | |
2412 asm volatile( | |
2979 | 2413 "pcmpeqw %%mm6, %%mm6 \n\t" // -1w |
2414 "psrlw $15, %%mm6 \n\t" // 1w | |
2415 "pxor %%mm7, %%mm7 \n\t" | |
2416 "movd %4, %%mm5 \n\t" | |
2417 "punpcklwd %%mm5, %%mm5 \n\t" | |
2418 "punpcklwd %%mm5, %%mm5 \n\t" | |
2419 "1: \n\t" | |
2420 "movq (%1, %0), %%mm0 \n\t" | |
2421 "movq 8(%1, %0), %%mm1 \n\t" | |
2422 "pmulhw %%mm5, %%mm0 \n\t" | |
2423 "pmulhw %%mm5, %%mm1 \n\t" | |
2424 "paddw %%mm6, %%mm0 \n\t" | |
2425 "paddw %%mm6, %%mm1 \n\t" | |
2426 "psraw $1, %%mm0 \n\t" | |
2427 "psraw $1, %%mm1 \n\t" | |
2428 "paddw (%2, %0), %%mm0 \n\t" | |
2429 "paddw 8(%2, %0), %%mm1 \n\t" | |
2430 "psraw $6, %%mm0 \n\t" | |
2431 "psraw $6, %%mm1 \n\t" | |
2432 "pmullw (%3, %0), %%mm0 \n\t" | |
2433 "pmullw 8(%3, %0), %%mm1 \n\t" | |
2434 "pmaddwd %%mm0, %%mm0 \n\t" | |
2435 "pmaddwd %%mm1, %%mm1 \n\t" | |
2436 "paddd %%mm1, %%mm0 \n\t" | |
2437 "psrld $4, %%mm0 \n\t" | |
2438 "paddd %%mm0, %%mm7 \n\t" | |
2439 "add $16, %0 \n\t" | |
2440 "cmp $128, %0 \n\t" //FIXME optimize & bench | |
2441 " jb 1b \n\t" | |
2442 "movq %%mm7, %%mm6 \n\t" | |
2443 "psrlq $32, %%mm7 \n\t" | |
2444 "paddd %%mm6, %%mm7 \n\t" | |
2445 "psrld $2, %%mm7 \n\t" | |
2446 "movd %%mm7, %0 \n\t" | |
2967 | 2447 |
1784 | 2448 : "+r" (i) |
2449 : "r"(basis), "r"(rem), "r"(weight), "g"(scale) | |
2450 ); | |
2451 return i; | |
2452 } | |
2453 | |
2454 static void add_8x8basis_mmx(int16_t rem[64], int16_t basis[64], int scale){ | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2256
diff
changeset
|
2455 long i=0; |
2967 | 2456 |
1784 | 2457 if(ABS(scale) < 256){ |
2458 scale<<= 16 + 1 - BASIS_SHIFT + RECON_SHIFT; | |
2459 asm volatile( | |
2979 | 2460 "pcmpeqw %%mm6, %%mm6 \n\t" // -1w |
2461 "psrlw $15, %%mm6 \n\t" // 1w | |
2462 "movd %3, %%mm5 \n\t" | |
2463 "punpcklwd %%mm5, %%mm5 \n\t" | |
2464 "punpcklwd %%mm5, %%mm5 \n\t" | |
2465 "1: \n\t" | |
2466 "movq (%1, %0), %%mm0 \n\t" | |
2467 "movq 8(%1, %0), %%mm1 \n\t" | |
2468 "pmulhw %%mm5, %%mm0 \n\t" | |
2469 "pmulhw %%mm5, %%mm1 \n\t" | |
2470 "paddw %%mm6, %%mm0 \n\t" | |
2471 "paddw %%mm6, %%mm1 \n\t" | |
2472 "psraw $1, %%mm0 \n\t" | |
2473 "psraw $1, %%mm1 \n\t" | |
2474 "paddw (%2, %0), %%mm0 \n\t" | |
2475 "paddw 8(%2, %0), %%mm1 \n\t" | |
2476 "movq %%mm0, (%2, %0) \n\t" | |
2477 "movq %%mm1, 8(%2, %0) \n\t" | |
2478 "add $16, %0 \n\t" | |
2479 "cmp $128, %0 \n\t" //FIXME optimize & bench | |
2480 " jb 1b \n\t" | |
2967 | 2481 |
1784 | 2482 : "+r" (i) |
2483 : "r"(basis), "r"(rem), "g"(scale) | |
2484 ); | |
2485 }else{ | |
2486 for(i=0; i<8*8; i++){ | |
2487 rem[i] += (basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT); | |
2967 | 2488 } |
1784 | 2489 } |
2490 } | |
2754 | 2491 |
2492 #include "h264dsp_mmx.c" | |
2967 | 2493 |
1092 | 2494 /* external functions, from idct_mmx.c */ |
2495 void ff_mmx_idct(DCTELEM *block); | |
2496 void ff_mmxext_idct(DCTELEM *block); | |
2497 | |
2696
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2498 void ff_vp3_idct_sse2(int16_t *input_data); |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2499 void ff_vp3_idct_mmx(int16_t *data); |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2500 void ff_vp3_dsp_init_mmx(void); |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2501 |
1092 | 2502 /* XXX: those functions should be suppressed ASAP when all IDCTs are |
2503 converted */ | |
2504 static void ff_libmpeg2mmx_idct_put(uint8_t *dest, int line_size, DCTELEM *block) | |
2505 { | |
2506 ff_mmx_idct (block); | |
2507 put_pixels_clamped_mmx(block, dest, line_size); | |
2508 } | |
2509 static void ff_libmpeg2mmx_idct_add(uint8_t *dest, int line_size, DCTELEM *block) | |
2510 { | |
2511 ff_mmx_idct (block); | |
2512 add_pixels_clamped_mmx(block, dest, line_size); | |
2513 } | |
2514 static void ff_libmpeg2mmx2_idct_put(uint8_t *dest, int line_size, DCTELEM *block) | |
2515 { | |
2516 ff_mmxext_idct (block); | |
2517 put_pixels_clamped_mmx(block, dest, line_size); | |
2518 } | |
2519 static void ff_libmpeg2mmx2_idct_add(uint8_t *dest, int line_size, DCTELEM *block) | |
2520 { | |
2521 ff_mmxext_idct (block); | |
2522 add_pixels_clamped_mmx(block, dest, line_size); | |
2523 } | |
2696
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2524 static void ff_vp3_idct_put_sse2(uint8_t *dest, int line_size, DCTELEM *block) |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2525 { |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2526 ff_vp3_idct_sse2(block); |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2527 put_signed_pixels_clamped_mmx(block, dest, line_size); |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2528 } |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2529 static void ff_vp3_idct_add_sse2(uint8_t *dest, int line_size, DCTELEM *block) |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2530 { |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2531 ff_vp3_idct_sse2(block); |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2532 add_pixels_clamped_mmx(block, dest, line_size); |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2533 } |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2534 static void ff_vp3_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block) |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2535 { |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2536 ff_vp3_idct_mmx(block); |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2537 put_signed_pixels_clamped_mmx(block, dest, line_size); |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2538 } |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2539 static void ff_vp3_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block) |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2540 { |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2541 ff_vp3_idct_mmx(block); |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2542 add_pixels_clamped_mmx(block, dest, line_size); |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2543 } |
2868 | 2544 #ifdef CONFIG_GPL |
2545 static void ff_idct_xvid_mmx_put(uint8_t *dest, int line_size, DCTELEM *block) | |
2546 { | |
2547 ff_idct_xvid_mmx (block); | |
2548 put_pixels_clamped_mmx(block, dest, line_size); | |
2549 } | |
2550 static void ff_idct_xvid_mmx_add(uint8_t *dest, int line_size, DCTELEM *block) | |
2551 { | |
2552 ff_idct_xvid_mmx (block); | |
2553 add_pixels_clamped_mmx(block, dest, line_size); | |
2554 } | |
2555 static void ff_idct_xvid_mmx2_put(uint8_t *dest, int line_size, DCTELEM *block) | |
2556 { | |
2557 ff_idct_xvid_mmx2 (block); | |
2558 put_pixels_clamped_mmx(block, dest, line_size); | |
2559 } | |
2560 static void ff_idct_xvid_mmx2_add(uint8_t *dest, int line_size, DCTELEM *block) | |
2561 { | |
2562 ff_idct_xvid_mmx2 (block); | |
2563 add_pixels_clamped_mmx(block, dest, line_size); | |
2564 } | |
2565 #endif | |
2967 | 2566 |
1092 | 2567 void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) |
0 | 2568 { |
2569 mm_flags = mm_support(); | |
1115 | 2570 |
1122 | 2571 if (avctx->dsp_mask) { |
2979 | 2572 if (avctx->dsp_mask & FF_MM_FORCE) |
2573 mm_flags |= (avctx->dsp_mask & 0xffff); | |
2574 else | |
2575 mm_flags &= ~(avctx->dsp_mask & 0xffff); | |
1122 | 2576 } |
1115 | 2577 |
631
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
2578 #if 0 |
1868 | 2579 av_log(avctx, AV_LOG_INFO, "libavcodec: CPU flags:"); |
0 | 2580 if (mm_flags & MM_MMX) |
1868 | 2581 av_log(avctx, AV_LOG_INFO, " mmx"); |
0 | 2582 if (mm_flags & MM_MMXEXT) |
1868 | 2583 av_log(avctx, AV_LOG_INFO, " mmxext"); |
0 | 2584 if (mm_flags & MM_3DNOW) |
1868 | 2585 av_log(avctx, AV_LOG_INFO, " 3dnow"); |
0 | 2586 if (mm_flags & MM_SSE) |
1868 | 2587 av_log(avctx, AV_LOG_INFO, " sse"); |
0 | 2588 if (mm_flags & MM_SSE2) |
1868 | 2589 av_log(avctx, AV_LOG_INFO, " sse2"); |
2590 av_log(avctx, AV_LOG_INFO, "\n"); | |
0 | 2591 #endif |
2592 | |
2593 if (mm_flags & MM_MMX) { | |
1092 | 2594 const int idct_algo= avctx->idct_algo; |
2595 | |
1232
e88d3b1fb2a1
more #ifdef CONFIG_ENCODERS by (Wolfgang Hesseler <qv at multimediaware dot com>)
michaelni
parents:
1186
diff
changeset
|
2596 #ifdef CONFIG_ENCODERS |
2024
f65d87bfdd5a
some of the warning fixes by (Michael Roitzsch <mroi at users dot sourceforge dot net>)
michael
parents:
1985
diff
changeset
|
2597 const int dct_algo = avctx->dct_algo; |
1565 | 2598 if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){ |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
2599 if(mm_flags & MM_SSE2){ |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
2600 c->fdct = ff_fdct_sse2; |
2979 | 2601 }else if(mm_flags & MM_MMXEXT){ |
1565 | 2602 c->fdct = ff_fdct_mmx2; |
2603 }else{ | |
2604 c->fdct = ff_fdct_mmx; | |
2605 } | |
2606 } | |
1232
e88d3b1fb2a1
more #ifdef CONFIG_ENCODERS by (Wolfgang Hesseler <qv at multimediaware dot com>)
michaelni
parents:
1186
diff
changeset
|
2607 #endif //CONFIG_ENCODERS |
2256 | 2608 if(avctx->lowres==0){ |
2609 if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SIMPLEMMX){ | |
2610 c->idct_put= ff_simple_idct_put_mmx; | |
2611 c->idct_add= ff_simple_idct_add_mmx; | |
2612 c->idct = ff_simple_idct_mmx; | |
2613 c->idct_permutation_type= FF_SIMPLE_IDCT_PERM; | |
2614 }else if(idct_algo==FF_IDCT_LIBMPEG2MMX){ | |
2615 if(mm_flags & MM_MMXEXT){ | |
2616 c->idct_put= ff_libmpeg2mmx2_idct_put; | |
2617 c->idct_add= ff_libmpeg2mmx2_idct_add; | |
2618 c->idct = ff_mmxext_idct; | |
2619 }else{ | |
2620 c->idct_put= ff_libmpeg2mmx_idct_put; | |
2621 c->idct_add= ff_libmpeg2mmx_idct_add; | |
2622 c->idct = ff_mmx_idct; | |
2623 } | |
2624 c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; | |
2696
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2625 }else if(idct_algo==FF_IDCT_VP3){ |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2626 if(mm_flags & MM_SSE2){ |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2627 c->idct_put= ff_vp3_idct_put_sse2; |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2628 c->idct_add= ff_vp3_idct_add_sse2; |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2629 c->idct = ff_vp3_idct_sse2; |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2630 c->idct_permutation_type= FF_TRANSPOSE_IDCT_PERM; |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2631 }else{ |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2632 ff_vp3_dsp_init_mmx(); |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2633 c->idct_put= ff_vp3_idct_put_mmx; |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2634 c->idct_add= ff_vp3_idct_add_mmx; |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2635 c->idct = ff_vp3_idct_mmx; |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2636 c->idct_permutation_type= FF_PARTTRANS_IDCT_PERM; |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2637 } |
2868 | 2638 #ifdef CONFIG_GPL |
2639 }else if(idct_algo==FF_IDCT_XVIDMMX){ | |
2640 if(mm_flags & MM_MMXEXT){ | |
2641 c->idct_put= ff_idct_xvid_mmx2_put; | |
2642 c->idct_add= ff_idct_xvid_mmx2_add; | |
2643 c->idct = ff_idct_xvid_mmx2; | |
2644 }else{ | |
2645 c->idct_put= ff_idct_xvid_mmx_put; | |
2646 c->idct_add= ff_idct_xvid_mmx_add; | |
2647 c->idct = ff_idct_xvid_mmx; | |
2648 } | |
2871
f4afa3812818
Fix compile without CONFIG_GPL, misplaced #endif caused a missing }.
reimar
parents:
2868
diff
changeset
|
2649 #endif |
1092 | 2650 } |
2651 } | |
1868 | 2652 |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
2653 #ifdef CONFIG_ENCODERS |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2654 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
|
2655 c->diff_pixels = diff_pixels_mmx; |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
2656 #endif //CONFIG_ENCODERS |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2657 c->put_pixels_clamped = put_pixels_clamped_mmx; |
1984
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
2658 c->put_signed_pixels_clamped = put_signed_pixels_clamped_mmx; |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2659 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
|
2660 c->clear_blocks = clear_blocks_mmx; |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
2661 #ifdef CONFIG_ENCODERS |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2662 c->pix_sum = pix_sum16_mmx; |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
2663 #endif //CONFIG_ENCODERS |
415 | 2664 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2665 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
|
2666 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
|
2667 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
|
2668 c->put_pixels_tab[0][3] = put_pixels16_xy2_mmx; |
0 | 2669 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2670 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
|
2671 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
|
2672 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
|
2673 c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_mmx; |
651 | 2674 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2675 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
|
2676 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
|
2677 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
|
2678 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx; |
415 | 2679 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2680 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
|
2681 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
|
2682 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
|
2683 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
|
2684 |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2685 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
|
2686 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
|
2687 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
|
2688 c->put_pixels_tab[1][3] = put_pixels8_xy2_mmx; |
0 | 2689 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2690 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
|
2691 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
|
2692 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
|
2693 c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_mmx; |
651 | 2694 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2695 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
|
2696 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
|
2697 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
|
2698 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx; |
651 | 2699 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2700 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
|
2701 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
|
2702 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
|
2703 c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy2_mmx; |
2967 | 2704 |
866 | 2705 c->add_bytes= add_bytes_mmx; |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
2706 #ifdef CONFIG_ENCODERS |
866 | 2707 c->diff_bytes= diff_bytes_mmx; |
2967 | 2708 |
936 | 2709 c->hadamard8_diff[0]= hadamard8_diff16_mmx; |
2710 c->hadamard8_diff[1]= hadamard8_diff_mmx; | |
2967 | 2711 |
2979 | 2712 c->pix_norm1 = pix_norm1_mmx; |
2713 c->sse[0] = (mm_flags & MM_SSE2) ? sse16_sse2 : sse16_mmx; | |
2714 c->sse[1] = sse8_mmx; | |
1729 | 2715 c->vsad[4]= vsad_intra16_mmx; |
2716 | |
2979 | 2717 c->nsse[0] = nsse16_mmx; |
2718 c->nsse[1] = nsse8_mmx; | |
1729 | 2719 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ |
2720 c->vsad[0] = vsad16_mmx; | |
2721 } | |
2967 | 2722 |
1784 | 2723 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ |
2724 c->try_8x8basis= try_8x8basis_mmx; | |
2725 } | |
2726 c->add_8x8basis= add_8x8basis_mmx; | |
2967 | 2727 |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
2728 #endif //CONFIG_ENCODERS |
1647 | 2729 |
2730 c->h263_v_loop_filter= h263_v_loop_filter_mmx; | |
2967 | 2731 c->h263_h_loop_filter= h263_h_loop_filter_mmx; |
2979 | 2732 c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_mmx; |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2902
diff
changeset
|
2733 c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_mmx; |
2967 | 2734 |
0 | 2735 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
|
2736 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
|
2737 c->put_pixels_tab[0][2] = put_pixels16_y2_mmx2; |
651 | 2738 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2739 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
|
2740 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
|
2741 c->avg_pixels_tab[0][2] = avg_pixels16_y2_mmx2; |
415 | 2742 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2743 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
|
2744 c->put_pixels_tab[1][2] = put_pixels8_y2_mmx2; |
651 | 2745 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2746 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
|
2747 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
|
2748 c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx2; |
1092 | 2749 |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
2750 #ifdef CONFIG_ENCODERS |
1153 | 2751 c->hadamard8_diff[0]= hadamard8_diff16_mmx2; |
2752 c->hadamard8_diff[1]= hadamard8_diff_mmx2; | |
1729 | 2753 c->vsad[4]= vsad_intra16_mmx2; |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
2754 #endif //CONFIG_ENCODERS |
1153 | 2755 |
2745 | 2756 c->h264_idct_add= ff_h264_idct_add_mmx2; |
2757 | |
1092 | 2758 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ |
2759 c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx2; | |
2760 c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmx2; | |
2761 c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx2; | |
2762 c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx2; | |
2763 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx2; | |
2764 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx2; | |
1772
8cd5257195c9
vsad16_mmx2 only applies if encoders are turned on
melanson
parents:
1765
diff
changeset
|
2765 #ifdef CONFIG_ENCODERS |
1729 | 2766 c->vsad[0] = vsad16_mmx2; |
1772
8cd5257195c9
vsad16_mmx2 only applies if encoders are turned on
melanson
parents:
1765
diff
changeset
|
2767 #endif //CONFIG_ENCODERS |
1092 | 2768 } |
959 | 2769 |
961 | 2770 #if 1 |
954 | 2771 SET_QPEL_FUNC(qpel_pixels_tab[0][ 0], qpel16_mc00_mmx2) |
2772 SET_QPEL_FUNC(qpel_pixels_tab[0][ 1], qpel16_mc10_mmx2) | |
2773 SET_QPEL_FUNC(qpel_pixels_tab[0][ 2], qpel16_mc20_mmx2) | |
2774 SET_QPEL_FUNC(qpel_pixels_tab[0][ 3], qpel16_mc30_mmx2) | |
2775 SET_QPEL_FUNC(qpel_pixels_tab[0][ 4], qpel16_mc01_mmx2) | |
2776 SET_QPEL_FUNC(qpel_pixels_tab[0][ 5], qpel16_mc11_mmx2) | |
2777 SET_QPEL_FUNC(qpel_pixels_tab[0][ 6], qpel16_mc21_mmx2) | |
2778 SET_QPEL_FUNC(qpel_pixels_tab[0][ 7], qpel16_mc31_mmx2) | |
2779 SET_QPEL_FUNC(qpel_pixels_tab[0][ 8], qpel16_mc02_mmx2) | |
2780 SET_QPEL_FUNC(qpel_pixels_tab[0][ 9], qpel16_mc12_mmx2) | |
2781 SET_QPEL_FUNC(qpel_pixels_tab[0][10], qpel16_mc22_mmx2) | |
2782 SET_QPEL_FUNC(qpel_pixels_tab[0][11], qpel16_mc32_mmx2) | |
2783 SET_QPEL_FUNC(qpel_pixels_tab[0][12], qpel16_mc03_mmx2) | |
2784 SET_QPEL_FUNC(qpel_pixels_tab[0][13], qpel16_mc13_mmx2) | |
2785 SET_QPEL_FUNC(qpel_pixels_tab[0][14], qpel16_mc23_mmx2) | |
2786 SET_QPEL_FUNC(qpel_pixels_tab[0][15], qpel16_mc33_mmx2) | |
2787 SET_QPEL_FUNC(qpel_pixels_tab[1][ 0], qpel8_mc00_mmx2) | |
2788 SET_QPEL_FUNC(qpel_pixels_tab[1][ 1], qpel8_mc10_mmx2) | |
2789 SET_QPEL_FUNC(qpel_pixels_tab[1][ 2], qpel8_mc20_mmx2) | |
2790 SET_QPEL_FUNC(qpel_pixels_tab[1][ 3], qpel8_mc30_mmx2) | |
2791 SET_QPEL_FUNC(qpel_pixels_tab[1][ 4], qpel8_mc01_mmx2) | |
2792 SET_QPEL_FUNC(qpel_pixels_tab[1][ 5], qpel8_mc11_mmx2) | |
2793 SET_QPEL_FUNC(qpel_pixels_tab[1][ 6], qpel8_mc21_mmx2) | |
2794 SET_QPEL_FUNC(qpel_pixels_tab[1][ 7], qpel8_mc31_mmx2) | |
2795 SET_QPEL_FUNC(qpel_pixels_tab[1][ 8], qpel8_mc02_mmx2) | |
2796 SET_QPEL_FUNC(qpel_pixels_tab[1][ 9], qpel8_mc12_mmx2) | |
2797 SET_QPEL_FUNC(qpel_pixels_tab[1][10], qpel8_mc22_mmx2) | |
2798 SET_QPEL_FUNC(qpel_pixels_tab[1][11], qpel8_mc32_mmx2) | |
2799 SET_QPEL_FUNC(qpel_pixels_tab[1][12], qpel8_mc03_mmx2) | |
2800 SET_QPEL_FUNC(qpel_pixels_tab[1][13], qpel8_mc13_mmx2) | |
2801 SET_QPEL_FUNC(qpel_pixels_tab[1][14], qpel8_mc23_mmx2) | |
2802 SET_QPEL_FUNC(qpel_pixels_tab[1][15], qpel8_mc33_mmx2) | |
961 | 2803 #endif |
1527 | 2804 |
2209 | 2805 //FIXME 3dnow too |
2806 #define dspfunc(PFX, IDX, NUM) \ | |
2807 c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_mmx2; \ | |
2808 c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_mmx2; \ | |
2809 c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_mmx2; \ | |
2810 c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_mmx2; \ | |
2811 c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_mmx2; \ | |
2812 c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_mmx2; \ | |
2813 c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_mmx2; \ | |
2814 c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_mmx2; \ | |
2815 c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_mmx2; \ | |
2816 c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_mmx2; \ | |
2817 c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_mmx2; \ | |
2818 c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_mmx2; \ | |
2819 c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_mmx2; \ | |
2820 c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_mmx2; \ | |
2821 c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_mmx2; \ | |
2822 c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_mmx2 | |
2823 | |
2824 dspfunc(put_h264_qpel, 0, 16); | |
2825 dspfunc(put_h264_qpel, 1, 8); | |
2826 dspfunc(put_h264_qpel, 2, 4); | |
2827 dspfunc(avg_h264_qpel, 0, 16); | |
2828 dspfunc(avg_h264_qpel, 1, 8); | |
2829 dspfunc(avg_h264_qpel, 2, 4); | |
2830 #undef dspfunc | |
2831 | |
2979 | 2832 c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_mmx2; |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2902
diff
changeset
|
2833 c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_mmx2; |
2633 | 2834 c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_mmx2; |
2835 c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_mmx2; | |
2836 c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_mmx2; | |
2837 c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_mmx2; | |
2707
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
2838 c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_mmx2; |
360024d31dab
H.264 deblocking optimizations (mmx for chroma_bS4 case, convert existing cases to 8-bit math)
lorenm
parents:
2696
diff
changeset
|
2839 c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_mmx2; |
2633 | 2840 |
2902
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2841 c->weight_h264_pixels_tab[0]= ff_h264_weight_16x16_mmx2; |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2842 c->weight_h264_pixels_tab[1]= ff_h264_weight_16x8_mmx2; |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2843 c->weight_h264_pixels_tab[2]= ff_h264_weight_8x16_mmx2; |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2844 c->weight_h264_pixels_tab[3]= ff_h264_weight_8x8_mmx2; |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2845 c->weight_h264_pixels_tab[4]= ff_h264_weight_8x4_mmx2; |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2846 c->weight_h264_pixels_tab[5]= ff_h264_weight_4x8_mmx2; |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2847 c->weight_h264_pixels_tab[6]= ff_h264_weight_4x4_mmx2; |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2848 c->weight_h264_pixels_tab[7]= ff_h264_weight_4x2_mmx2; |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2849 |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2850 c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16x16_mmx2; |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2851 c->biweight_h264_pixels_tab[1]= ff_h264_biweight_16x8_mmx2; |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2852 c->biweight_h264_pixels_tab[2]= ff_h264_biweight_8x16_mmx2; |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2853 c->biweight_h264_pixels_tab[3]= ff_h264_biweight_8x8_mmx2; |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2854 c->biweight_h264_pixels_tab[4]= ff_h264_biweight_8x4_mmx2; |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2855 c->biweight_h264_pixels_tab[5]= ff_h264_biweight_4x8_mmx2; |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2856 c->biweight_h264_pixels_tab[6]= ff_h264_biweight_4x4_mmx2; |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2857 c->biweight_h264_pixels_tab[7]= ff_h264_biweight_4x2_mmx2; |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2858 |
1686
68abbec33289
Here are juste two added #ifdef CONFIG_ENCODERS to allow
michael
parents:
1648
diff
changeset
|
2859 #ifdef CONFIG_ENCODERS |
1527 | 2860 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
|
2861 #endif //CONFIG_ENCODERS |
0 | 2862 } 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
|
2863 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
|
2864 c->put_pixels_tab[0][2] = put_pixels16_y2_3dnow; |
393 | 2865 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2866 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
|
2867 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
|
2868 c->avg_pixels_tab[0][2] = avg_pixels16_y2_3dnow; |
651 | 2869 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2870 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
|
2871 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
|
2872 |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2873 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
|
2874 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
|
2875 c->avg_pixels_tab[1][2] = avg_pixels8_y2_3dnow; |
1092 | 2876 |
2877 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ | |
2878 c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_3dnow; | |
2879 c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_3dnow; | |
2880 c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_3dnow; | |
2881 c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_3dnow; | |
2882 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_3dnow; | |
2883 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_3dnow; | |
2884 } | |
984 | 2885 |
954 | 2886 SET_QPEL_FUNC(qpel_pixels_tab[0][ 0], qpel16_mc00_3dnow) |
2887 SET_QPEL_FUNC(qpel_pixels_tab[0][ 1], qpel16_mc10_3dnow) | |
2888 SET_QPEL_FUNC(qpel_pixels_tab[0][ 2], qpel16_mc20_3dnow) | |
2889 SET_QPEL_FUNC(qpel_pixels_tab[0][ 3], qpel16_mc30_3dnow) | |
2890 SET_QPEL_FUNC(qpel_pixels_tab[0][ 4], qpel16_mc01_3dnow) | |
2891 SET_QPEL_FUNC(qpel_pixels_tab[0][ 5], qpel16_mc11_3dnow) | |
2892 SET_QPEL_FUNC(qpel_pixels_tab[0][ 6], qpel16_mc21_3dnow) | |
2893 SET_QPEL_FUNC(qpel_pixels_tab[0][ 7], qpel16_mc31_3dnow) | |
2894 SET_QPEL_FUNC(qpel_pixels_tab[0][ 8], qpel16_mc02_3dnow) | |
2895 SET_QPEL_FUNC(qpel_pixels_tab[0][ 9], qpel16_mc12_3dnow) | |
2896 SET_QPEL_FUNC(qpel_pixels_tab[0][10], qpel16_mc22_3dnow) | |
2897 SET_QPEL_FUNC(qpel_pixels_tab[0][11], qpel16_mc32_3dnow) | |
2898 SET_QPEL_FUNC(qpel_pixels_tab[0][12], qpel16_mc03_3dnow) | |
2899 SET_QPEL_FUNC(qpel_pixels_tab[0][13], qpel16_mc13_3dnow) | |
2900 SET_QPEL_FUNC(qpel_pixels_tab[0][14], qpel16_mc23_3dnow) | |
2901 SET_QPEL_FUNC(qpel_pixels_tab[0][15], qpel16_mc33_3dnow) | |
2902 SET_QPEL_FUNC(qpel_pixels_tab[1][ 0], qpel8_mc00_3dnow) | |
2903 SET_QPEL_FUNC(qpel_pixels_tab[1][ 1], qpel8_mc10_3dnow) | |
2904 SET_QPEL_FUNC(qpel_pixels_tab[1][ 2], qpel8_mc20_3dnow) | |
2905 SET_QPEL_FUNC(qpel_pixels_tab[1][ 3], qpel8_mc30_3dnow) | |
2906 SET_QPEL_FUNC(qpel_pixels_tab[1][ 4], qpel8_mc01_3dnow) | |
2907 SET_QPEL_FUNC(qpel_pixels_tab[1][ 5], qpel8_mc11_3dnow) | |
2908 SET_QPEL_FUNC(qpel_pixels_tab[1][ 6], qpel8_mc21_3dnow) | |
2909 SET_QPEL_FUNC(qpel_pixels_tab[1][ 7], qpel8_mc31_3dnow) | |
2910 SET_QPEL_FUNC(qpel_pixels_tab[1][ 8], qpel8_mc02_3dnow) | |
2911 SET_QPEL_FUNC(qpel_pixels_tab[1][ 9], qpel8_mc12_3dnow) | |
2912 SET_QPEL_FUNC(qpel_pixels_tab[1][10], qpel8_mc22_3dnow) | |
2913 SET_QPEL_FUNC(qpel_pixels_tab[1][11], qpel8_mc32_3dnow) | |
2914 SET_QPEL_FUNC(qpel_pixels_tab[1][12], qpel8_mc03_3dnow) | |
2915 SET_QPEL_FUNC(qpel_pixels_tab[1][13], qpel8_mc13_3dnow) | |
2916 SET_QPEL_FUNC(qpel_pixels_tab[1][14], qpel8_mc23_3dnow) | |
2917 SET_QPEL_FUNC(qpel_pixels_tab[1][15], qpel8_mc33_3dnow) | |
2209 | 2918 |
2919 #define dspfunc(PFX, IDX, NUM) \ | |
2920 c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_3dnow; \ | |
2921 c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_3dnow; \ | |
2922 c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_3dnow; \ | |
2923 c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_3dnow; \ | |
2924 c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_3dnow; \ | |
2925 c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_3dnow; \ | |
2926 c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_3dnow; \ | |
2927 c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_3dnow; \ | |
2928 c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_3dnow; \ | |
2929 c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_3dnow; \ | |
2930 c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_3dnow; \ | |
2931 c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_3dnow; \ | |
2932 c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_3dnow; \ | |
2933 c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_3dnow; \ | |
2934 c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_3dnow; \ | |
2935 c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_3dnow | |
2936 | |
2937 dspfunc(put_h264_qpel, 0, 16); | |
2938 dspfunc(put_h264_qpel, 1, 8); | |
2939 dspfunc(put_h264_qpel, 2, 4); | |
2940 dspfunc(avg_h264_qpel, 0, 16); | |
2941 dspfunc(avg_h264_qpel, 1, 8); | |
2942 dspfunc(avg_h264_qpel, 2, 4); | |
2732 | 2943 |
2979 | 2944 c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_3dnow; |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2902
diff
changeset
|
2945 c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_3dnow; |
0 | 2946 } |
2947 } | |
2967 | 2948 |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
2949 #ifdef CONFIG_ENCODERS |
1092 | 2950 dsputil_init_pix_mmx(c, avctx); |
1530
3b31998fe22f
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
1527
diff
changeset
|
2951 #endif //CONFIG_ENCODERS |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2952 #if 0 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2953 // for speed testing |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2954 get_pixels = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2955 put_pixels_clamped = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2956 add_pixels_clamped = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2957 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2958 pix_abs16x16 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2959 pix_abs16x16_x2 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2960 pix_abs16x16_y2 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2961 pix_abs16x16_xy2 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2962 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2963 put_pixels_tab[0] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2964 put_pixels_tab[1] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2965 put_pixels_tab[2] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2966 put_pixels_tab[3] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2967 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2968 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
|
2969 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
|
2970 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
|
2971 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
|
2972 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2973 avg_pixels_tab[0] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2974 avg_pixels_tab[1] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2975 avg_pixels_tab[2] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2976 avg_pixels_tab[3] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2977 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2978 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
|
2979 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
|
2980 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
|
2981 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
|
2982 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2983 //av_fdct = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2984 //ff_idct = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2985 #endif |
0 | 2986 } |