[FFmpeg-soc] [PATCH] 1/4 Split sws_getContext_setcpuflag from sws_getContext
Michael Niedermayer
michaelni at gmx.at
Wed Jun 11 07:13:27 CEST 2008
On Wed, Jun 11, 2008 at 02:33:54AM +0200, Keiji Costantini wrote:
> Actual objective is simplify the code.
> This is achieved splitting big functions into smaller ones, and reorganize
> them in a logical method.
>
> Those new functions are intended provisionals, the goal is to move specific
> ones into separate files (es. arch-specific ones).
>
> I post 4 patches, one for email, numbered accordingly.
>
> Finally I apologize for my absence in this period, I just finished written
> exam yesterday (will have oral part arond 24 so I will not be active around
> that time).
> --
> Keiji Costantini
> >From 828fe28348d7e51e3c77fd6d94b02204fd5a2104 Mon Sep 17 00:00:00 2001
> From: strites <strites at gmail.com>
> 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);
I see no advantage in spliting this out, that said i also see no big
disadvantage in doing it except that the code is more fragmented.
also it at least should be
flags= setcpuflag(flags);
but as said i dont see what this is good for.
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The educated differ from the uneducated as much as the living from the
dead. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-soc/attachments/20080611/97499f38/attachment.pgp>
More information about the FFmpeg-soc
mailing list