diff -u -r apps/codecs/libtremor/block.c apps/codecs/libtremor/block.c --- apps/codecs/libtremor/block.c 2009-01-30 20:01:37.000000000 +0900 +++ apps/codecs/libtremor/block.c 2009-02-08 15:34:46.000000000 +0900 @@ -26,6 +26,23 @@ #include "registry.h" #include "misc.h" +/* Define window buffer size on IRAM. + + The PP5024/5022 CPU are not have a penalty of the decode speed + by validating this switch in the present conditions. + + Needed IRAM size. + Normal 1024*4 + 128*4 = 4608 + Large 2048*4 + 256*4 = 9216 + Large(_LOW_ACCURACY_) 2048*1 + 256*1 = 2304 (Bytes) +*/ +#ifdef LIRAM_PP +#define WINDOW_BUFFER_L 2048 +#define WINDOW_BUFFER_S 256 +static LOOKUP_TNC window_buff_long[WINDOW_BUFFER_L] IBSS_ATTR; +static LOOKUP_TNC window_buff_short[WINDOW_BUFFER_S] IBSS_ATTR; +#endif + static int ilog(unsigned int v){ int ret=0; if(v)--v; @@ -145,6 +162,7 @@ static int _vds_init(vorbis_dsp_state *v,vorbis_info *vi){ int i; + long b_size[2]; codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; private_state *b=NULL; @@ -155,8 +173,22 @@ b->modebits=ilog(ci->modes); /* Vorbis I uses only window type 0 */ - b->window[0]=_vorbis_window(0,ci->blocksizes[0]/2); - b->window[1]=_vorbis_window(0,ci->blocksizes[1]/2); + b_size[0]=ci->blocksizes[0]/2; + b_size[1]=ci->blocksizes[1]/2; + b->window[0]=_vorbis_window(0,b_size[0]); + b->window[1]=_vorbis_window(0,b_size[1]); + +#ifdef LIRAM_PP + /* If fast internal ram sizes are enough, copy data there. */ + if(b_size[0] <= WINDOW_BUFFER_S){ + memcpy(window_buff_short, b->window[0], b_size[0]*sizeof(LOOKUP_TNC)); + b->window[0]=window_buff_short; + } + if(b_size[1] <= WINDOW_BUFFER_L){ + memcpy(window_buff_long, b->window[1], b_size[1]*sizeof(LOOKUP_TNC)); + b->window[1]=window_buff_long; + } +#endif /* finish the codebooks */ if(!ci->fullbooks){ diff -u -r apps/codecs/libtremor/config-tremor.h apps/codecs/libtremor/config-tremor.h --- apps/codecs/libtremor/config-tremor.h 2009-01-30 20:01:37.000000000 +0900 +++ apps/codecs/libtremor/config-tremor.h 2009-02-08 15:34:42.000000000 +0900 @@ -25,4 +25,14 @@ #define ICODE_ATTR_TREMOR_NOT_MDCT ICODE_ATTR #endif +/* Define CPU of large IRAM */ +#if (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) || (CONFIG_CPU == MCF5250) +#define LARGE_IRAM +#endif + +/* Define CPU of large IRAM (PP Only) */ +#if (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) +#define LIRAM_PP +#endif + // #define _LOW_ACCURACY_ diff -u -r apps/codecs/libtremor/os_types.h apps/codecs/libtremor/os_types.h --- apps/codecs/libtremor/os_types.h 2009-01-30 20:01:37.000000000 +0900 +++ apps/codecs/libtremor/os_types.h 2009-02-08 15:34:54.000000000 +0900 @@ -24,10 +24,12 @@ #ifdef _LOW_ACCURACY_ # define X(n) (((((n)>>22)+1)>>1) - ((((n)>>22)+1)>>9)) -# define LOOKUP_T const unsigned char +# define LOOKUP_T const unsigned char +# define LOOKUP_TNC unsigned char #else # define X(n) (n) # define LOOKUP_T const ogg_int32_t +# define LOOKUP_TNC ogg_int32_t #endif /* make it easy on the folks that want to compile the libs with a diff -u -r apps/codecs/libtremor/synthesis.c apps/codecs/libtremor/synthesis.c --- apps/codecs/libtremor/synthesis.c 2009-01-30 20:01:37.000000000 +0900 +++ apps/codecs/libtremor/synthesis.c 2009-02-08 15:34:58.000000000 +0900 @@ -25,12 +25,15 @@ #include "os.h" -/* IRAM buffer keep the block pcm data; only for windows size upto 2048 - for space restrictions. - libVorbis 1.1 Oggenc doesn't use larger windows anyway. */ +/* IRAM buffer keep the block pcm data; only for windows size upto 2048(4096) + for space restrictions. */ /* max 2 channels on the ihp-1xx (stereo), 2048 samples (2*2048*4=16Kb) */ -#define IRAM_PCM_END 2048 -#define CHANNELS 2 +#ifdef LARGE_IRAM +#define IRAM_PCM_END 4096 +#else +#define IRAM_PCM_END 2048 +#endif +#define CHANNELS 2 static ogg_int32_t *ipcm_vect[CHANNELS] IBSS_ATTR; static ogg_int32_t ipcm_buff[CHANNELS*IRAM_PCM_END] IBSS_ATTR LINE_ATTR; diff -u -r apps/codecs/libtremor/window_lookup.h apps/codecs/libtremor/window_lookup.h --- apps/codecs/libtremor/window_lookup.h 2009-01-30 20:01:37.000000000 +0900 +++ apps/codecs/libtremor/window_lookup.h 2009-02-08 15:35:06.000000000 +0900 @@ -15,7 +15,6 @@ ********************************************************************/ - #include "os_types.h" /* libvorbis currently only use the window sizes 256 and 2048, so only put @@ -50,8 +49,11 @@ X(0x7fd2a1fc), X(0x7fe64212), X(0x7ff2bd4c), X(0x7ffa0890), X(0x7ffdcf39), X(0x7fff6dac), X(0x7fffed01), X(0x7fffffc4), }; - +#ifdef LIRAM_PP +static LOOKUP_T vwin256[128] = { +#else static LOOKUP_T vwin256[128] ICONST_ATTR_TREMOR_WINDOW = { +#endif X(0x0001f018), X(0x00117066), X(0x00306e9e), X(0x005ee5f1), X(0x009ccf26), X(0x00ea208b), X(0x0146cdea), X(0x01b2c87f), X(0x022dfedf), X(0x02b85ced), X(0x0351cbbd), X(0x03fa317f), @@ -284,7 +286,11 @@ X(0x7fffffdd), X(0x7ffffff7), X(0x7fffffff), X(0x7fffffff), }; +#ifdef LIRAM_PP +static LOOKUP_T vwin2048[1024] = { +#else static LOOKUP_T vwin2048[1024] ICONST_ATTR_TREMOR_WINDOW = { +#endif X(0x000007c0), X(0x000045c4), X(0x0000c1ca), X(0x00017bd3), X(0x000273de), X(0x0003a9eb), X(0x00051df9), X(0x0006d007), X(0x0008c014), X(0x000aee1e), X(0x000d5a25), X(0x00100428),