[FFmpeg-devel] [RFC] abs vs FFABS
Ronald S. Bultje
rsbultje
Sat Jan 17 16:32:10 CET 2009
Hi,
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...
:-).
Ronald
[1] 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
mac121641:/tmp ronaldbultje$ time ./test m 1000000000
real 0m0.803s
user 0m0.794s
sys 0m0.005s
mac121641:/tmp ronaldbultje$ time ./test m 1000000000
real 0m0.808s
user 0m0.801s
sys 0m0.005s
mac121641:/tmp ronaldbultje$ time ./test m 1000000000
real 0m0.809s
user 0m0.802s
sys 0m0.005s
mac121641:/tmp ronaldbultje$ time ./test b 1000000000
real 0m0.769s
user 0m0.762s
sys 0m0.005s
mac121641:/tmp ronaldbultje$ time ./test b 1000000000
real 0m0.783s
user 0m0.757s
sys 0m0.005s
mac121641:/tmp ronaldbultje$ time ./test b 1000000000
real 0m0.771s
user 0m0.756s
sys 0m0.005s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 1324 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090117/87787aed/attachment.c>
More information about the ffmpeg-devel
mailing list