[MPlayer-dev-eng] [PATCH] cleanup swscale usage

Michael Niedermayer michaelni at gmx.at
Tue May 9 17:01:11 CEST 2006


Hi

On Tue, May 09, 2006 at 08:27:10AM -0400, Jason Tackaberry wrote:
> Hi Luca,
> 
> On Tue, 2006-05-09 at 10:12 +0200, Luca Abeni wrote:
> > I am currently trying to move swscale from the mplayer tree to the
> > ffmpeg tree (so that it can be used by ffmpeg and by other projects).
> > This would require some modifications to swscale (I already posted some
> > patches on the ffmpeg mailing list), and some modifications to mplayer
> > to use the modified swscale.
> 
> Some time ago I looked at porting swscale to xine as a shared library.
> One of the requirements is that it had to compile with -fPIC (for
> x86_64).  This involved changing the code not to clobber the ebx
> register.  I've attached a patch that does this.  It's against an older
> version of swscaler so might not apply cleanly to recent cvs, but should
> give you an idea.
> 
> Unfortunately I hit a roadblock with my efforts and haven't had time to
> revisit it.  I was getting a linker error (not compiler error) on x86_64
> with -fPIC.  I can't find the post I made to mplayer-dev-eng about this,
> but here's a reference to another post on xine devel list:
> 
>    http://article.gmane.org/gmane.comp.video.xine.devel/14594
> 
> I was able to get things working fine on x86 with -fPIC.  It was just
> x86_64 that gave me grief, and my asm-fu isn't strong enough to grok the
> issues in swscaler's code.
> 
> Anyway, I'd be thrilled to see swscaler more portable. :)
> 
> Cheers,
> Jason.

> --- postproc.nofpic/rgb2rgb_template.c	2005-11-29 16:18:36.000000000 -0500
> +++ postproc/rgb2rgb_template.c	2005-11-29 16:21:12.000000000 -0500
> @@ -2099,6 +2099,7 @@
>  	long y;
>  	const long chromWidth= width>>1;
>  #ifdef HAVE_MMX
> +//    printf("rgb24toyv12 MMX: %s:%d\n", __FILE__, __LINE__);

uhm ....

[...]
> -				"lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t" //FIXME optimize
> -				"add %4, %%"REG_b"			\n\t"
> -				WRITEBGR24(%%REGb, %5, %%REGa)
> +				"lea (%%"REG_a", %%"REG_a", 2), %%"REG_c"\n\t" //FIXME optimize
> +				"add %4, %%"REG_c"			\n\t"
> +				WRITEBGR24(%%ecx, %5, %%REGa)

s/%%ecx/%%REGc/


[...]
> @@ -1651,21 +1652,22 @@
>  static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, long width)
>  {
>  #ifdef HAVE_MMX
> +//    printf("bgr24ToY HAVE_MMX: %s:%d\n", __FILE__, __LINE__);
[...]
> +//        printf("hscale filterSize==4: %s:%d\n", __FILE__, __LINE__);
[...]
> +//        printf("hscale filterSize==8: %s:%d\n", __FILE__, __LINE__);
[...]
> +//        printf("hscale else: %s:%d\n", __FILE__, __LINE__);
...

hmm ...


> @@ -2248,7 +2256,7 @@
>  	src= formatConvBuffer;
>      }
>  
> -#ifdef HAVE_MMX
> +#if 0 //def HAVE_MMX

ugh


[...]
> -#if defined(ARCH_X86) || defined(ARCH_X86_64)
> +#if 0 && (defined(ARCH_X86) || defined(ARCH_X86_64))
> +// FIXME: make this work with -fPIC

ugh2


>  #ifdef HAVE_MMX2
>  	int i;
>  	if(canMMX2BeUsed)
>  	{
> +        printf("hyscale canMMX2BeUsed: %s:%d\n", __FILE__, __LINE__);

error out of patience ...

[...]

-- 
Michael

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the MPlayer-dev-eng mailing list