Mercurial > mplayer.hg
comparison libswscale/swscale.c @ 29404:efbe0c7de351
Do not misuse HAVE_ defines. Introduce COMPILE_TEMPLATE_ defines and use them
instead.
author | ramiro |
---|---|
date | Mon, 27 Jul 2009 06:47:41 +0000 |
parents | 2d985cc879c9 |
children | 9ad97332be79 |
comparison
equal
deleted
inserted
replaced
29403:6c1b9f334f97 | 29404:efbe0c7de351 |
---|---|
1322 #if ((HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL | 1322 #if ((HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL |
1323 #define COMPILE_3DNOW | 1323 #define COMPILE_3DNOW |
1324 #endif | 1324 #endif |
1325 #endif //ARCH_X86 | 1325 #endif //ARCH_X86 |
1326 | 1326 |
1327 #undef HAVE_MMX | 1327 #define COMPILE_TEMPLATE_MMX 0 |
1328 #undef HAVE_MMX2 | 1328 #define COMPILE_TEMPLATE_MMX2 0 |
1329 #undef HAVE_AMD3DNOW | 1329 #define COMPILE_TEMPLATE_AMD3DNOW 0 |
1330 #undef HAVE_ALTIVEC | 1330 #define COMPILE_TEMPLATE_ALTIVEC 0 |
1331 #define HAVE_MMX 0 | |
1332 #define HAVE_MMX2 0 | |
1333 #define HAVE_AMD3DNOW 0 | |
1334 #define HAVE_ALTIVEC 0 | |
1335 | 1331 |
1336 #ifdef COMPILE_C | 1332 #ifdef COMPILE_C |
1337 #define RENAME(a) a ## _C | 1333 #define RENAME(a) a ## _C |
1338 #include "swscale_template.c" | 1334 #include "swscale_template.c" |
1339 #endif | 1335 #endif |
1340 | 1336 |
1341 #ifdef COMPILE_ALTIVEC | 1337 #ifdef COMPILE_ALTIVEC |
1342 #undef RENAME | 1338 #undef RENAME |
1343 #undef HAVE_ALTIVEC | 1339 #undef COMPILE_TEMPLATE_ALTIVEC |
1344 #define HAVE_ALTIVEC 1 | 1340 #define COMPILE_TEMPLATE_ALTIVEC 1 |
1345 #define RENAME(a) a ## _altivec | 1341 #define RENAME(a) a ## _altivec |
1346 #include "swscale_template.c" | 1342 #include "swscale_template.c" |
1347 #endif | 1343 #endif |
1348 | 1344 |
1349 #if ARCH_X86 | 1345 #if ARCH_X86 |
1350 | 1346 |
1351 //MMX versions | 1347 //MMX versions |
1352 #ifdef COMPILE_MMX | 1348 #ifdef COMPILE_MMX |
1353 #undef RENAME | 1349 #undef RENAME |
1354 #undef HAVE_MMX | 1350 #undef COMPILE_TEMPLATE_MMX |
1355 #undef HAVE_MMX2 | 1351 #undef COMPILE_TEMPLATE_MMX2 |
1356 #undef HAVE_AMD3DNOW | 1352 #undef COMPILE_TEMPLATE_AMD3DNOW |
1357 #define HAVE_MMX 1 | 1353 #define COMPILE_TEMPLATE_MMX 1 |
1358 #define HAVE_MMX2 0 | 1354 #define COMPILE_TEMPLATE_MMX2 0 |
1359 #define HAVE_AMD3DNOW 0 | 1355 #define COMPILE_TEMPLATE_AMD3DNOW 0 |
1360 #define RENAME(a) a ## _MMX | 1356 #define RENAME(a) a ## _MMX |
1361 #include "swscale_template.c" | 1357 #include "swscale_template.c" |
1362 #endif | 1358 #endif |
1363 | 1359 |
1364 //MMX2 versions | 1360 //MMX2 versions |
1365 #ifdef COMPILE_MMX2 | 1361 #ifdef COMPILE_MMX2 |
1366 #undef RENAME | 1362 #undef RENAME |
1367 #undef HAVE_MMX | 1363 #undef COMPILE_TEMPLATE_MMX |
1368 #undef HAVE_MMX2 | 1364 #undef COMPILE_TEMPLATE_MMX2 |
1369 #undef HAVE_AMD3DNOW | 1365 #undef COMPILE_TEMPLATE_AMD3DNOW |
1370 #define HAVE_MMX 1 | 1366 #define COMPILE_TEMPLATE_MMX 1 |
1371 #define HAVE_MMX2 1 | 1367 #define COMPILE_TEMPLATE_MMX2 1 |
1372 #define HAVE_AMD3DNOW 0 | 1368 #define COMPILE_TEMPLATE_AMD3DNOW 0 |
1373 #define RENAME(a) a ## _MMX2 | 1369 #define RENAME(a) a ## _MMX2 |
1374 #include "swscale_template.c" | 1370 #include "swscale_template.c" |
1375 #endif | 1371 #endif |
1376 | 1372 |
1377 //3DNOW versions | 1373 //3DNOW versions |
1378 #ifdef COMPILE_3DNOW | 1374 #ifdef COMPILE_3DNOW |
1379 #undef RENAME | 1375 #undef RENAME |
1380 #undef HAVE_MMX | 1376 #undef COMPILE_TEMPLATE_MMX |
1381 #undef HAVE_MMX2 | 1377 #undef COMPILE_TEMPLATE_MMX2 |
1382 #undef HAVE_AMD3DNOW | 1378 #undef COMPILE_TEMPLATE_AMD3DNOW |
1383 #define HAVE_MMX 1 | 1379 #define COMPILE_TEMPLATE_MMX 1 |
1384 #define HAVE_MMX2 0 | 1380 #define COMPILE_TEMPLATE_MMX2 0 |
1385 #define HAVE_AMD3DNOW 1 | 1381 #define COMPILE_TEMPLATE_AMD3DNOW 1 |
1386 #define RENAME(a) a ## _3DNow | 1382 #define RENAME(a) a ## _3DNow |
1387 #include "swscale_template.c" | 1383 #include "swscale_template.c" |
1388 #endif | 1384 #endif |
1389 | 1385 |
1390 #endif //ARCH_X86 | 1386 #endif //ARCH_X86 |
1391 | |
1392 // minor note: the HAVE_xyz are messed up after this line so don't use them | |
1393 | 1387 |
1394 static double getSplineCoeff(double a, double b, double c, double d, double dist) | 1388 static double getSplineCoeff(double a, double b, double c, double d, double dist) |
1395 { | 1389 { |
1396 // printf("%f %f %f %f %f\n", a,b,c,d,dist); | 1390 // printf("%f %f %f %f %f\n", a,b,c,d,dist); |
1397 if (dist<=1.0) return ((d*dist + c)*dist + b)*dist +a; | 1391 if (dist<=1.0) return ((d*dist + c)*dist + b)*dist +a; |
2001 #endif | 1995 #endif |
2002 sws_init_swScale_C(c); | 1996 sws_init_swScale_C(c); |
2003 return swScale_C; | 1997 return swScale_C; |
2004 #endif /* ARCH_X86 && CONFIG_GPL */ | 1998 #endif /* ARCH_X86 && CONFIG_GPL */ |
2005 #else //CONFIG_RUNTIME_CPUDETECT | 1999 #else //CONFIG_RUNTIME_CPUDETECT |
2006 #if HAVE_MMX2 | 2000 #if COMPILE_TEMPLATE_MMX2 |
2007 sws_init_swScale_MMX2(c); | 2001 sws_init_swScale_MMX2(c); |
2008 return swScale_MMX2; | 2002 return swScale_MMX2; |
2009 #elif HAVE_AMD3DNOW | 2003 #elif COMPILE_TEMPLATE_AMD3DNOW |
2010 sws_init_swScale_3DNow(c); | 2004 sws_init_swScale_3DNow(c); |
2011 return swScale_3DNow; | 2005 return swScale_3DNow; |
2012 #elif HAVE_MMX | 2006 #elif COMPILE_TEMPLATE_MMX |
2013 sws_init_swScale_MMX(c); | 2007 sws_init_swScale_MMX(c); |
2014 return swScale_MMX; | 2008 return swScale_MMX; |
2015 #elif HAVE_ALTIVEC | 2009 #elif COMPILE_TEMPLATE_ALTIVEC |
2016 sws_init_swScale_altivec(c); | 2010 sws_init_swScale_altivec(c); |
2017 return swScale_altivec; | 2011 return swScale_altivec; |
2018 #else | 2012 #else |
2019 sws_init_swScale_C(c); | 2013 sws_init_swScale_C(c); |
2020 return swScale_C; | 2014 return swScale_C; |
2563 __asm__ volatile("emms\n\t"::: "memory"); | 2557 __asm__ volatile("emms\n\t"::: "memory"); |
2564 #endif | 2558 #endif |
2565 | 2559 |
2566 #if !CONFIG_RUNTIME_CPUDETECT //ensure that the flags match the compiled variant if cpudetect is off | 2560 #if !CONFIG_RUNTIME_CPUDETECT //ensure that the flags match the compiled variant if cpudetect is off |
2567 flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN); | 2561 flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN); |
2568 #if HAVE_MMX2 | 2562 #if COMPILE_TEMPLATE_MMX2 |
2569 flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2; | 2563 flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2; |
2570 #elif HAVE_AMD3DNOW | 2564 #elif COMPILE_TEMPLATE_AMD3DNOW |
2571 flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_3DNOW; | 2565 flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_3DNOW; |
2572 #elif HAVE_MMX | 2566 #elif COMPILE_TEMPLATE_MMX |
2573 flags |= SWS_CPU_CAPS_MMX; | 2567 flags |= SWS_CPU_CAPS_MMX; |
2574 #elif HAVE_ALTIVEC | 2568 #elif COMPILE_TEMPLATE_ALTIVEC |
2575 flags |= SWS_CPU_CAPS_ALTIVEC; | 2569 flags |= SWS_CPU_CAPS_ALTIVEC; |
2576 #elif ARCH_BFIN | 2570 #elif ARCH_BFIN |
2577 flags |= SWS_CPU_CAPS_BFIN; | 2571 flags |= SWS_CPU_CAPS_BFIN; |
2578 #endif | 2572 #endif |
2579 #endif /* CONFIG_RUNTIME_CPUDETECT */ | 2573 #endif /* CONFIG_RUNTIME_CPUDETECT */ |