summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-21 13:29:03 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-21 13:35:42 +0200
commitdcbff35199e1596d9d1200e734ef4a4c306e50f1 (patch)
treee173e3208ed6a79a0648e4324c3cc398b7d176ca /libavutil
parent05f228b0a01e8b97ba73a15c1eccb6b0a9060633 (diff)
parentd15c21e5fa3961f10026da1a3080a3aa3cf4cec9 (diff)
Merge commit 'd15c21e5fa3961f10026da1a3080a3aa3cf4cec9'
* commit 'd15c21e5fa3961f10026da1a3080a3aa3cf4cec9': avutil: Add a copy of ff_sqrt_tab back into avutil to restore ABI compatibility avutil: make some tables visible again avutil: remove inline av_log2 from public API celp_math: rename ff_log2 to ff_log2_q15 Conflicts: libavutil/libavutil.v Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/Makefile2
-rw-r--r--libavutil/common.h43
-rw-r--r--libavutil/intmath.h51
-rw-r--r--libavutil/libavutil.v2
-rw-r--r--libavutil/log2.c34
-rw-r--r--libavutil/sqrt_tab.c1
6 files changed, 92 insertions, 41 deletions
diff --git a/libavutil/Makefile b/libavutil/Makefile
index d290ff91ca..63a48be744 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -75,6 +75,7 @@ OBJS = adler32.o \
lfg.o \
lls.o \
log.o \
+ log2.o \
log2_tab.o \
lzo.o \
mathematics.o \
@@ -89,6 +90,7 @@ OBJS = adler32.o \
rc4.o \
samplefmt.o \
sha.o \
+ sqrt_tab.o \
time.o \
timecode.o \
tree.o \
diff --git a/libavutil/common.h b/libavutil/common.h
index 9ed6f11468..c2a54c4987 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -64,7 +64,6 @@
#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
/* misc math functions */
-extern const uint8_t ff_log2_tab[256];
/**
* Reverse the order of the bits of an 8-bits unsigned integer.
@@ -73,34 +72,6 @@ extern const uint8_t ff_log2_tab[256];
extern attribute_deprecated const uint8_t av_reverse[256];
#endif
-static av_always_inline av_const int av_log2_c(unsigned int v)
-{
- int n = 0;
- if (v & 0xffff0000) {
- v >>= 16;
- n += 16;
- }
- if (v & 0xff00) {
- v >>= 8;
- n += 8;
- }
- n += ff_log2_tab[v];
-
- return n;
-}
-
-static av_always_inline av_const int av_log2_16bit_c(unsigned int v)
-{
- int n = 0;
- if (v & 0xff00) {
- v >>= 8;
- n += 8;
- }
- n += ff_log2_tab[v];
-
- return n;
-}
-
#ifdef HAVE_AV_CONFIG_H
# include "config.h"
# include "intmath.h"
@@ -109,6 +80,14 @@ static av_always_inline av_const int av_log2_16bit_c(unsigned int v)
/* Pull in unguarded fallback defines at the end of this file. */
#include "common.h"
+#ifndef av_log2
+av_const int av_log2(unsigned v);
+#endif
+
+#ifndef av_log2_16bit
+av_const int av_log2_16bit(unsigned v);
+#endif
+
/**
* Clip a signed integer value into the amin-amax range.
* @param a value to clip
@@ -390,12 +369,6 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x)
* to ensure they are immediately available in intmath.h.
*/
-#ifndef av_log2
-# define av_log2 av_log2_c
-#endif
-#ifndef av_log2_16bit
-# define av_log2_16bit av_log2_16bit_c
-#endif
#ifndef av_ceil_log2
# define av_ceil_log2 av_ceil_log2_c
#endif
diff --git a/libavutil/intmath.h b/libavutil/intmath.h
index da333bc6d2..1e58cfba73 100644
--- a/libavutil/intmath.h
+++ b/libavutil/intmath.h
@@ -21,6 +21,8 @@
#ifndef AVUTIL_INTMATH_H
#define AVUTIL_INTMATH_H
+#include <stdint.h>
+
#include "config.h"
#include "attributes.h"
@@ -35,15 +37,54 @@
#if HAVE_FAST_CLZ && AV_GCC_VERSION_AT_LEAST(3,4)
-#ifndef av_log2
-# define av_log2(x) (31 - __builtin_clz((x)|1))
-# ifndef av_log2_16bit
-# define av_log2_16bit av_log2
+#ifndef ff_log2
+# define ff_log2(x) (31 - __builtin_clz((x)|1))
+# ifndef ff_log2_16bit
+# define ff_log2_16bit av_log2
# endif
-#endif /* av_log2 */
+#endif /* ff_log2 */
#endif /* AV_GCC_VERSION_AT_LEAST(3,4) */
+extern const uint8_t ff_log2_tab[256];
+
+#ifndef ff_log2
+#define ff_log2 ff_log2_c
+static av_always_inline av_const int ff_log2_c(unsigned int v)
+{
+ int n = 0;
+ if (v & 0xffff0000) {
+ v >>= 16;
+ n += 16;
+ }
+ if (v & 0xff00) {
+ v >>= 8;
+ n += 8;
+ }
+ n += ff_log2_tab[v];
+
+ return n;
+}
+#endif
+
+#ifndef ff_log2_16bit
+#define ff_log2_16bit ff_log2_16bit_c
+static av_always_inline av_const int ff_log2_16bit_c(unsigned int v)
+{
+ int n = 0;
+ if (v & 0xff00) {
+ v >>= 8;
+ n += 8;
+ }
+ n += ff_log2_tab[v];
+
+ return n;
+}
+#endif
+
+#define av_log2 ff_log2
+#define av_log2_16bit ff_log2_16bit
+
/**
* @}
*/
diff --git a/libavutil/libavutil.v b/libavutil/libavutil.v
index eb16ae175e..4c0631f6a7 100644
--- a/libavutil/libavutil.v
+++ b/libavutil/libavutil.v
@@ -1,4 +1,4 @@
LIBAVUTIL_$MAJOR {
- global: av*; ff_*;
+ global: av*; ff_*; ff_*_tab;
local: *;
};
diff --git a/libavutil/log2.c b/libavutil/log2.c
new file mode 100644
index 0000000000..b0c00e1cad
--- /dev/null
+++ b/libavutil/log2.c
@@ -0,0 +1,34 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "intmath.h"
+
+/* undef these to get the function prototypes from common.h */
+#undef av_log2
+#undef av_log2_16bit
+#include "common.h"
+
+int av_log2(unsigned v)
+{
+ return ff_log2(v);
+}
+
+int av_log2_16bit(unsigned v)
+{
+ return ff_log2_16bit(v);
+}
diff --git a/libavutil/sqrt_tab.c b/libavutil/sqrt_tab.c
new file mode 100644
index 0000000000..e3d978b569
--- /dev/null
+++ b/libavutil/sqrt_tab.c
@@ -0,0 +1 @@
+#include "libavcodec/sqrt_tab.c"