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

Michael Niedermayer michaelni
Wed Apr 23 22:33:08 CEST 2008


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

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080423/58132337/attachment.pgp>



More information about the ffmpeg-devel mailing list