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