Mercurial > mplayer.hg
comparison postproc/swscale.c @ 3152:54710806be56
runtime cpu detection optional (compiles faster)
author | michael |
---|---|
date | Tue, 27 Nov 2001 01:19:56 +0000 |
parents | b196b915fdc4 |
children | 0b172eb639f1 |
comparison
equal
deleted
inserted
replaced
3151:790a27fc64f1 | 3152:54710806be56 |
---|---|
134 } | 134 } |
135 #endif | 135 #endif |
136 | 136 |
137 //Note: we have C, X86, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one | 137 //Note: we have C, X86, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one |
138 //Plain C versions | 138 //Plain C versions |
139 #if !defined (HAVE_MMX) || defined (RUNTIME_CPUDETECT) | |
140 #define COMPILE_C | |
141 #endif | |
142 | |
143 #ifdef CAN_COMPILE_X86_ASM | |
144 | |
145 #if (defined (HAVE_MMX) && !defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT) | |
146 #define COMPILE_MMX | |
147 #endif | |
148 | |
149 #if defined (HAVE_MMX2) || defined (RUNTIME_CPUDETECT) | |
150 #define COMPILE_MMX2 | |
151 #endif | |
152 | |
153 #if (defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT) | |
154 #define COMPILE_3DNOW | |
155 #endif | |
156 #endif //CAN_COMPILE_X86_ASM | |
157 | |
158 #undef HAVE_MMX | |
159 #undef HAVE_MMX2 | |
160 #undef HAVE_3DNOW | |
161 #undef ARCH_X86 | |
162 | |
163 #ifdef COMPILE_C | |
139 #undef HAVE_MMX | 164 #undef HAVE_MMX |
140 #undef HAVE_MMX2 | 165 #undef HAVE_MMX2 |
141 #undef HAVE_3DNOW | 166 #undef HAVE_3DNOW |
142 #undef ARCH_X86 | 167 #undef ARCH_X86 |
143 #define RENAME(a) a ## _C | 168 #define RENAME(a) a ## _C |
144 #include "swscale_template.c" | 169 #include "swscale_template.c" |
170 #endif | |
145 | 171 |
146 #ifdef CAN_COMPILE_X86_ASM | 172 #ifdef CAN_COMPILE_X86_ASM |
147 | 173 |
148 //X86 versions | 174 //X86 versions |
149 /* | 175 /* |
154 #define ARCH_X86 | 180 #define ARCH_X86 |
155 #define RENAME(a) a ## _X86 | 181 #define RENAME(a) a ## _X86 |
156 #include "swscale_template.c" | 182 #include "swscale_template.c" |
157 */ | 183 */ |
158 //MMX versions | 184 //MMX versions |
185 #ifdef COMPILE_MMX | |
159 #undef RENAME | 186 #undef RENAME |
160 #define HAVE_MMX | 187 #define HAVE_MMX |
161 #undef HAVE_MMX2 | 188 #undef HAVE_MMX2 |
162 #undef HAVE_3DNOW | 189 #undef HAVE_3DNOW |
163 #define ARCH_X86 | 190 #define ARCH_X86 |
164 #define RENAME(a) a ## _MMX | 191 #define RENAME(a) a ## _MMX |
165 #include "swscale_template.c" | 192 #include "swscale_template.c" |
193 #endif | |
166 | 194 |
167 //MMX2 versions | 195 //MMX2 versions |
196 #ifdef COMPILE_MMX2 | |
168 #undef RENAME | 197 #undef RENAME |
169 #define HAVE_MMX | 198 #define HAVE_MMX |
170 #define HAVE_MMX2 | 199 #define HAVE_MMX2 |
171 #undef HAVE_3DNOW | 200 #undef HAVE_3DNOW |
172 #define ARCH_X86 | 201 #define ARCH_X86 |
173 #define RENAME(a) a ## _MMX2 | 202 #define RENAME(a) a ## _MMX2 |
174 #include "swscale_template.c" | 203 #include "swscale_template.c" |
204 #endif | |
175 | 205 |
176 //3DNOW versions | 206 //3DNOW versions |
207 #ifdef COMPILE_3DNOW | |
177 #undef RENAME | 208 #undef RENAME |
178 #define HAVE_MMX | 209 #define HAVE_MMX |
179 #undef HAVE_MMX2 | 210 #undef HAVE_MMX2 |
180 #define HAVE_3DNOW | 211 #define HAVE_3DNOW |
181 #define ARCH_X86 | 212 #define ARCH_X86 |
182 #define RENAME(a) a ## _3DNow | 213 #define RENAME(a) a ## _3DNow |
183 #include "swscale_template.c" | 214 #include "swscale_template.c" |
215 #endif | |
184 | 216 |
185 #endif //CAN_COMPILE_X86_ASM | 217 #endif //CAN_COMPILE_X86_ASM |
186 | 218 |
187 // minor note: the HAVE_xyz is messed up after that line so dont use it | 219 // minor note: the HAVE_xyz is messed up after that line so dont use it |
188 | 220 |
198 unsigned int s_xinc,unsigned int s_yinc){ | 230 unsigned int s_xinc,unsigned int s_yinc){ |
199 | 231 |
200 // scaling factors: | 232 // scaling factors: |
201 //static int s_yinc=(vo_dga_src_height<<16)/vo_dga_vp_height; | 233 //static int s_yinc=(vo_dga_src_height<<16)/vo_dga_vp_height; |
202 //static int s_xinc=(vo_dga_src_width<<8)/vo_dga_vp_width; | 234 //static int s_xinc=(vo_dga_src_width<<8)/vo_dga_vp_width; |
203 | 235 #ifdef RUNTIME_CPUDETECT |
204 #ifdef CAN_COMPILE_X86_ASM | 236 #ifdef CAN_COMPILE_X86_ASM |
205 // ordered per speed fasterst first | 237 // ordered per speed fasterst first |
206 if(gCpuCaps.hasMMX2) | 238 if(gCpuCaps.hasMMX2) |
207 SwScale_YV12slice_MMX2(srcptr, stride, y, h, dstptr, dststride, dstw, dstbpp, s_xinc, s_yinc); | 239 SwScale_YV12slice_MMX2(srcptr, stride, y, h, dstptr, dststride, dstw, dstbpp, s_xinc, s_yinc); |
208 else if(gCpuCaps.has3DNow) | 240 else if(gCpuCaps.has3DNow) |
212 else | 244 else |
213 SwScale_YV12slice_C(srcptr, stride, y, h, dstptr, dststride, dstw, dstbpp, s_xinc, s_yinc); | 245 SwScale_YV12slice_C(srcptr, stride, y, h, dstptr, dststride, dstw, dstbpp, s_xinc, s_yinc); |
214 #else | 246 #else |
215 SwScale_YV12slice_C(srcptr, stride, y, h, dstptr, dststride, dstw, dstbpp, s_xinc, s_yinc); | 247 SwScale_YV12slice_C(srcptr, stride, y, h, dstptr, dststride, dstw, dstbpp, s_xinc, s_yinc); |
216 #endif | 248 #endif |
249 #else //RUNTIME_CPUDETECT | |
250 #ifdef HAVE_MMX2 | |
251 SwScale_YV12slice_MMX2(srcptr, stride, y, h, dstptr, dststride, dstw, dstbpp, s_xinc, s_yinc); | |
252 #elif defined (HAVE_3DNOW) | |
253 SwScale_YV12slice_3DNow(srcptr, stride, y, h, dstptr, dststride, dstw, dstbpp, s_xinc, s_yinc); | |
254 #elif defined (HAVE_MMX) | |
255 SwScale_YV12slice_MMX(srcptr, stride, y, h, dstptr, dststride, dstw, dstbpp, s_xinc, s_yinc); | |
256 #else | |
257 SwScale_YV12slice_C(srcptr, stride, y, h, dstptr, dststride, dstw, dstbpp, s_xinc, s_yinc); | |
258 #endif | |
259 #endif //!RUNTIME_CPUDETECT | |
217 | 260 |
218 } | 261 } |
219 | 262 |
220 void SwScale_Init(){ | 263 void SwScale_Init(){ |
221 // generating tables: | 264 // generating tables: |