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

Vladimir Voroshilov voroshil
Thu Apr 24 16:32:53 CEST 2008


On Thu, Apr 24, 2008 at 3:33 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Thu, Apr 24, 2008 at 02:41:54AM +0700, Vladimir Voroshilov wrote:
>  [...]
>  > > > +/**
>  > > > + * \brief Calculates sum of array elements absolute values
>  > > > + * \param speech array with input data
>  > > > + * \param cycles number elements to proceed
>  > > > + * \param shift right shift by this value will be done before addition
>  > > > + *
>  > > > + * \return sum of absolute values
>  > > > + */
>  > > > +static int sum_of_absolute(const int16_t* speech, int cycles, int shift)
>  > > > +{
>  > > > +    int n;
>  > > > +    int sum = 0;
>  > > > +
>  > > > +    for(n=0; n<cycles; n++)
>  > > > +       sum += FFABS(speech[n] >> shift);
>  > > > +
>  > > > +    return sum;
>  > > > +}
>  > >
>  > > The place where the shift is done is not optimal for precission.
>  >
>  > I've just realized that i'm not using shift at all.
>  > Should i keep routine as is, remove shift or remove all routine?
>  > Currently moved outside loop.
>
>  if shift is always 0 remove shift.
>  and maybe yes, remove the whole routine its so simple that iam not sure
>  if this makes sense here, maybe if its speed critical it could be put in
>  dsputil but i guess it could as well stay in g729.c for now

I've inlined that code.


-- 
Regards,
Vladimir Voroshilov mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
ICQ: 95587719
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: acelp_math_23.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080424/f918094d/attachment.asc>



More information about the ffmpeg-devel mailing list