[MPlayer-dev-eng] [PATCH] af_scaletempo

Rich Felker dalias at aerifal.cx
Fri Sep 14 07:21:30 CEST 2007


On Fri, Sep 14, 2007 at 01:02:30AM -0400, Robert Juliano wrote:
> 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.

Read what Reimar said. You don’t have to do any divisions in the inner
loop. Instead do them outside. No need for float which is bad anyway
because it needs alternative non-float code to support machines
without hardware float.

Rich



More information about the MPlayer-dev-eng mailing list