[libav-commits] libm: add fallbacks for various single-precision functions

Mans Rullgard git at libav.org
Tue Oct 23 13:14:37 CEST 2012


Module: libav
Branch: master
Commit: fab0a8b2c6caa0e6478915bb42904995d70c4b3f

Author:    Mans Rullgard <mans at mansr.com>
Committer: Mans Rullgard <mans at mansr.com>
Date:      Sat Oct 13 22:54:53 2012 +0100

libm: add fallbacks for various single-precision functions

Signed-off-by: Mans Rullgard <mans at mansr.com>

---

 configure                   |    8 ++++++++
 libavcodec/aacps_tablegen.h |    1 +
 libavutil/libm.h            |   40 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index e1524fb..35cf34f 100755
--- a/configure
+++ b/configure
@@ -1125,20 +1125,28 @@ HAVE_LIST_PUB='
 '
 
 MATH_FUNCS="
+    atanf
+    atan2f
     cbrtf
+    cosf
     exp2
     exp2f
+    expf
     isinf
     isnan
+    ldexpf
     llrint
     llrintf
     log2
     log2f
+    log10f
     lrint
     lrintf
+    powf
     rint
     round
     roundf
+    sinf
     trunc
     truncf
 "
diff --git a/libavcodec/aacps_tablegen.h b/libavcodec/aacps_tablegen.h
index bd4e695..0c610ed 100644
--- a/libavcodec/aacps_tablegen.h
+++ b/libavcodec/aacps_tablegen.h
@@ -31,6 +31,7 @@
 #include "libavcodec/aacps_tables.h"
 #else
 #include "libavutil/common.h"
+#include "libavutil/libm.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/mem.h"
 #define NR_ALLPASS_BANDS20 30
diff --git a/libavutil/libm.h b/libavutil/libm.h
index 8305b7c..d6c2cf8 100644
--- a/libavutil/libm.h
+++ b/libavutil/libm.h
@@ -29,6 +29,21 @@
 #include "attributes.h"
 #include "intfloat.h"
 
+#if !HAVE_ATANF
+#undef atanf
+#define atanf(x) ((float)atan(x))
+#endif
+
+#if !HAVE_ATAN2F
+#undef atan2f
+#define atan2f(y, x) ((float)atan2(y, x))
+#endif
+
+#if !HAVE_POWF
+#undef powf
+#define powf(x, y) ((float)pow(x, y))
+#endif
+
 #if !HAVE_CBRTF
 static av_always_inline float cbrtf(float x)
 {
@@ -36,6 +51,16 @@ static av_always_inline float cbrtf(float x)
 }
 #endif
 
+#if !HAVE_COSF
+#undef cosf
+#define cosf(x) ((float)cos(x))
+#endif
+
+#if !HAVE_EXPF
+#undef expf
+#define expf(x) ((float)exp(x))
+#endif
+
 #if !HAVE_EXP2
 #undef exp2
 #define exp2(x) exp((x) * 0.693147180559945)
@@ -66,6 +91,11 @@ static av_always_inline av_const int isnan(float x)
 }
 #endif /* HAVE_ISNAN */
 
+#if !HAVE_LDEXPF
+#undef ldexpf
+#define ldexpf(x, exp) ((float)ldexp(x, exp))
+#endif
+
 #if !HAVE_LLRINT
 #undef llrint
 #define llrint(x) ((long long)rint(x))
@@ -86,6 +116,16 @@ static av_always_inline av_const int isnan(float x)
 #define log2f(x) ((float)log2(x))
 #endif /* HAVE_LOG2F */
 
+#if !HAVE_LOG10F
+#undef log10f
+#define log10f(x) ((float)log10(x))
+#endif
+
+#if !HAVE_SINF
+#undef sinf
+#define sinf(x) ((float)sin(x))
+#endif
+
 #if !HAVE_RINT
 static inline double rint(double x)
 {



More information about the libav-commits mailing list