From 649acec2fcebb16102d730af515f0ff94679fc1c Mon Sep 17 00:00:00 2001 From: Thom Johansen Date: Sun, 12 Jun 2005 12:43:05 +0000 Subject: Small Musepack optimisation. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6685 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libmusepack/Makefile | 3 ++- apps/codecs/libmusepack/math.h | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/codecs/libmusepack/Makefile b/apps/codecs/libmusepack/Makefile index 1d7dffc3dd..1e3eaf6232 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 3965eec353..8d1e50dda5 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)) -- cgit v1.2.3