>From 828fe28348d7e51e3c77fd6d94b02204fd5a2104 Mon Sep 17 00:00:00 2001 From: strites Date: Wed, 11 Jun 2008 00:25:03 +0200 Subject: [PATCH] Split sws_getContext_setcpuflag from sws_getContext --- swscale.c | 28 ++++++++++++++++------------ 1 files changed, 16 insertions(+), 12 deletions(-) diff --git a/swscale.c b/swscale.c index 069d75e..2835812 100644 --- a/swscale.c +++ b/swscale.c @@ -1926,6 +1926,21 @@ static int handle_jpeg(int *format) } } +static inline void sws_getContext_setcpuflag(int *flags) { + *flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN); +#ifdef HAVE_MMX2 + *flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2; +#elif defined (HAVE_3DNOW) + *flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_3DNOW; +#elif defined (HAVE_MMX) + *flags |= SWS_CPU_CAPS_MMX; +#elif defined (HAVE_ALTIVEC) + *flags |= SWS_CPU_CAPS_ALTIVEC; +#elif defined (ARCH_BFIN) + *flags |= SWS_CPU_CAPS_BFIN; +#endif +} + SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, double *param){ @@ -1941,18 +1956,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH #endif #if !defined(RUNTIME_CPUDETECT) || !defined (CONFIG_GPL) //ensure that the flags match the compiled variant if cpudetect is off - flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN); -#ifdef HAVE_MMX2 - flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2; -#elif defined (HAVE_3DNOW) - flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_3DNOW; -#elif defined (HAVE_MMX) - flags |= SWS_CPU_CAPS_MMX; -#elif defined (HAVE_ALTIVEC) - flags |= SWS_CPU_CAPS_ALTIVEC; -#elif defined (ARCH_BFIN) - flags |= SWS_CPU_CAPS_BFIN; -#endif + sws_getContext_setcpuflag(&flags); #endif /* RUNTIME_CPUDETECT */ if (clip_table[512] != 255) globalInit(); if (!rgb15to16) sws_rgb2rgb_init(flags); -- 1.5.3.7