[MPlayer-dev-eng] [PATCH] -fPIC support for libswscale

Michael Niedermayer michaelni at gmx.at
Sat Aug 12 13:40:02 CEST 2006


Hi

On Fri, Aug 11, 2006 at 11:09:12PM -0400, Jason Tackaberry wrote:
> The attached patch allows libswscale to be compiled with -fPIC.  In most
> cases I was able to use another register in lieu of ebx.  (Note that
> this patch also includes the patch in my previous email.)
> 
> I have tested the following (each separately with MMX, MMX2, and 3DNOW):
> 
> Scaling and/or colorspace conversion (non-special converters):
>       * YV12->BGR32 BICUBIC downscale
>       * YV12->BGR24 BICUBIC downscale
>       * RGB24->YUY2 BILINEAR upscale
>       * BGR24->YUY2 BILINEAR upscale
>       * BGR24->YUY2 FAST BILINEAR upscale
>       * BGR32->RGB32 FAST BILINEAR downscale
>       * Y8->Y8 BICUBLIN downscale
>       * YV12->YV12 BUCUBIC downscale
>       * YV12->YV12 BUCUBIC upscale
> 
> Algorithms:
>       * all algorithms, YV12->YV12 downscale and upscale
> 
> Special converters;
>       * YV12->YUY2
>       * YV12->BGR24
>       * BGR24->BGR32
>       * BGR24->YV12
> 
> Last year I did some work porting SwScaler to xine, which I've picked up
> again.  Making libswscale build with -fPIC is necessary for us, so I
> hope this patch has a chance of being merged.
> 
> My asm-fu is weak, so hopefully somebody clueful can review this patch.

have you tried compiling on gcc 2.95, 3.4 and 4.something? thats probably
a good idea to try as gcc can be fairly picky ...

[...]
> @@ -2248,6 +2248,7 @@
>  static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW, int xInc,
>  				  int16_t *filter, int16_t *filterPos, long filterSize)
>  {
> +
>  #ifdef HAVE_MMX

cosmetic change

[...]
> @@ -2346,13 +2350,14 @@
>  		filterPos-= counter/2;
>  		dst-= counter/2;
>  		asm volatile(
> +			//"push %%"REG_b"   		\n\t"
>  			"pxor %%mm7, %%mm7		\n\t"

trash

[...]
> @@ -2518,7 +2525,7 @@
>  
>  			:: "m" (src), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos),
>  			"m" (funnyYCode)
> -			: "%"REG_a, "%"REG_b, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D
> +			: "%"REG_a, "%"REG_BP, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D

ive a bad feeling about this change, i wont accpet this unless it is tested
on 2.95,3.4,4.something (test here means the specific piece above must be
executed and produce a binary identical picture)
the problem is gcc uses ebp to access "m" if -fomit-frame-pointer isnt used
(so yes the test MUST NOT use that of course)

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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