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