comparison libswscale/swscale.c @ 29348:1ee2b495f09b

AltiVec code and runtime cpudetect do not require CONFIG_GPL. Make sure the latter is only checked for x86 optimizations, which are GPL.
author diego
date Thu, 25 Jun 2009 20:06:03 +0000
parents e07f2855672a
children 853373376acb
comparison
equal deleted inserted replaced
29347:e07f2855672a 29348:1ee2b495f09b
1299 } 1299 }
1300 1300
1301 1301
1302 //Note: we have C, MMX, MMX2, 3DNOW versions, there is no 3DNOW+MMX2 one 1302 //Note: we have C, MMX, MMX2, 3DNOW versions, there is no 3DNOW+MMX2 one
1303 //Plain C versions 1303 //Plain C versions
1304 #if (!HAVE_MMX && !HAVE_ALTIVEC) || CONFIG_RUNTIME_CPUDETECT || !CONFIG_GPL 1304 #if ((!HAVE_MMX || !CONFIG_GPL) && !HAVE_ALTIVEC) || CONFIG_RUNTIME_CPUDETECT
1305 #define COMPILE_C 1305 #define COMPILE_C
1306 #endif 1306 #endif
1307 1307
1308 #if ARCH_PPC 1308 #if ARCH_PPC
1309 #if HAVE_ALTIVEC || CONFIG_RUNTIME_CPUDETECT 1309 #if HAVE_ALTIVEC || CONFIG_RUNTIME_CPUDETECT
1970 } 1970 }
1971 } 1971 }
1972 1972
1973 static SwsFunc getSwsFunc(SwsContext *c) 1973 static SwsFunc getSwsFunc(SwsContext *c)
1974 { 1974 {
1975 #if CONFIG_RUNTIME_CPUDETECT && CONFIG_GPL 1975 #if CONFIG_RUNTIME_CPUDETECT
1976 int flags = c->flags; 1976 int flags = c->flags;
1977 1977
1978 #if ARCH_X86 1978 #if ARCH_X86 && CONFIG_GPL
1979 // ordered per speed fastest first 1979 // ordered per speed fastest first
1980 if (flags & SWS_CPU_CAPS_MMX2) { 1980 if (flags & SWS_CPU_CAPS_MMX2) {
1981 sws_init_swScale_MMX2(c); 1981 sws_init_swScale_MMX2(c);
1982 return swScale_MMX2; 1982 return swScale_MMX2;
1983 } else if (flags & SWS_CPU_CAPS_3DNOW) { 1983 } else if (flags & SWS_CPU_CAPS_3DNOW) {
2001 return swScale_C; 2001 return swScale_C;
2002 } 2002 }
2003 #endif 2003 #endif
2004 sws_init_swScale_C(c); 2004 sws_init_swScale_C(c);
2005 return swScale_C; 2005 return swScale_C;
2006 #endif /* ARCH_X86 */ 2006 #endif /* ARCH_X86 && CONFIG_GPL */
2007 #else //CONFIG_RUNTIME_CPUDETECT 2007 #else //CONFIG_RUNTIME_CPUDETECT
2008 #if HAVE_MMX2 2008 #if HAVE_MMX2
2009 sws_init_swScale_MMX2(c); 2009 sws_init_swScale_MMX2(c);
2010 return swScale_MMX2; 2010 return swScale_MMX2;
2011 #elif HAVE_AMD3DNOW 2011 #elif HAVE_AMD3DNOW
2563 #if ARCH_X86 2563 #if ARCH_X86
2564 if (flags & SWS_CPU_CAPS_MMX) 2564 if (flags & SWS_CPU_CAPS_MMX)
2565 __asm__ volatile("emms\n\t"::: "memory"); 2565 __asm__ volatile("emms\n\t"::: "memory");
2566 #endif 2566 #endif
2567 2567
2568 #if !CONFIG_RUNTIME_CPUDETECT || !CONFIG_GPL //ensure that the flags match the compiled variant if cpudetect is off 2568 #if !CONFIG_RUNTIME_CPUDETECT //ensure that the flags match the compiled variant if cpudetect is off
2569 flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN); 2569 flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN);
2570 #if HAVE_MMX2 2570 #if HAVE_MMX2
2571 flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2; 2571 flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2;
2572 #elif HAVE_AMD3DNOW 2572 #elif HAVE_AMD3DNOW
2573 flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_3DNOW; 2573 flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_3DNOW;