[FFmpeg-devel] [PATCH] fix macro redefinition in ac3enc.c

Diego Biurrun diego
Thu Mar 5 23:27:24 CET 2009


On Thu, Mar 05, 2009 at 07:43:57PM +0000, M?ns Rullg?rd wrote:
> Diego Biurrun <diego at biurrun.de> writes:
> 
> > Here is a small patch to remove the redundant MUL16 macro from
> > libavcodec/ac3enc.c.  The very same macro exists in mathops.h.
> > This avoids the warning
> >
> > libavcodec/ac3enc.c:119:1: warning: "MUL16" redefined
> > In file included from libavcodec/bitstream.h:36,
> >                  from libavcodec/ac3enc.c:30:
> > libavcodec/mathops.h:79:1: warning: this is the location of the previous definition
> >
> > --- libavcodec/ac3enc.c	(revision 17826)
> > +++ libavcodec/ac3enc.c	(working copy)
> > @@ -116,8 +116,6 @@
> >    qim = (by - ay) >> 1;\
> >  }
> >  
> > -#define MUL16(a,b) ((a) * (b))
> > -
> 
> Looks OK to me.  I'd still run make test just to be sure.

Passes 'make test', applied.

> >  #define CMUL(pre, pim, are, aim, bre, bim) \
> >  {\
> >     pre = (MUL16(are, bre) - MUL16(aim, bim)) >> 15;\
> 
> This reminds me, there are variants of that macro in several places
> too.  We should clean it up somehow...

grep reveals the following ones:

libavcodec/mdct.c:
#define CMUL(pre, pim, are, aim, bre, bim) \
{\
    FFTSample _are = (are);\
    FFTSample _aim = (aim);\
    FFTSample _bre = (bre);\
    FFTSample _bim = (bim);\
    (pre) = _are * _bre - _aim * _bim;\
    (pim) = _are * _bim + _aim * _bre;\
}

libavcodec/ac3enc.c:
#define CMUL(pre, pim, are, aim, bre, bim) \
{\
   pre = (MUL16(are, bre) - MUL16(aim, bim)) >> 15;\
   pim = (MUL16(are, bim) + MUL16(bre, aim)) >> 15;\
}


libavcodec/x86/fft_sse.c:
#define CMUL(j,xmm0,xmm1)\
        "movaps   (%2,"#j",2), %%xmm6 \n"\
        "movaps 16(%2,"#j",2), "#xmm0"\n"\
        "movaps        %%xmm6, "#xmm1"\n"\
        "movaps        "#xmm0",%%xmm7 \n"\
        "mulps      (%3,"#j"), %%xmm6 \n"\
        "mulps      (%4,"#j"), "#xmm0"\n"\
        "mulps      (%4,"#j"), "#xmm1"\n"\
        "mulps      (%3,"#j"), %%xmm7 \n"\
        "subps         %%xmm6, "#xmm0"\n"\
        "addps         %%xmm7, "#xmm1"\n"

libavcodec/x86/fft_3dn2.c:
#define CMUL(j,mm0,mm1)\
        "movq  (%2,"#j",2), %%mm6 \n"\
        "movq 8(%2,"#j",2), "#mm0"\n"\
        "movq        %%mm6, "#mm1"\n"\
        "movq        "#mm0",%%mm7 \n"\
        "pfmul   (%3,"#j"), %%mm6 \n"\
        "pfmul   (%4,"#j"), "#mm0"\n"\
        "pfmul   (%4,"#j"), "#mm1"\n"\
        "pfmul   (%3,"#j"), %%mm7 \n"\
        "pfsub       %%mm6, "#mm0"\n"\
        "pfadd       %%mm7, "#mm1"\n"

They do look different to me...

Diego




More information about the ffmpeg-devel mailing list