[MPlayer-dev-eng] [PATCH] vf_ass: avoid a division

Reimar Döffinger Reimar.Doeffinger at gmx.de
Fri Sep 17 21:48:21 CEST 2010


On Fri, Sep 17, 2010 at 09:36:24PM +0200, Nicolas George wrote:
> > if (!k)
> >     continue;
> 
> ... is there any objection for me to commit this one?

Go ahead (though note that may suggestion is to check the src before
instead of after the multiplication).

> > Note that the constant add possibly should be tweaked a bit.
> > You could also use *129 instead of *258 in case the above
> > can overflow or you'd like to be able to use signed ints.
> 
> I think I will start with *129, since the one you wrote above was *257
> rather than *258; *258 would require one more shift for no useful reason.

Performance should not really matter much there, since it's
all the way outside the loop, so just writing it as
*= 258
would be fine.
Using 258 has the advantage that the shifts in the inner loop
are bytewise, for which a compiler can generate fast code
even for architectures that do not have fast arbitrary shifts.


More information about the MPlayer-dev-eng mailing list