diff options
Diffstat (limited to 'apps/codecs')
-rw-r--r-- | apps/codecs/demac/libdemac/decoder.c | 13 | ||||
-rw-r--r-- | apps/codecs/demac/libdemac/demac_config.h | 34 | ||||
-rw-r--r-- | apps/codecs/demac/libdemac/entropy.c | 18 | ||||
-rw-r--r-- | apps/codecs/demac/libdemac/filter.c | 2 |
4 files changed, 45 insertions, 22 deletions
diff --git a/apps/codecs/demac/libdemac/decoder.c b/apps/codecs/demac/libdemac/decoder.c index c415db774a..6566ba26a8 100644 --- a/apps/codecs/demac/libdemac/decoder.c +++ b/apps/codecs/demac/libdemac/decoder.c | |||
@@ -35,24 +35,27 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA | |||
35 | 35 | ||
36 | #ifdef FILTER256_IRAM | 36 | #ifdef FILTER256_IRAM |
37 | static filter_int filterbuf32[(32*3 + FILTER_HISTORY_SIZE) * 2] | 37 | static filter_int filterbuf32[(32*3 + FILTER_HISTORY_SIZE) * 2] |
38 | IBSS_ATTR __attribute__((aligned(16))); /* 2432/4864 bytes */ | 38 | IBSS_ATTR_DEMAC __attribute__((aligned(16))); |
39 | /* 2432 or 4864 bytes */ | ||
39 | static filter_int filterbuf256[(256*3 + FILTER_HISTORY_SIZE) * 2] | 40 | static filter_int filterbuf256[(256*3 + FILTER_HISTORY_SIZE) * 2] |
40 | IBSS_ATTR __attribute__((aligned(16))); /* 5120/10240 bytes */ | 41 | IBSS_ATTR_DEMAC __attribute__((aligned(16))); |
42 | /* 5120 or 10240 bytes */ | ||
41 | #define FILTERBUF64 filterbuf256 | 43 | #define FILTERBUF64 filterbuf256 |
42 | #define FILTERBUF32 filterbuf32 | 44 | #define FILTERBUF32 filterbuf32 |
43 | #define FILTERBUF16 filterbuf32 | 45 | #define FILTERBUF16 filterbuf32 |
44 | #else | 46 | #else |
45 | static filter_int filterbuf64[(64*3 + FILTER_HISTORY_SIZE) * 2] | 47 | static filter_int filterbuf64[(64*3 + FILTER_HISTORY_SIZE) * 2] |
46 | IBSS_ATTR __attribute__((aligned(16))); /* 2432/4864 bytes */ | 48 | IBSS_ATTR_DEMAC __attribute__((aligned(16))); |
49 | /* 2432 or 4864 bytes */ | ||
47 | static filter_int filterbuf256[(256*3 + FILTER_HISTORY_SIZE) * 2] | 50 | static filter_int filterbuf256[(256*3 + FILTER_HISTORY_SIZE) * 2] |
48 | __attribute__((aligned(16))); /* 5120/10240 bytes */ | 51 | __attribute__((aligned(16))); /* 5120 or 10240 bytes */ |
49 | #define FILTERBUF64 filterbuf64 | 52 | #define FILTERBUF64 filterbuf64 |
50 | #define FILTERBUF32 filterbuf64 | 53 | #define FILTERBUF32 filterbuf64 |
51 | #define FILTERBUF16 filterbuf64 | 54 | #define FILTERBUF16 filterbuf64 |
52 | #endif | 55 | #endif |
53 | 56 | ||
54 | /* This is only needed for "insane" files, and no current Rockbox targets | 57 | /* This is only needed for "insane" files, and no current Rockbox targets |
55 | can hope to decode them in realtime, although the Gigabeat S comes close. */ | 58 | can hope to decode them in realtime, except the Gigabeat S (at 528MHz). */ |
56 | static filter_int filterbuf1280[(1280*3 + FILTER_HISTORY_SIZE) * 2] | 59 | static filter_int filterbuf1280[(1280*3 + FILTER_HISTORY_SIZE) * 2] |
57 | IBSS_ATTR_DEMAC_INSANEBUF __attribute__((aligned(16))); | 60 | IBSS_ATTR_DEMAC_INSANEBUF __attribute__((aligned(16))); |
58 | /* 17408 or 34816 bytes */ | 61 | /* 17408 or 34816 bytes */ |
diff --git a/apps/codecs/demac/libdemac/demac_config.h b/apps/codecs/demac/libdemac/demac_config.h index c908c3ea10..f3b293e1d2 100644 --- a/apps/codecs/demac/libdemac/demac_config.h +++ b/apps/codecs/demac/libdemac/demac_config.h | |||
@@ -49,18 +49,39 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA | |||
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | #if CONFIG_CPU == PP5002 || defined(CPU_S5L870X) | 51 | #if CONFIG_CPU == PP5002 || defined(CPU_S5L870X) |
52 | /* Code in IRAM for speed, not enough IRAM for the insane filter buffer. */ | 52 | /* Code and data IRAM for speed (PP5002 has a broken cache), not enough IRAM |
53 | * for the insane filter buffer. Reciprocal table for division in IRAM. */ | ||
53 | #define ICODE_SECTION_DEMAC_ARM .icode | 54 | #define ICODE_SECTION_DEMAC_ARM .icode |
54 | #define ICODE_ATTR_DEMAC ICODE_ATTR | 55 | #define ICODE_ATTR_DEMAC ICODE_ATTR |
56 | #define ICONST_ATTR_DEMAC ICONST_ATTR | ||
57 | #define IBSS_ATTR_DEMAC IBSS_ATTR | ||
55 | #define IBSS_ATTR_DEMAC_INSANEBUF | 58 | #define IBSS_ATTR_DEMAC_INSANEBUF |
56 | #elif defined(CPU_PP502x) | 59 | |
57 | /* Insane filter buffer not in IRAM due to division table. */ | 60 | #elif CONFIG_CPU == PP5020 |
61 | /* Code and small data in DRAM for speed (PP5020 IRAM isn't completely single | ||
62 | * cycle). Insane filter buffer not in IRAM in favour of reciprocal table for | ||
63 | * divison. Decoded data buffers should be in IRAM (defined by the caller). */ | ||
64 | #define ICODE_SECTION_DEMAC_ARM .text | ||
65 | #define ICODE_ATTR_DEMAC | ||
66 | #define ICONST_ATTR_DEMAC | ||
67 | #define IBSS_ATTR_DEMAC | ||
68 | #define IBSS_ATTR_DEMAC_INSANEBUF | ||
69 | |||
70 | #elif CONFIG_CPU == PP5022 | ||
71 | /* Code in DRAM, data in IRAM. Insane filter buffer not in IRAM in favour of | ||
72 | * reciprocal table for divison */ | ||
58 | #define ICODE_SECTION_DEMAC_ARM .text | 73 | #define ICODE_SECTION_DEMAC_ARM .text |
59 | #define ICODE_ATTR_DEMAC | 74 | #define ICODE_ATTR_DEMAC |
75 | #define ICONST_ATTR_DEMAC ICONST_ATTR | ||
76 | #define IBSS_ATTR_DEMAC IBSS_ATTR | ||
60 | #define IBSS_ATTR_DEMAC_INSANEBUF | 77 | #define IBSS_ATTR_DEMAC_INSANEBUF |
78 | |||
61 | #else | 79 | #else |
80 | /* Code in DRAM, data in IRAM, including insane filter buffer. */ | ||
62 | #define ICODE_SECTION_DEMAC_ARM .text | 81 | #define ICODE_SECTION_DEMAC_ARM .text |
63 | #define ICODE_ATTR_DEMAC | 82 | #define ICODE_ATTR_DEMAC |
83 | #define ICONST_ATTR_DEMAC ICONST_ATTR | ||
84 | #define IBSS_ATTR_DEMAC IBSS_ATTR | ||
64 | #define IBSS_ATTR_DEMAC_INSANEBUF IBSS_ATTR | 85 | #define IBSS_ATTR_DEMAC_INSANEBUF IBSS_ATTR |
65 | #endif | 86 | #endif |
66 | 87 | ||
@@ -68,11 +89,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA | |||
68 | 89 | ||
69 | #define APE_OUTPUT_DEPTH (ape_ctx->bps) | 90 | #define APE_OUTPUT_DEPTH (ape_ctx->bps) |
70 | 91 | ||
71 | #define IBSS_ATTR | ||
72 | #define IBSS_ATTR_DEMAC_INSANEBUF | ||
73 | #define ICONST_ATTR | ||
74 | #define ICODE_ATTR | ||
75 | #define ICODE_ATTR_DEMAC | 92 | #define ICODE_ATTR_DEMAC |
93 | #define ICONST_ATTR_DEMAC | ||
94 | #define IBSS_ATTR_DEMAC | ||
95 | #define IBSS_ATTR_DEMAC_INSANEBUF | ||
76 | 96 | ||
77 | /* Use to give gcc hints on which branch is most likely taken */ | 97 | /* Use to give gcc hints on which branch is most likely taken */ |
78 | #if defined(__GNUC__) && __GNUC__ >= 3 | 98 | #if defined(__GNUC__) && __GNUC__ >= 3 |
diff --git a/apps/codecs/demac/libdemac/entropy.c b/apps/codecs/demac/libdemac/entropy.c index 24f5932de6..a09ba8f540 100644 --- a/apps/codecs/demac/libdemac/entropy.c +++ b/apps/codecs/demac/libdemac/entropy.c | |||
@@ -36,7 +36,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA | |||
36 | hard-coded in the Monkey's Audio decoder. | 36 | hard-coded in the Monkey's Audio decoder. |
37 | */ | 37 | */ |
38 | 38 | ||
39 | static const int counts_3970[65] ICONST_ATTR = | 39 | static const int counts_3970[65] ICONST_ATTR_DEMAC = |
40 | { | 40 | { |
41 | 0,14824,28224,39348,47855,53994,58171,60926, | 41 | 0,14824,28224,39348,47855,53994,58171,60926, |
42 | 62682,63786,64463,64878,65126,65276,65365,65419, | 42 | 62682,63786,64463,64878,65126,65276,65365,65419, |
@@ -50,7 +50,7 @@ static const int counts_3970[65] ICONST_ATTR = | |||
50 | }; | 50 | }; |
51 | 51 | ||
52 | /* counts_diff_3970[i] = counts_3970[i+1] - counts_3970[i] */ | 52 | /* counts_diff_3970[i] = counts_3970[i+1] - counts_3970[i] */ |
53 | static const int counts_diff_3970[64] ICONST_ATTR = | 53 | static const int counts_diff_3970[64] ICONST_ATTR_DEMAC = |
54 | { | 54 | { |
55 | 14824,13400,11124,8507,6139,4177,2755,1756, | 55 | 14824,13400,11124,8507,6139,4177,2755,1756, |
56 | 1104,677,415,248,150,89,54,31, | 56 | 1104,677,415,248,150,89,54,31, |
@@ -62,7 +62,7 @@ static const int counts_diff_3970[64] ICONST_ATTR = | |||
62 | 1,1,1,1,1,1,1,1 | 62 | 1,1,1,1,1,1,1,1 |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static const int counts_3980[65] ICONST_ATTR = | 65 | static const int counts_3980[65] ICONST_ATTR_DEMAC = |
66 | { | 66 | { |
67 | 0,19578,36160,48417,56323,60899,63265,64435, | 67 | 0,19578,36160,48417,56323,60899,63265,64435, |
68 | 64971,65232,65351,65416,65447,65466,65476,65482, | 68 | 64971,65232,65351,65416,65447,65466,65476,65482, |
@@ -77,7 +77,7 @@ static const int counts_3980[65] ICONST_ATTR = | |||
77 | 77 | ||
78 | /* counts_diff_3980[i] = counts_3980[i+1] - counts_3980[i] */ | 78 | /* counts_diff_3980[i] = counts_3980[i+1] - counts_3980[i] */ |
79 | 79 | ||
80 | static const int counts_diff_3980[64] ICONST_ATTR = | 80 | static const int counts_diff_3980[64] ICONST_ATTR_DEMAC = |
81 | { | 81 | { |
82 | 19578,16582,12257,7906,4576,2366,1170,536, | 82 | 19578,16582,12257,7906,4576,2366,1170,536, |
83 | 261,119,65,31,19,10,6,3, | 83 | 261,119,65,31,19,10,6,3, |
@@ -122,8 +122,8 @@ each function (and the RNGC macro)). | |||
122 | for aligned reads. | 122 | for aligned reads. |
123 | */ | 123 | */ |
124 | 124 | ||
125 | static unsigned char* bytebuffer IBSS_ATTR; | 125 | static unsigned char* bytebuffer IBSS_ATTR_DEMAC; |
126 | static int bytebufferoffset IBSS_ATTR; | 126 | static int bytebufferoffset IBSS_ATTR_DEMAC; |
127 | 127 | ||
128 | static inline void skip_byte(void) | 128 | static inline void skip_byte(void) |
129 | { | 129 | { |
@@ -159,7 +159,7 @@ struct rangecoder_t | |||
159 | unsigned int buffer; /* buffer for input/output */ | 159 | unsigned int buffer; /* buffer for input/output */ |
160 | }; | 160 | }; |
161 | 161 | ||
162 | static struct rangecoder_t rc IBSS_ATTR; | 162 | static struct rangecoder_t rc IBSS_ATTR_DEMAC; |
163 | 163 | ||
164 | /* Start the decoder */ | 164 | /* Start the decoder */ |
165 | static inline void range_start_decoding(void) | 165 | static inline void range_start_decoding(void) |
@@ -276,8 +276,8 @@ struct rice_t | |||
276 | uint32_t ksum; | 276 | uint32_t ksum; |
277 | }; | 277 | }; |
278 | 278 | ||
279 | static struct rice_t riceX IBSS_ATTR; | 279 | static struct rice_t riceX IBSS_ATTR_DEMAC; |
280 | static struct rice_t riceY IBSS_ATTR; | 280 | static struct rice_t riceY IBSS_ATTR_DEMAC; |
281 | 281 | ||
282 | static inline void update_rice(struct rice_t* rice, int x) | 282 | static inline void update_rice(struct rice_t* rice, int x) |
283 | { | 283 | { |
diff --git a/apps/codecs/demac/libdemac/filter.c b/apps/codecs/demac/libdemac/filter.c index 47a0aeb28e..8055098301 100644 --- a/apps/codecs/demac/libdemac/filter.c +++ b/apps/codecs/demac/libdemac/filter.c | |||
@@ -260,7 +260,7 @@ static void ICODE_ATTR_DEMAC do_apply_filter_3970(struct filter_t* f, | |||
260 | } | 260 | } |
261 | } | 261 | } |
262 | 262 | ||
263 | static struct filter_t filter[2] IBSS_ATTR; | 263 | static struct filter_t filter[2] IBSS_ATTR_DEMAC; |
264 | 264 | ||
265 | static void do_init_filter(struct filter_t* f, filter_int* buf) | 265 | static void do_init_filter(struct filter_t* f, filter_int* buf) |
266 | { | 266 | { |