[FFmpeg-devel] [PATCH][RFC] lavu/libm: add exp10 support
michael at niedermayer.cc
Tue Dec 22 12:35:56 CET 2015
On Mon, Dec 21, 2015 at 07:19:50PM -0800, Ganesh Ajjanagadde wrote:
> exp10 is a function available in GNU libm. Looks like no other common
> libm has it. As such, I am mostly neutral about its inclusion, with a
> very slight bias in favor since I am actually posting this.
> 1. It is faster than pow, and has less of a chance of going into one of
> the terribly slow paths:
> Speedup is roughly 30% of the original execution time for an "average"
> benchmark over 1e8 arguments uniformly spaced from -1 to 1
> (similar results for other intervals):
> ./test 4.07s user 0.00s system 100% cpu 4.068 total (exp10)
> ./test 5.71s user 0.00s system 100% cpu 5.711 total (pow)
> 1. It is GNU libm only, and requires -D_GNU_SOURCE.
> 2. Speedup is not that impressive.
> 3. pow(10, x) is not terribly common in the code, and still cheaper
> approximation (not as accurate, but often reasonable) exp(ln(10)*x) is
> much faster:
> ./test 2.55s user 0.00s system 99% cpu 2.548 total (exp(ln(10)*x))
IMHO a exp10 fallback should be implemented using exp2() if that is faster
Code requiring absolute accuracy must be written using integers as C
does not gurantee accuracy for float and double.
A single libc or fallback providing more accuracy does not really help
as our code must function correctly in the absence of such accuracy
also the accuracy difference between exp2() and pow() should be
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 181 bytes
Desc: Digital signature
More information about the ffmpeg-devel