From 22c9b6ef8e1e1f4354ff0fc445990512175a1649 Mon Sep 17 00:00:00 2001 From: Andree Buschmann Date: Mon, 16 May 2011 21:31:59 +0000 Subject: Use more IRAM for mpc on S5L870x. Speed up decoding by ~2%. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29891 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libmusepack/internal.h | 2 +- apps/codecs/libmusepack/mpc_decoder.c | 3 ++- apps/codecs/libmusepack/mpc_demux.c | 2 +- apps/codecs/libmusepack/mpcdec.h | 21 ++++++++++++++++++++- apps/codecs/libmusepack/synth_filter.c | 6 +++++- 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/apps/codecs/libmusepack/internal.h b/apps/codecs/libmusepack/internal.h index 760f50b02d..0f29060a7d 100644 --- a/apps/codecs/libmusepack/internal.h +++ b/apps/codecs/libmusepack/internal.h @@ -58,7 +58,7 @@ typedef struct mpc_block_t { } mpc_block; #define MAX_FRAME_SIZE 4352 -#define DEMUX_BUFFER_SIZE (65536 - MAX_FRAME_SIZE) // need some space as sand box +#define DEMUX_BUFFER_SIZE (32768 - MAX_FRAME_SIZE) // need some space as sand box struct mpc_demux_t { mpc_reader * r; diff --git a/apps/codecs/libmusepack/mpc_decoder.c b/apps/codecs/libmusepack/mpc_decoder.c index face3d1f81..eb0638524f 100644 --- a/apps/codecs/libmusepack/mpc_decoder.c +++ b/apps/codecs/libmusepack/mpc_decoder.c @@ -123,7 +123,8 @@ void mpc_decoder_requantisierung (mpc_decoder *d) void mpc_decoder_read_bitstream_sv7(mpc_decoder * d, mpc_bits_reader * r) ICODE_ATTR_MPC_LARGE_IRAM; void mpc_decoder_read_bitstream_sv8(mpc_decoder * d, mpc_bits_reader * r, - mpc_bool_t is_key_frame); + mpc_bool_t is_key_frame) + ICODE_ATTR_MPC_SV8_BS_DEC; //------------------------------------------------------------------------------ // macros diff --git a/apps/codecs/libmusepack/mpc_demux.c b/apps/codecs/libmusepack/mpc_demux.c index e4ae0f89d3..499170c135 100644 --- a/apps/codecs/libmusepack/mpc_demux.c +++ b/apps/codecs/libmusepack/mpc_demux.c @@ -51,7 +51,7 @@ #define MAX_BUFFER_SIZE (DEMUX_BUFFER_SIZE + MAX_FRAME_SIZE) // globals -static mpc_uint8_t g_buffer[MAX_BUFFER_SIZE]; +static mpc_uint8_t g_buffer[MAX_BUFFER_SIZE] IBSS_ATTR_MPC_BITBUFFER; static mpc_seek_t g_seek_table[MAX_SEEK_TABLE_SIZE]; static mpc_demux g_mpc_demux IBSS_ATTR; diff --git a/apps/codecs/libmusepack/mpcdec.h b/apps/codecs/libmusepack/mpcdec.h index d4c3bd22fc..68754dcbd2 100644 --- a/apps/codecs/libmusepack/mpcdec.h +++ b/apps/codecs/libmusepack/mpcdec.h @@ -52,23 +52,42 @@ extern "C" { #define IBSS_ATTR_MPC_LARGE_IRAM IBSS_ATTR #define ICODE_ATTR_MPC_LARGE_IRAM #define ICONST_ATTR_MPC_LARGE_IRAM ICONST_ATTR +/* Does not fit into IRAM. */ +#define IBSS_ATTR_MPC_BITBUFFER +#define ICODE_ATTR_MPC_SV8_BS_DEC /* Keep the data arrays of bitsreadr.c in IRAM. */ #define ICONST_ATTR_MPC_BITSREADER ICONST_ATTR -#elif (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) || defined(CPU_S5L870X) +#elif (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) /* Enough IRAM to move additional data and code to it. */ #define IBSS_ATTR_MPC_LARGE_IRAM IBSS_ATTR #define ICODE_ATTR_MPC_LARGE_IRAM ICODE_ATTR #define ICONST_ATTR_MPC_LARGE_IRAM ICONST_ATTR +/* Does not fit into IRAM. */ +#define IBSS_ATTR_MPC_BITBUFFER +#define ICODE_ATTR_MPC_SV8_BS_DEC /* Not putting the data arrays of bitsreader.c to IRAM allows to move the * sv7/sv8 bitstream demuxing into IRAM. This config is faster. */ #define ICONST_ATTR_MPC_BITSREADER +#elif defined(CPU_S5L870X) +/* Enough IRAM to move additional data and code to it. */ +#define IBSS_ATTR_MPC_LARGE_IRAM IBSS_ATTR +#define ICODE_ATTR_MPC_LARGE_IRAM ICODE_ATTR +#define ICONST_ATTR_MPC_LARGE_IRAM ICONST_ATTR +/* Faster when moved to IRAM. */ +#define IBSS_ATTR_MPC_BITBUFFER IBSS_ATTR +#define ICODE_ATTR_MPC_SV8_BS_DEC ICODE_ATTR +/* Not faster when moved to IRAM. */ +#define ICONST_ATTR_MPC_BITSREADER + #else /* Not enough IRAM available. */ #define IBSS_ATTR_MPC_LARGE_IRAM #define ICODE_ATTR_MPC_LARGE_IRAM #define ICONST_ATTR_MPC_LARGE_IRAM +#define IBSS_ATTR_MPC_BITBUFFER +#define ICODE_ATTR_MPC_SV8_BS_DEC #define ICONST_ATTR_MPC_BITSREADER #endif diff --git a/apps/codecs/libmusepack/synth_filter.c b/apps/codecs/libmusepack/synth_filter.c index 602edff6c6..3ad2b236a0 100644 --- a/apps/codecs/libmusepack/synth_filter.c +++ b/apps/codecs/libmusepack/synth_filter.c @@ -510,7 +510,11 @@ mpc_decoder_windowing_D(MPC_SAMPLE_FORMAT * Data, #endif /* CPU_ARM || CPU_COLDFIRE */ static void -mpc_full_synthesis_filter(MPC_SAMPLE_FORMAT *OutData, MPC_SAMPLE_FORMAT *V, const MPC_SAMPLE_FORMAT *Y) +mpc_full_synthesis_filter(MPC_SAMPLE_FORMAT *OutData, MPC_SAMPLE_FORMAT *V, + const MPC_SAMPLE_FORMAT *Y) ICODE_ATTR_MPC_LARGE_IRAM; +static void +mpc_full_synthesis_filter(MPC_SAMPLE_FORMAT *OutData, MPC_SAMPLE_FORMAT *V, + const MPC_SAMPLE_FORMAT *Y) { mpc_uint32_t n; -- cgit v1.2.3