[SCM] libav/experimental: Add a log2 replacement for systems that haven't quite caught up with the C99 standard library.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:48:49 UTC 2013


The following commit has been merged in the experimental branch:
commit 291fd18a6ede0fc6a6d35c9a98af6ae7fd6d6117
Author: Alex Converse <alex.converse at gmail.com>
Date:   Fri Jul 10 19:20:06 2009 +0000

    Add a log2 replacement for systems that haven't quite caught up with the C99
    standard library.
    
    Originally committed as revision 19395 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/configure b/configure
index 7998273..ad9e8c1 100755
--- a/configure
+++ b/configure
@@ -911,6 +911,7 @@ HAVE_LIST="
     libdc1394_1
     libdc1394_2
     llrint
+    log2
     loongson
     lrint
     lrintf
@@ -2078,7 +2079,7 @@ check_lib math.h sin -lm
 check_lib va/va.h vaInitialize -lva
 
 # test for C99 functions in math.h
-for func in llrint lrint lrintf round roundf truncf; do
+for func in llrint log2 lrint lrintf round roundf truncf; do
     check_exec <<EOF && enable $func || disable $func
 #include <math.h>
 int main(void) { return ($func(3.999f) > 0)?0:1; }
diff --git a/libavutil/internal.h b/libavutil/internal.h
index a80ea24..1012f1c 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -265,6 +265,13 @@ static av_always_inline av_const long long llrint(double x)
 }
 #endif /* HAVE_LLRINT */
 
+#if !HAVE_LOG2
+static av_always_inline av_const double log2(double x)
+{
+    return log(x) * 1.44269504088896340736;
+}
+#endif /* HAVE_LOG2 */
+
 #if !HAVE_LRINT
 static av_always_inline av_const long int lrint(double x)
 {

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list