[FFmpeg-devel] [PATCH] dot_product() static non-inline in a header

Aurelien Jacobs aurel
Mon Dec 15 22:24:19 CET 2008


Kostya wrote:

> On Sun, Dec 14, 2008 at 11:37:20PM +0000, M?ns Rullg?rd wrote:
> [...]
> > > +++ libavcodec/celp_math.c	(working copy)
> > > @@ -196,6 +196,17 @@
> > >      return (power_int << 15) + value;
> > >  }
> > >  
> > > +int ff_dot_product(const int16_t* a, const int16_t* b, int length, int shift)
> > > +{
> > > +    int sum = 0;
> > > +    int i;
> > > +
> > > +    for(i=0; i<length; i++)
> > > +        sum += (a[i] * b[i]) >> shift;
> > > +
> > > +    return sum;
> > > +}
> > 
> > This looks generic enough that it should probably be moved to
> > something like dsputils.  It is also trivially simdable.
> 
> No, we have scalarproduct_int16() in DSPContext already which has the same
> syntax and does the same thing. Also it has AltiVec and SSE2 implementations.

True !
Attached patch uses scalarproduct_int16() and removes ff_dot_product().
It is not really tested as ff_acelp_decode_gain_code() is currently unused.
But it should be OK anyway.

Aurel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dot_product_dsp.diff
Type: text/x-patch
Size: 3019 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081215/4f3b06b6/attachment.bin>



More information about the ffmpeg-devel mailing list