>From fe4c17bce5fb24e499d647fce4d67c2f8b450035 Mon Sep 17 00:00:00 2001 From: Keiji Costantini Date: Wed, 9 Jul 2008 23:20:36 +0900 Subject: [PATCH] Checks of sws_getContext() moved up --- swscale.c | 37 +++++++++++++++++++------------------ 1 files changed, 19 insertions(+), 18 deletions(-) diff --git a/swscale.c b/swscale.c index 44596b5..90a3351 100644 --- a/swscale.c +++ b/swscale.c @@ -2220,24 +2220,6 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH int unscaled, needsDither; int srcRange, dstRange; SwsFilter dummyFilter= {NULL, NULL, NULL, NULL}; -#if defined(ARCH_X86) - if (flags & SWS_CPU_CAPS_MMX) - asm volatile("emms\n\t"::: "memory"); -#endif - -#if !defined(RUNTIME_CPUDETECT) || !defined (CONFIG_GPL) //ensure that the flags match the compiled variant if cpudetect is off - flags = sws_getContext_setcpuflag(flags); -#endif /* RUNTIME_CPUDETECT */ - if (clip_table[512] != 255) globalInit(); - if (!rgb15to16) sws_rgb2rgb_init(flags); - - unscaled = (srcW == dstW && srcH == dstH); - needsDither= (isBGR(dstFormat) || isRGB(dstFormat)) - && (fmt_depth(dstFormat))<24 - && ((fmt_depth(dstFormat))<(fmt_depth(srcFormat)) || (!(isRGB(srcFormat) || isBGR(srcFormat)))); - - srcRange = handle_jpeg(&srcFormat); - dstRange = handle_jpeg(&dstFormat); if (!isSupportedIn(srcFormat)) { @@ -2262,6 +2244,25 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH return NULL; } +#if defined(ARCH_X86) + if (flags & SWS_CPU_CAPS_MMX) + asm volatile("emms\n\t"::: "memory"); +#endif + +#if !defined(RUNTIME_CPUDETECT) || !defined (CONFIG_GPL) //ensure that the flags match the compiled variant if cpudetect is off + flags = sws_getContext_setcpuflag(flags); +#endif /* RUNTIME_CPUDETECT */ + if (clip_table[512] != 255) globalInit(); + if (!rgb15to16) sws_rgb2rgb_init(flags); + + unscaled = (srcW == dstW && srcH == dstH); + needsDither= (isBGR(dstFormat) || isRGB(dstFormat)) + && (fmt_depth(dstFormat))<24 + && ((fmt_depth(dstFormat))<(fmt_depth(srcFormat)) || (!(isRGB(srcFormat) || isBGR(srcFormat)))); + + srcRange = handle_jpeg(&srcFormat); + dstRange = handle_jpeg(&dstFormat); + if (!dstFilter) dstFilter= &dummyFilter; if (!srcFilter) srcFilter= &dummyFilter; -- 1.5.4.5