[FFmpeg-devel] [RFC] abs vs FFABS

Måns Rullgård mans
Sat Jan 17 17:33:28 CET 2009

"Ronald S. Bultje" <rsbultje at gmail.com> writes:

> Hi Uoti,
> On Sat, Jan 17, 2009 at 11:10 AM, Uoti Urpala <uoti.urpala at pp1.inet.fi> wrote:
>> The compiler should be able to optimize that whole function to
>> "return 0;", and current GCC does.
> The idea is that it doesn't because the input is (semi-)random. The
> abs()/FFABS() is done on a calculated number per cycle. I wish I could
> check assembler to ensure it does, but I don't think it can just be
> optimized to return 0, because every outcome is checked (see test_end)
> and it returns 1 if it is wrong.

The result is discarded, so there is no need to calculate it at all.
Why don't you check the assembler yourself and see that the loops are

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list