summaryrefslogtreecommitdiff
path: root/apps/codecs/libffmpegFLAC
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2009-12-05 16:47:43 +0000
committerNils Wallménius <nils@rockbox.org>2009-12-05 16:47:43 +0000
commitb9d7f98f8c5653c9b5d945655cc64934da596142 (patch)
tree0a25d85df5377aa053287cdc53af6957ab140adf /apps/codecs/libffmpegFLAC
parent0651fe572b8fe1eb5457325f81a8c9986e479ef6 (diff)
downloadrockbox-b9d7f98f8c5653c9b5d945655cc64934da596142.tar.gz
rockbox-b9d7f98f8c5653c9b5d945655cc64934da596142.zip
Move av_log2 function and asociated table to the codec lib, remove 3 identical implementations, always have LUT in iram (gives a *tiny* speedup on coldfire), make the clz based function return the same value as the non clz based function for 0 input to be safe (slows down flac ~2% on the gigabeat S)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23858 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libffmpegFLAC')
-rw-r--r--apps/codecs/libffmpegFLAC/SOURCES3
-rw-r--r--apps/codecs/libffmpegFLAC/golomb.h30
-rw-r--r--apps/codecs/libffmpegFLAC/tables.c18
3 files changed, 1 insertions, 50 deletions
diff --git a/apps/codecs/libffmpegFLAC/SOURCES b/apps/codecs/libffmpegFLAC/SOURCES
index 823a2b7744..deed19bcec 100644
--- a/apps/codecs/libffmpegFLAC/SOURCES
+++ b/apps/codecs/libffmpegFLAC/SOURCES
@@ -1,9 +1,6 @@
1bitstream.c 1bitstream.c
2decoder.c 2decoder.c
3shndec.c 3shndec.c
4#if !(defined(CPU_ARM) && (ARM_ARCH > 4))
5tables.c
6#endif
7#if defined(CPU_COLDFIRE) 4#if defined(CPU_COLDFIRE)
8coldfire.S 5coldfire.S
9#elif defined(CPU_ARM) 6#elif defined(CPU_ARM)
diff --git a/apps/codecs/libffmpegFLAC/golomb.h b/apps/codecs/libffmpegFLAC/golomb.h
index 11753fc4bb..4f99671338 100644
--- a/apps/codecs/libffmpegFLAC/golomb.h
+++ b/apps/codecs/libffmpegFLAC/golomb.h
@@ -20,35 +20,7 @@
20 */ 20 */
21 21
22#include <limits.h> 22#include <limits.h>
23 23#include "codeclib.h"
24#if (defined(CPU_ARM) && (ARM_ARCH > 4))
25static inline int av_log2(uint32_t v)
26{
27 return 31 - __builtin_clz(v);
28}
29#else
30
31/* From libavutil/common.h */
32extern const uint8_t ff_log2_tab[256];
33
34static inline int av_log2(unsigned int v)
35{
36 int n;
37
38 n = 0;
39 if (v & 0xffff0000) {
40 v >>= 16;
41 n += 16;
42 }
43 if (v & 0xff00) {
44 v >>= 8;
45 n += 8;
46 }
47 n += ff_log2_tab[v];
48
49 return n;
50}
51#endif
52 24
53/** 25/**
54 * @file golomb.h 26 * @file golomb.h
diff --git a/apps/codecs/libffmpegFLAC/tables.c b/apps/codecs/libffmpegFLAC/tables.c
deleted file mode 100644
index 58b1bb68d7..0000000000
--- a/apps/codecs/libffmpegFLAC/tables.c
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifdef BUILD_STANDALONE
2#define ICONST_ATTR
3#else
4#include "codeclib.h"
5#endif
6#include <inttypes.h>
7
8/* From ffmpeg - libavutil/common.h */
9const uint8_t ff_log2_tab[256] ICONST_ATTR = {
10 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,
11 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,
12 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,
13 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,
14 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,
15 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,
16 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,
17 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
18};