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