Originally committed as revision 898 to svn://svn.ffmpeg.org/ffmpeg/trunk
strip="strip"
cpu=`uname -m`
mmx="default"
strip="strip"
cpu=`uname -m`
mmx="default"
case "$cpu" in
i386|i486|i586|i686|i86pc|BePC)
cpu="x86"
case "$cpu" in
i386|i486|i586|i686|i86pc|BePC)
cpu="x86"
;;
--disable-mmx) mmx="no"
;;
;;
--disable-mmx) mmx="no"
;;
+ --disable-altivec) altivec="no"
+ ;;
--enable-gprof) gprof="yes"
;;
--disable-v4l) v4l="no"
--enable-gprof) gprof="yes"
;;
--disable-v4l) v4l="no"
+# Can only do AltiVec on PowerPC
+if test $altivec = "default"; then
+ if test $cpu = "powerpc"; then
+ altivec="yes"
+ else
+ altivec="no"
+ fi
+fi
+
+# See does our compiler support Motorola AltiVec C API
+if test $altivec = "yes"; then
+cat > $TMPC << EOF
+int main(void) {
+ vector signed int v1, v2, v3;
+ v1 = vec_add(v2,v3);
+ return 0;
+}
+EOF
+$cc -o $TMPO $TMPC -faltivec 2> /dev/null || altivec="no"
+fi
+
# Checking for CFLAGS
if test -z "$CFLAGS"; then
CFLAGS="-O3"
# Checking for CFLAGS
if test -z "$CFLAGS"; then
CFLAGS="-O3"
echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
echo " --cpu=CPU force cpu to CPU [$cpu]"
echo " --disable-mmx disable mmx usage"
echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
echo " --cpu=CPU force cpu to CPU [$cpu]"
echo " --disable-mmx disable mmx usage"
+echo " --disable-altivec disable AltiVec usage"
echo " --disable-audio-oss disable OSS audio support [default=no]"
echo " --disable-v4l disable video4linux grabbing [default=no]"
echo " --disable-network disable network support [default=no]"
echo " --disable-audio-oss disable OSS audio support [default=no]"
echo " --disable-v4l disable video4linux grabbing [default=no]"
echo " --disable-network disable network support [default=no]"
echo "CPU $cpu"
echo "Big Endian $bigendian"
echo "MMX enabled $mmx"
echo "CPU $cpu"
echo "Big Endian $bigendian"
echo "MMX enabled $mmx"
+echo "AltiVec enabled $altivec"
echo "gprof enabled $gprof"
echo "zlib enabled $zlib"
echo "mp3lame enabled $mp3lame"
echo "gprof enabled $gprof"
echo "zlib enabled $zlib"
echo "mp3lame enabled $mp3lame"
echo "TARGET_MMX=yes" >> config.mak
echo "#define HAVE_MMX 1" >> $TMPH
fi
echo "TARGET_MMX=yes" >> config.mak
echo "#define HAVE_MMX 1" >> $TMPH
fi
+if test "$altivec" = "yes" ; then
+ echo "TARGET_ALTIVEC=yes" >> config.mak
+ echo "#define HAVE_ALTIVEC 1" >> $TMPH
+fi
if test "$gprof" = "yes" ; then
echo "TARGET_GPROF=yes" >> config.mak
echo "#define HAVE_GPROF 1" >> $TMPH
if test "$gprof" = "yes" ; then
echo "TARGET_GPROF=yes" >> config.mak
echo "#define HAVE_GPROF 1" >> $TMPH
endif
ifeq ($(TARGET_ARCH_POWERPC),yes)
endif
ifeq ($(TARGET_ARCH_POWERPC),yes)
+OBJS += ppc/dsputil_ppc.o
+endif
+
+ifeq ($(TARGET_ALTIVEC),yes)
CFLAGS += -faltivec
OBJS += ppc/dsputil_altivec.o
endif
CFLAGS += -faltivec
OBJS += ppc/dsputil_altivec.o
endif
use_permuted_idct = 0;
#endif
#ifdef ARCH_POWERPC
use_permuted_idct = 0;
#endif
#ifdef ARCH_POWERPC
-#ifdef CONFIG_DARWIN
- dsputil_init_altivec();
-#endif
#endif
#ifdef SIMPLE_IDCT
#endif
#ifdef SIMPLE_IDCT
#define emms_c()
#define __align8 __attribute__ ((aligned (16)))
#define emms_c()
#define __align8 __attribute__ ((aligned (16)))
-#ifdef CONFIG_DARWIN
-void dsputil_init_altivec(void);
-#endif
+void dsputil_init_ppc(void);
-void dsputil_init_altivec(void)
-{
- if (has_altivec()) {
- pix_abs16x16 = pix_abs16x16_altivec;
- pix_abs8x8 = pix_abs8x8_altivec;
- pix_sum = pix_sum_altivec;
- }
-}
-
int has_altivec(void)
{
#if CONFIG_DARWIN
int has_altivec(void)
{
#if CONFIG_DARWIN
--- /dev/null
+extern int pix_abs16x16_altivec(uint8_t *pix1, uint8_t *pix2, int line_size);
+extern int pix_abs8x8_altivec(uint8_t *pix1, uint8_t *pix2, int line_size);
+extern int pix_sum_altivec(UINT8 * pix, int line_size);
+
+extern int has_altivec(void);
--- /dev/null
+#include "../../config.h"
+#include "../dsputil.h"
+
+#ifdef HAVE_ALTIVEC
+#include "dsputil_altivec.h"
+#endif
+
+void dsputil_init_ppc(void)
+{
+#if HAVE_ALTIVEC
+ if (has_altivec()) {
+ pix_abs16x16 = pix_abs16x16_altivec;
+ pix_abs8x8 = pix_abs8x8_altivec;
+ pix_sum = pix_sum_altivec;
+ } else
+#endif
+ {
+ /* Non-AltiVec PPC optimisations here */
+ }
+}