[Ffmpeg-devel] [PATCH] Allow disabling some AltiVec-optimized codecs

Diego Biurrun diego
Tue Nov 21 22:39:14 CET 2006


Here is a patch that allows conditionally compiling some of the AltiVec
optimizations depending on the codec in question being enabled or not.

I'm not sure if the best way to do this is through #ifdef or the new
ENABLE definitions, here is a patch that uses the latter.

Diego
-------------- next part --------------
Index: libavcodec/ppc/dsputil_ppc.c
===================================================================
--- libavcodec/ppc/dsputil_ppc.c	(revision 7148)
+++ libavcodec/ppc/dsputil_ppc.c	(working copy)
@@ -274,14 +274,14 @@
     }
 
 #ifdef HAVE_ALTIVEC
-    dsputil_h264_init_ppc(c, avctx);
+    if(ENABLE_H264_DECODER) dsputil_h264_init_ppc(c, avctx);
 
     if (has_altivec()) {
         mm_flags |= MM_ALTIVEC;
 
         dsputil_init_altivec(c, avctx);
-        snow_init_altivec(c, avctx);
-        vc1dsp_init_altivec(c, avctx);
+        if(ENABLE_SNOW_DECODER) snow_init_altivec(c, avctx);
+        if(ENABLE_VC1_DECODER) vc1dsp_init_altivec(c, avctx);
         float_init_altivec(c, avctx);
         c->gmc1 = gmc1_altivec;
 
Index: libavcodec/Makefile
===================================================================
--- libavcodec/Makefile	(revision 7149)
+++ libavcodec/Makefile	(working copy)
@@ -388,11 +388,14 @@
                                           ppc/fft_altivec.o          \
                                           ppc/gmc_altivec.o          \
                                           ppc/fdct_altivec.o         \
-                                          ppc/h264_altivec.o         \
-                                          ppc/snow_altivec.o         \
-                                          ppc/vc1dsp_altivec.o       \
                                           ppc/float_altivec.o        \
 
+ifeq ($(TARGET_ALTIVEC),yes)
+OBJS-$(CONFIG_H264_DECODER)            += ppc/h264_altivec.o
+OBJS-$(CONFIG_SNOW_DECODER)            += ppc/snow_altivec.o
+OBJS-$(CONFIG_VC1_DECODER)             += ppc/vc1dsp_altivec.o
+endif
+
 OBJS-$(TARGET_ARCH_BFIN)               += bfin/dsputil_bfin.o \
 
 CFLAGS += $(CFLAGS-yes)



More information about the ffmpeg-devel mailing list