[MPlayer-dev-eng] [PATCH] Bug with SWS_FAST_BILINEAR and runtime CPU detection in libswscale

Jason Tackaberry tack at urandom.ca
Sat Aug 12 02:40:06 CEST 2006


When runtime CPU detection is enabled, swscale_template.c will be
compiled three times, with HAVE_MMX, HAVE_MMX2/HAVE_MMX, and then
HAVE_3DNOW.  It will compile with HAVE_3DNOW last:

        //3DNOW versions
        #ifdef COMPILE_3DNOW
        #undef RENAME
        #define HAVE_MMX
        #undef HAVE_MMX2
        #define HAVE_3DNOW
        #define RENAME(a) a ## _3DNow
        #include "swscale_template.c"
        #endif

The compile then proceeds onto the rest of the code in swscale.c, but
note that HAVE_MMX2 is now undefined, even though swscale_template.c
will have been compiled with HAVE_MMX2.  This causes a problem in
hyscale and hcscale when SWS_FAST_BILINEAR is used, because the code
path followed for HAVE_MMX2 expects the mmx2FilterPos to be non-null (it
is dereferenced in the asm code).  However, the code that allocates the
memory for this in swscale.c doesn't get compiled because in swscale.c
HAVE_MMX2 got undefined.

The attached patch fixes this problem by redefining HAVE_* when they
have a corresponding COMPILE_* define

Cheers,
Jason.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: swscale-runtime-cpudetect-fix.diff
Type: text/x-patch
Size: 485 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20060811/d76c4907/attachment.bin>


More information about the MPlayer-dev-eng mailing list