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