summaryrefslogtreecommitdiff
path: root/apps/codecs/libffmpegFLAC/golomb.h
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2009-11-29 15:21:00 +0000
committerNils Wallménius <nils@rockbox.org>2009-11-29 15:21:00 +0000
commit685ca2672e5842fe185c8f12da6bf108fd8f074f (patch)
tree6502f259585220713af4976652454cf6ec1ccac4 /apps/codecs/libffmpegFLAC/golomb.h
parent07fe3562a1195784c4a761b63b4d027cd0984c0b (diff)
Use clz instruction to calculate integer logarithms, speeds up decoding of one flac 8 sample by 12%.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23783 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libffmpegFLAC/golomb.h')
-rw-r--r--apps/codecs/libffmpegFLAC/golomb.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/codecs/libffmpegFLAC/golomb.h b/apps/codecs/libffmpegFLAC/golomb.h
index 659ecc1579..11753fc4bb 100644
--- a/apps/codecs/libffmpegFLAC/golomb.h
+++ b/apps/codecs/libffmpegFLAC/golomb.h
@@ -21,6 +21,13 @@
#include <limits.h>
+#if (defined(CPU_ARM) && (ARM_ARCH > 4))
+static inline int av_log2(uint32_t v)
+{
+ return 31 - __builtin_clz(v);
+}
+#else
+
/* From libavutil/common.h */
extern const uint8_t ff_log2_tab[256];
@@ -41,6 +48,7 @@ static inline int av_log2(unsigned int v)
return n;
}
+#endif
/**
* @file golomb.h