From 6b7c7703f4c762d0419dfb0e186fa21cec78e4bc Mon Sep 17 00:00:00 2001 From: Vitor Sessak Date: Tue, 12 Jan 2010 02:19:51 +0000 Subject: [PATCH] Add replacements for log2f(), exp2() and exp2f() for platforms that lacks it. Should fix build breakage on some platforms introduced in r21125. Originally committed as revision 21155 to svn://svn.ffmpeg.org/ffmpeg/trunk --- configure | 6 ++++++ libavutil/internal.h | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/configure b/configure index afb0e3099f..e90277be09 100755 --- a/configure +++ b/configure @@ -954,6 +954,8 @@ HAVE_LIST=" dos_paths ebp_available ebx_available + exp2 + exp2f fast_64bit fast_cmov fast_unaligned @@ -970,6 +972,7 @@ HAVE_LIST=" libdc1394_2 llrint log2 + log2f loongson lrint lrintf @@ -2379,8 +2382,11 @@ done check_lib math.h sin -lm check_lib va/va.h vaInitialize -lva +check_func exp2 +check_func exp2f check_func llrint check_func log2 +check_func log2f check_func lrint check_func lrintf check_func round diff --git a/libavutil/internal.h b/libavutil/internal.h index 7f620d8dd7..ad43206756 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -263,6 +263,20 @@ if ((y) < (x)) {\ }\ } +#if !HAVE_EXP2 +static av_always_inline av_const double exp2(double x) +{ + return exp(x * 0.693147180559945); +} +#endif /* HAVE_EXP2 */ + +#if !HAVE_EXP2F +static av_always_inline av_const float exp2f(float x) +{ + return exp2(x); +} +#endif /* HAVE_EXP2F */ + #if !HAVE_LLRINT static av_always_inline av_const long long llrint(double x) { @@ -277,6 +291,13 @@ static av_always_inline av_const double log2(double x) } #endif /* HAVE_LOG2 */ +#if !HAVE_LOG2F +static av_always_inline av_const float log2f(float x) +{ + return log2(x); +} +#endif /* HAVE_LOG2F */ + #if !HAVE_LRINT static av_always_inline av_const long int lrint(double x) {