From ff78cd84185e44943feca14671b111339030809f Mon Sep 17 00:00:00 2001 From: Andree Buschmann Date: Sat, 17 May 2008 11:11:01 +0000 Subject: [PATCH] Commit FS#9000. Speed up Musepack decoder by 3% on PP5022/24 via using ICODE_ATTR for calc_new_V(). Additionally correct a type in decoder-struct. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17552 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libmusepack/decoder.h | 2 +- apps/codecs/libmusepack/musepack.h | 10 ++++++++++ apps/codecs/libmusepack/synth_filter.c | 8 ++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/apps/codecs/libmusepack/decoder.h b/apps/codecs/libmusepack/decoder.h index e36425bd1e..1f78d53c8d 100644 --- a/apps/codecs/libmusepack/decoder.h +++ b/apps/codecs/libmusepack/decoder.h @@ -113,7 +113,7 @@ typedef struct mpc_decoder_t { mpc_uint8_t SeekTable_Step; #ifdef MPC_FIXED_POINT - unsigned char SCF_shift[256]; + mpc_uint8_t SCF_shift[256]; #endif MPC_SAMPLE_FORMAT V_L[MPC_V_MEM + 960]; diff --git a/apps/codecs/libmusepack/musepack.h b/apps/codecs/libmusepack/musepack.h index 5d1ad0de3f..9bdebf8b04 100644 --- a/apps/codecs/libmusepack/musepack.h +++ b/apps/codecs/libmusepack/musepack.h @@ -66,6 +66,16 @@ extern "C" { #endif #endif +#ifndef ICODE_ATTR_MPC_LARGE_IRAM +#if (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) +/* PP5022/24 have 128KB of IRAM and have better performance with ICODE_ATTR */ +#define ICODE_ATTR_MPC_LARGE_IRAM ICODE_ATTR +#else +/* all other targets either haven't enough IRAM or performance suffers */ +#define ICODE_ATTR_MPC_LARGE_IRAM +#endif +#endif + #ifdef ROCKBOX_LITTLE_ENDIAN #define MPC_LITTLE_ENDIAN #endif diff --git a/apps/codecs/libmusepack/synth_filter.c b/apps/codecs/libmusepack/synth_filter.c index aed5d75fb1..faf014c90d 100644 --- a/apps/codecs/libmusepack/synth_filter.c +++ b/apps/codecs/libmusepack/synth_filter.c @@ -198,7 +198,11 @@ static const MPC_SAMPLE_FORMAT Di_opt [32] [16] ICONST_ATTR = { #define INVCOS30 MPC_MAKE_INVCOS( 684664578) #define INVCOS31 MPC_MAKE_INVCOS(1367679739) -static inline void +void +mpc_calculate_new_V ( const MPC_SAMPLE_FORMAT * Sample, MPC_SAMPLE_FORMAT * V ) +ICODE_ATTR_MPC_LARGE_IRAM; + +void mpc_calculate_new_V ( const MPC_SAMPLE_FORMAT * Sample, MPC_SAMPLE_FORMAT * V ) { // Calculating new V-buffer values for left channel @@ -453,7 +457,7 @@ mpc_calculate_new_V ( const MPC_SAMPLE_FORMAT * Sample, MPC_SAMPLE_FORMAT * V ) // total: 111 adds, 107 subs, 80 muls, 80 shifts } -static inline void +static void mpc_decoder_windowing_D(MPC_SAMPLE_FORMAT * Data, const MPC_SAMPLE_FORMAT * V) { const MPC_SAMPLE_FORMAT *D = (const MPC_SAMPLE_FORMAT *) &Di_opt;