From 7e33f16aee169d3142ea51c4be065759e372260c Mon Sep 17 00:00:00 2001 From: Magnus Holmgren Date: Thu, 28 Jul 2005 12:04:41 +0000 Subject: [PATCH] Tweaked IRAM usage in the Vorbis codec. Speeds up decoding by about 10% on a couple of test files. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7249 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/Tremor/bitwise.c | 4 +++- apps/codecs/Tremor/codebook.c | 1 + apps/codecs/Tremor/mdct.c | 1 + apps/codecs/Tremor/mdct_lookup.h | 2 +- apps/codecs/Tremor/window_lookup.h | 14 +++++++------- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/apps/codecs/Tremor/bitwise.c b/apps/codecs/Tremor/bitwise.c index bf8c7ec163..ac2e6e6d76 100644 --- a/apps/codecs/Tremor/bitwise.c +++ b/apps/codecs/Tremor/bitwise.c @@ -22,7 +22,7 @@ #include #include "ogg.h" -static const unsigned long mask[] = +static const unsigned long mask[] IDATA_ATTR = {0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f, 0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff, 0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff, @@ -79,6 +79,7 @@ void oggpack_readinit(oggpack_buffer *b,ogg_reference *r){ } /* Read in bits without advancing the bitptr; bits <= 32 */ +long oggpack_look(oggpack_buffer *b,int bits) ICODE_ATTR; long oggpack_look(oggpack_buffer *b,int bits){ unsigned long m=mask[bits]; unsigned long ret=0; @@ -139,6 +140,7 @@ long oggpack_look(oggpack_buffer *b,int bits){ } /* limited to 32 at a time */ +void oggpack_adv(oggpack_buffer *b,int bits) ICODE_ATTR; void oggpack_adv(oggpack_buffer *b,int bits){ bits+=b->headbit; b->headbit=bits&7; diff --git a/apps/codecs/Tremor/codebook.c b/apps/codecs/Tremor/codebook.c index f03b5efb04..288800eaaa 100644 --- a/apps/codecs/Tremor/codebook.c +++ b/apps/codecs/Tremor/codebook.c @@ -210,6 +210,7 @@ static inline long decode_packed_entry_number(codebook *book, addmul==2 -> multiplicitive */ /* returns the [original, not compacted] entry number or -1 on eof *********/ +long vorbis_book_decode(codebook *book, oggpack_buffer *b) ICODE_ATTR; long vorbis_book_decode(codebook *book, oggpack_buffer *b){ long packed_entry=decode_packed_entry_number(book,b); if(packed_entry>=0) diff --git a/apps/codecs/Tremor/mdct.c b/apps/codecs/Tremor/mdct.c index 9bdfdce2e2..f16a536dc7 100644 --- a/apps/codecs/Tremor/mdct.c +++ b/apps/codecs/Tremor/mdct.c @@ -144,6 +144,7 @@ STIN void mdct_butterfly_32(DATA_TYPE *x){ } /* N/stage point generic N stage butterfly (in place, 4 register) */ +void mdct_butterfly_generic(DATA_TYPE *x,int points, int step) ICODE_ATTR; void mdct_butterfly_generic(DATA_TYPE *x,int points, int step){ LOOKUP_T *T = sincos_lookup0; DATA_TYPE *x1 = x + points - 8; diff --git a/apps/codecs/Tremor/mdct_lookup.h b/apps/codecs/Tremor/mdct_lookup.h index dfbdacbf6e..3913a8b976 100644 --- a/apps/codecs/Tremor/mdct_lookup.h +++ b/apps/codecs/Tremor/mdct_lookup.h @@ -282,7 +282,7 @@ static LOOKUP_T sincos_lookup0[1026] IDATA_ATTR = { }; /* {sin((2*i+1)*PI/4096), cos((2*i+1)*PI/4096)}, with i = 0 to 511 */ -static LOOKUP_T sincos_lookup1[1024] = { +static LOOKUP_T sincos_lookup1[1024] IDATA_ATTR = { X(0x001921fb), X(0x7ffffd88), X(0x004b65ee), X(0x7fffe9cb), X(0x007da9d4), X(0x7fffc251), X(0x00afeda8), X(0x7fff8719), X(0x00e23160), X(0x7fff3824), X(0x011474f6), X(0x7ffed572), diff --git a/apps/codecs/Tremor/window_lookup.h b/apps/codecs/Tremor/window_lookup.h index 64350d8fba..37a8bccb2b 100644 --- a/apps/codecs/Tremor/window_lookup.h +++ b/apps/codecs/Tremor/window_lookup.h @@ -18,9 +18,9 @@ #include "os_types.h" -/* Oggenc 1.1 seems to use exclusively windows sizes 256, 2048 - keep the most common sizes in fast IRAM; - because we have the available space also 128, 512 */ +/* libvorbis currently only use the window sizes 256 and 2048, so only put + * them in fast IRAM. + */ static LOOKUP_T vwin64[32] = { X(0x001f0003), X(0x01168c98), X(0x030333c8), X(0x05dfe3a4), X(0x09a49562), X(0x0e45df18), X(0x13b47ef2), X(0x19dcf676), @@ -32,7 +32,7 @@ static LOOKUP_T vwin64[32] = { X(0x7fdd78a5), X(0x7ff6ec6d), X(0x7ffed0e9), X(0x7ffffc3f), }; -static LOOKUP_T vwin128[64] IDATA_ATTR LINE_ATTR = { +static LOOKUP_T vwin128[64] = { X(0x0007c04d), X(0x0045bb89), X(0x00c18b87), X(0x017ae294), X(0x02714a4e), X(0x03a4217a), X(0x05129952), X(0x06bbb24f), X(0x089e38a1), X(0x0ab8c073), X(0x0d09a228), X(0x0f8ef6bd), @@ -51,7 +51,7 @@ static LOOKUP_T vwin128[64] IDATA_ATTR LINE_ATTR = { X(0x7ffdcf39), X(0x7fff6dac), X(0x7fffed01), X(0x7fffffc4), }; -static LOOKUP_T vwin256[128] IDATA_ATTR LINE_ATTR = { +static LOOKUP_T vwin256[128] IDATA_ATTR = { X(0x0001f018), X(0x00117066), X(0x00306e9e), X(0x005ee5f1), X(0x009ccf26), X(0x00ea208b), X(0x0146cdea), X(0x01b2c87f), X(0x022dfedf), X(0x02b85ced), X(0x0351cbbd), X(0x03fa317f), @@ -86,7 +86,7 @@ static LOOKUP_T vwin256[128] IDATA_ATTR LINE_ATTR = { X(0x7fffdcd2), X(0x7ffff6d6), X(0x7ffffed0), X(0x7ffffffc), }; -static LOOKUP_T vwin512[256] IDATA_ATTR LINE_ATTR = { +static LOOKUP_T vwin512[256] = { X(0x00007c06), X(0x00045c32), X(0x000c1c62), X(0x0017bc4c), X(0x00273b7a), X(0x003a9955), X(0x0051d51c), X(0x006cede7), X(0x008be2a9), X(0x00aeb22a), X(0x00d55b0d), X(0x00ffdbcc), @@ -284,7 +284,7 @@ static LOOKUP_T vwin1024[512] = { X(0x7fffffdd), X(0x7ffffff7), X(0x7fffffff), X(0x7fffffff), }; -static LOOKUP_T vwin2048[1024] IDATA_ATTR LINE_ATTR = { +static LOOKUP_T vwin2048[1024] IDATA_ATTR = { X(0x000007c0), X(0x000045c4), X(0x0000c1ca), X(0x00017bd3), X(0x000273de), X(0x0003a9eb), X(0x00051df9), X(0x0006d007), X(0x0008c014), X(0x000aee1e), X(0x000d5a25), X(0x00100428),