The table is so small that the space gain is not worth the
performance overhead of cross-library access.
---
libavcodec/aacps.c | 1 +
libavcodec/mathops.c | 2 ++
libavcodec/mathops.h | 1 +
libavutil/Makefile | 1 +
libavutil/log2_tab.c | 30 ++++++++++++++++++++++++++++++
libavutil/mathematics.c | 11 -----------
6 files changed, 35 insertions(+), 11 deletions(-)
create mode 100644 libavutil/log2_tab.c
diff --git a/libavcodec/aacps.c b/libavcodec/aacps.c
index fa7e9ac..16dde15 100644
--- a/libavcodec/aacps.c
+++ b/libavcodec/aacps.c
@@ -28,6 +28,7 @@
#include "aacps_tablegen.h"
#include "aacpsdata.c"
#include "dsputil.h"
+#include "mathops.h"
#define PS_BASELINE 0 ///< Operate in Baseline PS mode
///< Baseline implies 10 or 20 stereo bands,
diff --git a/libavcodec/mathops.c b/libavcodec/mathops.c
index 45d06eb..99b548d 100644
--- a/libavcodec/mathops.c
+++ b/libavcodec/mathops.c
@@ -66,3 +66,5 @@ const uint8_t ff_sqrt_tab[256]={
222,223,223,224,224,225,226,226,227,227,228,228,229,230,230,231,231,232,232,233,233,234,235,235,236,236,237,237,238,238,239,239,
240,240,241,242,242,243,243,244,244,245,245,246,246,247,247,248,248,249,249,250,250,251,251,252,252,253,253,254,254,255,255,255
};
+
+#include "libavutil/log2_tab.c"
diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
index 4e9f27f..7a04b23 100644
--- a/libavcodec/mathops.h
+++ b/libavcodec/mathops.h
@@ -188,6 +188,7 @@ if ((y) < (x)) {\
#endif
extern const uint32_t ff_inverse[257];
+extern const uint8_t ff_log2_tab[256];
extern const uint8_t ff_sqrt_tab[256];
#ifndef FASTDIV
diff --git a/libavutil/Makefile b/libavutil/Makefile
index a7219c9..5394734 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -68,6 +68,7 @@ OBJS = adler32.o
\
lfg.o \
lls.o \
log.o \
+ log2_tab.o \
lzo.o \
mathematics.o \
md5.o \
diff --git a/libavutil/log2_tab.c b/libavutil/log2_tab.c
new file mode 100644
index 0000000..f6cbe79
--- /dev/null
+++ b/libavutil/log2_tab.c
@@ -0,0 +1,30 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav 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.
+ *
+ * Libav 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 Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdint.h>
+
+const uint8_t ff_log2_tab[256]={
+ 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
+};
diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index ce89195..1655e1c 100644
--- a/libavutil/mathematics.c
+++ b/libavutil/mathematics.c
@@ -28,17 +28,6 @@
#include <limits.h>
#include "mathematics.h"
-const uint8_t ff_log2_tab[256]={
- 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
-};
-
const uint8_t av_reverse[256]={
0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0,
0x08,0x88,0x48,0xC8,0x28,0xA8,0x68,0xE8,0x18,0x98,0x58,0xD8,0x38,0xB8,0x78,0xF8,
--
1.7.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel