# [FFmpeg-devel] [PATCH] Common fixed-point ACELP routines (1/3) - math

Fri Apr 25 19:59:27 CEST 2008

```Michael Niedermayer wrote:
> On Fri, Apr 25, 2008 at 10:41:27PM +0700, Vladimir Voroshilov wrote:
> > Michael Niedermayer wrote:
> > > On Fri, Apr 25, 2008 at 07:14:18PM +0700, Vladimir Voroshilov wrote:
> > > > Michael Niedermayer wrote:
> > > > > On Fri, Apr 25, 2008 at 02:20:46PM +0700, Vladimir Voroshilov wrote:
> > > >
> > > > [...]
> > > >
> > > > > > +/**
> > > > > > + * \brief Calculates sum of array elements multiplications
> > > > > > + * \param speech array with input data
> > > > > > + * \param cycles number elements to proceed
> > > > > > + * \param offset offset for calculation sum of s[i]*s[i+offset]
> > > > > > + * \param shift right shift by this value will be done before multiplication
> > > > > > + *
> > > > > > + * \return sum of multiplications
> > > > > > + *
> > > > > > + * \note array must be at least length+offset long!
> > > > >                                    ^^^^^^
> > > > > its called cycles in the function, and yes i agree length is a better name
> > > > >
> > > > >
> > > > > > + */
> > > > > > +static int sum_of_squares(const int16_t* speech, int cycles, int offset, int shift)
> > > > > > +{
> > > > > > +    const int16_t* speech_end;
> > > > > > +    int sum = 0;
> > > > > > +
> > > > >
> > > > > > +    shift <<= 1;
> > > > >
> > > > > I would prefer if this is done outside of the function, doing it inside
> > > > > means only even shift values can be used.
> > > > v>
> > > >
> > > > All above fixed.
> > >
> > > looks ok
> >
> > So can be committed right now as is (with acelp_math name) ?
>
> yes
>
>
> >
> > What about such log message:
> > "Fixed-point implementation of ff_cos, ff_log2, ff_exp2.
> > Also implemented routine for calculating sum(a[i] * a[i-offset]>>shift)"
>
> yes

Applied.

>
> [...]
> --
>
> It is not what we do, but why we do it that matters.

--
Regards,