diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-05-16 21:47:13 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-05-16 21:47:13 +0000 |
commit | 7b054efa0be8dbc209c351610fd8152b4de89f99 (patch) | |
tree | 763bb2fe04dfadbadc0dff1e0777403cec2a2e70 | |
parent | 22c9b6ef8e1e1f4354ff0fc445990512175a1649 (diff) | |
download | rockbox-7b054efa0be8dbc209c351610fd8152b4de89f99.tar.gz rockbox-7b054efa0be8dbc209c351610fd8152b4de89f99.zip |
FS#12117: Use more IRAM for atrac3. Speeds up decoding from 1-2% (PP5022, PP5024, S5L870x) to 11% (MCF5250).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29892 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/codecs/atrac3_rm.c | 6 | ||||
-rw-r--r-- | apps/codecs/libatrac/atrac3.c | 11 | ||||
-rw-r--r-- | apps/codecs/libatrac/atrac3.h | 11 | ||||
-rw-r--r-- | apps/codecs/libatrac/atrac3data.h | 47 |
4 files changed, 41 insertions, 34 deletions
diff --git a/apps/codecs/atrac3_rm.c b/apps/codecs/atrac3_rm.c index 4c619898bb..b666dd4513 100644 --- a/apps/codecs/atrac3_rm.c +++ b/apps/codecs/atrac3_rm.c | |||
@@ -28,9 +28,9 @@ | |||
28 | 28 | ||
29 | CODEC_HEADER | 29 | CODEC_HEADER |
30 | 30 | ||
31 | static RMContext rmctx; | 31 | static RMContext rmctx IBSS_ATTR_LARGE_IRAM; |
32 | static RMPacket pkt; | 32 | static RMPacket pkt IBSS_ATTR_LARGE_IRAM; |
33 | static ATRAC3Context q IBSS_ATTR; | 33 | static ATRAC3Context q IBSS_ATTR; |
34 | 34 | ||
35 | static void init_rm(RMContext *rmctx) | 35 | static void init_rm(RMContext *rmctx) |
36 | { | 36 | { |
diff --git a/apps/codecs/libatrac/atrac3.c b/apps/codecs/libatrac/atrac3.c index be41df5aad..711537fa96 100644 --- a/apps/codecs/libatrac/atrac3.c +++ b/apps/codecs/libatrac/atrac3.c | |||
@@ -60,12 +60,15 @@ | |||
60 | #define QMFWIN_TYPE int32_t | 60 | #define QMFWIN_TYPE int32_t |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | static VLC spectral_coeff_tab[7]; | 63 | static VLC spectral_coeff_tab[7] IBSS_ATTR_LARGE_IRAM; |
64 | static QMFWIN_TYPE qmf_window[48] IBSS_ATTR MEM_ALIGN_ATTR; | 64 | static QMFWIN_TYPE qmf_window[48] IBSS_ATTR MEM_ALIGN_ATTR; |
65 | static int32_t atrac3_spectrum [2][1024] IBSS_ATTR MEM_ALIGN_ATTR; | 65 | static int32_t atrac3_spectrum [2][1024] IBSS_ATTR MEM_ALIGN_ATTR; |
66 | static int32_t atrac3_IMDCT_buf[2][ 512] IBSS_ATTR MEM_ALIGN_ATTR; | 66 | static int32_t atrac3_IMDCT_buf[2][ 512] IBSS_ATTR MEM_ALIGN_ATTR; |
67 | static int32_t atrac3_prevFrame[2][1024] IBSS_ATTR MEM_ALIGN_ATTR; | 67 | static int32_t atrac3_prevFrame[2][1024] IBSS_ATTR MEM_ALIGN_ATTR; |
68 | static channel_unit channel_units[2] IBSS_ATTR_LARGE_IRAM; | 68 | static channel_unit channel_units[2] IBSS_ATTR_LARGE_IRAM; |
69 | static VLC_TYPE atrac3_vlc_table[4096][2] IBSS_ATTR_LARGE_IRAM; | ||
70 | static int vlcs_initialized = 0; | ||
71 | |||
69 | 72 | ||
70 | 73 | ||
71 | /** | 74 | /** |
@@ -1153,13 +1156,11 @@ int atrac3_decode_frame(unsigned long block_align, ATRAC3Context *q, | |||
1153 | * Atrac3 initialization | 1156 | * Atrac3 initialization |
1154 | * | 1157 | * |
1155 | * @param rmctx pointer to the RMContext | 1158 | * @param rmctx pointer to the RMContext |
1156 | */ | 1159 | */ |
1157 | int atrac3_decode_init(ATRAC3Context *q, struct mp3entry *id3) | 1160 | int atrac3_decode_init(ATRAC3Context *q, struct mp3entry *id3) |
1158 | { | 1161 | { |
1159 | int i; | 1162 | int i; |
1160 | uint8_t *edata_ptr = (uint8_t*)&id3->id3v2buf; | 1163 | uint8_t *edata_ptr = (uint8_t*)&id3->id3v2buf; |
1161 | static VLC_TYPE atrac3_vlc_table[4096][2]; | ||
1162 | static int vlcs_initialized = 0; | ||
1163 | 1164 | ||
1164 | #if defined(CPU_COLDFIRE) | 1165 | #if defined(CPU_COLDFIRE) |
1165 | coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE); | 1166 | coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE); |
diff --git a/apps/codecs/libatrac/atrac3.h b/apps/codecs/libatrac/atrac3.h index 941bb6d2ad..64086b6411 100644 --- a/apps/codecs/libatrac/atrac3.h +++ b/apps/codecs/libatrac/atrac3.h | |||
@@ -23,14 +23,17 @@ | |||
23 | #include "../librm/rm.h" | 23 | #include "../librm/rm.h" |
24 | #include "codeclib.h" | 24 | #include "codeclib.h" |
25 | 25 | ||
26 | #if (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) || (CONFIG_CPU == MCF5250) | 26 | #if (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) || \ |
27 | /* PP5022/24 and MCF5250 have larger IRAM */ | 27 | (CONFIG_CPU == MCF5250) || defined(CPU_S5L870X) |
28 | #define IBSS_ATTR_LARGE_IRAM IBSS_ATTR | 28 | /* PP5022/24, MCF5250 and S5L870x have larger IRAM */ |
29 | #define ICODE_ATTR_LARGE_IRAM ICODE_ATTR | 29 | #define IBSS_ATTR_LARGE_IRAM IBSS_ATTR |
30 | #define ICODE_ATTR_LARGE_IRAM ICODE_ATTR | ||
31 | #define ICONST_ATTR_LARGE_IRAM ICONST_ATTR | ||
30 | #else | 32 | #else |
31 | /* other CPUs IRAM is not large enough */ | 33 | /* other CPUs IRAM is not large enough */ |
32 | #define IBSS_ATTR_LARGE_IRAM | 34 | #define IBSS_ATTR_LARGE_IRAM |
33 | #define ICODE_ATTR_LARGE_IRAM | 35 | #define ICODE_ATTR_LARGE_IRAM |
36 | #define ICONST_ATTR_LARGE_IRAM | ||
34 | #endif | 37 | #endif |
35 | 38 | ||
36 | /* These structures are needed to store the parsed gain control data. */ | 39 | /* These structures are needed to store the parsed gain control data. */ |
diff --git a/apps/codecs/libatrac/atrac3data.h b/apps/codecs/libatrac/atrac3data.h index 0da9d9e758..30abb37572 100644 --- a/apps/codecs/libatrac/atrac3data.h +++ b/apps/codecs/libatrac/atrac3data.h | |||
@@ -32,88 +32,91 @@ | |||
32 | 32 | ||
33 | /* VLC tables */ | 33 | /* VLC tables */ |
34 | 34 | ||
35 | static const uint8_t huffcode1[9] = { | 35 | static const uint8_t huffcode1[9] ICONST_ATTR_LARGE_IRAM = { |
36 | 0x0,0x4,0x5,0xC,0xD,0x1C,0x1D,0x1E,0x1F, | 36 | 0x0,0x4,0x5,0xC,0xD,0x1C,0x1D,0x1E,0x1F, |
37 | }; | 37 | }; |
38 | 38 | ||
39 | static const uint8_t huffbits1[9] = { | 39 | static const uint8_t huffbits1[9] ICONST_ATTR_LARGE_IRAM = { |
40 | 1,3,3,4,4,5,5,5,5, | 40 | 1,3,3,4,4,5,5,5,5, |
41 | }; | 41 | }; |
42 | 42 | ||
43 | static const uint8_t huffcode2[5] = { | 43 | static const uint8_t huffcode2[5] ICONST_ATTR_LARGE_IRAM = { |
44 | 0x0,0x4,0x5,0x6,0x7, | 44 | 0x0,0x4,0x5,0x6,0x7, |
45 | }; | 45 | }; |
46 | 46 | ||
47 | static const uint8_t huffbits2[5] = { | 47 | static const uint8_t huffbits2[5] ICONST_ATTR_LARGE_IRAM = { |
48 | 1,3,3,3,3, | 48 | 1,3,3,3,3, |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static const uint8_t huffcode3[7] = { | 51 | static const uint8_t huffcode3[7] ICONST_ATTR_LARGE_IRAM = { |
52 | 0x0,0x4,0x5,0xC,0xD,0xE,0xF, | 52 | 0x0,0x4,0x5,0xC,0xD,0xE,0xF, |
53 | }; | 53 | }; |
54 | 54 | ||
55 | static const uint8_t huffbits3[7] = { | 55 | static const uint8_t huffbits3[7] ICONST_ATTR_LARGE_IRAM = { |
56 | 1,3,3,4,4,4,4, | 56 | 1,3,3,4,4,4,4, |
57 | }; | 57 | }; |
58 | 58 | ||
59 | static const uint8_t huffcode4[9] = { | 59 | static const uint8_t huffcode4[9] ICONST_ATTR_LARGE_IRAM = { |
60 | 0x0,0x4,0x5,0xC,0xD,0x1C,0x1D,0x1E,0x1F, | 60 | 0x0,0x4,0x5,0xC,0xD,0x1C,0x1D,0x1E,0x1F, |
61 | }; | 61 | }; |
62 | 62 | ||
63 | static const uint8_t huffbits4[9] = { | 63 | static const uint8_t huffbits4[9] ICONST_ATTR_LARGE_IRAM = { |
64 | 1,3,3,4,4,5,5,5,5, | 64 | 1,3,3,4,4,5,5,5,5, |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static const uint8_t huffcode5[15] = { | 67 | static const uint8_t huffcode5[15] ICONST_ATTR_LARGE_IRAM = { |
68 | 0x0,0x2,0x3,0x8,0x9,0xA,0xB,0x1C,0x1D,0x3C,0x3D,0x3E,0x3F,0xC,0xD, | 68 | 0x0,0x2,0x3,0x8,0x9,0xA,0xB,0x1C,0x1D,0x3C,0x3D,0x3E,0x3F,0xC,0xD, |
69 | }; | 69 | }; |
70 | 70 | ||
71 | static const uint8_t huffbits5[15] = { | 71 | static const uint8_t huffbits5[15] ICONST_ATTR_LARGE_IRAM = { |
72 | 2,3,3,4,4,4,4,5,5,6,6,6,6,4,4 | 72 | 2,3,3,4,4,4,4,5,5,6,6,6,6,4,4 |
73 | }; | 73 | }; |
74 | 74 | ||
75 | static const uint8_t huffcode6[31] = { | 75 | static const uint8_t huffcode6[31] ICONST_ATTR_LARGE_IRAM = { |
76 | 0x0,0x2,0x3,0x4,0x5,0x6,0x7,0x14,0x15,0x16,0x17,0x18,0x19,0x34,0x35, | 76 | 0x0,0x2,0x3,0x4,0x5,0x6,0x7,0x14,0x15,0x16,0x17,0x18,0x19,0x34,0x35, |
77 | 0x36,0x37,0x38,0x39,0x3A,0x3B,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F,0x8,0x9, | 77 | 0x36,0x37,0x38,0x39,0x3A,0x3B,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F,0x8,0x9, |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static const uint8_t huffbits6[31] = { | 80 | static const uint8_t huffbits6[31] ICONST_ATTR_LARGE_IRAM = { |
81 | 3,4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,4,4 | 81 | 3,4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,4,4 |
82 | }; | 82 | }; |
83 | 83 | ||
84 | static const uint8_t huffcode7[63] = { | 84 | static const uint8_t huffcode7[63] ICONST_ATTR_LARGE_IRAM = { |
85 | 0x0,0x8,0x9,0xA,0xB,0xC,0xD,0xE,0xF,0x10,0x11,0x24,0x25,0x26,0x27,0x28, | 85 | 0x0,0x8,0x9,0xA,0xB,0xC,0xD,0xE,0xF,0x10,0x11,0x24,0x25,0x26,0x27,0x28, |
86 | 0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x68,0x69,0x6A,0x6B,0x6C, | 86 | 0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x68,0x69,0x6A,0x6B,0x6C, |
87 | 0x6D,0x6E,0x6F,0x70,0x71,0x72,0x73,0x74,0x75,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2, | 87 | 0x6D,0x6E,0x6F,0x70,0x71,0x72,0x73,0x74,0x75,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2, |
88 | 0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF,0x2,0x3, | 88 | 0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF,0x2,0x3, |
89 | }; | 89 | }; |
90 | 90 | ||
91 | static const uint8_t huffbits7[63] = { | 91 | static const uint8_t huffbits7[63] ICONST_ATTR_LARGE_IRAM = { |
92 | 3,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7, | 92 | 3,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7, |
93 | 7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,4,4 | 93 | 7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,4,4 |
94 | }; | 94 | }; |
95 | 95 | ||
96 | static const uint8_t huff_tab_sizes[7] = { | 96 | static const uint8_t huff_tab_sizes[7] ICONST_ATTR_LARGE_IRAM = { |
97 | 9, 5, 7, 9, 15, 31, 63, | 97 | 9, 5, 7, 9, 15, 31, 63, |
98 | }; | 98 | }; |
99 | 99 | ||
100 | static const uint8_t* const huff_codes[7] = { | 100 | static const uint8_t* const huff_codes[7] ICONST_ATTR_LARGE_IRAM = { |
101 | huffcode1,huffcode2,huffcode3,huffcode4,huffcode5,huffcode6,huffcode7, | 101 | huffcode1,huffcode2,huffcode3,huffcode4,huffcode5,huffcode6,huffcode7, |
102 | }; | 102 | }; |
103 | 103 | ||
104 | static const uint8_t* const huff_bits[7] = { | 104 | static const uint8_t* const huff_bits[7] ICONST_ATTR_LARGE_IRAM = { |
105 | huffbits1,huffbits2,huffbits3,huffbits4,huffbits5,huffbits6,huffbits7, | 105 | huffbits1,huffbits2,huffbits3,huffbits4,huffbits5,huffbits6,huffbits7, |
106 | }; | 106 | }; |
107 | 107 | ||
108 | static const uint16_t atrac3_vlc_offs[] = { | 108 | static const uint16_t atrac3_vlc_offs[] ICONST_ATTR_LARGE_IRAM = { |
109 | 0,512,1024,1536,2048,2560,3072,3584,4096 | 109 | 0,512,1024,1536,2048,2560,3072,3584,4096 |
110 | }; | 110 | }; |
111 | 111 | ||
112 | /* selector tables */ | 112 | /* selector tables */ |
113 | 113 | ||
114 | static const uint8_t CLCLengthTab[8] = {0, 4, 3, 3, 4, 4, 5, 6}; | 114 | static const uint8_t CLCLengthTab[8] ICONST_ATTR_LARGE_IRAM = { |
115 | static const int8_t seTab_0[4] = {0, 1, -2, -1}; | 115 | 0, 4, 3, 3, 4, 4, 5, 6}; |
116 | static const int8_t decTable1[18] = {0,0, 0,1, 0,-1, 1,0, -1,0, 1,1, 1,-1, -1,1, -1,-1}; | 116 | static const int8_t seTab_0[4] ICONST_ATTR_LARGE_IRAM = { |
117 | 0, 1, -2, -1}; | ||
118 | static const int8_t decTable1[18] ICONST_ATTR_LARGE_IRAM = { | ||
119 | 0,0, 0,1, 0,-1, 1,0, -1,0, 1,1, 1,-1, -1,1, -1,-1}; | ||
117 | 120 | ||
118 | 121 | ||
119 | /* tables for the scalefactor decoding */ | 122 | /* tables for the scalefactor decoding */ |
@@ -122,7 +125,7 @@ static const float iMaxQuant[8] = { | |||
122 | 0.0, 1.0/1.5, 1.0/2.5, 1.0/3.5, 1.0/4.5, 1.0/7.5, 1.0/15.5, 1.0/31.5 | 125 | 0.0, 1.0/1.5, 1.0/2.5, 1.0/3.5, 1.0/4.5, 1.0/7.5, 1.0/15.5, 1.0/31.5 |
123 | }; | 126 | }; |
124 | */ | 127 | */ |
125 | static const uint16_t subbandTab[33] = { | 128 | static const uint16_t subbandTab[33] ICONST_ATTR_LARGE_IRAM = { |
126 | 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, | 129 | 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, |
127 | 256, 288, 320, 352, 384, 416, 448, 480, 512, 576, 640, 704, 768, 896, 1024 | 130 | 256, 288, 320, 352, 384, 416, 448, 480, 512, 576, 640, 704, 768, 896, 1024 |
128 | }; | 131 | }; |