summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2005-06-12 12:43:05 +0000
committerThom Johansen <thomj@rockbox.org>2005-06-12 12:43:05 +0000
commit649acec2fcebb16102d730af515f0ff94679fc1c (patch)
tree682a52ce284ad06d2c903ba2b4f69c58ec078cea
parent3c30ee51d89ac49ad0790889d554c760367e6ec9 (diff)
downloadrockbox-649acec2fcebb16102d730af515f0ff94679fc1c.zip
rockbox-649acec2fcebb16102d730af515f0ff94679fc1c.tar.gz
rockbox-649acec2fcebb16102d730af515f0ff94679fc1c.tar.bz2
rockbox-649acec2fcebb16102d730af515f0ff94679fc1c.tar.xz
Small Musepack optimisation.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6685 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/libmusepack/Makefile3
-rw-r--r--apps/codecs/libmusepack/math.h16
2 files changed, 18 insertions, 1 deletions
diff --git a/apps/codecs/libmusepack/Makefile b/apps/codecs/libmusepack/Makefile
index 1d7dffc..1e3eaf6 100644
--- a/apps/codecs/libmusepack/Makefile
+++ b/apps/codecs/libmusepack/Makefile
@@ -14,7 +14,8 @@ ifdef APPEXTRA
INCLUDES += -I$(APPSDIR)/$(APPEXTRA)
endif
-CFLAGS = $(GCCOPTS) \
+MUSEPACKOPTS = -O2
+CFLAGS = $(GCCOPTS) $(MUSEPACKOPTS)\
$(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE}
# This sets up 'SRC' based on the files mentioned in SOURCES
diff --git a/apps/codecs/libmusepack/math.h b/apps/codecs/libmusepack/math.h
index 3965eec..8d1e50d 100644
--- a/apps/codecs/libmusepack/math.h
+++ b/apps/codecs/libmusepack/math.h
@@ -99,8 +99,24 @@ static inline MPC_SAMPLE_FORMAT MPC_MULTIPLY_EX(MPC_SAMPLE_FORMAT item1,MPC_SAMP
#ifdef MPC_HAVE_MULHIGH
#define MPC_MULTIPLY_FRACT(X,Y) _MulHigh(X,Y)
#else
+#if CONFIG_CPU==MCF5249 && !defined(SIMULATOR)
+/* loses one bit of accuracy.
+ the rest of the macros won't be as easy as this... */
+#define MPC_MULTIPLY_FRACT(X,Y) \
+ ({ \
+ MPC_SAMPLE_FORMAT t; \
+ asm volatile ( \
+ "mac.l %[A], %[B], %%acc0\n\t" \
+ "movclr.l %%acc0, %[t]\n\t" \
+ "asr.l #1, %[t]\n\t" \
+ : [t] "=d" (t) \
+ : [A] "r" ((X)), [B] "r" ((Y))); \
+ t; \
+ })
+#else
#define MPC_MULTIPLY_FRACT(X,Y) MPC_MULTIPLY_EX(X,Y,32)
#endif
+#endif
#define MPC_MAKE_FRACT_CONST(X) (MPC_SAMPLE_FORMAT)((X) * (double)(((mpc_int64_t)1)<<32) )
#define MPC_MULTIPLY_FRACT_CONST(X,Y) MPC_MULTIPLY_FRACT(X,MPC_MAKE_FRACT_CONST(Y))