[FFmpeg-cvslog] configure: Check for the math function rint

Ronald S. Bultje git at videolan.org
Thu Jul 12 00:03:07 CEST 2012


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Tue Jun 26 15:05:28 2012 +0300| [183b1c2268529bbb8389d572deb00083c49682dc] | committer: Martin Storsjö

configure: Check for the math function rint

Add a fallback implementation if it doesn't exist.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=183b1c2268529bbb8389d572deb00083c49682dc
---

 configure        |    2 ++
 libavutil/libm.h |    7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/configure b/configure
index ffb1e7e..2888c72 100755
--- a/configure
+++ b/configure
@@ -1124,6 +1124,7 @@ HAVE_LIST="
     poll_h
     posix_memalign
     rdtsc
+    rint
     round
     roundf
     rweflags
@@ -2954,6 +2955,7 @@ check_mathfunc log2
 check_mathfunc log2f
 check_mathfunc lrint
 check_mathfunc lrintf
+check_mathfunc rint
 check_mathfunc round
 check_mathfunc roundf
 check_mathfunc trunc
diff --git a/libavutil/libm.h b/libavutil/libm.h
index b5821e8..8305b7c 100644
--- a/libavutil/libm.h
+++ b/libavutil/libm.h
@@ -86,6 +86,13 @@ static av_always_inline av_const int isnan(float x)
 #define log2f(x) ((float)log2(x))
 #endif /* HAVE_LOG2F */
 
+#if !HAVE_RINT
+static inline double rint(double x)
+{
+    return x >= 0 ? floor(x + 0.5) : ceil(x - 0.5);
+}
+#endif /* HAVE_RINT */
+
 #if !HAVE_LRINT
 static av_always_inline av_const long int lrint(double x)
 {



More information about the ffmpeg-cvslog mailing list