[Ffmpeg-devel] [PATCH] Build failes on i386 if snow is disabled

Martin Storsjö martin
Sun Feb 25 21:25:45 CET 2007


On Thu, 22 Feb 2007, Diego Biurrun wrote:

> On Thu, Feb 22, 2007 at 07:30:49AM +0200, Martin Storsj? wrote:
>> On Thu, 22 Feb 2007, Diego Biurrun wrote:
>>
>>> Looks wrong, AFAIR snowdsp_mmx is used by the decoder, not the encoder.
>>> Maybe both, but surely not just the encoder.
>>
>> I was able to build a complete ffmpeg using this when enabling only the
>> decoder.
>
> No doubt about this, the optimized routines were just left out..
>
>> Additionally, in dsputil_mmx.c, all references to the
>> ff_snow-routines are wrapped in CONFIG_SNOW_ENCODER only.
>
> True, but this looks wrong to me, in libavcodec/ppc/dsputil_ppc.c they
> are protected by 'if(ENABLE_SNOW_DECODER)' ..

Yes, it definitively seems to be wrong at the moment. Currently, the 
generic implementations of the snow dsp functions are set in dsputil.c 
only if CONFIG_SNOW_ENCODER is defined. Thus, the snow decoder segfaults 
if the encoder isn't built.

Attached is a new attempt at fixing this. It changes all occurrances of 
#ifdef CONFIG_SNOW_ENCODER into #if defined(CONFIG_SNOW_ENCODER) || 
defined(CONFIG_SNOW_DECODER), and includes the architecture-dependent dsp 
routines in the build only if the snow decoder/encoder is built (the 
original problem I had).

// Martin
-------------- next part --------------
Index: libavcodec/i386/dsputil_mmx.c
===================================================================
--- libavcodec/i386/dsputil_mmx.c	(revision 8055)
+++ libavcodec/i386/dsputil_mmx.c	(working copy)
@@ -3037,7 +3037,7 @@
     asm volatile("emms");
 }
 
-#ifdef CONFIG_SNOW_ENCODER
+#if defined(CONFIG_SNOW_ENCODER) || defined(CONFIG_SNOW_DECODER)
 extern void ff_snow_horizontal_compose97i_sse2(DWTELEM *b, int width);
 extern void ff_snow_horizontal_compose97i_mmx(DWTELEM *b, int width);
 extern void ff_snow_vertical_compose97i_sse2(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, DWTELEM *b3, DWTELEM *b4, DWTELEM *b5, int width);
@@ -3462,7 +3462,7 @@
             c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_3dnow;
         }
 
-#ifdef CONFIG_SNOW_ENCODER
+#if defined(CONFIG_SNOW_ENCODER) || defined(CONFIG_SNOW_DECODER)
         if(mm_flags & MM_SSE2){
             c->horizontal_compose97i = ff_snow_horizontal_compose97i_sse2;
             c->vertical_compose97i = ff_snow_vertical_compose97i_sse2;
Index: libavcodec/ppc/dsputil_ppc.c
===================================================================
--- libavcodec/ppc/dsputil_ppc.c	(revision 8055)
+++ libavcodec/ppc/dsputil_ppc.c	(working copy)
@@ -280,7 +280,7 @@
         mm_flags |= MM_ALTIVEC;
 
         dsputil_init_altivec(c, avctx);
-        if(ENABLE_SNOW_DECODER) snow_init_altivec(c, avctx);
+        if(ENABLE_SNOW_DECODER || ENABLE_SNOW_ENCODER) snow_init_altivec(c, avctx);
         if(ENABLE_VC1_DECODER || ENABLE_WMV3_DECODER)
             vc1dsp_init_altivec(c, avctx);
         float_init_altivec(c, avctx);
Index: libavcodec/snow.h
===================================================================
--- libavcodec/snow.h	(revision 8055)
+++ libavcodec/snow.h	(working copy)
@@ -127,7 +127,7 @@
 extern void ff_snow_horizontal_compose97i(DWTELEM *b, int width);
 extern void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8);
 
-#ifdef CONFIG_SNOW_ENCODER
+#if defined(CONFIG_SNOW_ENCODER) || defined(CONFIG_SNOW_DECODER)
 int w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
 int w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
 #else
Index: libavcodec/dsputil.c
===================================================================
--- libavcodec/dsputil.c	(revision 8055)
+++ libavcodec/dsputil.c	(working copy)
@@ -297,7 +297,7 @@
 }
 
 
-#ifdef CONFIG_SNOW_ENCODER //dwt is in snow.c
+#if defined(CONFIG_SNOW_ENCODER) || defined(CONFIG_SNOW_DECODER) //dwt is in snow.c
 static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){
     int s, i, j;
     const int dec_count= w==8 ? 3 : 4;
@@ -3196,7 +3196,7 @@
         case FF_CMP_NSSE:
             cmp[i]= c->nsse[i];
             break;
-#ifdef CONFIG_SNOW_ENCODER
+#if defined(CONFIG_SNOW_ENCODER) || defined(CONFIG_SNOW_DECODER)
         case FF_CMP_W53:
             cmp[i]= c->w53[i];
             break;
@@ -4069,7 +4069,7 @@
     c->vsse[4]= vsse_intra16_c;
     c->nsse[0]= nsse16_c;
     c->nsse[1]= nsse8_c;
-#ifdef CONFIG_SNOW_ENCODER
+#if defined(CONFIG_SNOW_ENCODER) || defined(CONFIG_SNOW_DECODER)
     c->w53[0]= w53_16_c;
     c->w53[1]= w53_8_c;
     c->w97[0]= w97_16_c;
@@ -4097,7 +4097,7 @@
     c->try_8x8basis= try_8x8basis_c;
     c->add_8x8basis= add_8x8basis_c;
 
-#ifdef CONFIG_SNOW_ENCODER
+#if defined(CONFIG_SNOW_ENCODER) || defined(CONFIG_SNOW_DECODER)
     c->vertical_compose97i = ff_snow_vertical_compose97i;
     c->horizontal_compose97i = ff_snow_horizontal_compose97i;
     c->inner_add_yblock = ff_snow_inner_add_yblock;
Index: libavcodec/utils.c
===================================================================
--- libavcodec/utils.c	(revision 8055)
+++ libavcodec/utils.c	(working copy)
@@ -630,7 +630,7 @@
 {"vsad", "sum of absolute vertical differences", 0, FF_OPT_TYPE_CONST, FF_CMP_VSAD, INT_MIN, INT_MAX, V|E, "cmp_func"},
 {"vsse","sum of squared vertical differences", 0, FF_OPT_TYPE_CONST, FF_CMP_VSSE, INT_MIN, INT_MAX, V|E, "cmp_func"},
 {"nsse", "noise preserving sum of squared differences", 0, FF_OPT_TYPE_CONST, FF_CMP_NSSE, INT_MIN, INT_MAX, V|E, "cmp_func"},
-#ifdef CONFIG_SNOW_ENCODER
+#if defined(CONFIG_SNOW_ENCODER) || defined(CONFIG_SNOW_DECODER)
 {"w53", "5/3 wavelet, only used in snow", 0, FF_OPT_TYPE_CONST, FF_CMP_W53, INT_MIN, INT_MAX, V|E, "cmp_func"},
 {"w97", "9/7 wavelet, only used in snow", 0, FF_OPT_TYPE_CONST, FF_CMP_W97, INT_MIN, INT_MAX, V|E, "cmp_func"},
 #endif
Index: libavcodec/Makefile
===================================================================
--- libavcodec/Makefile	(revision 8055)
+++ libavcodec/Makefile	(working copy)
@@ -327,8 +327,10 @@
         i386/vp3dsp_sse2.o \
         i386/fft_3dn.o \
         i386/fft_3dn2.o \
-        i386/snowdsp_mmx.o \
 
+OBJS-$(CONFIG_SNOW_DECODER)            += i386/snowdsp_mmx.o
+OBJS-$(CONFIG_SNOW_ENCODER)            += i386/snowdsp_mmx.o
+
 ifeq ($(CONFIG_GPL),yes)
 OBJS += i386/idct_mmx.o
 endif
@@ -392,6 +394,7 @@
 ifeq ($(TARGET_ALTIVEC),yes)
 OBJS-$(CONFIG_H264_DECODER)            += ppc/h264_altivec.o
 OBJS-$(CONFIG_SNOW_DECODER)            += ppc/snow_altivec.o
+OBJS-$(CONFIG_SNOW_ENCODER)            += ppc/snow_altivec.o
 OBJS-$(CONFIG_VC1_DECODER)             += ppc/vc1dsp_altivec.o
 OBJS-$(CONFIG_WMV3_DECODER)            += ppc/vc1dsp_altivec.o
 endif



More information about the ffmpeg-devel mailing list