changeset 411:d25e027364d6 libavutil

Check for the presence of llrint(), lrint(), round() and roundf() and provide simple replacements if they are unavailable. patch by Michael Kostylev, mik niipt ru
author diego
date Thu, 27 Dec 2007 01:53:02 +0000
parents 033099f22fc2
children 357ac44f4720
files internal.h
diffstat 1 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/internal.h	Thu Dec 27 01:42:46 2007 +0000
+++ b/internal.h	Thu Dec 27 01:53:02 2007 +0000
@@ -270,6 +270,20 @@
     }\
 }
 
+#ifndef HAVE_LLRINT
+static av_always_inline long long llrint(double x)
+{
+    return rint(x);
+}
+#endif /* HAVE_LLRINT */
+
+#ifndef HAVE_LRINT
+static av_always_inline long int lrint(double x)
+{
+    return rint(x);
+}
+#endif /* HAVE_LRINT */
+
 #ifndef HAVE_LRINTF
 static av_always_inline long int lrintf(float x)
 {
@@ -277,4 +291,18 @@
 }
 #endif /* HAVE_LRINTF */
 
+#ifndef HAVE_ROUND
+static av_always_inline double round(double x)
+{
+    return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
+}
+#endif /* HAVE_ROUND */
+
+#ifndef HAVE_ROUNDF
+static av_always_inline float roundf(float x)
+{
+    return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
+}
+#endif /* HAVE_ROUNDF */
+
 #endif /* FFMPEG_INTERNAL_H */