[RFC] Support building universal binaries of FFmpeg on Darwin
Hi, Attached below is an initial patch to allow building a universal, or fat, binary of FFmpeg on Darwin 8.0 and later using GCC 4.0. The generated binary will contain 4 architectures: G3, G4, G5 and x86. Having the three PowerPC architectures allows GCC to tune for the specified CPU, and possibly vectorize code. The configure script needed a lot of hackery to defer detection of e.g. AltiVec to compile-time. Source code changes mainly involve ensuring that files in libavcodec/ppc and libavcodec/i386 compile with both PPC and x86 compilers. A few cases where CONFIG_DARWIN was incorrectly assumed to mean Motorola AltiVec syntax was also fixed. However, I ran into a major issue: The Darwin assembler is an old version of GNU as, and it does not support the i386 syntax used in FFmpeg. I believe the issues boil down to: - The asm macro syntax used in Darwin[1] is different from the currently used syntax. It appears to not support named arguments and use ".endmacro" instead of ".endm". Perhaps using C macros would be better? (In i386/fdct_mmx.c) - The .balign pseudo-op doesn't exist. The best substitute I could find was .align[2]. (In i386/dsputil_mmx.c) - I get a lot of errors about "Junk character 47 (/)". I don't know what that means :/ (In i386/simple_idct_mmx.c) I don't know x86 assembly, so I have no idea how to fix this. I was hoping someone else might be able to help. All other files compile fine. - Dan Christiansen P.S. Please Cc any replies directly to me, as I'm not subscribed to either of these lists. Alex Beregszaszi said on IRC that this might be of interest to MPlayer developers as well, so this mail is Cc'ed there. [1] <http://developer.apple.com/documentation/DeveloperTools/Reference/Assembler/ASMDirectives/chapter_5_section_3.html#//apple_ref/doc/uid/TP30000851-//apple_ref/doc/uid/TP30000823-TPXREF146> [2] <http://developer.apple.com/documentation/DeveloperTools/Reference/Assembler/ASMDirectives/chapter_5_section_7.html#//apple_ref/doc/uid/TP30000851-//apple_ref/doc/uid/TP30000823-TPXREF174>
I would like to pick up these patches and adapt them for VLC and eventually real inclusion into ffmpeg. However before doing any of this, I just wanna check no one else is working on this atm. Don't wanna double the effort with the same result. So. DJ On 22-jun-2005, at 18:49, Dan Villiom Podlaski Christiansen wrote:
Hi,
Attached below is an initial patch to allow building a universal, or fat, binary of FFmpeg on Darwin 8.0 and later using GCC 4.0. The generated binary will contain 4 architectures: G3, G4, G5 and x86. Having the three PowerPC architectures allows GCC to tune for the specified CPU, and possibly vectorize code.
The configure script needed a lot of hackery to defer detection of e.g. AltiVec to compile-time. Source code changes mainly involve ensuring that files in libavcodec/ppc and libavcodec/i386 compile with both PPC and x86 compilers. A few cases where CONFIG_DARWIN was incorrectly assumed to mean Motorola AltiVec syntax was also fixed.
However, I ran into a major issue: The Darwin assembler is an old version of GNU as, and it does not support the i386 syntax used in FFmpeg. I believe the issues boil down to:
- The asm macro syntax used in Darwin[1] is different from the currently used syntax. It appears to not support named arguments and use ".endmacro" instead of ".endm". Perhaps using C macros would be better? (In i386/fdct_mmx.c) - The .balign pseudo-op doesn't exist. The best substitute I could find was .align[2]. (In i386/dsputil_mmx.c) - I get a lot of errors about "Junk character 47 (/)". I don't know what that means :/ (In i386/simple_idct_mmx.c)
I don't know x86 assembly, so I have no idea how to fix this. I was hoping someone else might be able to help. All other files compile fine.
- Dan Christiansen
P.S. Please Cc any replies directly to me, as I'm not subscribed to either of these lists. Alex Beregszaszi said on IRC that this might be of interest to MPlayer developers as well, so this mail is Cc'ed there.
[1] <http://developer.apple.com/documentation/DeveloperTools/ Reference/Assembler/ASMDirectives/chapter_5_section_3.html#// apple_ref/doc/uid/TP30000851-//apple_ref/doc/uid/TP30000823-TPXREF146> [2] <http://developer.apple.com/documentation/DeveloperTools/ Reference/Assembler/ASMDirectives/chapter_5_section_7.html#// apple_ref/doc/uid/TP30000851-//apple_ref/doc/uid/TP30000823-TPXREF174>
? dynamic.diff Index: configure =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/configure,v retrieving revision 1.185 diff -a -u -u -r1.185 configure --- configure 29 May 2005 22:11:05 -0000 1.185 +++ configure 22 Jun 2005 16:24:29 -0000 @@ -449,7 +449,7 @@ ;; --enable-pp) pp="yes" ;; - --enable-shared-pp) shared_pp="yes" + --enable-shared-pp) shared_pp="yes"; extralibs="$extralibs -L $source_path/libavcodec/libpostproc -lpostproc" ;; --enable-libgsm) libgsm="yes" ;; @@ -593,9 +593,22 @@ fi fi
+# check for fat support +if test $cpu = fat; then + if test `uname -r | cut -d. -f1` -lt 8 ; then + echo "error, universal binaries only available on Mac OS X 10.4 or greater!" + exit 1 + elif test "$tune" != "generic" -a "$tune" != "multiple" ; then + echo "error, universal binaries cannot be tuned for one specific processor!" + exit 1 + else + tune=multiple + fi +fi + # compute mmx state if test $mmx = "default"; then - if test $cpu = "x86" -o $cpu = "x86_64"; then + if test $cpu = "x86" -o $cpu = "x86_64" -o $cpu = fat; then mmx="yes" else mmx="no" @@ -609,18 +622,24 @@ CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto - qtune=auto" else gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`" + if test $cpu != fat; then + CFLAGS="$CFLAGS -pipe" + fi case "$gcc_version" in *2.95*) - CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer" + CFLAGS="$CFLAGS -no-cpp-precomp -fomit-frame-pointer" ;; *[34].*) - CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer - force_cpusubtype_ALL -Wno-sign-compare" + CFLAGS="$CFLAGS -no-cpp-precomp -fomit-frame-pointer -Wno-sign- compare" + if test "$cpu" != fat; then + CFLAGS="$CFLAGS -force_cpusubtype_ALL" + fi if test "$lshared" = no; then needmdynamicnopic="yes" fi ;; *) - CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer" + CFLAGS="$CFLAGS -no-cpp-precomp -fomit-frame-pointer" if test "$lshared" = no; then needmdynamicnopic="yes" fi @@ -631,7 +650,7 @@
# Can only do AltiVec on PowerPC if test $altivec = "default"; then - if test $cpu = "powerpc"; then + if test $cpu = "powerpc" -o $cpu = "fat"; then altivec="yes" else altivec="no" @@ -696,6 +715,23 @@ i[3456]86|pentium|pentiumpro|pentium-mmx|pentium[234]|prescott|k6| k6-[23]|athlon|athlon-tbird|athlon-4|athlon-[mx]p|winchip-c6| winchip2|c3|nocona) CFLAGS="$CFLAGS -march=$tune" ;; + multiple) + cc=gcc-4.0 + sdkpath=/Developer/SDKs/MacOSX10.4u.sdk + TUNECPU="ppc750, ppc7450, ppc970" + FAT_ARCHS="-arch ppc750 -arch ppc7450 -arch ppc970" + if test -d $sdkpath; then + FAT_ARCHS="$FAT_ARCHS -arch i686" + TUNECPU="$TUNECPU, i686" + LDFLAGS="$LDFLAGS -Wl,-syslibroot,$sdkpath" + CFLAGS="$CFLAGS -isysroot $sdkpath" + fi + if test "$shared_pp" != "yes" -a "$lshared" != "yes"; then + CFLAGS="$CFLAGS $FAT_ARCHS -fast -ftree-vectorize" + else + CFLAGS="$CFLAGS $FAT_ARCHS -fastf -fPIC -ftree-vectorize" + fi + ;; *) echo "WARNING: unknown CPU \"$tune\", ignored" ;; @@ -711,7 +747,6 @@ CFLAGS="$CFLAGS -maltivec -mabi=altivec" fi fi -fi
# See if we have <altivec.h> cat > $TMPC << EOF @@ -744,7 +779,8 @@ } EOF fi -$cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no" +$cc -o $TMPE $TMPC 2> /dev/null || altivec="no" +fi fi
# Can only do mmi on mips @@ -788,7 +824,7 @@ ranlib="${cross_prefix}${ranlib}" strip="${cross_prefix}${strip}"
-if test -z "$cross_prefix" ; then +if test -z "$cross_prefix" -a "$cpu" != "fat"; then
# --- # big/little endian test @@ -864,7 +900,9 @@ $cc -o $TMPE $TMPC 2> /dev/null || _memalign=no fi
-if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" ! = "yes"; then +# danchr at opendarwin.org: Darwin malloc() returns a value that is +# "aligned such that it can be used for any data type" +if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" ! = "yes" -a "$targetos" != "Darwin"; then echo "error, no memalign() but sse enabled, either disable it or use --enable-memalign-hack" exit 1 fi @@ -906,7 +944,7 @@ EOF
have_lrintf="no" -if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then +if $cc $CFLAGS $LDFLAGS $extralibs -o $TMPE $TMPC 2> /dev/null ; then have_lrintf="yes" # allanc at chickenandporn.com: cannot execute cross-compiled # code on the host. Only execute if not cross-compiling. @@ -1217,7 +1255,55 @@ echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak echo "TARGET_OS=$TARGET_OS" >> config.mak -if test "$cpu" = "x86" ; then +if test "$cpu" = "fat"; then + echo "TARGET_ARCH_X86=yes" >> config.mak + echo "TARGET_ARCH_POWERPC=yes" >> config.mak + echo "FAT_ARCHS=$FAT_ARCHS" >> config.mak + if test "$altivec" = "yes" ; then + echo "TARGET_ALTIVEC=yes" >> config.mak + echo "#ifdef __ALTIVEC__" >> $TMPH + echo "# define HAVE_ALTIVEC 1" >> $TMPH + echo "# define HAVE_ALTIVEC_H 1" >> $TMPH + echo "#endif" >> $TMPH + echo "#ifdef __APPLE_ALTIVEC__" >> $TMPH + echo "# define HAVE_ALTIVEC 1" >> $TMPH + echo "#endif" >> $TMPH + fi + echo "#ifdef __BIG_ENDIAN__" >> $TMPH + echo "# define WORDS_BIGENDIAN 1" >> $TMPH + echo "#endif" >> $TMPH + echo "#ifdef __ppc__" >> $TMPH + echo "# define ARCH_POWERPC 1" >> $TMPH + echo "# ifdef _ARCH_PPC64" >> $TMPH + echo "# define POWERPC_MODE_64BITS 1" >> $TMPH + echo "# else" >> $TMPH + echo "# define POWERPC_MODE_32BITS 1" >> $TMPH + echo "# define NO_DCBZL" >> $TMPH + echo "# endif" >> $TMPH + if test "$powerpc_perf" = "yes"; then + echo "# define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH + fi + echo "#endif" >> $TMPH + echo "#ifdef __ppc64__" >> $TMPH + echo "# define ARCH_POWERPC 1" >> $TMPH + echo "# define POWERPC_MODE_64BITS 1" >> $TMPH + if test "$powerpc_perf" = "yes"; then + echo "# define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH + fi + echo "#endif" >> $TMPH + echo "#ifdef __i386__" >> $TMPH + echo "#define __CPU__ 586" >> $TMPH + echo "# define ARCH_X86 1" >> $TMPH + if test "$mmx" = "yes" ; then + echo "TARGET_MMX=yes" >> config.mak + echo "#define HAVE_MMX 1" >> $TMPH + fi + if test "$builtin_vector" = "yes" ; then + echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak + echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH + fi + echo "#endif" >> $TMPH +elif test "$cpu" = "x86" ; then echo "TARGET_ARCH_X86=yes" >> config.mak echo "#define ARCH_X86 1" >> $TMPH elif test "$cpu" = "x86_64" ; then @@ -1264,31 +1350,33 @@ echo "#define EMULATE_INTTYPES 1" >> $TMPH fi if test "$emu_fast_int" = "yes" ; then - echo "#define EMULATE_FAST_INT 1" >> $TMPH + echo "#define EMULATE_FAST_INT 1" >> $TMPH fi -if test "$mmx" = "yes" ; then - echo "TARGET_MMX=yes" >> config.mak - echo "#define HAVE_MMX 1" >> $TMPH - echo "#define __CPU__ 586" >> $TMPH -fi -if test "$builtin_vector" = "yes" ; then - echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak - echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH -fi -if test "$mmi" = "yes" ; then - echo "TARGET_MMI=yes" >> config.mak - echo "#define HAVE_MMI 1" >> $TMPH -fi -if test "$altivec" = "yes" ; then - echo "TARGET_ALTIVEC=yes" >> config.mak - echo "#define HAVE_ALTIVEC 1" >> $TMPH - echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH - echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH - if test "$_altivec_h" = "yes" ; then - echo "#define HAVE_ALTIVEC_H 1" >> $TMPH - else - echo "#undef HAVE_ALTIVEC_H" >> $TMPH - fi +if test "$cpu" != "fat"; then + if test "$mmx" = "yes" ; then + echo "TARGET_MMX=yes" >> config.mak + echo "#define HAVE_MMX 1" >> $TMPH + echo "#define __CPU__ 586" >> $TMPH + fi + if test "$builtin_vector" = "yes" ; then + echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak + echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH + fi + if test "$mmi" = "yes" ; then + echo "TARGET_MMI=yes" >> config.mak + echo "#define HAVE_MMI 1" >> $TMPH + fi + if test "$altivec" = "yes" ; then + echo "TARGET_ALTIVEC=yes" >> config.mak + echo "#define HAVE_ALTIVEC 1" >> $TMPH + echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH + echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH + if test "$_altivec_h" = "yes" ; then + echo "#define HAVE_ALTIVEC_H 1" >> $TMPH + else + echo "#undef HAVE_ALTIVEC_H" >> $TMPH + fi + fi fi if test "$gprof" = "yes" ; then echo "TARGET_GPROF=yes" >> config.mak Index: libavcodec/Makefile =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/Makefile,v retrieving revision 1.194 diff -a -u -u -r1.194 Makefile --- libavcodec/Makefile 3 Jun 2005 13:59:38 -0000 1.194 +++ libavcodec/Makefile 22 Jun 2005 16:24:29 -0000 @@ -238,26 +238,18 @@ ifeq ($(CONFIG_DTS),yes) OBJS+= dtsdec.o CFLAGS += $(DTS_INC) -EXTRALIBS += -ldts endif
ifeq ($(CONFIG_FAAD),yes) OBJS+= faad.o -ifeq ($(CONFIG_FAADBIN),yes) -# no libs needed -else -EXTRALIBS += -lfaad -endif endif
ifeq ($(CONFIG_FAAC),yes) OBJS+= faac.o -EXTRALIBS += -lfaac endif
ifeq ($(CONFIG_XVID),yes) OBJS+= xvidff.o -EXTRALIBS += -lxvidcore endif
ifeq ($(CONFIG_X264),yes) @@ -266,17 +258,13 @@ endif
ifeq ($(CONFIG_PP),yes) -ifeq ($(SHARED_PP),yes) -EXTRALIBS += -Llibpostproc -lpostproc$(BUILDSUF) -else -# LIBS += libpostproc/libpostproc.a ... should be fixed +ifneq ($(SHARED_PP),yes) OBJS += libpostproc/postprocess.o endif endif
ifeq ($(CONFIG_MP3LAME),yes) OBJS += mp3lameaudio.o -EXTRALIBS += -lmp3lame endif
ifeq ($(CONFIG_LIBOGG),yes) Index: libavcodec/dsputil.h =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/dsputil.h,v retrieving revision 1.118 diff -a -u -u -r1.118 dsputil.h --- libavcodec/dsputil.h 17 Jun 2005 08:24:35 -0000 1.118 +++ libavcodec/dsputil.h 22 Jun 2005 16:24:29 -0000 @@ -462,7 +462,7 @@
extern int mm_flags;
-#if defined(HAVE_ALTIVEC) && !defined(CONFIG_DARWIN) +#if defined(HAVE_ALTIVEC) && defined(HAVE_ALTIVEC_H) #define pixel altivec_pixel #include <altivec.h> #undef pixel Index: libavcodec/i386/cputest.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/i386/cputest.c,v retrieving revision 1.14 diff -a -u -u -r1.14 cputest.c --- libavcodec/i386/cputest.c 13 Dec 2004 16:11:38 -0000 1.14 +++ libavcodec/i386/cputest.c 22 Jun 2005 16:24:29 -0000 @@ -4,6 +4,8 @@ #include <stdlib.h> #include "../dsputil.h"
+#ifdef HAVE_MMX + #ifdef ARCH_X86_64 # define REG_b "rbx" # define REG_S "rsi" @@ -129,3 +131,5 @@ return 0; } #endif + +#endif /* HAVE_MMX */ Index: libavcodec/i386/dsputil_mmx.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/i386/dsputil_mmx.c,v retrieving revision 1.98 diff -a -u -u -r1.98 dsputil_mmx.c --- libavcodec/i386/dsputil_mmx.c 2 Jun 2005 20:45:35 -0000 1.98 +++ libavcodec/i386/dsputil_mmx.c 22 Jun 2005 16:24:29 -0000 @@ -28,6 +28,8 @@ //#undef NDEBUG //#include <assert.h>
+#ifdef HAVE_MMX + extern const uint8_t ff_h263_loop_filter_strength[32];
int mm_flags; /* multimedia extension flags */ @@ -2843,3 +2845,5 @@ //ff_idct = just_return; #endif } + +#endif /* HAVE_MMX */ Index: libavcodec/i386/fdct_mmx.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/i386/fdct_mmx.c,v retrieving revision 1.16 diff -a -u -u -r1.16 fdct_mmx.c --- libavcodec/i386/fdct_mmx.c 11 Oct 2004 02:19:29 -0000 1.16 +++ libavcodec/i386/fdct_mmx.c 22 Jun 2005 16:24:29 -0000 @@ -17,6 +17,8 @@ #include "../dsputil.h" #include "mmx.h"
+#ifdef HAVE_MMX + #define ATTR_ALIGN(align) __attribute__ ((__aligned__ (align)))
///////////////////////////////////////////////////////////////////// / @@ -357,14 +359,22 @@ "movdqa \\t+32(%1), %%xmm3 \n\t" "movdqa \\t+48(%1), %%xmm7 \n\t" "movdqa \\t(%1), %%xmm4 \n\t" - "movdqa \\t+16(%1), %%xmm5 \n\t" + "movdqa \\t+16(%1), %%xmm5 \n\t" +#ifdef __APPLE_CC__ + ".endmacro \n\t" +#else ".endm \n\t" +#endif ".macro FDCT_ROW_SSE2_H2 i t \n\t" "movq \\i(%0), %%xmm2 \n\t" "movq \\i+8(%0), %%xmm0 \n\t" "movdqa \\t+32(%1), %%xmm3 \n\t" "movdqa \\t+48(%1), %%xmm7 \n\t" +#ifdef __APPLE_CC__ + ".endmacro \n\t" +#else ".endm \n\t" +#endif ".macro FDCT_ROW_SSE2 i \n\t" "movq %%xmm2, %%xmm1 \n\t" "pshuflw $27, %%xmm0, %%xmm0 \n\t" @@ -384,7 +394,11 @@ "psrad %3, %%xmm1 \n\t" "packssdw %%xmm3, %%xmm1 \n\t" "movdqa %%xmm1, \\i(%4) \n\t" - ".endm \n\t" +#ifdef __APPLE_CC__ + ".endmacro \n\t" +#else + ".endm \n\t" +#endif "movdqa (%2), %%xmm6 \n\t" "FDCT_ROW_SSE2_H1 0 0 \n\t" "FDCT_ROW_SSE2 0 \n\t" @@ -560,3 +574,4 @@ fdct_row_sse2(block1, block); }
+#endif /* HAVE_MMX */ Index: libavcodec/i386/h264dsp_mmx.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/i386/h264dsp_mmx.c,v retrieving revision 1.1 diff -a -u -u -r1.1 h264dsp_mmx.c --- libavcodec/i386/h264dsp_mmx.c 2 Jun 2005 20:45:35 -0000 1.1 +++ libavcodec/i386/h264dsp_mmx.c 22 Jun 2005 16:24:29 -0000 @@ -16,6 +16,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#ifdef HAVE_MMX
/***********************************/ /* IDCT */ @@ -910,3 +911,4 @@ #undef H264_CHROMA_OP #undef H264_CHROMA_MC8_TMPL
+#endif /* HAVE_MMX */ Index: libavcodec/i386/idct_mmx.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/i386/idct_mmx.c,v retrieving revision 1.12 diff -a -u -u -r1.12 idct_mmx.c --- libavcodec/i386/idct_mmx.c 2 Jun 2005 20:45:35 -0000 1.12 +++ libavcodec/i386/idct_mmx.c 22 Jun 2005 16:24:29 -0000 @@ -27,6 +27,8 @@
#include "mmx.h"
+#ifdef HAVE_MMX + #define ATTR_ALIGN(align) __attribute__ ((__aligned__ (align)))
#define ROW_SHIFT 11 @@ -598,3 +600,4 @@ declare_idct (ff_mmx_idct, mmx_table, mmx_row_head, mmx_row, mmx_row_tail, mmx_row_mid)
+#endif /* HAVE_MMX */ Index: libavcodec/i386/motion_est_mmx.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/i386/motion_est_mmx.c,v retrieving revision 1.16 diff -a -u -u -r1.16 motion_est_mmx.c --- libavcodec/i386/motion_est_mmx.c 11 Oct 2004 02:19:29 -0000 1.16 +++ libavcodec/i386/motion_est_mmx.c 22 Jun 2005 16:24:29 -0000 @@ -22,6 +22,8 @@ #include "../dsputil.h" #include "mmx.h"
+#ifdef HAVE_MMX + static const __attribute__ ((aligned(8))) uint64_t round_tab[3]={ 0x0000000000000000ULL, 0x0001000100010001ULL, @@ -404,3 +406,5 @@ } } } + +#endif /* HAVE_MMX */ Index: libavcodec/i386/mpegvideo_mmx.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/i386/mpegvideo_mmx.c,v retrieving revision 1.34 diff -a -u -u -r1.34 mpegvideo_mmx.c --- libavcodec/i386/mpegvideo_mmx.c 11 Oct 2004 02:19:29 -0000 1.34 +++ libavcodec/i386/mpegvideo_mmx.c 22 Jun 2005 16:24:29 -0000 @@ -25,6 +25,8 @@ #include "../avcodec.h" #include "mmx.h"
+#ifdef HAVE_MMX + extern uint8_t zigzag_direct_noperm[64]; extern uint16_t inv_zigzag_direct16[64];
@@ -721,3 +723,5 @@ } } } + +#endif /* HAVE_MMX */ Index: libavcodec/i386/simple_idct_mmx.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/i386/simple_idct_mmx.c,v retrieving revision 1.13 diff -a -u -u -r1.13 simple_idct_mmx.c --- libavcodec/i386/simple_idct_mmx.c 18 May 2004 17:09:46 -0000 1.13 +++ libavcodec/i386/simple_idct_mmx.c 22 Jun 2005 16:24:29 -0000 @@ -20,6 +20,8 @@ #include "../dsputil.h" #include "../simple_idct.h"
+#ifdef HAVE_MMX + /* 23170.475006 22725.260826 @@ -1312,3 +1314,5 @@ idct(block); add_pixels_clamped_mmx(block, dest, line_size); } + +#endif /* HAVE_MMX */ Index: libavcodec/i386/vp3dsp_mmx.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/i386/vp3dsp_mmx.c,v retrieving revision 1.5 diff -a -u -u -r1.5 vp3dsp_mmx.c --- libavcodec/i386/vp3dsp_mmx.c 1 Jun 2005 21:19:00 -0000 1.5 +++ libavcodec/i386/vp3dsp_mmx.c 22 Jun 2005 16:24:29 -0000 @@ -24,6 +24,8 @@ #include "../dsputil.h" #include "mmx.h"
+#ifdef HAVE_MMX + #define IdctAdjustBeforeShift 8
/* (12 * 4) 2-byte memory locations ( = 96 bytes total) @@ -320,3 +322,5 @@ #undef J
} + +#endif /* HAVE_MMX */ Index: libavcodec/i386/vp3dsp_sse2.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/i386/vp3dsp_sse2.c,v retrieving revision 1.6 diff -a -u -u -r1.6 vp3dsp_sse2.c --- libavcodec/i386/vp3dsp_sse2.c 1 Jun 2005 21:19:00 -0000 1.6 +++ libavcodec/i386/vp3dsp_sse2.c 22 Jun 2005 16:24:29 -0000 @@ -24,6 +24,8 @@ #include "../dsputil.h" #include "mmx.h"
+#ifdef HAVE_BUILTIN_VECTOR + static const unsigned short __align16 SSE2_dequant_const[] = { 0,65535,65535,0,0,0,0,0, // 0x0000 0000 0000 0000 0000 FFFF FFFF 0000 @@ -824,3 +826,5 @@
SSE2_Column_IDCT(); } + +#endif HAVE_BUILTIN_VECTOR Index: libavcodec/ppc/dsputil_altivec.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/ppc/dsputil_altivec.c,v retrieving revision 1.27 diff -a -u -u -r1.27 dsputil_altivec.c --- libavcodec/ppc/dsputil_altivec.c 5 Oct 2004 18:36:15 -0000 1.27 +++ libavcodec/ppc/dsputil_altivec.c 22 Jun 2005 16:24:29 -0000 @@ -35,6 +35,8 @@ #include <signal.h> #include <setjmp.h>
+#ifdef HAVE_ALTIVEC + static sigjmp_buf jmpbuf; static volatile sig_atomic_t canjump = 0;
@@ -1773,3 +1775,5 @@ POWERPC_PERF_STOP_COUNT(altivec_avg_pixels8_xy2_num, 1); #endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } + +#endif /* HAVE_ALTIVEC */ Index: libavcodec/ppc/dsputil_h264_template_altivec.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/ppc/ dsputil_h264_template_altivec.c,v retrieving revision 1.1 diff -a -u -u -r1.1 dsputil_h264_template_altivec.c --- libavcodec/ppc/dsputil_h264_template_altivec.c 16 Sep 2004 19:05:22 -0000 1.1 +++ libavcodec/ppc/dsputil_h264_template_altivec.c 22 Jun 2005 16:24:29 -0000 @@ -16,6 +16,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#ifdef HAVE_ALTIVEC + /* this code assume that stride % 16 == 0 */ void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) { POWERPC_PERF_DECLARE(PREFIX_h264_chroma_mc8_num, 1); @@ -637,3 +639,5 @@ } POWERPC_PERF_STOP_COUNT(PREFIX_h264_qpel16_hv_lowpass_num, 1); } + +#endif /* HAVE_ALTIVEC */ Index: libavcodec/ppc/dsputil_ppc.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/ppc/dsputil_ppc.c,v retrieving revision 1.31 diff -a -u -u -r1.31 dsputil_ppc.c --- libavcodec/ppc/dsputil_ppc.c 11 Oct 2004 22:47:09 -0000 1.31 +++ libavcodec/ppc/dsputil_ppc.c 22 Jun 2005 16:24:29 -0000 @@ -26,6 +26,8 @@ #include "dsputil_altivec.h" #endif
+#ifdef ARCH_POWERPC + extern void fdct_altivec(int16_t *block); extern void idct_put_altivec(uint8_t *dest, int line_size, int16_t *block); extern void idct_add_altivec(uint8_t *dest, int line_size, int16_t *block); @@ -340,3 +342,5 @@ // ... pending ... } } + +#endif /* ARCH_POWERPC */ Index: libavcodec/ppc/fdct_altivec.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/ppc/fdct_altivec.c,v retrieving revision 1.2 diff -a -u -u -r1.2 fdct_altivec.c --- libavcodec/ppc/fdct_altivec.c 17 Apr 2005 21:41:16 -0000 1.2 +++ libavcodec/ppc/fdct_altivec.c 22 Jun 2005 16:24:29 -0000 @@ -23,6 +23,7 @@ #include "dsputil_altivec.h" #include "gcc_fixes.h"
+#ifdef HAVE_ALTIVEC
#define vs16(v) ((vector signed short)(v)) #define vs32(v) ((vector signed int)(v)) @@ -495,4 +496,6 @@ #endif /* ALTIVEC_USE_REFERENCE_C_CODE */ }
+#endif /* HAVE_ALTIVEC */ + /* vim:set foldmethod=marker foldlevel=0: */ Index: libavcodec/ppc/fft_altivec.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/ppc/fft_altivec.c,v retrieving revision 1.9 diff -a -u -u -r1.9 fft_altivec.c --- libavcodec/ppc/fft_altivec.c 13 Mar 2004 21:43:24 -0000 1.9 +++ libavcodec/ppc/fft_altivec.c 22 Jun 2005 16:24:29 -0000 @@ -24,6 +24,8 @@
#include "dsputil_altivec.h"
+#ifdef HAVE_ALTIVEC + /* those three macros are from libavcodec/fft.c and are required for the reference C code @@ -245,3 +247,5 @@
#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } + +#endif /* HAVE_ALTIVEC */ Index: libavcodec/ppc/gcc_fixes.h =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/ppc/gcc_fixes.h,v retrieving revision 1.5 diff -a -u -u -r1.5 gcc_fixes.h --- libavcodec/ppc/gcc_fixes.h 28 Feb 2004 15:03:53 -0000 1.5 +++ libavcodec/ppc/gcc_fixes.h 22 Jun 2005 16:24:29 -0000 @@ -12,7 +12,7 @@ #endif
#ifdef CONFIG_DARWIN -# ifndef __MWERKS__ +# if ! defined __MWERKS__ && defined __APPLE_CC__ && __APPLE_CC__
4000 && ! defined __APPLE_ALTIVEC__ # define AVV(x...) (x) # else # define AVV Index: libavcodec/ppc/gmc_altivec.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/ppc/gmc_altivec.c,v retrieving revision 1.10 diff -a -u -u -r1.10 gmc_altivec.c --- libavcodec/ppc/gmc_altivec.c 28 Feb 2004 15:03:53 -0000 1.10 +++ libavcodec/ppc/gmc_altivec.c 22 Jun 2005 16:24:29 -0000 @@ -24,6 +24,8 @@
#include "dsputil_altivec.h"
+#ifdef HAVE_ALTIVEC + /* altivec-enhanced gmc1. ATM this code assume stride is a multiple of 8, to preserve proper dst alignement. @@ -170,3 +172,5 @@
#endif /* ALTIVEC_USE_REFERENCE_C_CODE */ } + +#endif /* HAVE_ALTIVEC */ Index: libavcodec/ppc/idct_altivec.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/ppc/idct_altivec.c,v retrieving revision 1.8 diff -a -u -u -r1.8 idct_altivec.c --- libavcodec/ppc/idct_altivec.c 28 Feb 2004 15:03:53 -0000 1.8 +++ libavcodec/ppc/idct_altivec.c 22 Jun 2005 16:24:29 -0000 @@ -43,6 +43,8 @@
#include "dsputil_altivec.h"
+#ifdef HAVE_ALTIVEC + #define vector_s16_t vector signed short #define const_vector_s16_t const_vector signed short #define vector_u16_t vector unsigned short @@ -247,3 +249,4 @@ #endif /* ALTIVEC_USE_REFERENCE_C_CODE */ }
+#endif /* HAVE_ALTIVEC */ Index: libavcodec/ppc/mpegvideo_altivec.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/ppc/mpegvideo_altivec.c,v retrieving revision 1.13 diff -a -u -u -r1.13 mpegvideo_altivec.c --- libavcodec/ppc/mpegvideo_altivec.c 16 Apr 2004 12:47:37 -0000 1.13 +++ libavcodec/ppc/mpegvideo_altivec.c 22 Jun 2005 16:24:29 -0000 @@ -28,6 +28,8 @@
#include "dsputil_altivec.h"
+#ifdef HAVE_ALTIVEC + // Swaps two variables (used for altivec registers) #define SWAP(a,b) \ do { \ @@ -647,3 +649,5 @@
POWERPC_PERF_STOP_COUNT(altivec_dct_unquantize_h263_num, nCoeffs == 63); } + +#endif /* HAVE_ALTIVEC */ Index: libavformat/Makefile =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/Makefile,v retrieving revision 1.91 diff -a -u -u -r1.91 Makefile --- libavformat/Makefile 22 May 2005 23:58:58 -0000 1.91 +++ libavformat/Makefile 22 Jun 2005 16:24:30 -0000 @@ -97,7 +97,7 @@ $(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $ (PPOBJS) $(AVCLIBS) $(EXTRALIBS) -lib /machine:i386 /def:$(@:.dll=.def) else - $(CC) $(SHFLAGS) -o $@ $(OBJS) $(PPOBJS) $(AVCLIBS) $(EXTRALIBS) + $(CC) $(SHFLAGS) -o $@ $(OBJS) $(PPOBJS) $(EXTRALIBS) $(LDFLAGS) endif
depend: $(SRCS) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel at mplayerhq.hu http://mplayerhq.hu/mailman/listinfo/ffmpeg-devel
participants (2)
-
d.hartman@student.utwente.nl -
danchr@opendarwin.org