diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-02-15 22:38:01 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-02-15 22:38:01 +0000 |
commit | 800e3d9a978b246c3a49bd51e65b4de94fa668e4 (patch) | |
tree | 6727bee5239af68e68123abf27a39a681b958f67 | |
parent | 86fc47c33a63b1797219610aa55846adb2f0c19b (diff) |
Major optimization of atrac3 codec for Coldfire targets. Moving several number cruncher arrays to IRAM. Decoder is sped up by +50% on h300, decoder now finally is realtime on Coldfire targets as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24677 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/codecs/libatrac/atrac3.c | 18 | ||||
-rw-r--r-- | apps/codecs/libatrac/atrac3.h | 10 |
2 files changed, 20 insertions, 8 deletions
diff --git a/apps/codecs/libatrac/atrac3.c b/apps/codecs/libatrac/atrac3.c index b2f675ef18..3c6ecc9197 100644 --- a/apps/codecs/libatrac/atrac3.c +++ b/apps/codecs/libatrac/atrac3.c @@ -55,9 +55,12 @@ #define FFMIN(a,b) ((a) > (b) ? (b) : (a)) #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) -static int32_t qmf_window[48] IBSS_ATTR; -static VLC spectral_coeff_tab[7]; -static channel_unit channel_units[2] IBSS_ATTR_LARGE_IRAM; +static VLC spectral_coeff_tab[7]; +static int32_t qmf_window[48] IBSS_ATTR; +static int32_t atrac3_spectrum [2][1024] IBSS_ATTR __attribute__((aligned(16))); +static int32_t atrac3_IMDCT_buf[2][ 512] IBSS_ATTR __attribute__((aligned(16))); +static int32_t atrac3_prevFrame[2][1024] IBSS_ATTR; +static channel_unit channel_units[2] IBSS_ATTR_LARGE_IRAM; /** @@ -425,7 +428,7 @@ static void inverseQuantizeSpectrum(int *mantissas, int32_t *pOut, * @return outSubbands subband counter, fix for broken specification/files */ -int decodeSpectrum (GetBitContext *gb, int32_t *pOut) ICODE_ATTR; +int decodeSpectrum (GetBitContext *gb, int32_t *pOut) ICODE_ATTR_LARGE_IRAM; int decodeSpectrum (GetBitContext *gb, int32_t *pOut) { int numSubbands, codingMode, cnt, first, last, subbWidth; @@ -1228,7 +1231,14 @@ int atrac3_decode_init(ATRAC3Context *q, RMContext *rmctx) q->matrix_coeff_index_next[i] = 3; } + /* Link the iram'ed arrays to the decoder's data structure */ q->pUnits = channel_units; + q->pUnits[0].spectrum = &atrac3_spectrum [0][0]; + q->pUnits[1].spectrum = &atrac3_spectrum [1][0]; + q->pUnits[0].IMDCT_buf = &atrac3_IMDCT_buf[0][0]; + q->pUnits[1].IMDCT_buf = &atrac3_IMDCT_buf[1][0]; + q->pUnits[0].prevFrame = &atrac3_prevFrame[0][0]; + q->pUnits[1].prevFrame = &atrac3_prevFrame[1][0]; return 0; } diff --git a/apps/codecs/libatrac/atrac3.h b/apps/codecs/libatrac/atrac3.h index a817db2b55..5bed9c60bf 100644 --- a/apps/codecs/libatrac/atrac3.h +++ b/apps/codecs/libatrac/atrac3.h @@ -3,10 +3,12 @@ #if (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) || (CONFIG_CPU == MCF5250) /* PP5022/24 and MCF5250 have larger IRAM */ -#define IBSS_ATTR_LARGE_IRAM IBSS_ATTR +#define IBSS_ATTR_LARGE_IRAM IBSS_ATTR +#define ICODE_ATTR_LARGE_IRAM ICODE_ATTR #else /* other CPUs IRAM is not large enough */ #define IBSS_ATTR_LARGE_IRAM +#define ICODE_ATTR_LARGE_IRAM #endif /* These structures are needed to store the parsed gain control data. */ @@ -30,12 +32,12 @@ typedef struct { int bandsCoded; int numComponents; tonal_component components[64]; - int32_t prevFrame[1024]; + int32_t *prevFrame; int gcBlkSwitch; gain_block gainBlock[2]; - int32_t spectrum[1024] __attribute__((aligned(16))); - int32_t IMDCT_buf[1024] __attribute__((aligned(16))); + int32_t *spectrum; + int32_t *IMDCT_buf; int32_t delayBuf1[46]; ///<qmf delay buffers int32_t delayBuf2[46]; |