[FFmpeg-devel] [RFC] abs vs FFABS
Sat Jan 17 16:52:16 CET 2009
Ronald S. Bultje wrote:
> On Sat, Jan 17, 2009 at 9:02 AM, Stefan Gehrer <stefan.gehrer at gmx.de> wrote:
>> currently there is a mixture of abs and FFABS in the code,
>> for example in dsputil.c 96 of the former and 36 of the latter.
>> In cavs* I use abs() throughout, so I wonder if there is
>> a preference for one of the two and then if the other one
>> should be replaced.
> abs() appears faster, so maybe FFABS() should be removed in favour of abs().
> I'm wondering if context makes a difference in which one is faster in
> particular cases? I wouldn't want to have to test every single case...
>  1billion abs/FFABS cycles + some checks, m = macro (FFABS()), b =
> built-in (abs()), see attached code
> i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build
> 5367), compiled with -O3
If I compile with -O3 (gcc 4.3.2), execution takes no measurable time.
It seems the loop gets optimized away.
If I compile without optimization, both macro and builtin run for
the same time of about two seconds and then print a
"math op failed", which is surprising.
More information about the ffmpeg-devel