On Mon, Apr 11, 2011 at 11:07:39AM +0200, Luca Barbato wrote:
> With this commit we should have all the arch specific code moved away.
> Init pattern now:
> - generic C init first
> - arch specific init later overwriting
>
> In future the arch specific init will overwrite just the generics for
> which we have an optimization.
> ---
> libswscale/Makefile | 3 +-
> libswscale/rgb2rgb.c | 94 +----------------------------
> libswscale/x86/rgb2rgb.c | 146
> ++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 152 insertions(+), 91 deletions(-)
> create mode 100644 libswscale/x86/rgb2rgb.c
>
> index e6d7971..9e27e82 100644
> --- a/libswscale/rgb2rgb.c
> +++ b/libswscale/rgb2rgb.c
> @@ -130,21 +51,14 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) =
> 0x0000001f0000001fULL;
> 32-bit C version, and and&add trick by Michael Niedermayer
> */
>
> +void rgb2rgb_init_x86();
> +
> void sws_rgb2rgb_init(int flags)
> {
> -
> + rgb2rgb_init_c();
> #if HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX
> - if (flags & SWS_CPU_CAPS_SSE2)
> - rgb2rgb_init_SSE2();
> - else if (flags & SWS_CPU_CAPS_MMX2)
> - rgb2rgb_init_MMX2();
> - else if (flags & SWS_CPU_CAPS_3DNOW)
> - rgb2rgb_init_3DNOW();
> - else if (flags & SWS_CPU_CAPS_MMX)
> - rgb2rgb_init_MMX();
> - else
> + rgb2rgb_init_x86();
> #endif /* HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX */
> - rgb2rgb_init_c();
> }
change condition to #if ARCH_X86 or something, the function is always present
on x86 even if empty, isn't it?
> #if LIBSWSCALE_VERSION_MAJOR < 1
> diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c
> new file mode 100644
> index 0000000..a1130c3
> --- /dev/null
> +++ b/libswscale/x86/rgb2rgb.c
[...]
> +
> +/*
> + RGB15->RGB16 original by Strepto/Astral
> + ported to gcc & bugfixed : A'rpi
> + MMX2, 3DNOW optimization by Nick Kurshev
> + 32-bit C version, and and&add trick by Michael Niedermayer
> +*/
that comment does not belong here
> +void rgb2rgb_init_x86(int flags);
is that requirement by modern GCC to declare function before its
implementation in the same file?
> +void rgb2rgb_init_x86(int flags)
> +{
> +
> +#if HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX
> + if (flags & SWS_CPU_CAPS_SSE2)
> + rgb2rgb_init_SSE2();
> + else if (flags & SWS_CPU_CAPS_MMX2)
> + rgb2rgb_init_MMX2();
> + else if (flags & SWS_CPU_CAPS_3DNOW)
> + rgb2rgb_init_3DNOW();
> + else if (flags & SWS_CPU_CAPS_MMX)
> + rgb2rgb_init_MMX();
> +#endif /* HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX */
> +}
> --
> 1.7.4.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel