[FFmpeg-devel] [PATCH] swscale C code and the GPL

Diego Biurrun diego
Thu Jun 25 22:06:13 CEST 2009


On Thu, Jun 25, 2009 at 07:50:15PM +0200, Michael Niedermayer wrote:
> On Thu, Jun 25, 2009 at 05:16:59PM +0200, Diego Biurrun wrote:
> > Here is a patch that fixes a false dependency of the C code in swscale
> > on the GPL.  I'm not 100% sure about the last hunk, the rest should be
> > correct.
> > 
> >  swscale.c |   10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 063e24e6798072a6a3955b963e820e1dc5583f77  swscale_gpl.diff

Where did this come from, it's not in my patch..

> > --- libswscale/swscale.c	(revision 29389)
> > +++ libswscale/swscale.c	(working copy)
> > @@ -1301,7 +1301,7 @@
> >  
> >  //Note: we have C, MMX, MMX2, 3DNOW versions, there is no 3DNOW+MMX2 one
> >  //Plain C versions
> > -#if (!HAVE_MMX && !HAVE_ALTIVEC) || CONFIG_RUNTIME_CPUDETECT || !CONFIG_GPL
> > +#if ((!HAVE_MMX || !CONFIG_GPL) && !HAVE_ALTIVEC) || CONFIG_RUNTIME_CPUDETECT
> >  #define COMPILE_C
> >  #endif
> 
> as this changes just the HAVE_ALTIVEC == 1 case, its for the altivec
> maintainer to decide

I'm confident enough about this part.

> > @@ -1972,10 +1972,10 @@
> >  
> >  static SwsFunc getSwsFunc(SwsContext *c)
> >  {
> > -#if CONFIG_RUNTIME_CPUDETECT && CONFIG_GPL
> > +#if CONFIG_RUNTIME_CPUDETECT
> >      int flags = c->flags;
> >  
> > -#if ARCH_X86
> > +#if ARCH_X86 && CONFIG_GPL
> >      // ordered per speed fastest first
> >      if (flags & SWS_CPU_CAPS_MMX2) {
> >          sws_init_swScale_MMX2(c);
> 
> redundant

I beg to differ.  Without the CONFIG_GPL, x86 optimizations would get
enabled.

> > @@ -2565,7 +2565,7 @@
> >          __asm__ volatile("emms\n\t"::: "memory");
> >  #endif
> >  
> > -#if !CONFIG_RUNTIME_CPUDETECT || !CONFIG_GPL //ensure that the flags match the compiled variant if cpudetect is off
> > +#if !CONFIG_RUNTIME_CPUDETECT //ensure that the flags match the compiled variant if cpudetect is off
> >      flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN);
> >  #if   HAVE_MMX2
> >      flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2;
> 
> i suspect this change is correct

OK, applied then.  Thanks for the quick review.

Diego



More information about the ffmpeg-devel mailing list