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