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