[FFmpeg-cvslog] libm: Add fallback definition for cbrt() using pow()

James Almer git at videolan.org
Tue Jan 22 19:37:10 CET 2013


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Jan 22 04:10:21 2013 -0300| [e65d8509f0657810511b96f2eec43b7cf31434e9] | committer: Michael Niedermayer

libm: Add fallback definition for cbrt() using pow()

The function is known to be missing in at least one target (MSVC).

Signed-off-by: James Almer <jamrial at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/configure b/configure
index 8460e5f..a741fc3 100755
--- a/configure
+++ b/configure
@@ -1300,6 +1300,7 @@ HAVE_LIST_PUB='
 MATH_FUNCS="
     atanf
     atan2f
+    cbrt
     cbrtf
     cosf
     exp2
diff --git a/libavutil/libm.h b/libavutil/libm.h
index bfcc21c..6c17b28 100644
--- a/libavutil/libm.h
+++ b/libavutil/libm.h
@@ -48,6 +48,13 @@
 #define powf(x, y) ((float)pow(x, y))
 #endif
 
+#if !HAVE_CBRT
+static av_always_inline double cbrt(double x)
+{
+    return x < 0 ? -pow(-x, 1.0 / 3.0) : pow(x, 1.0 / 3.0);
+}
+#endif
+
 #if !HAVE_CBRTF
 static av_always_inline float cbrtf(float x)
 {



More information about the ffmpeg-cvslog mailing list