Mercurial > libavcodec.hg
annotate i386/dsputil_mmx.c @ 7494:b0a840bb7b12 libavcodec
indent
author | michael |
---|---|
date | Tue, 05 Aug 2008 11:04:49 +0000 |
parents | 2ced44037814 |
children | 3d1b177a1b8c |
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 | |
6763 | 25 #include "libavutil/x86_cpu.h" |
26 #include "libavcodec/dsputil.h" | |
27 #include "libavcodec/h263.h" | |
28 #include "libavcodec/mpegvideo.h" | |
29 #include "libavcodec/simple_idct.h" | |
5946
55251379b5b1
make ff_p* vars extern so that they can be used in various *_mmx.c files
aurel
parents:
5933
diff
changeset
|
30 #include "dsputil_mmx.h" |
1984
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
31 #include "mmx.h" |
5014
42b99a3aadde
better separation of vp3dsp functions from dsputil_mmx.c
aurel
parents:
5010
diff
changeset
|
32 #include "vp3dsp_mmx.h" |
42b99a3aadde
better separation of vp3dsp functions from dsputil_mmx.c
aurel
parents:
5010
diff
changeset
|
33 #include "vp3dsp_sse2.h" |
6585 | 34 #include "idct_xvid.h" |
0 | 35 |
1729 | 36 //#undef NDEBUG |
37 //#include <assert.h> | |
38 | |
4197 | 39 int mm_flags; /* multimedia extension flags */ |
936 | 40 |
0 | 41 /* pixel operations */ |
5947 | 42 DECLARE_ALIGNED_8 (const uint64_t, ff_bone) = 0x0101010101010101ULL; |
43 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
|
44 |
55251379b5b1
make ff_p* vars extern so that they can be used in various *_mmx.c files
aurel
parents:
5933
diff
changeset
|
45 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
|
46 {0x8000000080000000ULL, 0x8000000080000000ULL}; |
8e13ec0f8aa3
change vorbis_inverse_coupling_sse2() so it works on sse1 cpus
michael
parents:
3541
diff
changeset
|
47 |
5946
55251379b5b1
make ff_p* vars extern so that they can be used in various *_mmx.c files
aurel
parents:
5933
diff
changeset
|
48 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
|
49 DECLARE_ALIGNED_8 (const uint64_t, ff_pw_4 ) = 0x0004000400040004ULL; |
6331 | 50 DECLARE_ALIGNED_16(const xmm_t, ff_pw_5 ) = {0x0005000500050005ULL, 0x0005000500050005ULL}; |
5946
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_8 ) = 0x0008000800080008ULL; |
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_15 ) = 0x000F000F000F000FULL; |
6331 | 53 DECLARE_ALIGNED_16(const xmm_t, ff_pw_16 ) = {0x0010001000100010ULL, 0x0010001000100010ULL}; |
5946
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_20 ) = 0x0014001400140014ULL; |
6557 | 55 DECLARE_ALIGNED_16(const xmm_t, ff_pw_28 ) = {0x001C001C001C001CULL, 0x001C001C001C001CULL}; |
6329
5969caa9190d
clean up an ugliness introduced in r11826. this syntax will require fewer changes when adding future sse2 code.
lorenm
parents:
6327
diff
changeset
|
56 DECLARE_ALIGNED_16(const xmm_t, ff_pw_32 ) = {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
|
57 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
|
58 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
|
59 DECLARE_ALIGNED_8 (const uint64_t, ff_pw_96 ) = 0x0060006000600060ULL; |
6333 | 60 DECLARE_ALIGNED_8 (const uint64_t, ff_pw_128) = 0x0080008000800080ULL; |
6384 | 61 DECLARE_ALIGNED_8 (const uint64_t, ff_pw_255) = 0x00ff00ff00ff00ffULL; |
5946
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 |
6391
3dc36ec2dcad
__asm __volatile -> asm volatile, improves code consistency and works
reimar
parents:
6384
diff
changeset
|
73 #define JUMPALIGN() asm volatile (ASMALIGN(3)::) |
3dc36ec2dcad
__asm __volatile -> asm volatile, improves code consistency and works
reimar
parents:
6384
diff
changeset
|
74 #define MOVQ_ZERO(regd) asm volatile ("pxor %%" #regd ", %%" #regd ::) |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
75 |
448 | 76 #define MOVQ_BFE(regd) \ |
6391
3dc36ec2dcad
__asm __volatile -> asm volatile, improves code consistency and works
reimar
parents:
6384
diff
changeset
|
77 asm volatile ( \ |
448 | 78 "pcmpeqd %%" #regd ", %%" #regd " \n\t"\ |
79 "paddb %%" #regd ", %%" #regd " \n\t" ::) | |
80 | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
81 #ifndef PIC |
6391
3dc36ec2dcad
__asm __volatile -> asm volatile, improves code consistency and works
reimar
parents:
6384
diff
changeset
|
82 #define MOVQ_BONE(regd) asm volatile ("movq %0, %%" #regd " \n\t" ::"m"(ff_bone)) |
3dc36ec2dcad
__asm __volatile -> asm volatile, improves code consistency and works
reimar
parents:
6384
diff
changeset
|
83 #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
|
84 #else |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
85 // 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
|
86 // pcmpeqd -> -1 |
448 | 87 #define MOVQ_BONE(regd) \ |
6391
3dc36ec2dcad
__asm __volatile -> asm volatile, improves code consistency and works
reimar
parents:
6384
diff
changeset
|
88 asm volatile ( \ |
448 | 89 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ |
90 "psrlw $15, %%" #regd " \n\t" \ | |
91 "packuswb %%" #regd ", %%" #regd " \n\t" ::) | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
92 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
93 #define MOVQ_WTWO(regd) \ |
6391
3dc36ec2dcad
__asm __volatile -> asm volatile, improves code consistency and works
reimar
parents:
6384
diff
changeset
|
94 asm volatile ( \ |
448 | 95 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ |
96 "psrlw $15, %%" #regd " \n\t" \ | |
97 "psllw $1, %%" #regd " \n\t"::) | |
387 | 98 |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
99 #endif |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
100 |
448 | 101 // 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
|
102 // first argument is unmodifed and second is trashed |
471 | 103 // regfe is supposed to contain 0xfefefefefefefefe |
104 #define PAVGB_MMX_NO_RND(rega, regb, regr, regfe) \ | |
2979 | 105 "movq " #rega ", " #regr " \n\t"\ |
106 "pand " #regb ", " #regr " \n\t"\ | |
107 "pxor " #rega ", " #regb " \n\t"\ | |
108 "pand " #regfe "," #regb " \n\t"\ | |
109 "psrlq $1, " #regb " \n\t"\ | |
110 "paddb " #regb ", " #regr " \n\t" | |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
111 |
471 | 112 #define PAVGB_MMX(rega, regb, regr, regfe) \ |
2979 | 113 "movq " #rega ", " #regr " \n\t"\ |
114 "por " #regb ", " #regr " \n\t"\ | |
115 "pxor " #rega ", " #regb " \n\t"\ | |
116 "pand " #regfe "," #regb " \n\t"\ | |
117 "psrlq $1, " #regb " \n\t"\ | |
118 "psubb " #regb ", " #regr " \n\t" | |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
119 |
471 | 120 // mm6 is supposed to contain 0xfefefefefefefefe |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
121 #define PAVGBP_MMX_NO_RND(rega, regb, regr, regc, regd, regp) \ |
2979 | 122 "movq " #rega ", " #regr " \n\t"\ |
123 "movq " #regc ", " #regp " \n\t"\ | |
124 "pand " #regb ", " #regr " \n\t"\ | |
125 "pand " #regd ", " #regp " \n\t"\ | |
126 "pxor " #rega ", " #regb " \n\t"\ | |
127 "pxor " #regc ", " #regd " \n\t"\ | |
128 "pand %%mm6, " #regb " \n\t"\ | |
129 "pand %%mm6, " #regd " \n\t"\ | |
130 "psrlq $1, " #regb " \n\t"\ | |
131 "psrlq $1, " #regd " \n\t"\ | |
132 "paddb " #regb ", " #regr " \n\t"\ | |
133 "paddb " #regd ", " #regp " \n\t" | |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
134 |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
135 #define PAVGBP_MMX(rega, regb, regr, regc, regd, regp) \ |
2979 | 136 "movq " #rega ", " #regr " \n\t"\ |
137 "movq " #regc ", " #regp " \n\t"\ | |
138 "por " #regb ", " #regr " \n\t"\ | |
139 "por " #regd ", " #regp " \n\t"\ | |
140 "pxor " #rega ", " #regb " \n\t"\ | |
141 "pxor " #regc ", " #regd " \n\t"\ | |
142 "pand %%mm6, " #regb " \n\t"\ | |
143 "pand %%mm6, " #regd " \n\t"\ | |
144 "psrlq $1, " #regd " \n\t"\ | |
145 "psrlq $1, " #regb " \n\t"\ | |
146 "psubb " #regb ", " #regr " \n\t"\ | |
147 "psubb " #regd ", " #regp " \n\t" | |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
148 |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
149 /***********************************/ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
150 /* MMX no rounding */ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
151 #define DEF(x, y) x ## _no_rnd_ ## y ##_mmx |
448 | 152 #define SET_RND MOVQ_WONE |
2979 | 153 #define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX_NO_RND(a, b, c, d, e, f) |
154 #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
|
155 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
156 #include "dsputil_mmx_rnd.h" |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
157 |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
158 #undef DEF |
448 | 159 #undef SET_RND |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
160 #undef PAVGBP |
471 | 161 #undef PAVGB |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
162 /***********************************/ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
163 /* MMX rounding */ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
164 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
165 #define DEF(x, y) x ## _ ## y ##_mmx |
448 | 166 #define SET_RND MOVQ_WTWO |
2979 | 167 #define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX(a, b, c, d, e, f) |
168 #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
|
169 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
170 #include "dsputil_mmx_rnd.h" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
171 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
172 #undef DEF |
448 | 173 #undef SET_RND |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
174 #undef PAVGBP |
471 | 175 #undef PAVGB |
387 | 176 |
0 | 177 /***********************************/ |
178 /* 3Dnow specific */ | |
179 | |
180 #define DEF(x) x ## _3dnow | |
181 #define PAVGB "pavgusb" | |
182 | |
183 #include "dsputil_mmx_avg.h" | |
184 | |
185 #undef DEF | |
186 #undef PAVGB | |
187 | |
188 /***********************************/ | |
189 /* MMX2 specific */ | |
190 | |
386 | 191 #define DEF(x) x ## _mmx2 |
0 | 192 |
193 /* Introduced only in MMX2 set */ | |
194 #define PAVGB "pavgb" | |
195 | |
196 #include "dsputil_mmx_avg.h" | |
197 | |
198 #undef DEF | |
199 #undef PAVGB | |
200 | |
6327 | 201 #define put_no_rnd_pixels16_mmx put_pixels16_mmx |
202 #define put_no_rnd_pixels8_mmx put_pixels8_mmx | |
6321 | 203 #define put_pixels16_mmx2 put_pixels16_mmx |
204 #define put_pixels8_mmx2 put_pixels8_mmx | |
205 #define put_pixels4_mmx2 put_pixels4_mmx | |
206 #define put_no_rnd_pixels16_mmx2 put_no_rnd_pixels16_mmx | |
207 #define put_no_rnd_pixels8_mmx2 put_no_rnd_pixels8_mmx | |
208 #define put_pixels16_3dnow put_pixels16_mmx | |
209 #define put_pixels8_3dnow put_pixels8_mmx | |
210 #define put_pixels4_3dnow put_pixels4_mmx | |
211 #define put_no_rnd_pixels16_3dnow put_no_rnd_pixels16_mmx | |
212 #define put_no_rnd_pixels8_3dnow put_no_rnd_pixels8_mmx | |
213 | |
0 | 214 /***********************************/ |
215 /* standard MMX */ | |
216 | |
1064 | 217 void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size) |
0 | 218 { |
219 const DCTELEM *p; | |
1064 | 220 uint8_t *pix; |
0 | 221 |
222 /* read the pixels */ | |
223 p = block; | |
224 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
225 /* unrolled loop */ |
6391
3dc36ec2dcad
__asm __volatile -> asm volatile, improves code consistency and works
reimar
parents:
6384
diff
changeset
|
226 asm volatile( |
2979 | 227 "movq %3, %%mm0 \n\t" |
228 "movq 8%3, %%mm1 \n\t" | |
229 "movq 16%3, %%mm2 \n\t" | |
230 "movq 24%3, %%mm3 \n\t" | |
231 "movq 32%3, %%mm4 \n\t" | |
232 "movq 40%3, %%mm5 \n\t" | |
233 "movq 48%3, %%mm6 \n\t" | |
234 "movq 56%3, %%mm7 \n\t" | |
235 "packuswb %%mm1, %%mm0 \n\t" | |
236 "packuswb %%mm3, %%mm2 \n\t" | |
237 "packuswb %%mm5, %%mm4 \n\t" | |
238 "packuswb %%mm7, %%mm6 \n\t" | |
239 "movq %%mm0, (%0) \n\t" | |
240 "movq %%mm2, (%0, %1) \n\t" | |
241 "movq %%mm4, (%0, %1, 2) \n\t" | |
242 "movq %%mm6, (%0, %2) \n\t" | |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
243 ::"r" (pix), "r" ((x86_reg)line_size), "r" ((x86_reg)line_size*3), "m"(*p) |
2979 | 244 :"memory"); |
0 | 245 pix += line_size*4; |
246 p += 32; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
247 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
248 // 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
|
249 // compiler would generate some very strange code |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
250 // thus using "r" |
6391
3dc36ec2dcad
__asm __volatile -> asm volatile, improves code consistency and works
reimar
parents:
6384
diff
changeset
|
251 asm volatile( |
2979 | 252 "movq (%3), %%mm0 \n\t" |
253 "movq 8(%3), %%mm1 \n\t" | |
254 "movq 16(%3), %%mm2 \n\t" | |
255 "movq 24(%3), %%mm3 \n\t" | |
256 "movq 32(%3), %%mm4 \n\t" | |
257 "movq 40(%3), %%mm5 \n\t" | |
258 "movq 48(%3), %%mm6 \n\t" | |
259 "movq 56(%3), %%mm7 \n\t" | |
260 "packuswb %%mm1, %%mm0 \n\t" | |
261 "packuswb %%mm3, %%mm2 \n\t" | |
262 "packuswb %%mm5, %%mm4 \n\t" | |
263 "packuswb %%mm7, %%mm6 \n\t" | |
264 "movq %%mm0, (%0) \n\t" | |
265 "movq %%mm2, (%0, %1) \n\t" | |
266 "movq %%mm4, (%0, %1, 2) \n\t" | |
267 "movq %%mm6, (%0, %2) \n\t" | |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
268 ::"r" (pix), "r" ((x86_reg)line_size), "r" ((x86_reg)line_size*3), "r"(p) |
2979 | 269 :"memory"); |
0 | 270 } |
271 | |
3089 | 272 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
|
273 { 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
|
274 |
1984
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
275 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
|
276 { |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
277 int i; |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
278 |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
279 movq_m2r(*vector128, mm1); |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
280 for (i = 0; i < 8; i++) { |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
281 movq_m2r(*(block), mm0); |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
282 packsswb_m2r(*(block + 4), mm0); |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
283 block += 8; |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
284 paddb_r2r(mm1, mm0); |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
285 movq_r2m(mm0, *pixels); |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
286 pixels += line_size; |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
287 } |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
288 } |
ef919e9ef73e
separate out put_signed_pixels_clamped() into its own function and
melanson
parents:
1977
diff
changeset
|
289 |
1064 | 290 void add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size) |
0 | 291 { |
292 const DCTELEM *p; | |
1064 | 293 uint8_t *pix; |
0 | 294 int i; |
295 | |
296 /* read the pixels */ | |
297 p = block; | |
298 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
299 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
300 i = 4; |
342
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
301 do { |
6391
3dc36ec2dcad
__asm __volatile -> asm volatile, improves code consistency and works
reimar
parents:
6384
diff
changeset
|
302 asm volatile( |
2979 | 303 "movq (%2), %%mm0 \n\t" |
304 "movq 8(%2), %%mm1 \n\t" | |
305 "movq 16(%2), %%mm2 \n\t" | |
306 "movq 24(%2), %%mm3 \n\t" | |
307 "movq %0, %%mm4 \n\t" | |
308 "movq %1, %%mm6 \n\t" | |
309 "movq %%mm4, %%mm5 \n\t" | |
310 "punpcklbw %%mm7, %%mm4 \n\t" | |
311 "punpckhbw %%mm7, %%mm5 \n\t" | |
312 "paddsw %%mm4, %%mm0 \n\t" | |
313 "paddsw %%mm5, %%mm1 \n\t" | |
314 "movq %%mm6, %%mm5 \n\t" | |
315 "punpcklbw %%mm7, %%mm6 \n\t" | |
316 "punpckhbw %%mm7, %%mm5 \n\t" | |
317 "paddsw %%mm6, %%mm2 \n\t" | |
318 "paddsw %%mm5, %%mm3 \n\t" | |
319 "packuswb %%mm1, %%mm0 \n\t" | |
320 "packuswb %%mm3, %%mm2 \n\t" | |
321 "movq %%mm0, %0 \n\t" | |
322 "movq %%mm2, %1 \n\t" | |
323 :"+m"(*pix), "+m"(*(pix+line_size)) | |
324 :"r"(p) | |
325 :"memory"); | |
0 | 326 pix += line_size*2; |
327 p += 16; | |
342
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
328 } while (--i); |
0 | 329 } |
330 | |
2209 | 331 static void put_pixels4_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
332 { | |
6391
3dc36ec2dcad
__asm __volatile -> asm volatile, improves code consistency and works
reimar
parents:
6384
diff
changeset
|
333 asm volatile( |
2979 | 334 "lea (%3, %3), %%"REG_a" \n\t" |
3576
f7125bf10892
Support for MacIntel, last part: balign directives
gpoirier
parents:
3574
diff
changeset
|
335 ASMALIGN(3) |
2979 | 336 "1: \n\t" |
337 "movd (%1), %%mm0 \n\t" | |
338 "movd (%1, %3), %%mm1 \n\t" | |
339 "movd %%mm0, (%2) \n\t" | |
340 "movd %%mm1, (%2, %3) \n\t" | |
341 "add %%"REG_a", %1 \n\t" | |
342 "add %%"REG_a", %2 \n\t" | |
343 "movd (%1), %%mm0 \n\t" | |
344 "movd (%1, %3), %%mm1 \n\t" | |
345 "movd %%mm0, (%2) \n\t" | |
346 "movd %%mm1, (%2, %3) \n\t" | |
347 "add %%"REG_a", %1 \n\t" | |
348 "add %%"REG_a", %2 \n\t" | |
349 "subl $4, %0 \n\t" | |
350 "jnz 1b \n\t" | |
351 : "+g"(h), "+r" (pixels), "+r" (block) | |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
352 : "r"((x86_reg)line_size) |
2979 | 353 : "%"REG_a, "memory" |
354 ); | |
2209 | 355 } |
356 | |
1064 | 357 static void put_pixels8_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
0 | 358 { |
6391
3dc36ec2dcad
__asm __volatile -> asm volatile, improves code consistency and works
reimar
parents:
6384
diff
changeset
|
359 asm volatile( |
2979 | 360 "lea (%3, %3), %%"REG_a" \n\t" |
3576
f7125bf10892
Support for MacIntel, last part: balign directives
gpoirier
parents:
3574
diff
changeset
|
361 ASMALIGN(3) |
2979 | 362 "1: \n\t" |
363 "movq (%1), %%mm0 \n\t" | |
364 "movq (%1, %3), %%mm1 \n\t" | |
365 "movq %%mm0, (%2) \n\t" | |
366 "movq %%mm1, (%2, %3) \n\t" | |
367 "add %%"REG_a", %1 \n\t" | |
368 "add %%"REG_a", %2 \n\t" | |
369 "movq (%1), %%mm0 \n\t" | |
370 "movq (%1, %3), %%mm1 \n\t" | |
371 "movq %%mm0, (%2) \n\t" | |
372 "movq %%mm1, (%2, %3) \n\t" | |
373 "add %%"REG_a", %1 \n\t" | |
374 "add %%"REG_a", %2 \n\t" | |
375 "subl $4, %0 \n\t" | |
376 "jnz 1b \n\t" | |
377 : "+g"(h), "+r" (pixels), "+r" (block) | |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
378 : "r"((x86_reg)line_size) |
2979 | 379 : "%"REG_a, "memory" |
380 ); | |
0 | 381 } |
382 | |
1064 | 383 static void put_pixels16_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
651 | 384 { |
6391
3dc36ec2dcad
__asm __volatile -> asm volatile, improves code consistency and works
reimar
parents:
6384
diff
changeset
|
385 asm volatile( |
2979 | 386 "lea (%3, %3), %%"REG_a" \n\t" |
3576
f7125bf10892
Support for MacIntel, last part: balign directives
gpoirier
parents:
3574
diff
changeset
|
387 ASMALIGN(3) |
2979 | 388 "1: \n\t" |
389 "movq (%1), %%mm0 \n\t" | |
390 "movq 8(%1), %%mm4 \n\t" | |
391 "movq (%1, %3), %%mm1 \n\t" | |
392 "movq 8(%1, %3), %%mm5 \n\t" | |
393 "movq %%mm0, (%2) \n\t" | |
394 "movq %%mm4, 8(%2) \n\t" | |
395 "movq %%mm1, (%2, %3) \n\t" | |
396 "movq %%mm5, 8(%2, %3) \n\t" | |
397 "add %%"REG_a", %1 \n\t" | |
398 "add %%"REG_a", %2 \n\t" | |
399 "movq (%1), %%mm0 \n\t" | |
400 "movq 8(%1), %%mm4 \n\t" | |
401 "movq (%1, %3), %%mm1 \n\t" | |
402 "movq 8(%1, %3), %%mm5 \n\t" | |
403 "movq %%mm0, (%2) \n\t" | |
404 "movq %%mm4, 8(%2) \n\t" | |
405 "movq %%mm1, (%2, %3) \n\t" | |
406 "movq %%mm5, 8(%2, %3) \n\t" | |
407 "add %%"REG_a", %1 \n\t" | |
408 "add %%"REG_a", %2 \n\t" | |
409 "subl $4, %0 \n\t" | |
410 "jnz 1b \n\t" | |
411 : "+g"(h), "+r" (pixels), "+r" (block) | |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
412 : "r"((x86_reg)line_size) |
2979 | 413 : "%"REG_a, "memory" |
414 ); | |
651 | 415 } |
416 | |
6331 | 417 static void put_pixels16_sse2(uint8_t *block, const uint8_t *pixels, int line_size, int h) |
418 { | |
6391
3dc36ec2dcad
__asm __volatile -> asm volatile, improves code consistency and works
reimar
parents:
6384
diff
changeset
|
419 asm volatile( |
6331 | 420 "1: \n\t" |
421 "movdqu (%1), %%xmm0 \n\t" | |
422 "movdqu (%1,%3), %%xmm1 \n\t" | |
423 "movdqu (%1,%3,2), %%xmm2 \n\t" | |
424 "movdqu (%1,%4), %%xmm3 \n\t" | |
425 "movdqa %%xmm0, (%2) \n\t" | |
426 "movdqa %%xmm1, (%2,%3) \n\t" | |
427 "movdqa %%xmm2, (%2,%3,2) \n\t" | |
428 "movdqa %%xmm3, (%2,%4) \n\t" | |
429 "subl $4, %0 \n\t" | |
430 "lea (%1,%3,4), %1 \n\t" | |
431 "lea (%2,%3,4), %2 \n\t" | |
432 "jnz 1b \n\t" | |
433 : "+g"(h), "+r" (pixels), "+r" (block) | |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
434 : "r"((x86_reg)line_size), "r"((x86_reg)3L*line_size) |
6331 | 435 : "memory" |
436 ); | |
437 } | |
438 | |
439 static void avg_pixels16_sse2(uint8_t *block, const uint8_t *pixels, int line_size, int h) | |
440 { | |
6391
3dc36ec2dcad
__asm __volatile -> asm volatile, improves code consistency and works
reimar
parents:
6384
diff
changeset
|
441 asm volatile( |
6331 | 442 "1: \n\t" |
443 "movdqu (%1), %%xmm0 \n\t" | |
444 "movdqu (%1,%3), %%xmm1 \n\t" | |
445 "movdqu (%1,%3,2), %%xmm2 \n\t" | |
446 "movdqu (%1,%4), %%xmm3 \n\t" | |
447 "pavgb (%2), %%xmm0 \n\t" | |
448 "pavgb (%2,%3), %%xmm1 \n\t" | |
449 "pavgb (%2,%3,2), %%xmm2 \n\t" | |
450 "pavgb (%2,%4), %%xmm3 \n\t" | |
451 "movdqa %%xmm0, (%2) \n\t" | |
452 "movdqa %%xmm1, (%2,%3) \n\t" | |
453 "movdqa %%xmm2, (%2,%3,2) \n\t" | |
454 "movdqa %%xmm3, (%2,%4) \n\t" | |
455 "subl $4, %0 \n\t" | |
456 "lea (%1,%3,4), %1 \n\t" | |
457 "lea (%2,%3,4), %2 \n\t" | |
458 "jnz 1b \n\t" | |
459 : "+g"(h), "+r" (pixels), "+r" (block) | |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
460 : "r"((x86_reg)line_size), "r"((x86_reg)3L*line_size) |
6331 | 461 : "memory" |
462 ); | |
463 } | |
464 | |
296 | 465 static void clear_blocks_mmx(DCTELEM *blocks) |
466 { | |
6391
3dc36ec2dcad
__asm __volatile -> asm volatile, improves code consistency and works
reimar
parents:
6384
diff
changeset
|
467 asm volatile( |
2979 | 468 "pxor %%mm7, %%mm7 \n\t" |
469 "mov $-128*6, %%"REG_a" \n\t" | |
470 "1: \n\t" | |
471 "movq %%mm7, (%0, %%"REG_a") \n\t" | |
472 "movq %%mm7, 8(%0, %%"REG_a") \n\t" | |
473 "movq %%mm7, 16(%0, %%"REG_a") \n\t" | |
474 "movq %%mm7, 24(%0, %%"REG_a") \n\t" | |
475 "add $32, %%"REG_a" \n\t" | |
476 " 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
|
477 : : "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
|
478 : "%"REG_a |
296 | 479 ); |
480 } | |
481 | |
866 | 482 static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w){ |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
483 x86_reg i=0; |
866 | 484 asm volatile( |
7087 | 485 "jmp 2f \n\t" |
2979 | 486 "1: \n\t" |
487 "movq (%1, %0), %%mm0 \n\t" | |
488 "movq (%2, %0), %%mm1 \n\t" | |
489 "paddb %%mm0, %%mm1 \n\t" | |
490 "movq %%mm1, (%2, %0) \n\t" | |
491 "movq 8(%1, %0), %%mm0 \n\t" | |
492 "movq 8(%2, %0), %%mm1 \n\t" | |
493 "paddb %%mm0, %%mm1 \n\t" | |
494 "movq %%mm1, 8(%2, %0) \n\t" | |
495 "add $16, %0 \n\t" | |
7087 | 496 "2: \n\t" |
2979 | 497 "cmp %3, %0 \n\t" |
7087 | 498 " js 1b \n\t" |
866 | 499 : "+r" (i) |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
500 : "r"(src), "r"(dst), "r"((x86_reg)w-15) |
866 | 501 ); |
502 for(; i<w; i++) | |
503 dst[i+0] += src[i+0]; | |
504 } | |
505 | |
6384 | 506 static void add_bytes_l2_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){ |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
507 x86_reg i=0; |
6384 | 508 asm volatile( |
7087 | 509 "jmp 2f \n\t" |
6384 | 510 "1: \n\t" |
511 "movq (%2, %0), %%mm0 \n\t" | |
512 "movq 8(%2, %0), %%mm1 \n\t" | |
513 "paddb (%3, %0), %%mm0 \n\t" | |
514 "paddb 8(%3, %0), %%mm1 \n\t" | |
515 "movq %%mm0, (%1, %0) \n\t" | |
516 "movq %%mm1, 8(%1, %0) \n\t" | |
517 "add $16, %0 \n\t" | |
7087 | 518 "2: \n\t" |
6384 | 519 "cmp %4, %0 \n\t" |
7087 | 520 " js 1b \n\t" |
6384 | 521 : "+r" (i) |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
522 : "r"(dst), "r"(src1), "r"(src2), "r"((x86_reg)w-15) |
6384 | 523 ); |
524 for(; i<w; i++) | |
525 dst[i] = src1[i] + src2[i]; | |
526 } | |
527 | |
1648 | 528 #define H263_LOOP_FILTER \ |
2979 | 529 "pxor %%mm7, %%mm7 \n\t"\ |
530 "movq %0, %%mm0 \n\t"\ | |
531 "movq %0, %%mm1 \n\t"\ | |
532 "movq %3, %%mm2 \n\t"\ | |
533 "movq %3, %%mm3 \n\t"\ | |
534 "punpcklbw %%mm7, %%mm0 \n\t"\ | |
535 "punpckhbw %%mm7, %%mm1 \n\t"\ | |
536 "punpcklbw %%mm7, %%mm2 \n\t"\ | |
537 "punpckhbw %%mm7, %%mm3 \n\t"\ | |
538 "psubw %%mm2, %%mm0 \n\t"\ | |
539 "psubw %%mm3, %%mm1 \n\t"\ | |
540 "movq %1, %%mm2 \n\t"\ | |
541 "movq %1, %%mm3 \n\t"\ | |
542 "movq %2, %%mm4 \n\t"\ | |
543 "movq %2, %%mm5 \n\t"\ | |
544 "punpcklbw %%mm7, %%mm2 \n\t"\ | |
545 "punpckhbw %%mm7, %%mm3 \n\t"\ | |
546 "punpcklbw %%mm7, %%mm4 \n\t"\ | |
547 "punpckhbw %%mm7, %%mm5 \n\t"\ | |
548 "psubw %%mm2, %%mm4 \n\t"\ | |
549 "psubw %%mm3, %%mm5 \n\t"\ | |
550 "psllw $2, %%mm4 \n\t"\ | |
551 "psllw $2, %%mm5 \n\t"\ | |
552 "paddw %%mm0, %%mm4 \n\t"\ | |
553 "paddw %%mm1, %%mm5 \n\t"\ | |
554 "pxor %%mm6, %%mm6 \n\t"\ | |
555 "pcmpgtw %%mm4, %%mm6 \n\t"\ | |
556 "pcmpgtw %%mm5, %%mm7 \n\t"\ | |
557 "pxor %%mm6, %%mm4 \n\t"\ | |
558 "pxor %%mm7, %%mm5 \n\t"\ | |
559 "psubw %%mm6, %%mm4 \n\t"\ | |
560 "psubw %%mm7, %%mm5 \n\t"\ | |
561 "psrlw $3, %%mm4 \n\t"\ | |
562 "psrlw $3, %%mm5 \n\t"\ | |
563 "packuswb %%mm5, %%mm4 \n\t"\ | |
564 "packsswb %%mm7, %%mm6 \n\t"\ | |
565 "pxor %%mm7, %%mm7 \n\t"\ | |
566 "movd %4, %%mm2 \n\t"\ | |
567 "punpcklbw %%mm2, %%mm2 \n\t"\ | |
568 "punpcklbw %%mm2, %%mm2 \n\t"\ | |
569 "punpcklbw %%mm2, %%mm2 \n\t"\ | |
570 "psubusb %%mm4, %%mm2 \n\t"\ | |
571 "movq %%mm2, %%mm3 \n\t"\ | |
572 "psubusb %%mm4, %%mm3 \n\t"\ | |
573 "psubb %%mm3, %%mm2 \n\t"\ | |
574 "movq %1, %%mm3 \n\t"\ | |
575 "movq %2, %%mm4 \n\t"\ | |
576 "pxor %%mm6, %%mm3 \n\t"\ | |
577 "pxor %%mm6, %%mm4 \n\t"\ | |
578 "paddusb %%mm2, %%mm3 \n\t"\ | |
579 "psubusb %%mm2, %%mm4 \n\t"\ | |
580 "pxor %%mm6, %%mm3 \n\t"\ | |
581 "pxor %%mm6, %%mm4 \n\t"\ | |
582 "paddusb %%mm2, %%mm2 \n\t"\ | |
583 "packsswb %%mm1, %%mm0 \n\t"\ | |
584 "pcmpgtb %%mm0, %%mm7 \n\t"\ | |
585 "pxor %%mm7, %%mm0 \n\t"\ | |
586 "psubb %%mm7, %%mm0 \n\t"\ | |
587 "movq %%mm0, %%mm1 \n\t"\ | |
588 "psubusb %%mm2, %%mm0 \n\t"\ | |
589 "psubb %%mm0, %%mm1 \n\t"\ | |
590 "pand %5, %%mm1 \n\t"\ | |
591 "psrlw $2, %%mm1 \n\t"\ | |
592 "pxor %%mm7, %%mm1 \n\t"\ | |
593 "psubb %%mm7, %%mm1 \n\t"\ | |
594 "movq %0, %%mm5 \n\t"\ | |
595 "movq %3, %%mm6 \n\t"\ | |
596 "psubb %%mm1, %%mm5 \n\t"\ | |
597 "paddb %%mm1, %%mm6 \n\t" | |
1648 | 598 |
1647 | 599 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
|
600 if(ENABLE_ANY_H263) { |
1647 | 601 const int strength= ff_h263_loop_filter_strength[qscale]; |
602 | |
603 asm volatile( | |
2967 | 604 |
1648 | 605 H263_LOOP_FILTER |
2967 | 606 |
2979 | 607 "movq %%mm3, %1 \n\t" |
608 "movq %%mm4, %2 \n\t" | |
609 "movq %%mm5, %0 \n\t" | |
610 "movq %%mm6, %3 \n\t" | |
1647 | 611 : "+m" (*(uint64_t*)(src - 2*stride)), |
612 "+m" (*(uint64_t*)(src - 1*stride)), | |
613 "+m" (*(uint64_t*)(src + 0*stride)), | |
614 "+m" (*(uint64_t*)(src + 1*stride)) | |
615 : "g" (2*strength), "m"(ff_pb_FC) | |
616 ); | |
5394
e9a6215f4e3a
help some gcc version to optimize out those functions
aurel
parents:
5278
diff
changeset
|
617 } |
1647 | 618 } |
619 | |
1648 | 620 static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int src_stride){ |
621 asm volatile( //FIXME could save 1 instruction if done as 8x4 ... | |
2979 | 622 "movd %4, %%mm0 \n\t" |
623 "movd %5, %%mm1 \n\t" | |
624 "movd %6, %%mm2 \n\t" | |
625 "movd %7, %%mm3 \n\t" | |
626 "punpcklbw %%mm1, %%mm0 \n\t" | |
627 "punpcklbw %%mm3, %%mm2 \n\t" | |
628 "movq %%mm0, %%mm1 \n\t" | |
629 "punpcklwd %%mm2, %%mm0 \n\t" | |
630 "punpckhwd %%mm2, %%mm1 \n\t" | |
631 "movd %%mm0, %0 \n\t" | |
632 "punpckhdq %%mm0, %%mm0 \n\t" | |
633 "movd %%mm0, %1 \n\t" | |
634 "movd %%mm1, %2 \n\t" | |
635 "punpckhdq %%mm1, %%mm1 \n\t" | |
636 "movd %%mm1, %3 \n\t" | |
2967 | 637 |
1648 | 638 : "=m" (*(uint32_t*)(dst + 0*dst_stride)), |
639 "=m" (*(uint32_t*)(dst + 1*dst_stride)), | |
640 "=m" (*(uint32_t*)(dst + 2*dst_stride)), | |
641 "=m" (*(uint32_t*)(dst + 3*dst_stride)) | |
642 : "m" (*(uint32_t*)(src + 0*src_stride)), | |
643 "m" (*(uint32_t*)(src + 1*src_stride)), | |
644 "m" (*(uint32_t*)(src + 2*src_stride)), | |
645 "m" (*(uint32_t*)(src + 3*src_stride)) | |
646 ); | |
647 } | |
648 | |
649 static void h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale){ | |
5394
e9a6215f4e3a
help some gcc version to optimize out those functions
aurel
parents:
5278
diff
changeset
|
650 if(ENABLE_ANY_H263) { |
1648 | 651 const int strength= ff_h263_loop_filter_strength[qscale]; |
6181 | 652 DECLARE_ALIGNED(8, uint64_t, temp[4]); |
1648 | 653 uint8_t *btemp= (uint8_t*)temp; |
2967 | 654 |
1648 | 655 src -= 2; |
656 | |
657 transpose4x4(btemp , src , 8, stride); | |
658 transpose4x4(btemp+4, src + 4*stride, 8, stride); | |
659 asm volatile( | |
660 H263_LOOP_FILTER // 5 3 4 6 | |
2967 | 661 |
1648 | 662 : "+m" (temp[0]), |
663 "+m" (temp[1]), | |
664 "+m" (temp[2]), | |
665 "+m" (temp[3]) | |
666 : "g" (2*strength), "m"(ff_pb_FC) | |
667 ); | |
668 | |
669 asm volatile( | |
2979 | 670 "movq %%mm5, %%mm1 \n\t" |
671 "movq %%mm4, %%mm0 \n\t" | |
672 "punpcklbw %%mm3, %%mm5 \n\t" | |
673 "punpcklbw %%mm6, %%mm4 \n\t" | |
674 "punpckhbw %%mm3, %%mm1 \n\t" | |
675 "punpckhbw %%mm6, %%mm0 \n\t" | |
676 "movq %%mm5, %%mm3 \n\t" | |
677 "movq %%mm1, %%mm6 \n\t" | |
678 "punpcklwd %%mm4, %%mm5 \n\t" | |
679 "punpcklwd %%mm0, %%mm1 \n\t" | |
680 "punpckhwd %%mm4, %%mm3 \n\t" | |
681 "punpckhwd %%mm0, %%mm6 \n\t" | |
682 "movd %%mm5, (%0) \n\t" | |
683 "punpckhdq %%mm5, %%mm5 \n\t" | |
684 "movd %%mm5, (%0,%2) \n\t" | |
685 "movd %%mm3, (%0,%2,2) \n\t" | |
686 "punpckhdq %%mm3, %%mm3 \n\t" | |
687 "movd %%mm3, (%0,%3) \n\t" | |
688 "movd %%mm1, (%1) \n\t" | |
689 "punpckhdq %%mm1, %%mm1 \n\t" | |
690 "movd %%mm1, (%1,%2) \n\t" | |
691 "movd %%mm6, (%1,%2,2) \n\t" | |
692 "punpckhdq %%mm6, %%mm6 \n\t" | |
693 "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
|
694 :: "r" (src), |
86e2b1424801
optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents:
2293
diff
changeset
|
695 "r" (src + 4*stride), |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
696 "r" ((x86_reg) stride ), |
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
697 "r" ((x86_reg)(3*stride)) |
1648 | 698 ); |
5394
e9a6215f4e3a
help some gcc version to optimize out those functions
aurel
parents:
5278
diff
changeset
|
699 } |
1648 | 700 } |
701 | |
6437 | 702 /* draw the edges of width 'w' of an image of size width, height |
703 this mmx version can only handle w==8 || w==16 */ | |
704 static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w) | |
705 { | |
706 uint8_t *ptr, *last_line; | |
707 int i; | |
708 | |
709 last_line = buf + (height - 1) * wrap; | |
710 /* left and right */ | |
711 ptr = buf; | |
712 if(w==8) | |
713 { | |
714 asm volatile( | |
715 "1: \n\t" | |
716 "movd (%0), %%mm0 \n\t" | |
717 "punpcklbw %%mm0, %%mm0 \n\t" | |
718 "punpcklwd %%mm0, %%mm0 \n\t" | |
719 "punpckldq %%mm0, %%mm0 \n\t" | |
720 "movq %%mm0, -8(%0) \n\t" | |
721 "movq -8(%0, %2), %%mm1 \n\t" | |
722 "punpckhbw %%mm1, %%mm1 \n\t" | |
723 "punpckhwd %%mm1, %%mm1 \n\t" | |
724 "punpckhdq %%mm1, %%mm1 \n\t" | |
725 "movq %%mm1, (%0, %2) \n\t" | |
726 "add %1, %0 \n\t" | |
727 "cmp %3, %0 \n\t" | |
728 " jb 1b \n\t" | |
729 : "+r" (ptr) | |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
730 : "r" ((x86_reg)wrap), "r" ((x86_reg)width), "r" (ptr + wrap*height) |
6437 | 731 ); |
732 } | |
733 else | |
734 { | |
735 asm volatile( | |
736 "1: \n\t" | |
737 "movd (%0), %%mm0 \n\t" | |
738 "punpcklbw %%mm0, %%mm0 \n\t" | |
739 "punpcklwd %%mm0, %%mm0 \n\t" | |
740 "punpckldq %%mm0, %%mm0 \n\t" | |
741 "movq %%mm0, -8(%0) \n\t" | |
742 "movq %%mm0, -16(%0) \n\t" | |
743 "movq -8(%0, %2), %%mm1 \n\t" | |
744 "punpckhbw %%mm1, %%mm1 \n\t" | |
745 "punpckhwd %%mm1, %%mm1 \n\t" | |
746 "punpckhdq %%mm1, %%mm1 \n\t" | |
747 "movq %%mm1, (%0, %2) \n\t" | |
748 "movq %%mm1, 8(%0, %2) \n\t" | |
749 "add %1, %0 \n\t" | |
750 "cmp %3, %0 \n\t" | |
751 " jb 1b \n\t" | |
752 : "+r" (ptr) | |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
753 : "r" ((x86_reg)wrap), "r" ((x86_reg)width), "r" (ptr + wrap*height) |
6437 | 754 ); |
755 } | |
756 | |
757 for(i=0;i<w;i+=4) { | |
758 /* top and bottom (and hopefully also the corners) */ | |
759 ptr= buf - (i + 1) * wrap - w; | |
760 asm volatile( | |
761 "1: \n\t" | |
762 "movq (%1, %0), %%mm0 \n\t" | |
763 "movq %%mm0, (%0) \n\t" | |
764 "movq %%mm0, (%0, %2) \n\t" | |
765 "movq %%mm0, (%0, %2, 2) \n\t" | |
766 "movq %%mm0, (%0, %3) \n\t" | |
767 "add $8, %0 \n\t" | |
768 "cmp %4, %0 \n\t" | |
769 " jb 1b \n\t" | |
770 : "+r" (ptr) | |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
771 : "r" ((x86_reg)buf - (x86_reg)ptr - w), "r" ((x86_reg)-wrap), "r" ((x86_reg)-wrap*3), "r" (ptr+width+2*w) |
6437 | 772 ); |
773 ptr= last_line + (i + 1) * wrap - w; | |
774 asm volatile( | |
775 "1: \n\t" | |
776 "movq (%1, %0), %%mm0 \n\t" | |
777 "movq %%mm0, (%0) \n\t" | |
778 "movq %%mm0, (%0, %2) \n\t" | |
779 "movq %%mm0, (%0, %2, 2) \n\t" | |
780 "movq %%mm0, (%0, %3) \n\t" | |
781 "add $8, %0 \n\t" | |
782 "cmp %4, %0 \n\t" | |
783 " jb 1b \n\t" | |
784 : "+r" (ptr) | |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
785 : "r" ((x86_reg)last_line - (x86_reg)ptr - w), "r" ((x86_reg)wrap), "r" ((x86_reg)wrap*3), "r" (ptr+width+2*w) |
6437 | 786 ); |
787 } | |
788 } | |
789 | |
6384 | 790 #define PAETH(cpu, abs3)\ |
7460
2ced44037814
Mark add_png_paeth_prediction_* functions which are only used within this file
diego
parents:
7286
diff
changeset
|
791 static void add_png_paeth_prediction_##cpu(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp)\ |
6384 | 792 {\ |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
793 x86_reg i = -bpp;\ |
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
794 x86_reg end = w-3;\ |
6384 | 795 asm volatile(\ |
796 "pxor %%mm7, %%mm7 \n"\ | |
797 "movd (%1,%0), %%mm0 \n"\ | |
798 "movd (%2,%0), %%mm1 \n"\ | |
799 "punpcklbw %%mm7, %%mm0 \n"\ | |
800 "punpcklbw %%mm7, %%mm1 \n"\ | |
801 "add %4, %0 \n"\ | |
802 "1: \n"\ | |
803 "movq %%mm1, %%mm2 \n"\ | |
804 "movd (%2,%0), %%mm1 \n"\ | |
805 "movq %%mm2, %%mm3 \n"\ | |
806 "punpcklbw %%mm7, %%mm1 \n"\ | |
807 "movq %%mm2, %%mm4 \n"\ | |
808 "psubw %%mm1, %%mm3 \n"\ | |
809 "psubw %%mm0, %%mm4 \n"\ | |
810 "movq %%mm3, %%mm5 \n"\ | |
811 "paddw %%mm4, %%mm5 \n"\ | |
812 abs3\ | |
813 "movq %%mm4, %%mm6 \n"\ | |
814 "pminsw %%mm5, %%mm6 \n"\ | |
815 "pcmpgtw %%mm6, %%mm3 \n"\ | |
816 "pcmpgtw %%mm5, %%mm4 \n"\ | |
817 "movq %%mm4, %%mm6 \n"\ | |
818 "pand %%mm3, %%mm4 \n"\ | |
819 "pandn %%mm3, %%mm6 \n"\ | |
820 "pandn %%mm0, %%mm3 \n"\ | |
821 "movd (%3,%0), %%mm0 \n"\ | |
822 "pand %%mm1, %%mm6 \n"\ | |
823 "pand %%mm4, %%mm2 \n"\ | |
824 "punpcklbw %%mm7, %%mm0 \n"\ | |
825 "movq %6, %%mm5 \n"\ | |
826 "paddw %%mm6, %%mm0 \n"\ | |
827 "paddw %%mm2, %%mm3 \n"\ | |
828 "paddw %%mm3, %%mm0 \n"\ | |
829 "pand %%mm5, %%mm0 \n"\ | |
830 "movq %%mm0, %%mm3 \n"\ | |
831 "packuswb %%mm3, %%mm3 \n"\ | |
832 "movd %%mm3, (%1,%0) \n"\ | |
833 "add %4, %0 \n"\ | |
834 "cmp %5, %0 \n"\ | |
835 "jle 1b \n"\ | |
836 :"+r"(i)\ | |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
837 :"r"(dst), "r"(top), "r"(src), "r"((x86_reg)bpp), "g"(end),\ |
6384 | 838 "m"(ff_pw_255)\ |
839 :"memory"\ | |
840 );\ | |
841 } | |
842 | |
843 #define ABS3_MMX2\ | |
844 "psubw %%mm5, %%mm7 \n"\ | |
845 "pmaxsw %%mm7, %%mm5 \n"\ | |
846 "pxor %%mm6, %%mm6 \n"\ | |
847 "pxor %%mm7, %%mm7 \n"\ | |
848 "psubw %%mm3, %%mm6 \n"\ | |
849 "psubw %%mm4, %%mm7 \n"\ | |
850 "pmaxsw %%mm6, %%mm3 \n"\ | |
851 "pmaxsw %%mm7, %%mm4 \n"\ | |
852 "pxor %%mm7, %%mm7 \n" | |
853 | |
854 #define ABS3_SSSE3\ | |
855 "pabsw %%mm3, %%mm3 \n"\ | |
856 "pabsw %%mm4, %%mm4 \n"\ | |
857 "pabsw %%mm5, %%mm5 \n" | |
858 | |
859 PAETH(mmx2, ABS3_MMX2) | |
860 #ifdef HAVE_SSSE3 | |
861 PAETH(ssse3, ABS3_SSSE3) | |
862 #endif | |
863 | |
954 | 864 #define QPEL_V_LOW(m3,m4,m5,m6, pw_20, pw_3, rnd, in0, in1, in2, in7, out, OP)\ |
2979 | 865 "paddw " #m4 ", " #m3 " \n\t" /* x1 */\ |
866 "movq "MANGLE(ff_pw_20)", %%mm4 \n\t" /* 20 */\ | |
867 "pmullw " #m3 ", %%mm4 \n\t" /* 20x1 */\ | |
868 "movq "#in7", " #m3 " \n\t" /* d */\ | |
869 "movq "#in0", %%mm5 \n\t" /* D */\ | |
870 "paddw " #m3 ", %%mm5 \n\t" /* x4 */\ | |
871 "psubw %%mm5, %%mm4 \n\t" /* 20x1 - x4 */\ | |
872 "movq "#in1", %%mm5 \n\t" /* C */\ | |
873 "movq "#in2", %%mm6 \n\t" /* B */\ | |
874 "paddw " #m6 ", %%mm5 \n\t" /* x3 */\ | |
875 "paddw " #m5 ", %%mm6 \n\t" /* x2 */\ | |
876 "paddw %%mm6, %%mm6 \n\t" /* 2x2 */\ | |
877 "psubw %%mm6, %%mm5 \n\t" /* -2x2 + x3 */\ | |
878 "pmullw "MANGLE(ff_pw_3)", %%mm5 \n\t" /* -6x2 + 3x3 */\ | |
879 "paddw " #rnd ", %%mm4 \n\t" /* x2 */\ | |
880 "paddw %%mm4, %%mm5 \n\t" /* 20x1 - 6x2 + 3x3 - x4 */\ | |
881 "psraw $5, %%mm5 \n\t"\ | |
882 "packuswb %%mm5, %%mm5 \n\t"\ | |
954 | 883 OP(%%mm5, out, %%mm7, d) |
884 | |
959 | 885 #define QPEL_BASE(OPNAME, ROUNDER, RND, OP_MMX2, OP_3DNOW)\ |
1057 | 886 static void OPNAME ## mpeg4_qpel16_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ |
954 | 887 uint64_t temp;\ |
888 \ | |
889 asm volatile(\ | |
2979 | 890 "pxor %%mm7, %%mm7 \n\t"\ |
891 "1: \n\t"\ | |
892 "movq (%0), %%mm0 \n\t" /* ABCDEFGH */\ | |
893 "movq %%mm0, %%mm1 \n\t" /* ABCDEFGH */\ | |
894 "movq %%mm0, %%mm2 \n\t" /* ABCDEFGH */\ | |
895 "punpcklbw %%mm7, %%mm0 \n\t" /* 0A0B0C0D */\ | |
896 "punpckhbw %%mm7, %%mm1 \n\t" /* 0E0F0G0H */\ | |
897 "pshufw $0x90, %%mm0, %%mm5 \n\t" /* 0A0A0B0C */\ | |
898 "pshufw $0x41, %%mm0, %%mm6 \n\t" /* 0B0A0A0B */\ | |
899 "movq %%mm2, %%mm3 \n\t" /* ABCDEFGH */\ | |
900 "movq %%mm2, %%mm4 \n\t" /* ABCDEFGH */\ | |
901 "psllq $8, %%mm2 \n\t" /* 0ABCDEFG */\ | |
902 "psllq $16, %%mm3 \n\t" /* 00ABCDEF */\ | |
903 "psllq $24, %%mm4 \n\t" /* 000ABCDE */\ | |
904 "punpckhbw %%mm7, %%mm2 \n\t" /* 0D0E0F0G */\ | |
905 "punpckhbw %%mm7, %%mm3 \n\t" /* 0C0D0E0F */\ | |
906 "punpckhbw %%mm7, %%mm4 \n\t" /* 0B0C0D0E */\ | |
907 "paddw %%mm3, %%mm5 \n\t" /* b */\ | |
908 "paddw %%mm2, %%mm6 \n\t" /* c */\ | |
909 "paddw %%mm5, %%mm5 \n\t" /* 2b */\ | |
910 "psubw %%mm5, %%mm6 \n\t" /* c - 2b */\ | |
911 "pshufw $0x06, %%mm0, %%mm5 \n\t" /* 0C0B0A0A */\ | |
912 "pmullw "MANGLE(ff_pw_3)", %%mm6 \n\t" /* 3c - 6b */\ | |
913 "paddw %%mm4, %%mm0 \n\t" /* a */\ | |
914 "paddw %%mm1, %%mm5 \n\t" /* d */\ | |
915 "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" /* 20a */\ | |
916 "psubw %%mm5, %%mm0 \n\t" /* 20a - d */\ | |
917 "paddw %6, %%mm6 \n\t"\ | |
918 "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\ | |
919 "psraw $5, %%mm0 \n\t"\ | |
920 "movq %%mm0, %5 \n\t"\ | |
954 | 921 /* mm1=EFGH, mm2=DEFG, mm3=CDEF, mm4=BCDE, mm7=0 */\ |
922 \ | |
2979 | 923 "movq 5(%0), %%mm0 \n\t" /* FGHIJKLM */\ |
924 "movq %%mm0, %%mm5 \n\t" /* FGHIJKLM */\ | |
925 "movq %%mm0, %%mm6 \n\t" /* FGHIJKLM */\ | |
926 "psrlq $8, %%mm0 \n\t" /* GHIJKLM0 */\ | |
927 "psrlq $16, %%mm5 \n\t" /* HIJKLM00 */\ | |
928 "punpcklbw %%mm7, %%mm0 \n\t" /* 0G0H0I0J */\ | |
929 "punpcklbw %%mm7, %%mm5 \n\t" /* 0H0I0J0K */\ | |
930 "paddw %%mm0, %%mm2 \n\t" /* b */\ | |
931 "paddw %%mm5, %%mm3 \n\t" /* c */\ | |
932 "paddw %%mm2, %%mm2 \n\t" /* 2b */\ | |
933 "psubw %%mm2, %%mm3 \n\t" /* c - 2b */\ | |
934 "movq %%mm6, %%mm2 \n\t" /* FGHIJKLM */\ | |
935 "psrlq $24, %%mm6 \n\t" /* IJKLM000 */\ | |
936 "punpcklbw %%mm7, %%mm2 \n\t" /* 0F0G0H0I */\ | |
937 "punpcklbw %%mm7, %%mm6 \n\t" /* 0I0J0K0L */\ | |
938 "pmullw "MANGLE(ff_pw_3)", %%mm3 \n\t" /* 3c - 6b */\ | |
939 "paddw %%mm2, %%mm1 \n\t" /* a */\ | |
940 "paddw %%mm6, %%mm4 \n\t" /* d */\ | |
941 "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" /* 20a */\ | |
942 "psubw %%mm4, %%mm3 \n\t" /* - 6b +3c - d */\ | |
943 "paddw %6, %%mm1 \n\t"\ | |
944 "paddw %%mm1, %%mm3 \n\t" /* 20a - 6b +3c - d */\ | |
945 "psraw $5, %%mm3 \n\t"\ | |
946 "movq %5, %%mm1 \n\t"\ | |
947 "packuswb %%mm3, %%mm1 \n\t"\ | |
959 | 948 OP_MMX2(%%mm1, (%1),%%mm4, q)\ |
954 | 949 /* mm0= GHIJ, mm2=FGHI, mm5=HIJK, mm6=IJKL, mm7=0 */\ |
950 \ | |
2979 | 951 "movq 9(%0), %%mm1 \n\t" /* JKLMNOPQ */\ |
952 "movq %%mm1, %%mm4 \n\t" /* JKLMNOPQ */\ | |
953 "movq %%mm1, %%mm3 \n\t" /* JKLMNOPQ */\ | |
954 "psrlq $8, %%mm1 \n\t" /* KLMNOPQ0 */\ | |
955 "psrlq $16, %%mm4 \n\t" /* LMNOPQ00 */\ | |
956 "punpcklbw %%mm7, %%mm1 \n\t" /* 0K0L0M0N */\ | |
957 "punpcklbw %%mm7, %%mm4 \n\t" /* 0L0M0N0O */\ | |
958 "paddw %%mm1, %%mm5 \n\t" /* b */\ | |
959 "paddw %%mm4, %%mm0 \n\t" /* c */\ | |
960 "paddw %%mm5, %%mm5 \n\t" /* 2b */\ | |
961 "psubw %%mm5, %%mm0 \n\t" /* c - 2b */\ | |
962 "movq %%mm3, %%mm5 \n\t" /* JKLMNOPQ */\ | |
963 "psrlq $24, %%mm3 \n\t" /* MNOPQ000 */\ | |
964 "pmullw "MANGLE(ff_pw_3)", %%mm0 \n\t" /* 3c - 6b */\ | |
965 "punpcklbw %%mm7, %%mm3 \n\t" /* 0M0N0O0P */\ | |
966 "paddw %%mm3, %%mm2 \n\t" /* d */\ | |
967 "psubw %%mm2, %%mm0 \n\t" /* -6b + 3c - d */\ | |
968 "movq %%mm5, %%mm2 \n\t" /* JKLMNOPQ */\ | |
969 "punpcklbw %%mm7, %%mm2 \n\t" /* 0J0K0L0M */\ | |
970 "punpckhbw %%mm7, %%mm5 \n\t" /* 0N0O0P0Q */\ | |
971 "paddw %%mm2, %%mm6 \n\t" /* a */\ | |
972 "pmullw "MANGLE(ff_pw_20)", %%mm6 \n\t" /* 20a */\ | |
973 "paddw %6, %%mm0 \n\t"\ | |
974 "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\ | |
975 "psraw $5, %%mm0 \n\t"\ | |
954 | 976 /* mm1=KLMN, mm2=JKLM, mm3=MNOP, mm4=LMNO, mm5=NOPQ mm7=0 */\ |
977 \ | |
2979 | 978 "paddw %%mm5, %%mm3 \n\t" /* a */\ |
979 "pshufw $0xF9, %%mm5, %%mm6 \n\t" /* 0O0P0Q0Q */\ | |
980 "paddw %%mm4, %%mm6 \n\t" /* b */\ | |
981 "pshufw $0xBE, %%mm5, %%mm4 \n\t" /* 0P0Q0Q0P */\ | |
982 "pshufw $0x6F, %%mm5, %%mm5 \n\t" /* 0Q0Q0P0O */\ | |
983 "paddw %%mm1, %%mm4 \n\t" /* c */\ | |
984 "paddw %%mm2, %%mm5 \n\t" /* d */\ | |
985 "paddw %%mm6, %%mm6 \n\t" /* 2b */\ | |
986 "psubw %%mm6, %%mm4 \n\t" /* c - 2b */\ | |
987 "pmullw "MANGLE(ff_pw_20)", %%mm3 \n\t" /* 20a */\ | |
988 "pmullw "MANGLE(ff_pw_3)", %%mm4 \n\t" /* 3c - 6b */\ | |
989 "psubw %%mm5, %%mm3 \n\t" /* -6b + 3c - d */\ | |
990 "paddw %6, %%mm4 \n\t"\ | |
991 "paddw %%mm3, %%mm4 \n\t" /* 20a - 6b + 3c - d */\ | |
992 "psraw $5, %%mm4 \n\t"\ | |
993 "packuswb %%mm4, %%mm0 \n\t"\ | |
959 | 994 OP_MMX2(%%mm0, 8(%1), %%mm4, q)\ |
954 | 995 \ |
2979 | 996 "add %3, %0 \n\t"\ |
997 "add %4, %1 \n\t"\ | |
998 "decl %2 \n\t"\ | |
999 " jnz 1b \n\t"\ | |
6513
713c4fd84e0b
Hardcode register to prevent aparent miscompilation.
michael
parents:
6512
diff
changeset
|
1000 : "+a"(src), "+c"(dst), "+D"(h)\ |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
1001 : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(temp), "m"(ROUNDER)\ |
966 | 1002 : "memory"\ |
954 | 1003 );\ |
1004 }\ | |
1005 \ | |
1006 static void OPNAME ## mpeg4_qpel16_h_lowpass_3dnow(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ | |
1007 int i;\ | |
1008 int16_t temp[16];\ | |
1009 /* quick HACK, XXX FIXME MUST be optimized */\ | |
1010 for(i=0; i<h; i++)\ | |
1011 {\ | |
1012 temp[ 0]= (src[ 0]+src[ 1])*20 - (src[ 0]+src[ 2])*6 + (src[ 1]+src[ 3])*3 - (src[ 2]+src[ 4]);\ | |
1013 temp[ 1]= (src[ 1]+src[ 2])*20 - (src[ 0]+src[ 3])*6 + (src[ 0]+src[ 4])*3 - (src[ 1]+src[ 5]);\ | |
1014 temp[ 2]= (src[ 2]+src[ 3])*20 - (src[ 1]+src[ 4])*6 + (src[ 0]+src[ 5])*3 - (src[ 0]+src[ 6]);\ | |
1015 temp[ 3]= (src[ 3]+src[ 4])*20 - (src[ 2]+src[ 5])*6 + (src[ 1]+src[ 6])*3 - (src[ 0]+src[ 7]);\ | |
1016 temp[ 4]= (src[ 4]+src[ 5])*20 - (src[ 3]+src[ 6])*6 + (src[ 2]+src[ 7])*3 - (src[ 1]+src[ 8]);\ | |
1017 temp[ 5]= (src[ 5]+src[ 6])*20 - (src[ 4]+src[ 7])*6 + (src[ 3]+src[ 8])*3 - (src[ 2]+src[ 9]);\ | |
1018 temp[ 6]= (src[ 6]+src[ 7])*20 - (src[ 5]+src[ 8])*6 + (src[ 4]+src[ 9])*3 - (src[ 3]+src[10]);\ | |
1019 temp[ 7]= (src[ 7]+src[ 8])*20 - (src[ 6]+src[ 9])*6 + (src[ 5]+src[10])*3 - (src[ 4]+src[11]);\ | |
1020 temp[ 8]= (src[ 8]+src[ 9])*20 - (src[ 7]+src[10])*6 + (src[ 6]+src[11])*3 - (src[ 5]+src[12]);\ | |
1021 temp[ 9]= (src[ 9]+src[10])*20 - (src[ 8]+src[11])*6 + (src[ 7]+src[12])*3 - (src[ 6]+src[13]);\ | |
1022 temp[10]= (src[10]+src[11])*20 - (src[ 9]+src[12])*6 + (src[ 8]+src[13])*3 - (src[ 7]+src[14]);\ | |
1023 temp[11]= (src[11]+src[12])*20 - (src[10]+src[13])*6 + (src[ 9]+src[14])*3 - (src[ 8]+src[15]);\ | |
1024 temp[12]= (src[12]+src[13])*20 - (src[11]+src[14])*6 + (src[10]+src[15])*3 - (src[ 9]+src[16]);\ | |
1025 temp[13]= (src[13]+src[14])*20 - (src[12]+src[15])*6 + (src[11]+src[16])*3 - (src[10]+src[16]);\ | |
1026 temp[14]= (src[14]+src[15])*20 - (src[13]+src[16])*6 + (src[12]+src[16])*3 - (src[11]+src[15]);\ | |
1027 temp[15]= (src[15]+src[16])*20 - (src[14]+src[16])*6 + (src[13]+src[15])*3 - (src[12]+src[14]);\ | |
1028 asm volatile(\ | |
2979 | 1029 "movq (%0), %%mm0 \n\t"\ |
1030 "movq 8(%0), %%mm1 \n\t"\ | |
1031 "paddw %2, %%mm0 \n\t"\ | |
1032 "paddw %2, %%mm1 \n\t"\ | |
1033 "psraw $5, %%mm0 \n\t"\ | |
1034 "psraw $5, %%mm1 \n\t"\ | |
1035 "packuswb %%mm1, %%mm0 \n\t"\ | |
959 | 1036 OP_3DNOW(%%mm0, (%1), %%mm1, q)\ |
2979 | 1037 "movq 16(%0), %%mm0 \n\t"\ |
1038 "movq 24(%0), %%mm1 \n\t"\ | |
1039 "paddw %2, %%mm0 \n\t"\ | |
1040 "paddw %2, %%mm1 \n\t"\ | |
1041 "psraw $5, %%mm0 \n\t"\ | |
1042 "psraw $5, %%mm1 \n\t"\ | |
1043 "packuswb %%mm1, %%mm0 \n\t"\ | |
959 | 1044 OP_3DNOW(%%mm0, 8(%1), %%mm1, q)\ |
954 | 1045 :: "r"(temp), "r"(dst), "m"(ROUNDER)\ |
966 | 1046 : "memory"\ |
954 | 1047 );\ |
1048 dst+=dstStride;\ | |
1049 src+=srcStride;\ | |
1050 }\ | |
1051 }\ | |
1052 \ | |
1057 | 1053 static void OPNAME ## mpeg4_qpel8_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ |
959 | 1054 asm volatile(\ |
2979 | 1055 "pxor %%mm7, %%mm7 \n\t"\ |
1056 "1: \n\t"\ | |
1057 "movq (%0), %%mm0 \n\t" /* ABCDEFGH */\ | |
1058 "movq %%mm0, %%mm1 \n\t" /* ABCDEFGH */\ | |
1059 "movq %%mm0, %%mm2 \n\t" /* ABCDEFGH */\ | |
1060 "punpcklbw %%mm7, %%mm0 \n\t" /* 0A0B0C0D */\ | |
1061 "punpckhbw %%mm7, %%mm1 \n\t" /* 0E0F0G0H */\ | |
1062 "pshufw $0x90, %%mm0, %%mm5 \n\t" /* 0A0A0B0C */\ | |
1063 "pshufw $0x41, %%mm0, %%mm6 \n\t" /* 0B0A0A0B */\ | |
1064 "movq %%mm2, %%mm3 \n\t" /* ABCDEFGH */\ | |
1065 "movq %%mm2, %%mm4 \n\t" /* ABCDEFGH */\ | |
1066 "psllq $8, %%mm2 \n\t" /* 0ABCDEFG */\ | |
1067 "psllq $16, %%mm3 \n\t" /* 00ABCDEF */\ | |
1068 "psllq $24, %%mm4 \n\t" /* 000ABCDE */\ | |
1069 "punpckhbw %%mm7, %%mm2 \n\t" /* 0D0E0F0G */\ | |
1070 "punpckhbw %%mm7, %%mm3 \n\t" /* 0C0D0E0F */\ | |
1071 "punpckhbw %%mm7, %%mm4 \n\t" /* 0B0C0D0E */\ | |
1072 "paddw %%mm3, %%mm5 \n\t" /* b */\ | |
1073 "paddw %%mm2, %%mm6 \n\t" /* c */\ | |
1074 "paddw %%mm5, %%mm5 \n\t" /* 2b */\ | |
1075 "psubw %%mm5, %%mm6 \n\t" /* c - 2b */\ | |
1076 "pshufw $0x06, %%mm0, %%mm5 \n\t" /* 0C0B0A0A */\ | |
1077 "pmullw "MANGLE(ff_pw_3)", %%mm6 \n\t" /* 3c - 6b */\ | |
1078 "paddw %%mm4, %%mm0 \n\t" /* a */\ | |
1079 "paddw %%mm1, %%mm5 \n\t" /* d */\ | |
1080 "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" /* 20a */\ | |
1081 "psubw %%mm5, %%mm0 \n\t" /* 20a - d */\ | |
6512 | 1082 "paddw %5, %%mm6 \n\t"\ |
2979 | 1083 "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\ |
1084 "psraw $5, %%mm0 \n\t"\ | |
959 | 1085 /* mm1=EFGH, mm2=DEFG, mm3=CDEF, mm4=BCDE, mm7=0 */\ |
1086 \ | |
2979 | 1087 "movd 5(%0), %%mm5 \n\t" /* FGHI */\ |
1088 "punpcklbw %%mm7, %%mm5 \n\t" /* 0F0G0H0I */\ | |
1089 "pshufw $0xF9, %%mm5, %%mm6 \n\t" /* 0G0H0I0I */\ | |
1090 "paddw %%mm5, %%mm1 \n\t" /* a */\ | |
1091 "paddw %%mm6, %%mm2 \n\t" /* b */\ | |
1092 "pshufw $0xBE, %%mm5, %%mm6 \n\t" /* 0H0I0I0H */\ | |
1093 "pshufw $0x6F, %%mm5, %%mm5 \n\t" /* 0I0I0H0G */\ | |
1094 "paddw %%mm6, %%mm3 \n\t" /* c */\ | |
1095 "paddw %%mm5, %%mm4 \n\t" /* d */\ | |
1096 "paddw %%mm2, %%mm2 \n\t" /* 2b */\ | |
1097 "psubw %%mm2, %%mm3 \n\t" /* c - 2b */\ | |
1098 "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" /* 20a */\ | |
1099 "pmullw "MANGLE(ff_pw_3)", %%mm3 \n\t" /* 3c - 6b */\ | |
1100 "psubw %%mm4, %%mm3 \n\t" /* -6b + 3c - d */\ | |
6512 | 1101 "paddw %5, %%mm1 \n\t"\ |
2979 | 1102 "paddw %%mm1, %%mm3 \n\t" /* 20a - 6b + 3c - d */\ |
1103 "psraw $5, %%mm3 \n\t"\ | |
1104 "packuswb %%mm3, %%mm0 \n\t"\ | |
959 | 1105 OP_MMX2(%%mm0, (%1), %%mm4, q)\ |
1106 \ | |
2979 | 1107 "add %3, %0 \n\t"\ |
1108 "add %4, %1 \n\t"\ | |
1109 "decl %2 \n\t"\ | |
1110 " jnz 1b \n\t"\ | |
6513
713c4fd84e0b
Hardcode register to prevent aparent miscompilation.
michael
parents:
6512
diff
changeset
|
1111 : "+a"(src), "+c"(dst), "+d"(h)\ |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
1112 : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER)\ |
966 | 1113 : "memory"\ |
959 | 1114 );\ |
1115 }\ | |
1116 \ | |
1117 static void OPNAME ## mpeg4_qpel8_h_lowpass_3dnow(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ | |
1118 int i;\ | |
1119 int16_t temp[8];\ | |
1120 /* quick HACK, XXX FIXME MUST be optimized */\ | |
1121 for(i=0; i<h; i++)\ | |
1122 {\ | |
1123 temp[ 0]= (src[ 0]+src[ 1])*20 - (src[ 0]+src[ 2])*6 + (src[ 1]+src[ 3])*3 - (src[ 2]+src[ 4]);\ | |
1124 temp[ 1]= (src[ 1]+src[ 2])*20 - (src[ 0]+src[ 3])*6 + (src[ 0]+src[ 4])*3 - (src[ 1]+src[ 5]);\ | |
1125 temp[ 2]= (src[ 2]+src[ 3])*20 - (src[ 1]+src[ 4])*6 + (src[ 0]+src[ 5])*3 - (src[ 0]+src[ 6]);\ | |
1126 temp[ 3]= (src[ 3]+src[ 4])*20 - (src[ 2]+src[ 5])*6 + (src[ 1]+src[ 6])*3 - (src[ 0]+src[ 7]);\ | |
1127 temp[ 4]= (src[ 4]+src[ 5])*20 - (src[ 3]+src[ 6])*6 + (src[ 2]+src[ 7])*3 - (src[ 1]+src[ 8]);\ | |
1128 temp[ 5]= (src[ 5]+src[ 6])*20 - (src[ 4]+src[ 7])*6 + (src[ 3]+src[ 8])*3 - (src[ 2]+src[ 8]);\ | |
1129 temp[ 6]= (src[ 6]+src[ 7])*20 - (src[ 5]+src[ 8])*6 + (src[ 4]+src[ 8])*3 - (src[ 3]+src[ 7]);\ | |
1130 temp[ 7]= (src[ 7]+src[ 8])*20 - (src[ 6]+src[ 8])*6 + (src[ 5]+src[ 7])*3 - (src[ 4]+src[ 6]);\ | |
1131 asm volatile(\ | |
2979 | 1132 "movq (%0), %%mm0 \n\t"\ |
1133 "movq 8(%0), %%mm1 \n\t"\ | |
1134 "paddw %2, %%mm0 \n\t"\ | |
1135 "paddw %2, %%mm1 \n\t"\ | |
1136 "psraw $5, %%mm0 \n\t"\ | |
1137 "psraw $5, %%mm1 \n\t"\ | |
1138 "packuswb %%mm1, %%mm0 \n\t"\ | |
959 | 1139 OP_3DNOW(%%mm0, (%1), %%mm1, q)\ |
1140 :: "r"(temp), "r"(dst), "m"(ROUNDER)\ | |
966 | 1141 :"memory"\ |
959 | 1142 );\ |
1143 dst+=dstStride;\ | |
1144 src+=srcStride;\ | |
1145 }\ | |
1146 } | |
1147 | |
1148 #define QPEL_OP(OPNAME, ROUNDER, RND, OP, MMX)\ | |
1149 \ | |
1150 static void OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ | |
954 | 1151 uint64_t temp[17*4];\ |
1152 uint64_t *temp_ptr= temp;\ | |
1153 int count= 17;\ | |
1154 \ | |
1155 /*FIXME unroll */\ | |
1156 asm volatile(\ | |
2979 | 1157 "pxor %%mm7, %%mm7 \n\t"\ |
1158 "1: \n\t"\ | |
1159 "movq (%0), %%mm0 \n\t"\ | |
1160 "movq (%0), %%mm1 \n\t"\ | |
1161 "movq 8(%0), %%mm2 \n\t"\ | |
1162 "movq 8(%0), %%mm3 \n\t"\ | |
1163 "punpcklbw %%mm7, %%mm0 \n\t"\ | |
1164 "punpckhbw %%mm7, %%mm1 \n\t"\ | |
1165 "punpcklbw %%mm7, %%mm2 \n\t"\ | |
1166 "punpckhbw %%mm7, %%mm3 \n\t"\ | |
1167 "movq %%mm0, (%1) \n\t"\ | |
1168 "movq %%mm1, 17*8(%1) \n\t"\ | |
1169 "movq %%mm2, 2*17*8(%1) \n\t"\ | |
1170 "movq %%mm3, 3*17*8(%1) \n\t"\ | |
1171 "add $8, %1 \n\t"\ | |
1172 "add %3, %0 \n\t"\ | |
1173 "decl %2 \n\t"\ | |
1174 " jnz 1b \n\t"\ | |
954 | 1175 : "+r" (src), "+r" (temp_ptr), "+r"(count)\ |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
1176 : "r" ((x86_reg)srcStride)\ |
966 | 1177 : "memory"\ |
954 | 1178 );\ |
1179 \ | |
1180 temp_ptr= temp;\ | |
1181 count=4;\ | |
1182 \ | |
1183 /*FIXME reorder for speed */\ | |
1184 asm volatile(\ | |
2979 | 1185 /*"pxor %%mm7, %%mm7 \n\t"*/\ |
1186 "1: \n\t"\ | |
1187 "movq (%0), %%mm0 \n\t"\ | |
1188 "movq 8(%0), %%mm1 \n\t"\ | |
1189 "movq 16(%0), %%mm2 \n\t"\ | |
1190 "movq 24(%0), %%mm3 \n\t"\ | |
961 | 1191 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 16(%0), 8(%0), (%0), 32(%0), (%1), OP)\ |
1192 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 8(%0), (%0), (%0), 40(%0), (%1, %3), OP)\ | |
2979 | 1193 "add %4, %1 \n\t"\ |
961 | 1194 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, (%0), (%0), 8(%0), 48(%0), (%1), OP)\ |
954 | 1195 \ |
961 | 1196 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, (%0), 8(%0), 16(%0), 56(%0), (%1, %3), OP)\ |
2979 | 1197 "add %4, %1 \n\t"\ |
961 | 1198 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 8(%0), 16(%0), 24(%0), 64(%0), (%1), OP)\ |
1199 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 72(%0), (%1, %3), OP)\ | |
2979 | 1200 "add %4, %1 \n\t"\ |
961 | 1201 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 24(%0), 32(%0), 40(%0), 80(%0), (%1), OP)\ |
1202 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 88(%0), (%1, %3), OP)\ | |
2979 | 1203 "add %4, %1 \n\t"\ |
961 | 1204 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 40(%0), 48(%0), 56(%0), 96(%0), (%1), OP)\ |
1205 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 48(%0), 56(%0), 64(%0),104(%0), (%1, %3), OP)\ | |
2979 | 1206 "add %4, %1 \n\t"\ |
961 | 1207 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 56(%0), 64(%0), 72(%0),112(%0), (%1), OP)\ |
1208 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 64(%0), 72(%0), 80(%0),120(%0), (%1, %3), OP)\ | |
2979 | 1209 "add %4, %1 \n\t"\ |
961 | 1210 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 72(%0), 80(%0), 88(%0),128(%0), (%1), OP)\ |
954 | 1211 \ |
961 | 1212 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 80(%0), 88(%0), 96(%0),128(%0), (%1, %3), OP)\ |
2979 | 1213 "add %4, %1 \n\t" \ |
961 | 1214 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 88(%0), 96(%0),104(%0),120(%0), (%1), OP)\ |
1215 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 96(%0),104(%0),112(%0),112(%0), (%1, %3), OP)\ | |
954 | 1216 \ |
2979 | 1217 "add $136, %0 \n\t"\ |
1218 "add %6, %1 \n\t"\ | |
1219 "decl %2 \n\t"\ | |
1220 " 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
|
1221 \ |
967 | 1222 : "+r"(temp_ptr), "+r"(dst), "+g"(count)\ |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
1223 : "r"((x86_reg)dstStride), "r"(2*(x86_reg)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER), "g"(4-14*(x86_reg)dstStride)\ |
966 | 1224 :"memory"\ |
954 | 1225 );\ |
1226 }\ | |
1227 \ | |
1057 | 1228 static void OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ |
2209 | 1229 uint64_t temp[9*2];\ |
954 | 1230 uint64_t *temp_ptr= temp;\ |
1231 int count= 9;\ | |
1232 \ | |
1233 /*FIXME unroll */\ | |
1234 asm volatile(\ | |
2979 | 1235 "pxor %%mm7, %%mm7 \n\t"\ |
1236 "1: \n\t"\ | |
1237 "movq (%0), %%mm0 \n\t"\ | |
1238 "movq (%0), %%mm1 \n\t"\ | |
1239 "punpcklbw %%mm7, %%mm0 \n\t"\ | |
1240 "punpckhbw %%mm7, %%mm1 \n\t"\ | |
1241 "movq %%mm0, (%1) \n\t"\ | |
1242 "movq %%mm1, 9*8(%1) \n\t"\ | |
1243 "add $8, %1 \n\t"\ | |
1244 "add %3, %0 \n\t"\ | |
1245 "decl %2 \n\t"\ | |
1246 " jnz 1b \n\t"\ | |
954 | 1247 : "+r" (src), "+r" (temp_ptr), "+r"(count)\ |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
1248 : "r" ((x86_reg)srcStride)\ |
966 | 1249 : "memory"\ |
954 | 1250 );\ |
1251 \ | |
1252 temp_ptr= temp;\ | |
1253 count=2;\ | |
1254 \ | |
1255 /*FIXME reorder for speed */\ | |
1256 asm volatile(\ | |
2979 | 1257 /*"pxor %%mm7, %%mm7 \n\t"*/\ |
1258 "1: \n\t"\ | |
1259 "movq (%0), %%mm0 \n\t"\ | |
1260 "movq 8(%0), %%mm1 \n\t"\ | |
1261 "movq 16(%0), %%mm2 \n\t"\ | |
1262 "movq 24(%0), %%mm3 \n\t"\ | |
961 | 1263 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 16(%0), 8(%0), (%0), 32(%0), (%1), OP)\ |
1264 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 8(%0), (%0), (%0), 40(%0), (%1, %3), OP)\ | |
2979 | 1265 "add %4, %1 \n\t"\ |
961 | 1266 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, (%0), (%0), 8(%0), 48(%0), (%1), OP)\ |
954 | 1267 \ |
961 | 1268 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, (%0), 8(%0), 16(%0), 56(%0), (%1, %3), OP)\ |
2979 | 1269 "add %4, %1 \n\t"\ |
961 | 1270 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 8(%0), 16(%0), 24(%0), 64(%0), (%1), OP)\ |
954 | 1271 \ |
961 | 1272 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 64(%0), (%1, %3), OP)\ |
2979 | 1273 "add %4, %1 \n\t"\ |
961 | 1274 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 24(%0), 32(%0), 40(%0), 56(%0), (%1), OP)\ |
1275 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 48(%0), (%1, %3), OP)\ | |
954 | 1276 \ |
2979 | 1277 "add $72, %0 \n\t"\ |
1278 "add %6, %1 \n\t"\ | |
1279 "decl %2 \n\t"\ | |
1280 " jnz 1b \n\t"\ | |
954 | 1281 \ |
961 | 1282 : "+r"(temp_ptr), "+r"(dst), "+g"(count)\ |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
1283 : "r"((x86_reg)dstStride), "r"(2*(x86_reg)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER), "g"(4-6*(x86_reg)dstStride)\ |
966 | 1284 : "memory"\ |
1285 );\ | |
959 | 1286 }\ |
954 | 1287 \ |
1064 | 1288 static void OPNAME ## qpel8_mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\ |
6321 | 1289 OPNAME ## pixels8_ ## MMX(dst, src, stride, 8);\ |
954 | 1290 }\ |
1291 \ | |
1064 | 1292 static void OPNAME ## qpel8_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1293 uint64_t temp[8];\ |
954 | 1294 uint8_t * const half= (uint8_t*)temp;\ |
1295 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
|
1296 OPNAME ## pixels8_l2_ ## MMX(dst, src, half, stride, stride, 8);\ |
954 | 1297 }\ |
1298 \ | |
1064 | 1299 static void OPNAME ## qpel8_mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1300 OPNAME ## mpeg4_qpel8_h_lowpass_ ## MMX(dst, src, stride, stride, 8);\ |
1301 }\ | |
1302 \ | |
1064 | 1303 static void OPNAME ## qpel8_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1304 uint64_t temp[8];\ |
954 | 1305 uint8_t * const half= (uint8_t*)temp;\ |
1306 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
|
1307 OPNAME ## pixels8_l2_ ## MMX(dst, src+1, half, stride, stride, 8);\ |
954 | 1308 }\ |
1309 \ | |
1064 | 1310 static void OPNAME ## qpel8_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1311 uint64_t temp[8];\ |
954 | 1312 uint8_t * const half= (uint8_t*)temp;\ |
959 | 1313 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
|
1314 OPNAME ## pixels8_l2_ ## MMX(dst, src, half, stride, stride, 8);\ |
954 | 1315 }\ |
1316 \ | |
1064 | 1317 static void OPNAME ## qpel8_mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
959 | 1318 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, src, stride, stride);\ |
954 | 1319 }\ |
1320 \ | |
1064 | 1321 static void OPNAME ## qpel8_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1322 uint64_t temp[8];\ |
954 | 1323 uint8_t * const half= (uint8_t*)temp;\ |
959 | 1324 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
|
1325 OPNAME ## pixels8_l2_ ## MMX(dst, src+stride, half, stride, stride, 8);\ |
954 | 1326 }\ |
1064 | 1327 static void OPNAME ## qpel8_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1328 uint64_t half[8 + 9];\ |
1329 uint8_t * const halfH= ((uint8_t*)half) + 64;\ | |
1330 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 1331 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
|
1332 put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\ |
959 | 1333 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
|
1334 OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\ |
954 | 1335 }\ |
1064 | 1336 static void OPNAME ## qpel8_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1337 uint64_t half[8 + 9];\ |
1338 uint8_t * const halfH= ((uint8_t*)half) + 64;\ | |
1339 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 1340 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
|
1341 put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\ |
959 | 1342 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
|
1343 OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\ |
954 | 1344 }\ |
1064 | 1345 static void OPNAME ## qpel8_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1346 uint64_t half[8 + 9];\ |
1347 uint8_t * const halfH= ((uint8_t*)half) + 64;\ | |
1348 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 1349 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
|
1350 put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\ |
959 | 1351 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
|
1352 OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\ |
954 | 1353 }\ |
1064 | 1354 static void OPNAME ## qpel8_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1355 uint64_t half[8 + 9];\ |
1356 uint8_t * const halfH= ((uint8_t*)half) + 64;\ | |
1357 uint8_t * const halfHV= ((uint8_t*)half);\ | |
1358 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
|
1359 put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\ |
959 | 1360 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
|
1361 OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\ |
954 | 1362 }\ |
1064 | 1363 static void OPNAME ## qpel8_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1364 uint64_t half[8 + 9];\ |
954 | 1365 uint8_t * const halfH= ((uint8_t*)half) + 64;\ |
1366 uint8_t * const halfHV= ((uint8_t*)half);\ | |
1367 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ | |
959 | 1368 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
|
1369 OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\ |
954 | 1370 }\ |
1064 | 1371 static void OPNAME ## qpel8_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1372 uint64_t half[8 + 9];\ |
954 | 1373 uint8_t * const halfH= ((uint8_t*)half) + 64;\ |
1374 uint8_t * const halfHV= ((uint8_t*)half);\ | |
1375 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ | |
959 | 1376 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
|
1377 OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\ |
954 | 1378 }\ |
1064 | 1379 static void OPNAME ## qpel8_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1380 uint64_t half[8 + 9];\ |
1381 uint8_t * const halfH= ((uint8_t*)half);\ | |
954 | 1382 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
|
1383 put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\ |
984 | 1384 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\ |
954 | 1385 }\ |
1064 | 1386 static void OPNAME ## qpel8_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1387 uint64_t half[8 + 9];\ |
1388 uint8_t * const halfH= ((uint8_t*)half);\ | |
954 | 1389 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
|
1390 put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\ |
984 | 1391 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\ |
954 | 1392 }\ |
1064 | 1393 static void OPNAME ## qpel8_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1394 uint64_t half[9];\ |
954 | 1395 uint8_t * const halfH= ((uint8_t*)half);\ |
1396 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ | |
959 | 1397 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\ |
954 | 1398 }\ |
1064 | 1399 static void OPNAME ## qpel16_mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\ |
6321 | 1400 OPNAME ## pixels16_ ## MMX(dst, src, stride, 16);\ |
954 | 1401 }\ |
1402 \ | |
1064 | 1403 static void OPNAME ## qpel16_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1404 uint64_t temp[32];\ |
1405 uint8_t * const half= (uint8_t*)temp;\ | |
1406 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
|
1407 OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, stride, 16);\ |
954 | 1408 }\ |
1409 \ | |
1064 | 1410 static void OPNAME ## qpel16_mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1411 OPNAME ## mpeg4_qpel16_h_lowpass_ ## MMX(dst, src, stride, stride, 16);\ |
1412 }\ | |
1413 \ | |
1064 | 1414 static void OPNAME ## qpel16_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1415 uint64_t temp[32];\ |
1416 uint8_t * const half= (uint8_t*)temp;\ | |
1417 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
|
1418 OPNAME ## pixels16_l2_ ## MMX(dst, src+1, half, stride, stride, 16);\ |
954 | 1419 }\ |
1420 \ | |
1064 | 1421 static void OPNAME ## qpel16_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1422 uint64_t temp[32];\ |
1423 uint8_t * const half= (uint8_t*)temp;\ | |
959 | 1424 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
|
1425 OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, stride, 16);\ |
954 | 1426 }\ |
1427 \ | |
1064 | 1428 static void OPNAME ## qpel16_mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
959 | 1429 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, src, stride, stride);\ |
954 | 1430 }\ |
1431 \ | |
1064 | 1432 static void OPNAME ## qpel16_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1433 uint64_t temp[32];\ |
1434 uint8_t * const half= (uint8_t*)temp;\ | |
959 | 1435 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
|
1436 OPNAME ## pixels16_l2_ ## MMX(dst, src+stride, half, stride, stride, 16);\ |
954 | 1437 }\ |
1064 | 1438 static void OPNAME ## qpel16_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1439 uint64_t half[16*2 + 17*2];\ |
1440 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
1441 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 1442 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
|
1443 put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\ |
959 | 1444 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
|
1445 OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\ |
954 | 1446 }\ |
1064 | 1447 static void OPNAME ## qpel16_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1448 uint64_t half[16*2 + 17*2];\ |
1449 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
1450 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 1451 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
|
1452 put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\ |
959 | 1453 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
|
1454 OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\ |
954 | 1455 }\ |
1064 | 1456 static void OPNAME ## qpel16_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1457 uint64_t half[16*2 + 17*2];\ |
1458 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
1459 uint8_t * const halfHV= ((uint8_t*)half);\ | |
954 | 1460 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
|
1461 put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\ |
959 | 1462 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
|
1463 OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\ |
954 | 1464 }\ |
1064 | 1465 static void OPNAME ## qpel16_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1466 uint64_t half[16*2 + 17*2];\ |
1467 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
1468 uint8_t * const halfHV= ((uint8_t*)half);\ | |
1469 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
|
1470 put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\ |
959 | 1471 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
|
1472 OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\ |
954 | 1473 }\ |
1064 | 1474 static void OPNAME ## qpel16_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1475 uint64_t half[16*2 + 17*2];\ |
1476 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
1477 uint8_t * const halfHV= ((uint8_t*)half);\ | |
1478 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ | |
959 | 1479 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
|
1480 OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\ |
954 | 1481 }\ |
1064 | 1482 static void OPNAME ## qpel16_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1483 uint64_t half[16*2 + 17*2];\ |
1484 uint8_t * const halfH= ((uint8_t*)half) + 256;\ | |
1485 uint8_t * const halfHV= ((uint8_t*)half);\ | |
1486 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ | |
959 | 1487 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
|
1488 OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\ |
954 | 1489 }\ |
1064 | 1490 static void OPNAME ## qpel16_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1491 uint64_t half[17*2];\ |
1492 uint8_t * const halfH= ((uint8_t*)half);\ | |
954 | 1493 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
|
1494 put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\ |
984 | 1495 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\ |
954 | 1496 }\ |
1064 | 1497 static void OPNAME ## qpel16_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
984 | 1498 uint64_t half[17*2];\ |
1499 uint8_t * const halfH= ((uint8_t*)half);\ | |
954 | 1500 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
|
1501 put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\ |
984 | 1502 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\ |
954 | 1503 }\ |
1064 | 1504 static void OPNAME ## qpel16_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ |
954 | 1505 uint64_t half[17*2];\ |
1506 uint8_t * const halfH= ((uint8_t*)half);\ | |
1507 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ | |
959 | 1508 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\ |
954 | 1509 } |
1510 | |
2979 | 1511 #define PUT_OP(a,b,temp, size) "mov" #size " " #a ", " #b " \n\t" |
959 | 1512 #define AVG_3DNOW_OP(a,b,temp, size) \ |
2979 | 1513 "mov" #size " " #b ", " #temp " \n\t"\ |
1514 "pavgusb " #temp ", " #a " \n\t"\ | |
1515 "mov" #size " " #a ", " #b " \n\t" | |
959 | 1516 #define AVG_MMX2_OP(a,b,temp, size) \ |
2979 | 1517 "mov" #size " " #b ", " #temp " \n\t"\ |
1518 "pavgb " #temp ", " #a " \n\t"\ | |
1519 "mov" #size " " #a ", " #b " \n\t" | |
959 | 1520 |
1521 QPEL_BASE(put_ , ff_pw_16, _ , PUT_OP, PUT_OP) | |
1522 QPEL_BASE(avg_ , ff_pw_16, _ , AVG_MMX2_OP, AVG_3DNOW_OP) | |
1523 QPEL_BASE(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, PUT_OP) | |
1524 QPEL_OP(put_ , ff_pw_16, _ , PUT_OP, 3dnow) | |
1525 QPEL_OP(avg_ , ff_pw_16, _ , AVG_3DNOW_OP, 3dnow) | |
1526 QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, 3dnow) | |
954 | 1527 QPEL_OP(put_ , ff_pw_16, _ , PUT_OP, mmx2) |
959 | 1528 QPEL_OP(avg_ , ff_pw_16, _ , AVG_MMX2_OP, mmx2) |
954 | 1529 QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, mmx2) |
1530 | |
3807
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3777
diff
changeset
|
1531 /***********************************/ |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3777
diff
changeset
|
1532 /* 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
|
1533 |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3777
diff
changeset
|
1534 #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
|
1535 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
|
1536 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
|
1537 } |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3777
diff
changeset
|
1538 #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
|
1539 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
|
1540 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
|
1541 } |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3777
diff
changeset
|
1542 |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3777
diff
changeset
|
1543 #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
|
1544 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
|
1545 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
|
1546 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
|
1547 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
|
1548 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
|
1549 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
|
1550 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
|
1551 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
|
1552 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
|
1553 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
|
1554 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
|
1555 }\ |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3777
diff
changeset
|
1556 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
|
1557 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
|
1558 }\ |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3777
diff
changeset
|
1559 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
|
1560 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
|
1561 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
|
1562 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
|
1563 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
|
1564 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
|
1565 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
|
1566 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
|
1567 |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3777
diff
changeset
|
1568 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
|
1569 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
|
1570 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
|
1571 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
|
1572 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
|
1573 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
|
1574 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
|
1575 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
|
1576 |
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3777
diff
changeset
|
1577 |
393 | 1578 #if 0 |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1579 static void just_return() { return; } |
393 | 1580 #endif |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
1581 |
3248
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1582 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
|
1583 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
|
1584 const int w = 8; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1585 const int ix = ox>>(16+shift); |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1586 const int iy = oy>>(16+shift); |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1587 const int oxs = ox>>4; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1588 const int oys = oy>>4; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1589 const int dxxs = dxx>>4; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1590 const int dxys = dxy>>4; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1591 const int dyxs = dyx>>4; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1592 const int dyys = dyy>>4; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1593 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
|
1594 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
|
1595 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
|
1596 const uint64_t shift2 = 2*shift; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1597 uint8_t edge_buf[(h+1)*stride]; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1598 int x, y; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1599 |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1600 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
|
1601 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
|
1602 const int dxh = dxy*(h-1); |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1603 const int dyw = dyx*(w-1); |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1604 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
|
1605 ((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
|
1606 (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
|
1607 // 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
|
1608 || (dxx|dxy|dyx|dyy)&15 ) |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1609 { |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1610 //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
|
1611 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
|
1612 return; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1613 } |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1614 |
3250 | 1615 src += ix + iy*stride; |
3248
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1616 if( (unsigned)ix >= width-w || |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1617 (unsigned)iy >= height-h ) |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1618 { |
3250 | 1619 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
|
1620 src = edge_buf; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1621 } |
3250 | 1622 |
1623 asm volatile( | |
1624 "movd %0, %%mm6 \n\t" | |
1625 "pxor %%mm7, %%mm7 \n\t" | |
1626 "punpcklwd %%mm6, %%mm6 \n\t" | |
1627 "punpcklwd %%mm6, %%mm6 \n\t" | |
1628 :: "r"(1<<shift) | |
1629 ); | |
3248
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1630 |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1631 for(x=0; x<w; x+=4){ |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1632 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
|
1633 oxs - dxys + dxxs*(x+1), |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1634 oxs - dxys + dxxs*(x+2), |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1635 oxs - dxys + dxxs*(x+3) }; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1636 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
|
1637 oys - dyys + dyxs*(x+1), |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1638 oys - dyys + dyxs*(x+2), |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1639 oys - dyys + dyxs*(x+3) }; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1640 |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1641 for(y=0; y<h; y++){ |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1642 asm volatile( |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1643 "movq %0, %%mm4 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1644 "movq %1, %%mm5 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1645 "paddw %2, %%mm4 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1646 "paddw %3, %%mm5 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1647 "movq %%mm4, %0 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1648 "movq %%mm5, %1 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1649 "psrlw $12, %%mm4 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1650 "psrlw $12, %%mm5 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1651 : "+m"(*dx4), "+m"(*dy4) |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1652 : "m"(*dxy4), "m"(*dyy4) |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1653 ); |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1654 |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1655 asm volatile( |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1656 "movq %%mm6, %%mm2 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1657 "movq %%mm6, %%mm1 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1658 "psubw %%mm4, %%mm2 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1659 "psubw %%mm5, %%mm1 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1660 "movq %%mm2, %%mm0 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1661 "movq %%mm4, %%mm3 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1662 "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
|
1663 "pmullw %%mm5, %%mm3 \n\t" // dx*dy |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1664 "pmullw %%mm5, %%mm2 \n\t" // (s-dx)*dy |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1665 "pmullw %%mm4, %%mm1 \n\t" // dx*(s-dy) |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1666 |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1667 "movd %4, %%mm5 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1668 "movd %3, %%mm4 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1669 "punpcklbw %%mm7, %%mm5 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1670 "punpcklbw %%mm7, %%mm4 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1671 "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
|
1672 "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
|
1673 |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1674 "movd %2, %%mm5 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1675 "movd %1, %%mm4 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1676 "punpcklbw %%mm7, %%mm5 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1677 "punpcklbw %%mm7, %%mm4 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1678 "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
|
1679 "pmullw %%mm4, %%mm0 \n\t" // src[0,0] * (s-dx)*(s-dy) |
3250 | 1680 "paddw %5, %%mm1 \n\t" |
3248
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1681 "paddw %%mm3, %%mm2 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1682 "paddw %%mm1, %%mm0 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1683 "paddw %%mm2, %%mm0 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1684 |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1685 "psrlw %6, %%mm0 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1686 "packuswb %%mm0, %%mm0 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1687 "movd %%mm0, %0 \n\t" |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1688 |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1689 : "=m"(dst[x+y*stride]) |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1690 : "m"(src[0]), "m"(src[1]), |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1691 "m"(src[stride]), "m"(src[stride+1]), |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1692 "m"(*r4), "m"(shift2) |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1693 ); |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1694 src += stride; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1695 } |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1696 src += 4-h*stride; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1697 } |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1698 } |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
1699 |
3215
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3213
diff
changeset
|
1700 #define PREFETCH(name, op) \ |
4172 | 1701 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
|
1702 const uint8_t *p= mem;\ |
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3213
diff
changeset
|
1703 do{\ |
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3213
diff
changeset
|
1704 asm volatile(#op" %0" :: "m"(*p));\ |
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3213
diff
changeset
|
1705 p+= stride;\ |
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3213
diff
changeset
|
1706 }while(--h);\ |
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3213
diff
changeset
|
1707 } |
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3213
diff
changeset
|
1708 PREFETCH(prefetch_mmx2, prefetcht0) |
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3213
diff
changeset
|
1709 PREFETCH(prefetch_3dnow, prefetch) |
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3213
diff
changeset
|
1710 #undef PREFETCH |
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3213
diff
changeset
|
1711 |
2754 | 1712 #include "h264dsp_mmx.c" |
2967 | 1713 |
6009 | 1714 /* CAVS specific */ |
3524 | 1715 void ff_cavsdsp_init_mmx2(DSPContext* c, AVCodecContext *avctx); |
6522
dfa76e0734e5
Add missed call to ff_cavsdsp_init_3dnow() in dsputil_init_mmx()
zuxy
parents:
6513
diff
changeset
|
1716 void ff_cavsdsp_init_3dnow(DSPContext* c, AVCodecContext *avctx); |
3524 | 1717 |
1718 void ff_put_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride) { | |
1719 put_pixels8_mmx(dst, src, stride, 8); | |
1720 } | |
1721 void ff_avg_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride) { | |
1722 avg_pixels8_mmx(dst, src, stride, 8); | |
1723 } | |
1724 void ff_put_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride) { | |
1725 put_pixels16_mmx(dst, src, stride, 16); | |
1726 } | |
1727 void ff_avg_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride) { | |
1728 avg_pixels16_mmx(dst, src, stride, 16); | |
1729 } | |
1730 | |
5948 | 1731 /* VC1 specific */ |
1732 void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx); | |
1733 | |
1734 void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd) { | |
1735 put_pixels8_mmx(dst, src, stride, 8); | |
1736 } | |
1737 | |
1092 | 1738 /* external functions, from idct_mmx.c */ |
1739 void ff_mmx_idct(DCTELEM *block); | |
1740 void ff_mmxext_idct(DCTELEM *block); | |
1741 | |
1742 /* XXX: those functions should be suppressed ASAP when all IDCTs are | |
1743 converted */ | |
4020
723818b5de0f
Put libmpeg2 IDCT functions under CONFIG_GPL, fixes link failure
diego
parents:
4001
diff
changeset
|
1744 #ifdef CONFIG_GPL |
1092 | 1745 static void ff_libmpeg2mmx_idct_put(uint8_t *dest, int line_size, DCTELEM *block) |
1746 { | |
1747 ff_mmx_idct (block); | |
1748 put_pixels_clamped_mmx(block, dest, line_size); | |
1749 } | |
1750 static void ff_libmpeg2mmx_idct_add(uint8_t *dest, int line_size, DCTELEM *block) | |
1751 { | |
1752 ff_mmx_idct (block); | |
1753 add_pixels_clamped_mmx(block, dest, line_size); | |
1754 } | |
1755 static void ff_libmpeg2mmx2_idct_put(uint8_t *dest, int line_size, DCTELEM *block) | |
1756 { | |
1757 ff_mmxext_idct (block); | |
1758 put_pixels_clamped_mmx(block, dest, line_size); | |
1759 } | |
1760 static void ff_libmpeg2mmx2_idct_add(uint8_t *dest, int line_size, DCTELEM *block) | |
1761 { | |
1762 ff_mmxext_idct (block); | |
1763 add_pixels_clamped_mmx(block, dest, line_size); | |
1764 } | |
4020
723818b5de0f
Put libmpeg2 IDCT functions under CONFIG_GPL, fixes link failure
diego
parents:
4001
diff
changeset
|
1765 #endif |
2868 | 1766 static void ff_idct_xvid_mmx_put(uint8_t *dest, int line_size, DCTELEM *block) |
1767 { | |
1768 ff_idct_xvid_mmx (block); | |
1769 put_pixels_clamped_mmx(block, dest, line_size); | |
1770 } | |
1771 static void ff_idct_xvid_mmx_add(uint8_t *dest, int line_size, DCTELEM *block) | |
1772 { | |
1773 ff_idct_xvid_mmx (block); | |
1774 add_pixels_clamped_mmx(block, dest, line_size); | |
1775 } | |
1776 static void ff_idct_xvid_mmx2_put(uint8_t *dest, int line_size, DCTELEM *block) | |
1777 { | |
1778 ff_idct_xvid_mmx2 (block); | |
1779 put_pixels_clamped_mmx(block, dest, line_size); | |
1780 } | |
1781 static void ff_idct_xvid_mmx2_add(uint8_t *dest, int line_size, DCTELEM *block) | |
1782 { | |
1783 ff_idct_xvid_mmx2 (block); | |
1784 add_pixels_clamped_mmx(block, dest, line_size); | |
1785 } | |
2967 | 1786 |
3541
3fbddeb13686
10l, vorbis_inverse_coupling_sse() was really 3dnow
lorenm
parents:
3536
diff
changeset
|
1787 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
|
1788 { |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1789 int i; |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1790 asm volatile("pxor %%mm7, %%mm7":); |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1791 for(i=0; i<blocksize; i+=2) { |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1792 asm volatile( |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1793 "movq %0, %%mm0 \n\t" |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1794 "movq %1, %%mm1 \n\t" |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1795 "movq %%mm0, %%mm2 \n\t" |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1796 "movq %%mm1, %%mm3 \n\t" |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1797 "pfcmpge %%mm7, %%mm2 \n\t" // m <= 0.0 |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1798 "pfcmpge %%mm7, %%mm3 \n\t" // a <= 0.0 |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1799 "pslld $31, %%mm2 \n\t" // keep only the sign bit |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1800 "pxor %%mm2, %%mm1 \n\t" |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1801 "movq %%mm3, %%mm4 \n\t" |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1802 "pand %%mm1, %%mm3 \n\t" |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1803 "pandn %%mm1, %%mm4 \n\t" |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1804 "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
|
1805 "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
|
1806 "movq %%mm3, %1 \n\t" |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1807 "movq %%mm0, %0 \n\t" |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1808 :"+m"(mag[i]), "+m"(ang[i]) |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1809 ::"memory" |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1810 ); |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1811 } |
3561 | 1812 asm volatile("femms"); |
3536
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1813 } |
3557
8e13ec0f8aa3
change vorbis_inverse_coupling_sse2() so it works on sse1 cpus
michael
parents:
3541
diff
changeset
|
1814 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
|
1815 { |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1816 int i; |
3557
8e13ec0f8aa3
change vorbis_inverse_coupling_sse2() so it works on sse1 cpus
michael
parents:
3541
diff
changeset
|
1817 |
8e13ec0f8aa3
change vorbis_inverse_coupling_sse2() so it works on sse1 cpus
michael
parents:
3541
diff
changeset
|
1818 asm volatile( |
8e13ec0f8aa3
change vorbis_inverse_coupling_sse2() so it works on sse1 cpus
michael
parents:
3541
diff
changeset
|
1819 "movaps %0, %%xmm5 \n\t" |
8e13ec0f8aa3
change vorbis_inverse_coupling_sse2() so it works on sse1 cpus
michael
parents:
3541
diff
changeset
|
1820 ::"m"(ff_pdw_80000000[0]) |
8e13ec0f8aa3
change vorbis_inverse_coupling_sse2() so it works on sse1 cpus
michael
parents:
3541
diff
changeset
|
1821 ); |
3536
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1822 for(i=0; i<blocksize; i+=4) { |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1823 asm volatile( |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1824 "movaps %0, %%xmm0 \n\t" |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1825 "movaps %1, %%xmm1 \n\t" |
3557
8e13ec0f8aa3
change vorbis_inverse_coupling_sse2() so it works on sse1 cpus
michael
parents:
3541
diff
changeset
|
1826 "xorps %%xmm2, %%xmm2 \n\t" |
8e13ec0f8aa3
change vorbis_inverse_coupling_sse2() so it works on sse1 cpus
michael
parents:
3541
diff
changeset
|
1827 "xorps %%xmm3, %%xmm3 \n\t" |
3536
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1828 "cmpleps %%xmm0, %%xmm2 \n\t" // m <= 0.0 |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1829 "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
|
1830 "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
|
1831 "xorps %%xmm2, %%xmm1 \n\t" |
3536
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1832 "movaps %%xmm3, %%xmm4 \n\t" |
3557
8e13ec0f8aa3
change vorbis_inverse_coupling_sse2() so it works on sse1 cpus
michael
parents:
3541
diff
changeset
|
1833 "andps %%xmm1, %%xmm3 \n\t" |
8e13ec0f8aa3
change vorbis_inverse_coupling_sse2() so it works on sse1 cpus
michael
parents:
3541
diff
changeset
|
1834 "andnps %%xmm1, %%xmm4 \n\t" |
3536
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1835 "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
|
1836 "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
|
1837 "movaps %%xmm3, %1 \n\t" |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1838 "movaps %%xmm0, %0 \n\t" |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1839 :"+m"(mag[i]), "+m"(ang[i]) |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1840 ::"memory" |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1841 ); |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1842 } |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1843 } |
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
1844 |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1845 static void vector_fmul_3dnow(float *dst, const float *src, int len){ |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
1846 x86_reg i = (len-4)*4; |
3574 | 1847 asm volatile( |
1848 "1: \n\t" | |
1849 "movq (%1,%0), %%mm0 \n\t" | |
1850 "movq 8(%1,%0), %%mm1 \n\t" | |
1851 "pfmul (%2,%0), %%mm0 \n\t" | |
1852 "pfmul 8(%2,%0), %%mm1 \n\t" | |
1853 "movq %%mm0, (%1,%0) \n\t" | |
1854 "movq %%mm1, 8(%1,%0) \n\t" | |
1855 "sub $16, %0 \n\t" | |
1856 "jge 1b \n\t" | |
1857 "femms \n\t" | |
1858 :"+r"(i) | |
1859 :"r"(dst), "r"(src) | |
1860 :"memory" | |
1861 ); | |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1862 } |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1863 static void vector_fmul_sse(float *dst, const float *src, int len){ |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
1864 x86_reg i = (len-8)*4; |
3574 | 1865 asm volatile( |
1866 "1: \n\t" | |
1867 "movaps (%1,%0), %%xmm0 \n\t" | |
1868 "movaps 16(%1,%0), %%xmm1 \n\t" | |
1869 "mulps (%2,%0), %%xmm0 \n\t" | |
1870 "mulps 16(%2,%0), %%xmm1 \n\t" | |
1871 "movaps %%xmm0, (%1,%0) \n\t" | |
1872 "movaps %%xmm1, 16(%1,%0) \n\t" | |
1873 "sub $32, %0 \n\t" | |
1874 "jge 1b \n\t" | |
1875 :"+r"(i) | |
1876 :"r"(dst), "r"(src) | |
1877 :"memory" | |
1878 ); | |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1879 } |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1880 |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1881 static void vector_fmul_reverse_3dnow2(float *dst, const float *src0, const float *src1, int len){ |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
1882 x86_reg i = len*4-16; |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1883 asm volatile( |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1884 "1: \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1885 "pswapd 8(%1), %%mm0 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1886 "pswapd (%1), %%mm1 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1887 "pfmul (%3,%0), %%mm0 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1888 "pfmul 8(%3,%0), %%mm1 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1889 "movq %%mm0, (%2,%0) \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1890 "movq %%mm1, 8(%2,%0) \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1891 "add $16, %1 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1892 "sub $16, %0 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1893 "jge 1b \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1894 :"+r"(i), "+r"(src1) |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1895 :"r"(dst), "r"(src0) |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1896 ); |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1897 asm volatile("femms"); |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1898 } |
3569
c42c03f3b402
convert vector_fmul_reverse_sse2 and vector_fmul_add_add_sse2 to sse
michael
parents:
3568
diff
changeset
|
1899 static void vector_fmul_reverse_sse(float *dst, const float *src0, const float *src1, int len){ |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
1900 x86_reg i = len*4-32; |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1901 asm volatile( |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1902 "1: \n\t" |
3569
c42c03f3b402
convert vector_fmul_reverse_sse2 and vector_fmul_add_add_sse2 to sse
michael
parents:
3568
diff
changeset
|
1903 "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
|
1904 "movaps (%1), %%xmm1 \n\t" |
c42c03f3b402
convert vector_fmul_reverse_sse2 and vector_fmul_add_add_sse2 to sse
michael
parents:
3568
diff
changeset
|
1905 "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
|
1906 "shufps $0x1b, %%xmm1, %%xmm1 \n\t" |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1907 "mulps (%3,%0), %%xmm0 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1908 "mulps 16(%3,%0), %%xmm1 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1909 "movaps %%xmm0, (%2,%0) \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1910 "movaps %%xmm1, 16(%2,%0) \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1911 "add $32, %1 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1912 "sub $32, %0 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1913 "jge 1b \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1914 :"+r"(i), "+r"(src1) |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1915 :"r"(dst), "r"(src0) |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1916 ); |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1917 } |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1918 |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1919 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
|
1920 const float *src2, int src3, int len, int step){ |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
1921 x86_reg i = (len-4)*4; |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1922 if(step == 2 && src3 == 0){ |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1923 dst += (len-4)*2; |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1924 asm volatile( |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1925 "1: \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1926 "movq (%2,%0), %%mm0 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1927 "movq 8(%2,%0), %%mm1 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1928 "pfmul (%3,%0), %%mm0 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1929 "pfmul 8(%3,%0), %%mm1 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1930 "pfadd (%4,%0), %%mm0 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1931 "pfadd 8(%4,%0), %%mm1 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1932 "movd %%mm0, (%1) \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1933 "movd %%mm1, 16(%1) \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1934 "psrlq $32, %%mm0 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1935 "psrlq $32, %%mm1 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1936 "movd %%mm0, 8(%1) \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1937 "movd %%mm1, 24(%1) \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1938 "sub $32, %1 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1939 "sub $16, %0 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1940 "jge 1b \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1941 :"+r"(i), "+r"(dst) |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1942 :"r"(src0), "r"(src1), "r"(src2) |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1943 :"memory" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1944 ); |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1945 } |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1946 else if(step == 1 && src3 == 0){ |
3574 | 1947 asm volatile( |
1948 "1: \n\t" | |
1949 "movq (%2,%0), %%mm0 \n\t" | |
1950 "movq 8(%2,%0), %%mm1 \n\t" | |
1951 "pfmul (%3,%0), %%mm0 \n\t" | |
1952 "pfmul 8(%3,%0), %%mm1 \n\t" | |
1953 "pfadd (%4,%0), %%mm0 \n\t" | |
1954 "pfadd 8(%4,%0), %%mm1 \n\t" | |
1955 "movq %%mm0, (%1,%0) \n\t" | |
1956 "movq %%mm1, 8(%1,%0) \n\t" | |
1957 "sub $16, %0 \n\t" | |
1958 "jge 1b \n\t" | |
1959 :"+r"(i) | |
1960 :"r"(dst), "r"(src0), "r"(src1), "r"(src2) | |
1961 :"memory" | |
1962 ); | |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1963 } |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1964 else |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1965 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
|
1966 asm volatile("femms"); |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1967 } |
3569
c42c03f3b402
convert vector_fmul_reverse_sse2 and vector_fmul_add_add_sse2 to sse
michael
parents:
3568
diff
changeset
|
1968 static void vector_fmul_add_add_sse(float *dst, const float *src0, const float *src1, |
3574 | 1969 const float *src2, int src3, int len, int step){ |
6755
33896780c612
Do not misuse long as the size of a register in x86.
ramiro
parents:
6601
diff
changeset
|
1970 x86_reg i = (len-8)*4; |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1971 if(step == 2 && src3 == 0){ |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1972 dst += (len-8)*2; |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1973 asm volatile( |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1974 "1: \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1975 "movaps (%2,%0), %%xmm0 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1976 "movaps 16(%2,%0), %%xmm1 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1977 "mulps (%3,%0), %%xmm0 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1978 "mulps 16(%3,%0), %%xmm1 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1979 "addps (%4,%0), %%xmm0 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1980 "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
|
1981 "movss %%xmm0, (%1) \n\t" |
c42c03f3b402
convert vector_fmul_reverse_sse2 and vector_fmul_add_add_sse2 to sse
michael
parents:
3568
diff
changeset
|
1982 "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
|
1983 "movhlps %%xmm0, %%xmm2 \n\t" |
c42c03f3b402
convert vector_fmul_reverse_sse2 and vector_fmul_add_add_sse2 to sse
michael
parents:
3568
diff
changeset
|
1984 "movhlps %%xmm1, %%xmm3 \n\t" |
c42c03f3b402
convert vector_fmul_reverse_sse2 and vector_fmul_add_add_sse2 to sse
michael
parents:
3568
diff
changeset
|
1985 "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
|
1986 "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
|
1987 "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
|
1988 "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
|
1989 "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
|
1990 "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
|
1991 "movhlps %%xmm0, %%xmm2 \n\t" |
c42c03f3b402
convert vector_fmul_reverse_sse2 and vector_fmul_add_add_sse2 to sse
michael
parents:
3568
diff
changeset
|
1992 "movhlps %%xmm1, %%xmm3 \n\t" |
c42c03f3b402
convert vector_fmul_reverse_sse2 and vector_fmul_add_add_sse2 to sse
michael
parents:
3568
diff
changeset
|
1993 "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
|
1994 "movss %%xmm3, 56(%1) \n\t" |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1995 "sub $64, %1 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1996 "sub $32, %0 \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1997 "jge 1b \n\t" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1998 :"+r"(i), "+r"(dst) |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
1999 :"r"(src0), "r"(src1), "r"(src2) |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2000 :"memory" |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2001 ); |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2002 } |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2003 else if(step == 1 && src3 == 0){ |
3574 | 2004 asm volatile( |
2005 "1: \n\t" | |
2006 "movaps (%2,%0), %%xmm0 \n\t" | |
2007 "movaps 16(%2,%0), %%xmm1 \n\t" | |
2008 "mulps (%3,%0), %%xmm0 \n\t" | |
2009 "mulps 16(%3,%0), %%xmm1 \n\t" | |
2010 "addps (%4,%0), %%xmm0 \n\t" | |
2011 "addps 16(%4,%0), %%xmm1 \n\t" | |
2012 "movaps %%xmm0, (%1,%0) \n\t" | |
2013 "movaps %%xmm1, 16(%1,%0) \n\t" | |
2014 "sub $32, %0 \n\t" | |
2015 "jge 1b \n\t" | |
2016 :"+r"(i) | |
2017 :"r"(dst), "r"(src0), "r"(src1), "r"(src2) | |
2018 :"memory" | |
2019 ); | |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2020 } |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2021 else |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2022 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
|
2023 } |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2024 |
7263 | 2025 static void vector_fmul_window_3dnow2(float *dst, const float *src0, const float *src1, |
2026 const float *win, float add_bias, int len){ | |
2027 #ifdef HAVE_6REGS | |
2028 if(add_bias == 0){ | |
2029 x86_reg i = -len*4; | |
2030 x86_reg j = len*4-8; | |
2031 asm volatile( | |
2032 "1: \n" | |
2033 "pswapd (%5,%1), %%mm1 \n" | |
2034 "movq (%5,%0), %%mm0 \n" | |
2035 "pswapd (%4,%1), %%mm5 \n" | |
2036 "movq (%3,%0), %%mm4 \n" | |
2037 "movq %%mm0, %%mm2 \n" | |
2038 "movq %%mm1, %%mm3 \n" | |
2039 "pfmul %%mm4, %%mm2 \n" // src0[len+i]*win[len+i] | |
2040 "pfmul %%mm5, %%mm3 \n" // src1[ j]*win[len+j] | |
2041 "pfmul %%mm4, %%mm1 \n" // src0[len+i]*win[len+j] | |
2042 "pfmul %%mm5, %%mm0 \n" // src1[ j]*win[len+i] | |
2043 "pfadd %%mm3, %%mm2 \n" | |
2044 "pfsub %%mm0, %%mm1 \n" | |
2045 "pswapd %%mm2, %%mm2 \n" | |
2046 "movq %%mm1, (%2,%0) \n" | |
2047 "movq %%mm2, (%2,%1) \n" | |
2048 "sub $8, %1 \n" | |
2049 "add $8, %0 \n" | |
2050 "jl 1b \n" | |
2051 "femms \n" | |
2052 :"+r"(i), "+r"(j) | |
2053 :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len) | |
2054 ); | |
2055 }else | |
2056 #endif | |
2057 ff_vector_fmul_window_c(dst, src0, src1, win, add_bias, len); | |
2058 } | |
2059 | |
7261 | 2060 static void vector_fmul_window_sse(float *dst, const float *src0, const float *src1, |
2061 const float *win, float add_bias, int len){ | |
2062 #ifdef HAVE_6REGS | |
2063 if(add_bias == 0){ | |
7263 | 2064 x86_reg i = -len*4; |
2065 x86_reg j = len*4-16; | |
7261 | 2066 asm volatile( |
2067 "1: \n" | |
7263 | 2068 "movaps (%5,%1), %%xmm1 \n" |
7261 | 2069 "movaps (%5,%0), %%xmm0 \n" |
7263 | 2070 "movaps (%4,%1), %%xmm5 \n" |
2071 "movaps (%3,%0), %%xmm4 \n" | |
2072 "shufps $0x1b, %%xmm1, %%xmm1 \n" | |
2073 "shufps $0x1b, %%xmm5, %%xmm5 \n" | |
7261 | 2074 "movaps %%xmm0, %%xmm2 \n" |
2075 "movaps %%xmm1, %%xmm3 \n" | |
7263 | 2076 "mulps %%xmm4, %%xmm2 \n" // src0[len+i]*win[len+i] |
2077 "mulps %%xmm5, %%xmm3 \n" // src1[ j]*win[len+j] | |
2078 "mulps %%xmm4, %%xmm1 \n" // src0[len+i]*win[len+j] | |
2079 "mulps %%xmm5, %%xmm0 \n" // src1[ j]*win[len+i] | |
2080 "addps %%xmm3, %%xmm2 \n" | |
2081 "subps %%xmm0, %%xmm1 \n" | |
7261 | 2082 "shufps $0x1b, %%xmm2, %%xmm2 \n" |
7263 | 2083 "movaps %%xmm1, (%2,%0) \n" |
2084 "movaps %%xmm2, (%2,%1) \n" | |
7261 | 2085 "sub $16, %1 \n" |
2086 "add $16, %0 \n" | |
2087 "jl 1b \n" | |
2088 :"+r"(i), "+r"(j) | |
7263 | 2089 :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len) |
7261 | 2090 ); |
2091 }else | |
2092 #endif | |
2093 ff_vector_fmul_window_c(dst, src0, src1, win, add_bias, len); | |
2094 } | |
2095 | |
7218 | 2096 static void float_to_int16_3dnow(int16_t *dst, const float *src, long len){ |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2097 // not bit-exact: pf2id uses different rounding than C and SSE |
7217
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2098 asm volatile( |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2099 "add %0 , %0 \n\t" |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2100 "lea (%2,%0,2) , %2 \n\t" |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2101 "add %0 , %1 \n\t" |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2102 "neg %0 \n\t" |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2103 "1: \n\t" |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2104 "pf2id (%2,%0,2) , %%mm0 \n\t" |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2105 "pf2id 8(%2,%0,2) , %%mm1 \n\t" |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2106 "pf2id 16(%2,%0,2) , %%mm2 \n\t" |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2107 "pf2id 24(%2,%0,2) , %%mm3 \n\t" |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2108 "packssdw %%mm1 , %%mm0 \n\t" |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2109 "packssdw %%mm3 , %%mm2 \n\t" |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2110 "movq %%mm0 , (%1,%0) \n\t" |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2111 "movq %%mm2 , 8(%1,%0) \n\t" |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2112 "add $16 , %0 \n\t" |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2113 " js 1b \n\t" |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2114 "femms \n\t" |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2115 :"+r"(len), "+r"(dst), "+r"(src) |
726770da3234
dont use C-asm loops and unroll once float_to_int16_3dnow()
michael
parents:
7087
diff
changeset
|
2116 ); |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2117 } |
7218 | 2118 static void float_to_int16_sse(int16_t *dst, const float *src, long len){ |
7219
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2119 asm volatile( |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2120 "add %0 , %0 \n\t" |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2121 "lea (%2,%0,2) , %2 \n\t" |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2122 "add %0 , %1 \n\t" |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2123 "neg %0 \n\t" |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2124 "1: \n\t" |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2125 "cvtps2pi (%2,%0,2) , %%mm0 \n\t" |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2126 "cvtps2pi 8(%2,%0,2) , %%mm1 \n\t" |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2127 "cvtps2pi 16(%2,%0,2) , %%mm2 \n\t" |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2128 "cvtps2pi 24(%2,%0,2) , %%mm3 \n\t" |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2129 "packssdw %%mm1 , %%mm0 \n\t" |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2130 "packssdw %%mm3 , %%mm2 \n\t" |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2131 "movq %%mm0 , (%1,%0) \n\t" |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2132 "movq %%mm2 , 8(%1,%0) \n\t" |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2133 "add $16 , %0 \n\t" |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2134 " js 1b \n\t" |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2135 "emms \n\t" |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2136 :"+r"(len), "+r"(dst), "+r"(src) |
f72ef5b28253
1 c-asm loop less and 1x unroll of float_to_int16_sse()
michael
parents:
7218
diff
changeset
|
2137 ); |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2138 } |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2139 |
7226 | 2140 static void float_to_int16_sse2(int16_t *dst, const float *src, long len){ |
2141 asm volatile( | |
2142 "add %0 , %0 \n\t" | |
2143 "lea (%2,%0,2) , %2 \n\t" | |
2144 "add %0 , %1 \n\t" | |
2145 "neg %0 \n\t" | |
2146 "1: \n\t" | |
2147 "cvtps2dq (%2,%0,2) , %%xmm0 \n\t" | |
2148 "cvtps2dq 16(%2,%0,2) , %%xmm1 \n\t" | |
2149 "packssdw %%xmm1 , %%xmm0 \n\t" | |
2150 "movdqa %%xmm0 , (%1,%0) \n\t" | |
2151 "add $16 , %0 \n\t" | |
2152 " js 1b \n\t" | |
2153 :"+r"(len), "+r"(dst), "+r"(src) | |
2154 ); | |
2155 } | |
2156 | |
7261 | 2157 #define FLOAT_TO_INT16_INTERLEAVE(cpu, body) \ |
2158 /* gcc pessimizes register allocation if this is in the same function as float_to_int16_interleave_sse2*/\ | |
7286
e267f2519248
float_to_int16_interleave: change src to an array of pointers instead of assuming it's contiguous.
lorenm
parents:
7278
diff
changeset
|
2159 static av_noinline void float_to_int16_interleave2_##cpu(int16_t *dst, const float **src, long len, int channels){\ |
e267f2519248
float_to_int16_interleave: change src to an array of pointers instead of assuming it's contiguous.
lorenm
parents:
7278
diff
changeset
|
2160 DECLARE_ALIGNED_16(int16_t, tmp[len]);\ |
7261 | 2161 int i,j,c;\ |
2162 for(c=0; c<channels; c++){\ | |
7286
e267f2519248
float_to_int16_interleave: change src to an array of pointers instead of assuming it's contiguous.
lorenm
parents:
7278
diff
changeset
|
2163 float_to_int16_##cpu(tmp, src[c], len);\ |
7261 | 2164 for(i=0, j=c; i<len; i++, j+=channels)\ |
7286
e267f2519248
float_to_int16_interleave: change src to an array of pointers instead of assuming it's contiguous.
lorenm
parents:
7278
diff
changeset
|
2165 dst[j] = tmp[i];\ |
7261 | 2166 }\ |
2167 }\ | |
2168 \ | |
7286
e267f2519248
float_to_int16_interleave: change src to an array of pointers instead of assuming it's contiguous.
lorenm
parents:
7278
diff
changeset
|
2169 static void float_to_int16_interleave_##cpu(int16_t *dst, const float **src, long len, int channels){\ |
7261 | 2170 if(channels==1)\ |
7286
e267f2519248
float_to_int16_interleave: change src to an array of pointers instead of assuming it's contiguous.
lorenm
parents:
7278
diff
changeset
|
2171 float_to_int16_##cpu(dst, src[0], len);\ |
7261 | 2172 else if(channels>2)\ |
2173 float_to_int16_interleave2_##cpu(dst, src, len, channels);\ | |
2174 else{\ | |
7286
e267f2519248
float_to_int16_interleave: change src to an array of pointers instead of assuming it's contiguous.
lorenm
parents:
7278
diff
changeset
|
2175 const float *src0 = src[0];\ |
e267f2519248
float_to_int16_interleave: change src to an array of pointers instead of assuming it's contiguous.
lorenm
parents:
7278
diff
changeset
|
2176 const float *src1 = src[1];\ |
7261 | 2177 asm volatile(\ |
2178 "shl $2, %0 \n"\ | |
2179 "add %0, %1 \n"\ | |
2180 "add %0, %2 \n"\ | |
7286
e267f2519248
float_to_int16_interleave: change src to an array of pointers instead of assuming it's contiguous.
lorenm
parents:
7278
diff
changeset
|
2181 "add %0, %3 \n"\ |
7261 | 2182 "neg %0 \n"\ |
2183 body\ | |
7286
e267f2519248
float_to_int16_interleave: change src to an array of pointers instead of assuming it's contiguous.
lorenm
parents:
7278
diff
changeset
|
2184 :"+r"(len), "+r"(dst), "+r"(src0), "+r"(src1)\ |
7261 | 2185 );\ |
2186 }\ | |
2187 } | |
2188 | |
2189 FLOAT_TO_INT16_INTERLEAVE(3dnow, | |
2190 "1: \n" | |
2191 "pf2id (%2,%0), %%mm0 \n" | |
2192 "pf2id 8(%2,%0), %%mm1 \n" | |
2193 "pf2id (%3,%0), %%mm2 \n" | |
2194 "pf2id 8(%3,%0), %%mm3 \n" | |
2195 "packssdw %%mm1, %%mm0 \n" | |
2196 "packssdw %%mm3, %%mm2 \n" | |
2197 "movq %%mm0, %%mm1 \n" | |
2198 "punpcklwd %%mm2, %%mm0 \n" | |
2199 "punpckhwd %%mm2, %%mm1 \n" | |
2200 "movq %%mm0, (%1,%0)\n" | |
7278
6c140c15ee8c
10l, float_to_int16_interleave_sse/3dnow wrote the wrong samples
lorenm
parents:
7263
diff
changeset
|
2201 "movq %%mm1, 8(%1,%0)\n" |
7261 | 2202 "add $16, %0 \n" |
2203 "js 1b \n" | |
2204 "femms \n" | |
2205 ) | |
2206 | |
2207 FLOAT_TO_INT16_INTERLEAVE(sse, | |
2208 "1: \n" | |
2209 "cvtps2pi (%2,%0), %%mm0 \n" | |
2210 "cvtps2pi 8(%2,%0), %%mm1 \n" | |
2211 "cvtps2pi (%3,%0), %%mm2 \n" | |
2212 "cvtps2pi 8(%3,%0), %%mm3 \n" | |
2213 "packssdw %%mm1, %%mm0 \n" | |
2214 "packssdw %%mm3, %%mm2 \n" | |
2215 "movq %%mm0, %%mm1 \n" | |
2216 "punpcklwd %%mm2, %%mm0 \n" | |
2217 "punpckhwd %%mm2, %%mm1 \n" | |
2218 "movq %%mm0, (%1,%0)\n" | |
7278
6c140c15ee8c
10l, float_to_int16_interleave_sse/3dnow wrote the wrong samples
lorenm
parents:
7263
diff
changeset
|
2219 "movq %%mm1, 8(%1,%0)\n" |
7261 | 2220 "add $16, %0 \n" |
2221 "js 1b \n" | |
2222 "emms \n" | |
2223 ) | |
2224 | |
2225 FLOAT_TO_INT16_INTERLEAVE(sse2, | |
2226 "1: \n" | |
2227 "cvtps2dq (%2,%0), %%xmm0 \n" | |
2228 "cvtps2dq (%3,%0), %%xmm1 \n" | |
2229 "packssdw %%xmm1, %%xmm0 \n" | |
2230 "movhlps %%xmm0, %%xmm1 \n" | |
2231 "punpcklwd %%xmm1, %%xmm0 \n" | |
2232 "movdqa %%xmm0, (%1,%0) \n" | |
2233 "add $16, %0 \n" | |
2234 "js 1b \n" | |
2235 ) | |
2236 | |
2237 | |
6195
5f704e9cb518
fix prototypes, remove warning: i386/dsputil_mmx.c:3594: warning: assignment from incompatible pointer type
bcoudurier
parents:
6181
diff
changeset
|
2238 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
|
2239 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
|
2240 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
|
2241 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
|
2242 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
|
2243 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
|
2244 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
|
2245 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
|
2246 |
7238
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2247 |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2248 static void add_int16_sse2(int16_t * v1, int16_t * v2, int order) |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2249 { |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2250 x86_reg o = -(order << 1); |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2251 v1 += order; |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2252 v2 += order; |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2253 asm volatile( |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2254 "1: \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2255 "movdqu (%1,%2), %%xmm0 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2256 "movdqu 16(%1,%2), %%xmm1 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2257 "paddw (%0,%2), %%xmm0 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2258 "paddw 16(%0,%2), %%xmm1 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2259 "movdqa %%xmm0, (%0,%2) \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2260 "movdqa %%xmm1, 16(%0,%2) \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2261 "add $32, %2 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2262 "js 1b \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2263 : "+r"(v1), "+r"(v2), "+r"(o) |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2264 ); |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2265 } |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2266 |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2267 static void sub_int16_sse2(int16_t * v1, int16_t * v2, int order) |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2268 { |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2269 x86_reg o = -(order << 1); |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2270 v1 += order; |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2271 v2 += order; |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2272 asm volatile( |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2273 "1: \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2274 "movdqa (%0,%2), %%xmm0 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2275 "movdqa 16(%0,%2), %%xmm2 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2276 "movdqu (%1,%2), %%xmm1 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2277 "movdqu 16(%1,%2), %%xmm3 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2278 "psubw %%xmm1, %%xmm0 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2279 "psubw %%xmm3, %%xmm2 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2280 "movdqa %%xmm0, (%0,%2) \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2281 "movdqa %%xmm2, 16(%0,%2) \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2282 "add $32, %2 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2283 "js 1b \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2284 : "+r"(v1), "+r"(v2), "+r"(o) |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2285 ); |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2286 } |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2287 |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2288 static int32_t scalarproduct_int16_sse2(int16_t * v1, int16_t * v2, int order, int shift) |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2289 { |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2290 int res = 0; |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2291 DECLARE_ALIGNED_16(int64_t, sh); |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2292 x86_reg o = -(order << 1); |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2293 |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2294 v1 += order; |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2295 v2 += order; |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2296 sh = shift; |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2297 asm volatile( |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2298 "pxor %%xmm7, %%xmm7 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2299 "1: \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2300 "movdqu (%0,%3), %%xmm0 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2301 "movdqu 16(%0,%3), %%xmm1 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2302 "pmaddwd (%1,%3), %%xmm0 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2303 "pmaddwd 16(%1,%3), %%xmm1 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2304 "paddd %%xmm0, %%xmm7 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2305 "paddd %%xmm1, %%xmm7 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2306 "add $32, %3 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2307 "js 1b \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2308 "movhlps %%xmm7, %%xmm2 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2309 "paddd %%xmm2, %%xmm7 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2310 "psrad %4, %%xmm7 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2311 "pshuflw $0x4E, %%xmm7,%%xmm2 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2312 "paddd %%xmm2, %%xmm7 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2313 "movd %%xmm7, %2 \n\t" |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2314 : "+r"(v1), "+r"(v2), "=r"(res), "+r"(o) |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2315 : "m"(sh) |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2316 ); |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2317 return res; |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2318 } |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2319 |
1092 | 2320 void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) |
0 | 2321 { |
4197 | 2322 mm_flags = mm_support(); |
1115 | 2323 |
1122 | 2324 if (avctx->dsp_mask) { |
2979 | 2325 if (avctx->dsp_mask & FF_MM_FORCE) |
4197 | 2326 mm_flags |= (avctx->dsp_mask & 0xffff); |
2979 | 2327 else |
4197 | 2328 mm_flags &= ~(avctx->dsp_mask & 0xffff); |
1122 | 2329 } |
1115 | 2330 |
631
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
2331 #if 0 |
1868 | 2332 av_log(avctx, AV_LOG_INFO, "libavcodec: CPU flags:"); |
4197 | 2333 if (mm_flags & MM_MMX) |
1868 | 2334 av_log(avctx, AV_LOG_INFO, " mmx"); |
4197 | 2335 if (mm_flags & MM_MMXEXT) |
1868 | 2336 av_log(avctx, AV_LOG_INFO, " mmxext"); |
4197 | 2337 if (mm_flags & MM_3DNOW) |
1868 | 2338 av_log(avctx, AV_LOG_INFO, " 3dnow"); |
4197 | 2339 if (mm_flags & MM_SSE) |
1868 | 2340 av_log(avctx, AV_LOG_INFO, " sse"); |
4197 | 2341 if (mm_flags & MM_SSE2) |
1868 | 2342 av_log(avctx, AV_LOG_INFO, " sse2"); |
2343 av_log(avctx, AV_LOG_INFO, "\n"); | |
0 | 2344 #endif |
2345 | |
4197 | 2346 if (mm_flags & MM_MMX) { |
1092 | 2347 const int idct_algo= avctx->idct_algo; |
2348 | |
2256 | 2349 if(avctx->lowres==0){ |
2350 if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SIMPLEMMX){ | |
2351 c->idct_put= ff_simple_idct_put_mmx; | |
2352 c->idct_add= ff_simple_idct_add_mmx; | |
2353 c->idct = ff_simple_idct_mmx; | |
2354 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
|
2355 #ifdef CONFIG_GPL |
2256 | 2356 }else if(idct_algo==FF_IDCT_LIBMPEG2MMX){ |
4197 | 2357 if(mm_flags & MM_MMXEXT){ |
2256 | 2358 c->idct_put= ff_libmpeg2mmx2_idct_put; |
2359 c->idct_add= ff_libmpeg2mmx2_idct_add; | |
2360 c->idct = ff_mmxext_idct; | |
2361 }else{ | |
2362 c->idct_put= ff_libmpeg2mmx_idct_put; | |
2363 c->idct_add= ff_libmpeg2mmx_idct_add; | |
2364 c->idct = ff_mmx_idct; | |
2365 } | |
2366 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
|
2367 #endif |
5007 | 2368 }else if((ENABLE_VP3_DECODER || ENABLE_VP5_DECODER || ENABLE_VP6_DECODER) && |
2369 idct_algo==FF_IDCT_VP3 && | |
3721
2000e401593d
disable vp3 mmx idct for theora files to avoid artifacts
aurel
parents:
3717
diff
changeset
|
2370 avctx->codec->id!=CODEC_ID_THEORA && |
3712
f7f75f718efb
Enables back the mmx/sse optimized version of the vp3 idct.
aurel
parents:
3666
diff
changeset
|
2371 !(avctx->flags & CODEC_FLAG_BITEXACT)){ |
4197 | 2372 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
|
2373 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
|
2374 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
|
2375 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
|
2376 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
|
2377 }else{ |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2378 ff_vp3_dsp_init_mmx(); |
9699d325049d
porting the mmx&sse2 (sse2 untested) vp3 idcts to the lavc idct API
michael
parents:
2691
diff
changeset
|
2379 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
|
2380 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
|
2381 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
|
2382 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
|
2383 } |
3524 | 2384 }else if(idct_algo==FF_IDCT_CAVS){ |
2385 c->idct_permutation_type= FF_TRANSPOSE_IDCT_PERM; | |
2868 | 2386 }else if(idct_algo==FF_IDCT_XVIDMMX){ |
6601 | 2387 if(mm_flags & MM_SSE2){ |
2388 c->idct_put= ff_idct_xvid_sse2_put; | |
2389 c->idct_add= ff_idct_xvid_sse2_add; | |
2390 c->idct = ff_idct_xvid_sse2; | |
2391 c->idct_permutation_type= FF_SSE2_IDCT_PERM; | |
2392 }else if(mm_flags & MM_MMXEXT){ | |
2868 | 2393 c->idct_put= ff_idct_xvid_mmx2_put; |
2394 c->idct_add= ff_idct_xvid_mmx2_add; | |
2395 c->idct = ff_idct_xvid_mmx2; | |
2396 }else{ | |
2397 c->idct_put= ff_idct_xvid_mmx_put; | |
2398 c->idct_add= ff_idct_xvid_mmx_add; | |
2399 c->idct = ff_idct_xvid_mmx; | |
2400 } | |
1092 | 2401 } |
2402 } | |
1868 | 2403 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2404 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
|
2405 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
|
2406 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
|
2407 c->clear_blocks = clear_blocks_mmx; |
415 | 2408 |
6327 | 2409 #define SET_HPEL_FUNCS(PFX, IDX, SIZE, CPU) \ |
2410 c->PFX ## _pixels_tab[IDX][0] = PFX ## _pixels ## SIZE ## _ ## CPU; \ | |
2411 c->PFX ## _pixels_tab[IDX][1] = PFX ## _pixels ## SIZE ## _x2_ ## CPU; \ | |
2412 c->PFX ## _pixels_tab[IDX][2] = PFX ## _pixels ## SIZE ## _y2_ ## CPU; \ | |
2413 c->PFX ## _pixels_tab[IDX][3] = PFX ## _pixels ## SIZE ## _xy2_ ## CPU | |
2414 | |
2415 SET_HPEL_FUNCS(put, 0, 16, mmx); | |
2416 SET_HPEL_FUNCS(put_no_rnd, 0, 16, mmx); | |
2417 SET_HPEL_FUNCS(avg, 0, 16, mmx); | |
2418 SET_HPEL_FUNCS(avg_no_rnd, 0, 16, mmx); | |
2419 SET_HPEL_FUNCS(put, 1, 8, mmx); | |
2420 SET_HPEL_FUNCS(put_no_rnd, 1, 8, mmx); | |
2421 SET_HPEL_FUNCS(avg, 1, 8, mmx); | |
2422 SET_HPEL_FUNCS(avg_no_rnd, 1, 8, mmx); | |
2967 | 2423 |
3248
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
2424 c->gmc= gmc_mmx; |
7aa9f80e7954
mmx implementation of 3-point GMC. (5x faster than C)
lorenm
parents:
3215
diff
changeset
|
2425 |
866 | 2426 c->add_bytes= add_bytes_mmx; |
6384 | 2427 c->add_bytes_l2= add_bytes_l2_mmx; |
1647 | 2428 |
6437 | 2429 c->draw_edges = draw_edges_mmx; |
2430 | |
5277
7b3fcb7c61ce
Avoid linking with h263.c functions when the relevant codecs
aurel
parents:
5255
diff
changeset
|
2431 if (ENABLE_ANY_H263) { |
5278 | 2432 c->h263_v_loop_filter= h263_v_loop_filter_mmx; |
2433 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
|
2434 } |
6057
03febc8f506f
add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents:
6056
diff
changeset
|
2435 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
|
2436 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
|
2437 c->put_no_rnd_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_mmx_nornd; |
2967 | 2438 |
3173 | 2439 c->h264_idct_dc_add= |
2440 c->h264_idct_add= ff_h264_idct_add_mmx; | |
3174 | 2441 c->h264_idct8_dc_add= |
2442 c->h264_idct8_add= ff_h264_idct8_add_mmx; | |
6320 | 2443 if (mm_flags & MM_SSE2) |
2444 c->h264_idct8_add= ff_h264_idct8_add_sse2; | |
3173 | 2445 |
4197 | 2446 if (mm_flags & MM_MMXEXT) { |
3215
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3213
diff
changeset
|
2447 c->prefetch = prefetch_mmx2; |
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3213
diff
changeset
|
2448 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2449 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
|
2450 c->put_pixels_tab[0][2] = put_pixels16_y2_mmx2; |
651 | 2451 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2452 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
|
2453 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
|
2454 c->avg_pixels_tab[0][2] = avg_pixels16_y2_mmx2; |
415 | 2455 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2456 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
|
2457 c->put_pixels_tab[1][2] = put_pixels8_y2_mmx2; |
651 | 2458 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2459 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
|
2460 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
|
2461 c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx2; |
1092 | 2462 |
3105
2d35fb3cb940
h264: special case dc-only idct. ~1% faster overall
lorenm
parents:
3089
diff
changeset
|
2463 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
|
2464 c->h264_idct8_dc_add= ff_h264_idct8_dc_add_mmx2; |
2745 | 2465 |
1092 | 2466 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ |
2467 c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx2; | |
2468 c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmx2; | |
2469 c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx2; | |
2470 c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx2; | |
2471 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx2; | |
2472 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx2; | |
2473 } | |
959 | 2474 |
6327 | 2475 #define SET_QPEL_FUNCS(PFX, IDX, SIZE, CPU) \ |
2476 c->PFX ## _pixels_tab[IDX][ 0] = PFX ## SIZE ## _mc00_ ## CPU; \ | |
2477 c->PFX ## _pixels_tab[IDX][ 1] = PFX ## SIZE ## _mc10_ ## CPU; \ | |
2478 c->PFX ## _pixels_tab[IDX][ 2] = PFX ## SIZE ## _mc20_ ## CPU; \ | |
2479 c->PFX ## _pixels_tab[IDX][ 3] = PFX ## SIZE ## _mc30_ ## CPU; \ | |
2480 c->PFX ## _pixels_tab[IDX][ 4] = PFX ## SIZE ## _mc01_ ## CPU; \ | |
2481 c->PFX ## _pixels_tab[IDX][ 5] = PFX ## SIZE ## _mc11_ ## CPU; \ | |
2482 c->PFX ## _pixels_tab[IDX][ 6] = PFX ## SIZE ## _mc21_ ## CPU; \ | |
2483 c->PFX ## _pixels_tab[IDX][ 7] = PFX ## SIZE ## _mc31_ ## CPU; \ | |
2484 c->PFX ## _pixels_tab[IDX][ 8] = PFX ## SIZE ## _mc02_ ## CPU; \ | |
2485 c->PFX ## _pixels_tab[IDX][ 9] = PFX ## SIZE ## _mc12_ ## CPU; \ | |
2486 c->PFX ## _pixels_tab[IDX][10] = PFX ## SIZE ## _mc22_ ## CPU; \ | |
2487 c->PFX ## _pixels_tab[IDX][11] = PFX ## SIZE ## _mc32_ ## CPU; \ | |
2488 c->PFX ## _pixels_tab[IDX][12] = PFX ## SIZE ## _mc03_ ## CPU; \ | |
2489 c->PFX ## _pixels_tab[IDX][13] = PFX ## SIZE ## _mc13_ ## CPU; \ | |
2490 c->PFX ## _pixels_tab[IDX][14] = PFX ## SIZE ## _mc23_ ## CPU; \ | |
2491 c->PFX ## _pixels_tab[IDX][15] = PFX ## SIZE ## _mc33_ ## CPU | |
2492 | |
2493 SET_QPEL_FUNCS(put_qpel, 0, 16, mmx2); | |
2494 SET_QPEL_FUNCS(put_qpel, 1, 8, mmx2); | |
2495 SET_QPEL_FUNCS(put_no_rnd_qpel, 0, 16, mmx2); | |
2496 SET_QPEL_FUNCS(put_no_rnd_qpel, 1, 8, mmx2); | |
2497 SET_QPEL_FUNCS(avg_qpel, 0, 16, mmx2); | |
2498 SET_QPEL_FUNCS(avg_qpel, 1, 8, mmx2); | |
2499 | |
2500 SET_QPEL_FUNCS(put_h264_qpel, 0, 16, mmx2); | |
2501 SET_QPEL_FUNCS(put_h264_qpel, 1, 8, mmx2); | |
2502 SET_QPEL_FUNCS(put_h264_qpel, 2, 4, mmx2); | |
2503 SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, mmx2); | |
2504 SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, mmx2); | |
2505 SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, mmx2); | |
2506 | |
2507 SET_QPEL_FUNCS(put_2tap_qpel, 0, 16, mmx2); | |
2508 SET_QPEL_FUNCS(put_2tap_qpel, 1, 8, mmx2); | |
2509 SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, mmx2); | |
2510 SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, mmx2); | |
2209 | 2511 |
6057
03febc8f506f
add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents:
6056
diff
changeset
|
2512 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
|
2513 c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_mmx2; |
3213 | 2514 c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_mmx2; |
2515 c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_mmx2; | |
2633 | 2516 c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_mmx2; |
2517 c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_mmx2; | |
2518 c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_mmx2; | |
2519 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
|
2520 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
|
2521 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
|
2522 c->h264_loop_filter_strength= h264_loop_filter_strength_mmx2; |
2633 | 2523 |
2902
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2524 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
|
2525 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
|
2526 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
|
2527 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
|
2528 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
|
2529 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
|
2530 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
|
2531 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
|
2532 |
3c79bc9f3aa9
h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents:
2899
diff
changeset
|
2533 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
|
2534 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
|
2535 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
|
2536 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
|
2537 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
|
2538 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
|
2539 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
|
2540 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
|
2541 |
5949 | 2542 if (ENABLE_CAVS_DECODER) |
5950 | 2543 ff_cavsdsp_init_mmx2(c, avctx); |
5949 | 2544 |
2545 if (ENABLE_VC1_DECODER || ENABLE_WMV3_DECODER) | |
5950 | 2546 ff_vc1dsp_init_mmx(c, avctx); |
5933 | 2547 |
6384 | 2548 c->add_png_paeth_prediction= add_png_paeth_prediction_mmx2; |
4197 | 2549 } else if (mm_flags & MM_3DNOW) { |
3215
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3213
diff
changeset
|
2550 c->prefetch = prefetch_3dnow; |
06f98047ff26
prefetch pixels for future motion compensation. 2-5% faster h264.
lorenm
parents:
3213
diff
changeset
|
2551 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2552 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
|
2553 c->put_pixels_tab[0][2] = put_pixels16_y2_3dnow; |
393 | 2554 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2555 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
|
2556 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
|
2557 c->avg_pixels_tab[0][2] = avg_pixels16_y2_3dnow; |
651 | 2558 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2559 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
|
2560 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
|
2561 |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
2562 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
|
2563 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
|
2564 c->avg_pixels_tab[1][2] = avg_pixels8_y2_3dnow; |
1092 | 2565 |
2566 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ | |
2567 c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_3dnow; | |
2568 c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_3dnow; | |
2569 c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_3dnow; | |
2570 c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_3dnow; | |
2571 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_3dnow; | |
2572 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_3dnow; | |
2573 } | |
984 | 2574 |
6327 | 2575 SET_QPEL_FUNCS(put_qpel, 0, 16, 3dnow); |
2576 SET_QPEL_FUNCS(put_qpel, 1, 8, 3dnow); | |
2577 SET_QPEL_FUNCS(put_no_rnd_qpel, 0, 16, 3dnow); | |
2578 SET_QPEL_FUNCS(put_no_rnd_qpel, 1, 8, 3dnow); | |
2579 SET_QPEL_FUNCS(avg_qpel, 0, 16, 3dnow); | |
2580 SET_QPEL_FUNCS(avg_qpel, 1, 8, 3dnow); | |
2581 | |
2582 SET_QPEL_FUNCS(put_h264_qpel, 0, 16, 3dnow); | |
2583 SET_QPEL_FUNCS(put_h264_qpel, 1, 8, 3dnow); | |
2584 SET_QPEL_FUNCS(put_h264_qpel, 2, 4, 3dnow); | |
2585 SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, 3dnow); | |
2586 SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, 3dnow); | |
2587 SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, 3dnow); | |
2588 | |
2589 SET_QPEL_FUNCS(put_2tap_qpel, 0, 16, 3dnow); | |
2590 SET_QPEL_FUNCS(put_2tap_qpel, 1, 8, 3dnow); | |
2591 SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, 3dnow); | |
2592 SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, 3dnow); | |
3807
6a40092eb9e6
approximate qpel functions: sacrifice some quality for some decoding speed. enabled on B-frames with -lavdopts fast.
lorenm
parents:
3777
diff
changeset
|
2593 |
6057
03febc8f506f
add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents:
6056
diff
changeset
|
2594 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
|
2595 c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_3dnow; |
6522
dfa76e0734e5
Add missed call to ff_cavsdsp_init_3dnow() in dsputil_init_mmx()
zuxy
parents:
6513
diff
changeset
|
2596 |
dfa76e0734e5
Add missed call to ff_cavsdsp_init_3dnow() in dsputil_init_mmx()
zuxy
parents:
6513
diff
changeset
|
2597 if (ENABLE_CAVS_DECODER) |
dfa76e0734e5
Add missed call to ff_cavsdsp_init_3dnow() in dsputil_init_mmx()
zuxy
parents:
6513
diff
changeset
|
2598 ff_cavsdsp_init_3dnow(c, avctx); |
0 | 2599 } |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
3174
diff
changeset
|
2600 |
6336
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2601 |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2602 #define H264_QPEL_FUNCS(x, y, CPU)\ |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2603 c->put_h264_qpel_pixels_tab[0][x+y*4] = put_h264_qpel16_mc##x##y##_##CPU;\ |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2604 c->put_h264_qpel_pixels_tab[1][x+y*4] = put_h264_qpel8_mc##x##y##_##CPU;\ |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2605 c->avg_h264_qpel_pixels_tab[0][x+y*4] = avg_h264_qpel16_mc##x##y##_##CPU;\ |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2606 c->avg_h264_qpel_pixels_tab[1][x+y*4] = avg_h264_qpel8_mc##x##y##_##CPU; |
6331 | 2607 if((mm_flags & MM_SSE2) && !(mm_flags & MM_3DNOW)){ |
2608 // these functions are slower than mmx on AMD, but faster on Intel | |
6336
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2609 /* FIXME works in most codecs, but crashes svq1 due to unaligned chroma |
6331 | 2610 c->put_pixels_tab[0][0] = put_pixels16_sse2; |
2611 c->avg_pixels_tab[0][0] = avg_pixels16_sse2; | |
6336
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2612 */ |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2613 H264_QPEL_FUNCS(0, 0, sse2); |
6331 | 2614 } |
6336
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2615 if(mm_flags & MM_SSE2){ |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2616 H264_QPEL_FUNCS(0, 1, sse2); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2617 H264_QPEL_FUNCS(0, 2, sse2); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2618 H264_QPEL_FUNCS(0, 3, sse2); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2619 H264_QPEL_FUNCS(1, 1, sse2); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2620 H264_QPEL_FUNCS(1, 2, sse2); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2621 H264_QPEL_FUNCS(1, 3, sse2); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2622 H264_QPEL_FUNCS(2, 1, sse2); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2623 H264_QPEL_FUNCS(2, 2, sse2); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2624 H264_QPEL_FUNCS(2, 3, sse2); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2625 H264_QPEL_FUNCS(3, 1, sse2); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2626 H264_QPEL_FUNCS(3, 2, sse2); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2627 H264_QPEL_FUNCS(3, 3, sse2); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2628 } |
6331 | 2629 #ifdef HAVE_SSSE3 |
2630 if(mm_flags & MM_SSSE3){ | |
6336
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2631 H264_QPEL_FUNCS(1, 0, ssse3); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2632 H264_QPEL_FUNCS(1, 1, ssse3); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2633 H264_QPEL_FUNCS(1, 2, ssse3); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2634 H264_QPEL_FUNCS(1, 3, ssse3); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2635 H264_QPEL_FUNCS(2, 0, ssse3); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2636 H264_QPEL_FUNCS(2, 1, ssse3); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2637 H264_QPEL_FUNCS(2, 2, ssse3); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2638 H264_QPEL_FUNCS(2, 3, ssse3); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2639 H264_QPEL_FUNCS(3, 0, ssse3); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2640 H264_QPEL_FUNCS(3, 1, ssse3); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2641 H264_QPEL_FUNCS(3, 2, ssse3); |
ef3fb5a7e275
sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents:
6335
diff
changeset
|
2642 H264_QPEL_FUNCS(3, 3, ssse3); |
6557 | 2643 c->put_no_rnd_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_ssse3_nornd; |
2644 c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_ssse3_rnd; | |
2645 c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_ssse3_rnd; | |
2646 c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_ssse3; | |
2647 c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_ssse3; | |
6384 | 2648 c->add_png_paeth_prediction= add_png_paeth_prediction_ssse3; |
6331 | 2649 } |
2650 #endif | |
2651 | |
4589
30261f4ed12d
Fix wrong conditional, Snow decoding, not encoding, was SIMD-accelerated.
diego
parents:
4436
diff
changeset
|
2652 #ifdef CONFIG_SNOW_DECODER |
5591 | 2653 if(mm_flags & MM_SSE2 & 0){ |
3210 | 2654 c->horizontal_compose97i = ff_snow_horizontal_compose97i_sse2; |
5602 | 2655 #ifdef HAVE_7REGS |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
3174
diff
changeset
|
2656 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
|
2657 #endif |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
2658 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
|
2659 } |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
3174
diff
changeset
|
2660 else{ |
5594
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5591
diff
changeset
|
2661 if(mm_flags & MM_MMXEXT){ |
3210 | 2662 c->horizontal_compose97i = ff_snow_horizontal_compose97i_mmx; |
5602 | 2663 #ifdef HAVE_7REGS |
3207
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
3174
diff
changeset
|
2664 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
|
2665 #endif |
5594
384629ebcb93
avoid overflow in the 3rd lifting step, this now needs mmx2 at minimum
michael
parents:
5591
diff
changeset
|
2666 } |
3211
b77b5e7072d6
add MMX and SSE versions of ff_snow_inner_add_yblock
gpoirier
parents:
3210
diff
changeset
|
2667 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
|
2668 } |
33110c1008a4
Add the mmx and sse2 implementations of ff_snow_vertical_compose().
gpoirier
parents:
3174
diff
changeset
|
2669 #endif |
3536
545a15c19c91
sse & sse2 implementations of vorbis channel coupling.
lorenm
parents:
3524
diff
changeset
|
2670 |
4197 | 2671 if(mm_flags & MM_3DNOW){ |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2672 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
|
2673 c->vector_fmul = vector_fmul_3dnow; |
7261 | 2674 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2675 c->float_to_int16 = float_to_int16_3dnow; |
7261 | 2676 c->float_to_int16_interleave = float_to_int16_interleave_3dnow; |
2677 } | |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2678 } |
7263 | 2679 if(mm_flags & MM_3DNOWEXT){ |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2680 c->vector_fmul_reverse = vector_fmul_reverse_3dnow2; |
7263 | 2681 c->vector_fmul_window = vector_fmul_window_3dnow2; |
2682 } | |
4197 | 2683 if(mm_flags & MM_SSE){ |
3557
8e13ec0f8aa3
change vorbis_inverse_coupling_sse2() so it works on sse1 cpus
michael
parents:
3541
diff
changeset
|
2684 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
|
2685 c->vector_fmul = vector_fmul_sse; |
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2686 c->float_to_int16 = float_to_int16_sse; |
7261 | 2687 c->float_to_int16_interleave = float_to_int16_interleave_sse; |
3569
c42c03f3b402
convert vector_fmul_reverse_sse2 and vector_fmul_add_add_sse2 to sse
michael
parents:
3568
diff
changeset
|
2688 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
|
2689 c->vector_fmul_add_add = vector_fmul_add_add_sse; |
7261 | 2690 c->vector_fmul_window = vector_fmul_window_sse; |
3568
945caa35ee9a
sse and 3dnow implementations of float->int conversion and mdct windowing.
lorenm
parents:
3561
diff
changeset
|
2691 } |
7226 | 2692 if(mm_flags & MM_SSE2){ |
2693 c->float_to_int16 = float_to_int16_sse2; | |
7261 | 2694 c->float_to_int16_interleave = float_to_int16_interleave_sse2; |
7226 | 2695 } |
4197 | 2696 if(mm_flags & MM_3DNOW) |
3574 | 2697 c->vector_fmul_add_add = vector_fmul_add_add_3dnow; // faster than sse |
7238
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2698 if(mm_flags & MM_SSE2){ |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2699 c->add_int16 = add_int16_sse2; |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2700 c->sub_int16 = sub_int16_sse2; |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2701 c->scalarproduct_int16 = scalarproduct_int16_sse2; |
08cc6e202aa6
SSE2 optimizations for Monkey's Audio decoder vector functions
kostya
parents:
7226
diff
changeset
|
2702 } |
0 | 2703 } |
2967 | 2704 |
6403
9a736918fd90
split encoding part of dsputil_mmx into its own file
aurel
parents:
6391
diff
changeset
|
2705 if (ENABLE_ENCODERS) |
9a736918fd90
split encoding part of dsputil_mmx into its own file
aurel
parents:
6391
diff
changeset
|
2706 dsputilenc_init_mmx(c, avctx); |
9a736918fd90
split encoding part of dsputil_mmx into its own file
aurel
parents:
6391
diff
changeset
|
2707 |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2708 #if 0 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2709 // for speed testing |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2710 get_pixels = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2711 put_pixels_clamped = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2712 add_pixels_clamped = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2713 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2714 pix_abs16x16 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2715 pix_abs16x16_x2 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2716 pix_abs16x16_y2 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2717 pix_abs16x16_xy2 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2718 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2719 put_pixels_tab[0] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2720 put_pixels_tab[1] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2721 put_pixels_tab[2] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2722 put_pixels_tab[3] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2723 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2724 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
|
2725 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
|
2726 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
|
2727 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
|
2728 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2729 avg_pixels_tab[0] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2730 avg_pixels_tab[1] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2731 avg_pixels_tab[2] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2732 avg_pixels_tab[3] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2733 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2734 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
|
2735 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
|
2736 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
|
2737 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
|
2738 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2739 //av_fdct = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2740 //ff_idct = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
2741 #endif |
0 | 2742 } |