[FFmpeg-devel] [PATCH] swscale when altivec is disabled.
Reinhard Tartler
siretart
Sun Mar 7 08:57:58 CET 2010
Currently, this configuration of ffmpeg (trunk) fails to build in
libswscale:
$ ./configure --enable-gpl --disable-altivec --enable-runtime-cpudetect
$ make libswscale/swscale.o
results in this compilation error on powerpc machines, (tested on a G4):
In file included from /home/siretart/ffmpeg/trunk2/libswscale/swscale_template.c:51,
from /home/siretart/ffmpeg/trunk2/libswscale/swscale.c:1180:
/home/siretart/ffmpeg/trunk2/libswscale/ppc/swscale_altivec_template.c: In function ?altivec_packIntArrayToCharArray?:
/home/siretart/ffmpeg/trunk2/libswscale/ppc/swscale_altivec_template.c:30: error: ?vector? undeclared (first use in this function)
/home/siretart/ffmpeg/trunk2/libswscale/ppc/swscale_altivec_template.c:30: error: (Each undeclared identifier is reported only once
This happens because with --disable-altivec disables any support for
altivec, including the keyword vector. In the end this means that
runtime detection of altivec is effectively not possible. The current
code however does not consider this. I'm therefore proposing this patch:
Index: swscale.c
===================================================================
--- swscale.c (revision 30856)
+++ swscale.c (working copy)
@@ -1135,21 +1135,21 @@
}
}
//Note: we have C, MMX, MMX2, 3DNOW versions, there is no 3DNOW+MMX2 one
//Plain C versions
#if ((!HAVE_MMX || !CONFIG_GPL) && !HAVE_ALTIVEC) || CONFIG_RUNTIME_CPUDETECT
#define COMPILE_C
#endif
#if ARCH_PPC
-#if HAVE_ALTIVEC || CONFIG_RUNTIME_CPUDETECT
+#if HAVE_ALTIVEC
#define COMPILE_ALTIVEC
#endif
#endif //ARCH_PPC
#if ARCH_X86
#if ((HAVE_MMX && !HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL
#define COMPILE_MMX
#endif
@@ -1238,21 +1238,21 @@
return swScale_3DNow;
} else if (flags & SWS_CPU_CAPS_MMX) {
sws_init_swScale_MMX(c);
return swScale_MMX;
} else {
sws_init_swScale_C(c);
return swScale_C;
}
#else
-#if ARCH_PPC
+#if ARCH_PPC && COMPILE_ALTIVEC
if (flags & SWS_CPU_CAPS_ALTIVEC) {
sws_init_swScale_altivec(c);
return swScale_altivec;
} else {
sws_init_swScale_C(c);
return swScale_C;
}
#endif
sws_init_swScale_C(c);
return swScale_C;
ok to apply?
--
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4
More information about the ffmpeg-devel
mailing list