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