From 5a1999eacd917e82a2725e1e0ee8f853dd14b93a Mon Sep 17 00:00:00 2001 From: Michael Giacomelli Date: Mon, 9 Jul 2007 01:59:33 +0000 Subject: Move very commonly accessed array into IRAM. Should give a nice speedup on Coldfire. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13827 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libwma/wmadec.h | 4 ++-- apps/codecs/libwma/wmadeci.c | 18 +++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'apps/codecs') diff --git a/apps/codecs/libwma/wmadec.h b/apps/codecs/libwma/wmadec.h index 395b29f6e8..56f935bbb4 100644 --- a/apps/codecs/libwma/wmadec.h +++ b/apps/codecs/libwma/wmadec.h @@ -25,7 +25,7 @@ #define M_PI 3.14159265358979323846 #define M_PI_F 0x3243f // in fixed 32 format -#define TWO_M_PI_F 0x6487f //in fixed 32 +#define TWO_M_PI_F 0x6487f //in fixed 32 #define MAX_CHANNELS 2 @@ -128,7 +128,7 @@ typedef struct WMADecodeContext fixed32 exponents[MAX_CHANNELS][BLOCK_MAX_SIZE]; fixed32 max_exponent[MAX_CHANNELS]; int16_t coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE]; - fixed32 coefs[MAX_CHANNELS][BLOCK_MAX_SIZE]; + fixed32 (*coefs)[MAX_CHANNELS][BLOCK_MAX_SIZE]; MDCTContext mdct_ctx[BLOCK_NB_SIZES]; fixed32 *windows[BLOCK_NB_SIZES]; FFTComplex *mdct_tmp; /* temporary storage for imdct */ diff --git a/apps/codecs/libwma/wmadeci.c b/apps/codecs/libwma/wmadeci.c index 7eab26863c..a1326abbfe 100644 --- a/apps/codecs/libwma/wmadeci.c +++ b/apps/codecs/libwma/wmadeci.c @@ -106,6 +106,8 @@ static void wma_lsp_to_curve_init(WMADecodeContext *s, int frame_len); int fft_calc(FFTContext *s, FFTComplex *z); +fixed32 coefsarray[MAX_CHANNELS][BLOCK_MAX_SIZE] IBSS_ATTR; + //static variables that replace malloced stuff fixed32 stat0[2048], stat1[1024], stat2[512], stat3[256], stat4[128]; //these are the MDCT reconstruction windows @@ -755,6 +757,8 @@ int wma_decode_init(WMADecodeContext* s, asf_waveformatex_t *wfx) s->bit_rate = wfx->bitrate; s->block_align = wfx->blockalign; + s->coefs = &coefsarray; + if (wfx->codec_id == ASF_CODEC_ID_WMAV1){ s->version = 1; }else{ @@ -1612,7 +1616,7 @@ static int wma_decode_block(WMADecodeContext *s) // mul = fixtof64(pow_table[total_gain])/(s->block_len/2)/fixtof64(s->max_exponent[ch]); mult = fixmul64byfixed(mult, mdct_norm); //what the hell? This is actually fixed64*2^16! - coefs = s->coefs[ch]; //VLC exponenents are used to get MDCT coef here! + coefs = (*(s->coefs))[ch]; //VLC exponenents are used to get MDCT coef here! n=0; @@ -1750,16 +1754,16 @@ static int wma_decode_block(WMADecodeContext *s) never happen */ if (!s->channel_coded[0]) { - memset(s->coefs[0], 0, sizeof(fixed32) * s->block_len); + memset((*(s->coefs))[0], 0, sizeof(fixed32) * s->block_len); s->channel_coded[0] = 1; } for(i = 0; i < s->block_len; ++i) { - a = s->coefs[0][i]; - b = s->coefs[1][i]; - s->coefs[0][i] = a + b; - s->coefs[1][i] = a - b; + a = (*s->coefs)[0][i]; + b = (*s->coefs)[1][i]; + (*s->coefs)[0][i] = a + b; + (*s->coefs)[1][i] = a - b; } } @@ -1776,7 +1780,7 @@ static int wma_decode_block(WMADecodeContext *s) ff_imdct_calc(&s->mdct_ctx[bsize], output, - s->coefs[ch], + (*(s->coefs))[ch], s->mdct_tmp); -- cgit v1.2.3