[MPlayer-dev-eng] [PATCH] af_scaletempo

Robert Juliano juliano.1 at osu.edu
Fri Sep 14 07:02:30 CEST 2007


On Thu, Sep 13, 2007 at 10:50:31AM +0200, Reimar D?ffinger wrote:
> > +#ifdef USE_INT
> > +      corr += ( *pc * *pw ) / s->sloping_divider;
> 
> No wonder the int version is slower. Divisions in an inner loop are
> horrible.
> And since you are doing a sum I don't really see why you have to do the
> division here and not outside the loop? It should still be faster and
> more precise to do it outside, even if you had to make corr 64 bit to
> avoid an overflow.

There are many ways to optimize this.  The best I've found
is to convert to float, do all floating-point calculations,
and then convert back to int.  With the division, the int
version is 2-4x slower, 20% slower without it, even against
two format conversions.



More information about the MPlayer-dev-eng mailing list