Mercurial > libavcodec.hg
annotate i386/dsputil_mmx.c @ 936:caa77cd960c0 libavcodec
qpel encoding
4mv+b frames encoding finally fixed
chroma ME
5 comparission functions for ME
b frame encoding speedup
wmv2 codec (unfinished)
user specified diamond size for EPZS
author | michaelni |
---|---|
date | Fri, 27 Dec 2002 23:51:46 +0000 |
parents | 725ef4ea3ecc |
children | 13aec7e50c52 |
rev | line source |
---|---|
0 | 1 /* |
2 * MMX optimized DSP utils | |
429 | 3 * Copyright (c) 2000, 2001 Fabrice Bellard. |
0 | 4 * |
429 | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Lesser General Public | |
7 * License as published by the Free Software Foundation; either | |
8 * version 2 of the License, or (at your option) any later version. | |
0 | 9 * |
429 | 10 * This library is distributed in the hope that it will be useful, |
0 | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
429 | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Lesser General Public License for more details. | |
0 | 14 * |
429 | 15 * You should have received a copy of the GNU Lesser General Public |
16 * License along with this library; if not, write to the Free Software | |
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
0 | 18 * |
19 * MMX optimization by Nick Kurshev <nickols_k@mail.ru> | |
20 */ | |
21 | |
22 #include "../dsputil.h" | |
23 | |
5 | 24 int mm_flags; /* multimedia extension flags */ |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
25 /* FIXME use them in static form */ |
294 | 26 int pix_abs16x16_mmx(UINT8 *blk1, UINT8 *blk2, int lx); |
27 int pix_abs16x16_x2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |
28 int pix_abs16x16_y2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |
29 int pix_abs16x16_xy2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |
30 | |
31 int pix_abs16x16_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |
32 int pix_abs16x16_x2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |
33 int pix_abs16x16_y2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |
34 int pix_abs16x16_xy2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |
35 | |
36 int pix_abs8x8_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |
37 int pix_abs8x8_x2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |
38 int pix_abs8x8_y2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |
39 int pix_abs8x8_xy2_mmx(UINT8 *blk1, UINT8 *blk2, int lx); | |
40 | |
41 int pix_abs8x8_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |
42 int pix_abs8x8_x2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |
43 int pix_abs8x8_y2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |
44 int pix_abs8x8_xy2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx); | |
45 | |
936 | 46 int sad16x16_mmx(void *s, UINT8 *blk1, UINT8 *blk2, int lx); |
47 int sad8x8_mmx(void *s, UINT8 *blk1, UINT8 *blk2, int lx); | |
48 int sad16x16_mmx2(void *s, UINT8 *blk1, UINT8 *blk2, int lx); | |
49 int sad8x8_mmx2(void *s, UINT8 *blk1, UINT8 *blk2, int lx); | |
50 | |
0 | 51 /* pixel operations */ |
387 | 52 static const uint64_t mm_bone __attribute__ ((aligned(8))) = 0x0101010101010101ULL; |
53 static const uint64_t mm_wone __attribute__ ((aligned(8))) = 0x0001000100010001ULL; | |
54 static const uint64_t mm_wtwo __attribute__ ((aligned(8))) = 0x0002000200020002ULL; | |
0 | 55 |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
56 #define JUMPALIGN() __asm __volatile (".balign 8"::) |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
57 #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
|
58 |
448 | 59 #define MOVQ_WONE(regd) \ |
60 __asm __volatile ( \ | |
61 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ | |
62 "psrlw $15, %%" #regd ::) | |
63 | |
64 #define MOVQ_BFE(regd) \ | |
65 __asm __volatile ( \ | |
66 "pcmpeqd %%" #regd ", %%" #regd " \n\t"\ | |
67 "paddb %%" #regd ", %%" #regd " \n\t" ::) | |
68 | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
69 #ifndef PIC |
448 | 70 #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
|
71 #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
|
72 #else |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
73 // 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
|
74 // pcmpeqd -> -1 |
448 | 75 #define MOVQ_BONE(regd) \ |
247
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 "packuswb %%" #regd ", %%" #regd " \n\t" ::) | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
80 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
81 #define MOVQ_WTWO(regd) \ |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
82 __asm __volatile ( \ |
448 | 83 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ |
84 "psrlw $15, %%" #regd " \n\t" \ | |
85 "psllw $1, %%" #regd " \n\t"::) | |
387 | 86 |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
87 #endif |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
88 |
448 | 89 // 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
|
90 // first argument is unmodifed and second is trashed |
471 | 91 // regfe is supposed to contain 0xfefefefefefefefe |
92 #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
|
93 "movq " #rega ", " #regr " \n\t"\ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
94 "pand " #regb ", " #regr " \n\t"\ |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
95 "pxor " #rega ", " #regb " \n\t"\ |
471 | 96 "pand " #regfe "," #regb " \n\t"\ |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
97 "psrlq $1, " #regb " \n\t"\ |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
98 "paddb " #regb ", " #regr " \n\t" |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
99 |
471 | 100 #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
|
101 "movq " #rega ", " #regr " \n\t"\ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
102 "por " #regb ", " #regr " \n\t"\ |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
103 "pxor " #rega ", " #regb " \n\t"\ |
471 | 104 "pand " #regfe "," #regb " \n\t"\ |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
105 "psrlq $1, " #regb " \n\t"\ |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
106 "psubb " #regb ", " #regr " \n\t" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
107 |
471 | 108 // mm6 is supposed to contain 0xfefefefefefefefe |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
109 #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
|
110 "movq " #rega ", " #regr " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
111 "movq " #regc ", " #regp " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
112 "pand " #regb ", " #regr " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
113 "pand " #regd ", " #regp " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
114 "pxor " #rega ", " #regb " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
115 "pxor " #regc ", " #regd " \n\t"\ |
448 | 116 "pand %%mm6, " #regb " \n\t"\ |
117 "pand %%mm6, " #regd " \n\t"\ | |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
118 "psrlq $1, " #regb " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
119 "psrlq $1, " #regd " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
120 "paddb " #regb ", " #regr " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
121 "paddb " #regd ", " #regp " \n\t" |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
122 |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
123 #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
|
124 "movq " #rega ", " #regr " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
125 "movq " #regc ", " #regp " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
126 "por " #regb ", " #regr " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
127 "por " #regd ", " #regp " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
128 "pxor " #rega ", " #regb " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
129 "pxor " #regc ", " #regd " \n\t"\ |
448 | 130 "pand %%mm6, " #regb " \n\t"\ |
131 "pand %%mm6, " #regd " \n\t"\ | |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
132 "psrlq $1, " #regd " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
133 "psrlq $1, " #regb " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
134 "psubb " #regb ", " #regr " \n\t"\ |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
135 "psubb " #regd ", " #regp " \n\t" |
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
136 |
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 /* MMX no rounding */ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
139 #define DEF(x, y) x ## _no_rnd_ ## y ##_mmx |
448 | 140 #define SET_RND MOVQ_WONE |
141 #define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX_NO_RND(a, b, c, d, e, f) | |
471 | 142 #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
|
143 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
144 #include "dsputil_mmx_rnd.h" |
444
a5edef76dac6
* new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents:
438
diff
changeset
|
145 |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
146 #undef DEF |
448 | 147 #undef SET_RND |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
148 #undef PAVGBP |
471 | 149 #undef PAVGB |
445
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
150 /***********************************/ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
151 /* MMX rounding */ |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
152 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
153 #define DEF(x, y) x ## _ ## y ##_mmx |
448 | 154 #define SET_RND MOVQ_WTWO |
155 #define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX(a, b, c, d, e, f) | |
471 | 156 #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
|
157 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
158 #include "dsputil_mmx_rnd.h" |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
159 |
62c01dbdc1e0
* code with new PAVGB for MMX only CPU splited into separate file
kabi
parents:
444
diff
changeset
|
160 #undef DEF |
448 | 161 #undef SET_RND |
446
efe0c0d40577
* reenabled original xy2 put routine - rounding error is really bad with
kabi
parents:
445
diff
changeset
|
162 #undef PAVGBP |
471 | 163 #undef PAVGB |
387 | 164 |
0 | 165 /***********************************/ |
166 /* 3Dnow specific */ | |
167 | |
168 #define DEF(x) x ## _3dnow | |
169 /* for Athlons PAVGUSB is prefered */ | |
170 #define PAVGB "pavgusb" | |
171 | |
172 #include "dsputil_mmx_avg.h" | |
173 | |
174 #undef DEF | |
175 #undef PAVGB | |
176 | |
177 /***********************************/ | |
178 /* MMX2 specific */ | |
179 | |
386 | 180 #define DEF(x) x ## _mmx2 |
0 | 181 |
182 /* Introduced only in MMX2 set */ | |
183 #define PAVGB "pavgb" | |
184 | |
185 #include "dsputil_mmx_avg.h" | |
186 | |
187 #undef DEF | |
188 #undef PAVGB | |
189 | |
190 /***********************************/ | |
191 /* standard MMX */ | |
192 | |
193 static void get_pixels_mmx(DCTELEM *block, const UINT8 *pixels, int line_size) | |
194 { | |
386 | 195 asm volatile( |
196 "movl $-128, %%eax \n\t" | |
197 "pxor %%mm7, %%mm7 \n\t" | |
198 ".balign 16 \n\t" | |
199 "1: \n\t" | |
200 "movq (%0), %%mm0 \n\t" | |
201 "movq (%0, %2), %%mm2 \n\t" | |
202 "movq %%mm0, %%mm1 \n\t" | |
203 "movq %%mm2, %%mm3 \n\t" | |
204 "punpcklbw %%mm7, %%mm0 \n\t" | |
205 "punpckhbw %%mm7, %%mm1 \n\t" | |
206 "punpcklbw %%mm7, %%mm2 \n\t" | |
207 "punpckhbw %%mm7, %%mm3 \n\t" | |
208 "movq %%mm0, (%1, %%eax)\n\t" | |
209 "movq %%mm1, 8(%1, %%eax)\n\t" | |
210 "movq %%mm2, 16(%1, %%eax)\n\t" | |
211 "movq %%mm3, 24(%1, %%eax)\n\t" | |
212 "addl %3, %0 \n\t" | |
213 "addl $32, %%eax \n\t" | |
214 "js 1b \n\t" | |
215 : "+r" (pixels) | |
216 : "r" (block+64), "r" (line_size), "r" (line_size*2) | |
217 : "%eax" | |
218 ); | |
0 | 219 } |
220 | |
936 | 221 static inline void diff_pixels_mmx(DCTELEM *block, const UINT8 *s1, const UINT8 *s2, int stride) |
324 | 222 { |
223 asm volatile( | |
386 | 224 "pxor %%mm7, %%mm7 \n\t" |
225 "movl $-128, %%eax \n\t" | |
324 | 226 ".balign 16 \n\t" |
227 "1: \n\t" | |
228 "movq (%0), %%mm0 \n\t" | |
229 "movq (%1), %%mm2 \n\t" | |
230 "movq %%mm0, %%mm1 \n\t" | |
231 "movq %%mm2, %%mm3 \n\t" | |
232 "punpcklbw %%mm7, %%mm0 \n\t" | |
233 "punpckhbw %%mm7, %%mm1 \n\t" | |
234 "punpcklbw %%mm7, %%mm2 \n\t" | |
235 "punpckhbw %%mm7, %%mm3 \n\t" | |
236 "psubw %%mm2, %%mm0 \n\t" | |
237 "psubw %%mm3, %%mm1 \n\t" | |
238 "movq %%mm0, (%2, %%eax)\n\t" | |
239 "movq %%mm1, 8(%2, %%eax)\n\t" | |
240 "addl %3, %0 \n\t" | |
241 "addl %3, %1 \n\t" | |
242 "addl $16, %%eax \n\t" | |
243 "jnz 1b \n\t" | |
244 : "+r" (s1), "+r" (s2) | |
245 : "r" (block+64), "r" (stride) | |
246 : "%eax" | |
247 ); | |
248 } | |
249 | |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
250 void put_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size) |
0 | 251 { |
252 const DCTELEM *p; | |
253 UINT8 *pix; | |
254 | |
255 /* read the pixels */ | |
256 p = block; | |
257 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
258 /* unrolled loop */ |
0 | 259 __asm __volatile( |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
260 "movq %3, %%mm0\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
261 "movq 8%3, %%mm1\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
262 "movq 16%3, %%mm2\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
263 "movq 24%3, %%mm3\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
264 "movq 32%3, %%mm4\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
265 "movq 40%3, %%mm5\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
266 "movq 48%3, %%mm6\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
267 "movq 56%3, %%mm7\n\t" |
0 | 268 "packuswb %%mm1, %%mm0\n\t" |
269 "packuswb %%mm3, %%mm2\n\t" | |
270 "packuswb %%mm5, %%mm4\n\t" | |
271 "packuswb %%mm7, %%mm6\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
272 "movq %%mm0, (%0)\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
273 "movq %%mm2, (%0, %1)\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
274 "movq %%mm4, (%0, %1, 2)\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
275 "movq %%mm6, (%0, %2)\n\t" |
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
276 ::"r" (pix), "r" (line_size), "r" (line_size*3), "m"(*p) |
0 | 277 :"memory"); |
278 pix += line_size*4; | |
279 p += 32; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
280 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
281 // 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
|
282 // compiler would generate some very strange code |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
283 // thus using "r" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
284 __asm __volatile( |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
285 "movq (%3), %%mm0\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
286 "movq 8(%3), %%mm1\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
287 "movq 16(%3), %%mm2\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
288 "movq 24(%3), %%mm3\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
289 "movq 32(%3), %%mm4\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
290 "movq 40(%3), %%mm5\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
291 "movq 48(%3), %%mm6\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
292 "movq 56(%3), %%mm7\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
293 "packuswb %%mm1, %%mm0\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
294 "packuswb %%mm3, %%mm2\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
295 "packuswb %%mm5, %%mm4\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
296 "packuswb %%mm7, %%mm6\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
297 "movq %%mm0, (%0)\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
298 "movq %%mm2, (%0, %1)\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
299 "movq %%mm4, (%0, %1, 2)\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
300 "movq %%mm6, (%0, %2)\n\t" |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
301 ::"r" (pix), "r" (line_size), "r" (line_size*3), "r"(p) |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
302 :"memory"); |
0 | 303 } |
304 | |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
305 void add_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size) |
0 | 306 { |
307 const DCTELEM *p; | |
308 UINT8 *pix; | |
309 int i; | |
310 | |
311 /* read the pixels */ | |
312 p = block; | |
313 pix = pixels; | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
314 MOVQ_ZERO(mm7); |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
315 i = 4; |
342
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
316 do { |
0 | 317 __asm __volatile( |
342
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
318 "movq (%2), %%mm0\n\t" |
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
319 "movq 8(%2), %%mm1\n\t" |
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
320 "movq 16(%2), %%mm2\n\t" |
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
321 "movq 24(%2), %%mm3\n\t" |
0 | 322 "movq %0, %%mm4\n\t" |
323 "movq %1, %%mm6\n\t" | |
324 "movq %%mm4, %%mm5\n\t" | |
325 "punpcklbw %%mm7, %%mm4\n\t" | |
326 "punpckhbw %%mm7, %%mm5\n\t" | |
327 "paddsw %%mm4, %%mm0\n\t" | |
328 "paddsw %%mm5, %%mm1\n\t" | |
329 "movq %%mm6, %%mm5\n\t" | |
330 "punpcklbw %%mm7, %%mm6\n\t" | |
331 "punpckhbw %%mm7, %%mm5\n\t" | |
332 "paddsw %%mm6, %%mm2\n\t" | |
333 "paddsw %%mm5, %%mm3\n\t" | |
334 "packuswb %%mm1, %%mm0\n\t" | |
335 "packuswb %%mm3, %%mm2\n\t" | |
336 "movq %%mm0, %0\n\t" | |
337 "movq %%mm2, %1\n\t" | |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
42
diff
changeset
|
338 :"+m"(*pix), "+m"(*(pix+line_size)) |
342
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
339 :"r"(p) |
0 | 340 :"memory"); |
341 pix += line_size*2; | |
342 p += 16; | |
342
8635a7036395
* fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents:
324
diff
changeset
|
343 } while (--i); |
0 | 344 } |
345 | |
651 | 346 static void put_pixels8_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h) |
0 | 347 { |
471 | 348 __asm __volatile( |
420 | 349 "lea (%3, %3), %%eax \n\t" |
422 | 350 ".balign 8 \n\t" |
420 | 351 "1: \n\t" |
352 "movq (%1), %%mm0 \n\t" | |
353 "movq (%1, %3), %%mm1 \n\t" | |
354 "movq %%mm0, (%2) \n\t" | |
355 "movq %%mm1, (%2, %3) \n\t" | |
356 "addl %%eax, %1 \n\t" | |
357 "addl %%eax, %2 \n\t" | |
358 "movq (%1), %%mm0 \n\t" | |
359 "movq (%1, %3), %%mm1 \n\t" | |
360 "movq %%mm0, (%2) \n\t" | |
361 "movq %%mm1, (%2, %3) \n\t" | |
362 "addl %%eax, %1 \n\t" | |
363 "addl %%eax, %2 \n\t" | |
364 "subl $4, %0 \n\t" | |
365 "jnz 1b \n\t" | |
366 : "+g"(h), "+r" (pixels), "+r" (block) | |
367 : "r"(line_size) | |
368 : "%eax", "memory" | |
369 ); | |
0 | 370 } |
371 | |
651 | 372 static void put_pixels16_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h) |
373 { | |
374 __asm __volatile( | |
375 "lea (%3, %3), %%eax \n\t" | |
376 ".balign 8 \n\t" | |
377 "1: \n\t" | |
378 "movq (%1), %%mm0 \n\t" | |
379 "movq 8(%1), %%mm4 \n\t" | |
380 "movq (%1, %3), %%mm1 \n\t" | |
381 "movq 8(%1, %3), %%mm5 \n\t" | |
382 "movq %%mm0, (%2) \n\t" | |
383 "movq %%mm4, 8(%2) \n\t" | |
384 "movq %%mm1, (%2, %3) \n\t" | |
385 "movq %%mm5, 8(%2, %3) \n\t" | |
386 "addl %%eax, %1 \n\t" | |
387 "addl %%eax, %2 \n\t" | |
388 "movq (%1), %%mm0 \n\t" | |
389 "movq 8(%1), %%mm4 \n\t" | |
390 "movq (%1, %3), %%mm1 \n\t" | |
391 "movq 8(%1, %3), %%mm5 \n\t" | |
392 "movq %%mm0, (%2) \n\t" | |
393 "movq %%mm4, 8(%2) \n\t" | |
394 "movq %%mm1, (%2, %3) \n\t" | |
395 "movq %%mm5, 8(%2, %3) \n\t" | |
396 "addl %%eax, %1 \n\t" | |
397 "addl %%eax, %2 \n\t" | |
398 "subl $4, %0 \n\t" | |
399 "jnz 1b \n\t" | |
400 : "+g"(h), "+r" (pixels), "+r" (block) | |
401 : "r"(line_size) | |
402 : "%eax", "memory" | |
403 ); | |
404 } | |
405 | |
296 | 406 static void clear_blocks_mmx(DCTELEM *blocks) |
407 { | |
471 | 408 __asm __volatile( |
296 | 409 "pxor %%mm7, %%mm7 \n\t" |
410 "movl $-128*6, %%eax \n\t" | |
411 "1: \n\t" | |
412 "movq %%mm7, (%0, %%eax) \n\t" | |
413 "movq %%mm7, 8(%0, %%eax) \n\t" | |
414 "movq %%mm7, 16(%0, %%eax) \n\t" | |
415 "movq %%mm7, 24(%0, %%eax) \n\t" | |
416 "addl $32, %%eax \n\t" | |
417 " js 1b \n\t" | |
418 : : "r" (((int)blocks)+128*6) | |
419 : "%eax" | |
420 ); | |
421 } | |
422 | |
688 | 423 static int pix_sum16_mmx(UINT8 * pix, int line_size){ |
424 const int h=16; | |
425 int sum; | |
426 int index= -line_size*h; | |
427 | |
428 __asm __volatile( | |
429 "pxor %%mm7, %%mm7 \n\t" | |
430 "pxor %%mm6, %%mm6 \n\t" | |
431 "1: \n\t" | |
432 "movq (%2, %1), %%mm0 \n\t" | |
433 "movq (%2, %1), %%mm1 \n\t" | |
434 "movq 8(%2, %1), %%mm2 \n\t" | |
435 "movq 8(%2, %1), %%mm3 \n\t" | |
436 "punpcklbw %%mm7, %%mm0 \n\t" | |
437 "punpckhbw %%mm7, %%mm1 \n\t" | |
438 "punpcklbw %%mm7, %%mm2 \n\t" | |
439 "punpckhbw %%mm7, %%mm3 \n\t" | |
440 "paddw %%mm0, %%mm1 \n\t" | |
441 "paddw %%mm2, %%mm3 \n\t" | |
442 "paddw %%mm1, %%mm3 \n\t" | |
443 "paddw %%mm3, %%mm6 \n\t" | |
444 "addl %3, %1 \n\t" | |
445 " js 1b \n\t" | |
446 "movq %%mm6, %%mm5 \n\t" | |
447 "psrlq $32, %%mm6 \n\t" | |
448 "paddw %%mm5, %%mm6 \n\t" | |
449 "movq %%mm6, %%mm5 \n\t" | |
450 "psrlq $16, %%mm6 \n\t" | |
451 "paddw %%mm5, %%mm6 \n\t" | |
452 "movd %%mm6, %0 \n\t" | |
453 "andl $0xFFFF, %0 \n\t" | |
454 : "=&r" (sum), "+r" (index) | |
455 : "r" (pix - index), "r" (line_size) | |
456 ); | |
457 | |
458 return sum; | |
459 } | |
460 | |
866 | 461 static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w){ |
462 int i=0; | |
463 asm volatile( | |
464 "1: \n\t" | |
465 "movq (%1, %0), %%mm0 \n\t" | |
466 "movq (%2, %0), %%mm1 \n\t" | |
467 "paddb %%mm0, %%mm1 \n\t" | |
468 "movq %%mm1, (%2, %0) \n\t" | |
469 "movq 8(%1, %0), %%mm0 \n\t" | |
470 "movq 8(%2, %0), %%mm1 \n\t" | |
471 "paddb %%mm0, %%mm1 \n\t" | |
472 "movq %%mm1, 8(%2, %0) \n\t" | |
473 "addl $16, %0 \n\t" | |
474 "cmpl %3, %0 \n\t" | |
475 " jb 1b \n\t" | |
476 : "+r" (i) | |
477 : "r"(src), "r"(dst), "r"(w-15) | |
478 ); | |
479 for(; i<w; i++) | |
480 dst[i+0] += src[i+0]; | |
481 } | |
482 | |
483 static void diff_bytes_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){ | |
484 int i=0; | |
485 asm volatile( | |
486 "1: \n\t" | |
487 "movq (%2, %0), %%mm0 \n\t" | |
488 "movq (%1, %0), %%mm1 \n\t" | |
489 "psubb %%mm0, %%mm1 \n\t" | |
490 "movq %%mm1, (%3, %0) \n\t" | |
491 "movq 8(%2, %0), %%mm0 \n\t" | |
492 "movq 8(%1, %0), %%mm1 \n\t" | |
493 "psubb %%mm0, %%mm1 \n\t" | |
494 "movq %%mm1, 8(%3, %0) \n\t" | |
495 "addl $16, %0 \n\t" | |
496 "cmpl %4, %0 \n\t" | |
497 " jb 1b \n\t" | |
498 : "+r" (i) | |
499 : "r"(src1), "r"(src2), "r"(dst), "r"(w-15) | |
500 ); | |
501 for(; i<w; i++) | |
502 dst[i+0] = src1[i+0]-src2[i+0]; | |
503 } | |
936 | 504 #define LBUTTERFLY(a,b)\ |
505 "paddw " #b ", " #a " \n\t"\ | |
506 "paddw " #b ", " #b " \n\t"\ | |
507 "psubw " #a ", " #b " \n\t" | |
866 | 508 |
936 | 509 #define HADAMARD48\ |
510 LBUTTERFLY(%%mm0, %%mm1)\ | |
511 LBUTTERFLY(%%mm2, %%mm3)\ | |
512 LBUTTERFLY(%%mm4, %%mm5)\ | |
513 LBUTTERFLY(%%mm6, %%mm7)\ | |
514 \ | |
515 LBUTTERFLY(%%mm0, %%mm2)\ | |
516 LBUTTERFLY(%%mm1, %%mm3)\ | |
517 LBUTTERFLY(%%mm4, %%mm6)\ | |
518 LBUTTERFLY(%%mm5, %%mm7)\ | |
519 \ | |
520 LBUTTERFLY(%%mm0, %%mm4)\ | |
521 LBUTTERFLY(%%mm1, %%mm5)\ | |
522 LBUTTERFLY(%%mm2, %%mm6)\ | |
523 LBUTTERFLY(%%mm3, %%mm7) | |
524 | |
525 #define MMABS(a,z)\ | |
526 "pxor " #z ", " #z " \n\t"\ | |
527 "pcmpgtw " #a ", " #z " \n\t"\ | |
528 "pxor " #z ", " #a " \n\t"\ | |
529 "psubw " #z ", " #a " \n\t" | |
530 | |
531 #define MMABS_SUM(a,z, sum)\ | |
532 "pxor " #z ", " #z " \n\t"\ | |
533 "pcmpgtw " #a ", " #z " \n\t"\ | |
534 "pxor " #z ", " #a " \n\t"\ | |
535 "psubw " #z ", " #a " \n\t"\ | |
536 "paddusw " #a ", " #sum " \n\t" | |
537 | |
538 | |
539 #define SBUTTERFLY(a,b,t,n)\ | |
540 "movq " #a ", " #t " \n\t" /* abcd */\ | |
541 "punpckl" #n " " #b ", " #a " \n\t" /* aebf */\ | |
542 "punpckh" #n " " #b ", " #t " \n\t" /* cgdh */\ | |
543 | |
544 #define TRANSPOSE4(a,b,c,d,t)\ | |
545 SBUTTERFLY(a,b,t,wd) /* a=aebf t=cgdh */\ | |
546 SBUTTERFLY(c,d,b,wd) /* c=imjn b=kolp */\ | |
547 SBUTTERFLY(a,c,d,dq) /* a=aeim d=bfjn */\ | |
548 SBUTTERFLY(t,b,c,dq) /* t=cgko c=dhlp */ | |
549 | |
550 #define LOAD4(o, a, b, c, d)\ | |
551 "movq "#o"(%1), " #a " \n\t"\ | |
552 "movq "#o"+16(%1), " #b " \n\t"\ | |
553 "movq "#o"+32(%1), " #c " \n\t"\ | |
554 "movq "#o"+48(%1), " #d " \n\t" | |
555 | |
556 #define STORE4(o, a, b, c, d)\ | |
557 "movq "#a", "#o"(%1) \n\t"\ | |
558 "movq "#b", "#o"+16(%1) \n\t"\ | |
559 "movq "#c", "#o"+32(%1) \n\t"\ | |
560 "movq "#d", "#o"+48(%1) \n\t"\ | |
561 | |
562 static int hadamard8_diff_mmx(void *s, uint8_t *src1, uint8_t *src2, int stride){ | |
563 uint64_t temp[16] __align8; | |
564 int sum=0; | |
565 | |
566 diff_pixels_mmx((DCTELEM*)temp, src1, src2, stride); | |
567 | |
568 asm volatile( | |
569 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3) | |
570 LOAD4(64, %%mm4, %%mm5, %%mm6, %%mm7) | |
571 | |
572 HADAMARD48 | |
573 | |
574 "movq %%mm7, 112(%1) \n\t" | |
575 | |
576 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7) | |
577 STORE4(0 , %%mm0, %%mm3, %%mm7, %%mm2) | |
578 | |
579 "movq 112(%1), %%mm7 \n\t" | |
580 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0) | |
581 STORE4(64, %%mm4, %%mm7, %%mm0, %%mm6) | |
582 | |
583 LOAD4(8 , %%mm0, %%mm1, %%mm2, %%mm3) | |
584 LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7) | |
585 | |
586 HADAMARD48 | |
587 | |
588 "movq %%mm7, 120(%1) \n\t" | |
589 | |
590 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7) | |
591 STORE4(8 , %%mm0, %%mm3, %%mm7, %%mm2) | |
592 | |
593 "movq 120(%1), %%mm7 \n\t" | |
594 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0) | |
595 "movq %%mm7, %%mm5 \n\t"//FIXME remove | |
596 "movq %%mm6, %%mm7 \n\t" | |
597 "movq %%mm0, %%mm6 \n\t" | |
598 // STORE4(72, %%mm4, %%mm7, %%mm0, %%mm6) //FIXME remove | |
599 | |
600 LOAD4(64, %%mm0, %%mm1, %%mm2, %%mm3) | |
601 // LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7) | |
602 | |
603 HADAMARD48 | |
604 "movq %%mm7, 64(%1) \n\t" | |
605 MMABS(%%mm0, %%mm7) | |
606 MMABS_SUM(%%mm1, %%mm7, %%mm0) | |
607 MMABS_SUM(%%mm2, %%mm7, %%mm0) | |
608 MMABS_SUM(%%mm3, %%mm7, %%mm0) | |
609 MMABS_SUM(%%mm4, %%mm7, %%mm0) | |
610 MMABS_SUM(%%mm5, %%mm7, %%mm0) | |
611 MMABS_SUM(%%mm6, %%mm7, %%mm0) | |
612 "movq 64(%1), %%mm1 \n\t" | |
613 MMABS_SUM(%%mm1, %%mm7, %%mm0) | |
614 "movq %%mm0, 64(%1) \n\t" | |
615 | |
616 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3) | |
617 LOAD4(8 , %%mm4, %%mm5, %%mm6, %%mm7) | |
618 | |
619 HADAMARD48 | |
620 "movq %%mm7, (%1) \n\t" | |
621 MMABS(%%mm0, %%mm7) | |
622 MMABS_SUM(%%mm1, %%mm7, %%mm0) | |
623 MMABS_SUM(%%mm2, %%mm7, %%mm0) | |
624 MMABS_SUM(%%mm3, %%mm7, %%mm0) | |
625 MMABS_SUM(%%mm4, %%mm7, %%mm0) | |
626 MMABS_SUM(%%mm5, %%mm7, %%mm0) | |
627 MMABS_SUM(%%mm6, %%mm7, %%mm0) | |
628 "movq (%1), %%mm1 \n\t" | |
629 MMABS_SUM(%%mm1, %%mm7, %%mm0) | |
630 "movq 64(%1), %%mm1 \n\t" | |
631 MMABS_SUM(%%mm1, %%mm7, %%mm0) | |
632 | |
633 "movq %%mm0, %%mm1 \n\t" | |
634 "psrlq $32, %%mm0 \n\t" | |
635 "paddusw %%mm1, %%mm0 \n\t" | |
636 "movq %%mm0, %%mm1 \n\t" | |
637 "psrlq $16, %%mm0 \n\t" | |
638 "paddusw %%mm1, %%mm0 \n\t" | |
639 "movd %%mm0, %0 \n\t" | |
640 | |
641 : "=r" (sum) | |
642 : "r"(temp) | |
643 ); | |
644 return sum&0xFFFF; | |
645 } | |
646 | |
647 WARPER88_1616(hadamard8_diff_mmx, hadamard8_diff16_mmx) | |
866 | 648 |
393 | 649 #if 0 |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
650 static void just_return() { return; } |
393 | 651 #endif |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
652 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
653 void dsputil_init_mmx(DSPContext* c, unsigned mask) |
0 | 654 { |
655 mm_flags = mm_support(); | |
631
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
656 #if 0 |
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
657 fprintf(stderr, "libavcodec: CPU flags:"); |
0 | 658 if (mm_flags & MM_MMX) |
631
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
659 fprintf(stderr, " mmx"); |
0 | 660 if (mm_flags & MM_MMXEXT) |
631
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
661 fprintf(stderr, " mmxext"); |
0 | 662 if (mm_flags & MM_3DNOW) |
631
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
663 fprintf(stderr, " 3dnow"); |
0 | 664 if (mm_flags & MM_SSE) |
631
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
665 fprintf(stderr, " sse"); |
0 | 666 if (mm_flags & MM_SSE2) |
631
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
667 fprintf(stderr, " sse2"); |
47a8964ba5cd
be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents:
629
diff
changeset
|
668 fprintf(stderr, "\n"); |
0 | 669 #endif |
670 | |
671 if (mm_flags & MM_MMX) { | |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
672 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
|
673 c->diff_pixels = diff_pixels_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
674 c->put_pixels_clamped = put_pixels_clamped_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
675 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
|
676 c->clear_blocks = clear_blocks_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
677 c->pix_sum = pix_sum16_mmx; |
415 | 678 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
679 c->pix_abs16x16 = pix_abs16x16_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
680 c->pix_abs16x16_x2 = pix_abs16x16_x2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
681 c->pix_abs16x16_y2 = pix_abs16x16_y2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
682 c->pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
683 c->pix_abs8x8 = pix_abs8x8_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
684 c->pix_abs8x8_x2 = pix_abs8x8_x2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
685 c->pix_abs8x8_y2 = pix_abs8x8_y2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
686 c->pix_abs8x8_xy2 = pix_abs8x8_xy2_mmx; |
574 | 687 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
688 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
|
689 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
|
690 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
|
691 c->put_pixels_tab[0][3] = put_pixels16_xy2_mmx; |
0 | 692 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
693 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
|
694 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
|
695 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
|
696 c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_mmx; |
651 | 697 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
698 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
|
699 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
|
700 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
|
701 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx; |
415 | 702 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
703 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
|
704 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
|
705 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
|
706 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
|
707 |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
708 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
|
709 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
|
710 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
|
711 c->put_pixels_tab[1][3] = put_pixels8_xy2_mmx; |
0 | 712 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
713 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
|
714 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
|
715 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
|
716 c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_mmx; |
651 | 717 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
718 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
|
719 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
|
720 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
|
721 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx; |
651 | 722 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
723 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
|
724 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
|
725 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
|
726 c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy2_mmx; |
866 | 727 |
728 c->add_bytes= add_bytes_mmx; | |
729 c->diff_bytes= diff_bytes_mmx; | |
936 | 730 |
731 c->hadamard8_diff[0]= hadamard8_diff16_mmx; | |
732 c->hadamard8_diff[1]= hadamard8_diff_mmx; | |
733 | |
734 c->sad[0]= sad16x16_mmx; | |
735 c->sad[1]= sad8x8_mmx; | |
736 | |
0 | 737 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
|
738 c->pix_abs16x16 = pix_abs16x16_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
739 c->pix_abs16x16_x2 = pix_abs16x16_x2_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
740 c->pix_abs16x16_y2 = pix_abs16x16_y2_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
741 c->pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx2; |
415 | 742 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
743 c->pix_abs8x8 = pix_abs8x8_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
744 c->pix_abs8x8_x2 = pix_abs8x8_x2_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
745 c->pix_abs8x8_y2 = pix_abs8x8_y2_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
746 c->pix_abs8x8_xy2 = pix_abs8x8_xy2_mmx2; |
386 | 747 |
936 | 748 c->sad[0]= sad16x16_mmx2; |
749 c->sad[1]= sad8x8_mmx2; | |
750 | |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
751 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
|
752 c->put_pixels_tab[0][2] = put_pixels16_y2_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
753 c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
754 c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmx2; |
651 | 755 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
756 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
|
757 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
|
758 c->avg_pixels_tab[0][2] = avg_pixels16_y2_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
759 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx2; |
415 | 760 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
761 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
|
762 c->put_pixels_tab[1][2] = put_pixels8_y2_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
763 c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
764 c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx2; |
651 | 765 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
766 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
|
767 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
|
768 c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx2; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
769 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx2; |
0 | 770 } 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
|
771 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
|
772 c->put_pixels_tab[0][2] = put_pixels16_y2_3dnow; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
773 c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_3dnow; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
774 c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_3dnow; |
393 | 775 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
776 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
|
777 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
|
778 c->avg_pixels_tab[0][2] = avg_pixels16_y2_3dnow; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
779 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_3dnow; |
651 | 780 |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
781 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
|
782 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
|
783 c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_3dnow; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
784 c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_3dnow; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
785 |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
786 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
|
787 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
|
788 c->avg_pixels_tab[1][2] = avg_pixels8_y2_3dnow; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
789 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_3dnow; |
0 | 790 } |
791 } | |
247
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
792 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
793 #if 0 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
794 // for speed testing |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
795 get_pixels = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
796 put_pixels_clamped = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
797 add_pixels_clamped = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
798 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
799 pix_abs16x16 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
800 pix_abs16x16_x2 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
801 pix_abs16x16_y2 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
802 pix_abs16x16_xy2 = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
803 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
804 put_pixels_tab[0] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
805 put_pixels_tab[1] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
806 put_pixels_tab[2] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
807 put_pixels_tab[3] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
808 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
809 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
|
810 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
|
811 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
|
812 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
|
813 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
814 avg_pixels_tab[0] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
815 avg_pixels_tab[1] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
816 avg_pixels_tab[2] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
817 avg_pixels_tab[3] = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
818 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
819 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
|
820 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
|
821 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
|
822 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
|
823 |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
824 //av_fdct = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
825 //ff_idct = just_return; |
6f48cacd9ed9
* some modifications to allow gcc to compile same code for -fPIC
kabi
parents:
188
diff
changeset
|
826 #endif |
0 | 827 } |
402 | 828 |
829 /* remove any non bit exact operation (testing purpose). NOTE that | |
830 this function should be kept as small as possible because it is | |
831 always difficult to test automatically non bit exact cases. */ | |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
832 void dsputil_set_bit_exact_mmx(DSPContext* c, unsigned mask) |
402 | 833 { |
834 if (mm_flags & MM_MMX) { | |
651 | 835 /* MMX2 & 3DNOW */ |
853
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
836 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
|
837 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
|
838 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
839 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
|
840 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
|
841 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx; |
651 | 842 |
402 | 843 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
|
844 c->pix_abs16x16_x2 = pix_abs16x16_x2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
845 c->pix_abs16x16_y2 = pix_abs16x16_y2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
846 c->pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
847 c->pix_abs8x8_x2 = pix_abs8x8_x2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
848 c->pix_abs8x8_y2 = pix_abs8x8_y2_mmx; |
eacc2dd8fd9d
* using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents:
706
diff
changeset
|
849 c->pix_abs8x8_xy2= pix_abs8x8_xy2_mmx; |
402 | 850 } |
851 } | |
852 } |