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