[FFmpeg-devel] [PATCH] libswscale: Altivec, C and runtime cpu detection

Adrian Stutz adrian
Thu Jun 25 10:03:54 CEST 2009


On Thu, Jun 25, 2009 at 1:07 AM, Diego Biurrun<diego at biurrun.de> wrote:
> I cannot reproduce the problem you are trying to solve.

Ok, I've just tried on my laptop with a clean checkout:

$ svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
$ cd ffmpeg
$ ./configure --enable-runtime-cpudetect --arch=ppc --enable-gpl
$ make

> libswscale/swscale.c: In function ?getSwsFunc?:
libswscale/swscale.c:2001: warning: implicit declaration of function
?sws_init_swScale_C?
libswscale/swscale.c:2002: error: ?swScale_C? undeclared (first use in
this function)
libswscale/swscale.c:2002: error: (Each undeclared identifier is
reported only once
libswscale/swscale.c:2002: error: for each function it appears in.)
make: *** [libswscale/swscale.o] Error 1

Note that without --enable-gpl the runtime CPU detection in libswscale
won't be used (shouldn't there be a warning about this?).

Looking at the code, here are the relevant sections (all in swscale.c):

Line 1308:
#if ARCH_PPC
#if (HAVE_ALTIVEC || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL
--> #undef COMPILE_C
#define COMPILE_ALTIVEC
#endif
#endif //ARCH_PPC

Here, if Altivec or runtime CPU detection is enabled (and GPL),
compilation of the C code is disabled.

Line 1974:
static SwsFunc getSwsFunc(SwsContext *c)
{
#if CONFIG_RUNTIME_CPUDETECT && CONFIG_GPL
    int flags = c->flags;
    /* snip */
#if ARCH_PPC
    if (flags & SWS_CPU_CAPS_ALTIVEC) {
        sws_init_swScale_altivec(c);
        return swScale_altivec;
    } else {
        sws_init_swScale_C(c);
-->     return swScale_C;
    }
#endif
    /* snip */
}

However, here in getSwsFunc() the code for runtime cpu detection on
PPC tries to use swScale_C which hasn't been included due to the
#undef COMPILE_C above.

Greetings
Adrian



More information about the ffmpeg-devel mailing list