configure+libm.h: add hypot emulation

Multimedia / FFmpeg - Ganesh Ajjanagadde [gmail.com] - 21 November 2015 07:51 UTC

It is known that the naive sqrt(x*x + y*y) approach for computing the hypotenuse suffers from overflow and accuracy issues, see e.g http://www.johndcook.com/blog/2010/06/02/whats-so-hard-about-finding-a-hypotenuse/. This adds hypot support to FFmpeg, a C99 function.

On platforms without hypot, this patch does a reaonable workaround, that although not as accurate as GNU libm, is readable and does not suffer from the overflow issue. Improvements can be made separately.

275aca8 configure+libm.h: add hypot emulation
configure | 2 ++
libavutil/libm.h | 23 +++++++++++++++++++++++
2 files changed, 25 insertions(+)

  • Share