summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Vasconcelos <pbv@rockbox.org>2005-05-27 09:14:00 +0000
committerPedro Vasconcelos <pbv@rockbox.org>2005-05-27 09:14:00 +0000
commit024db0a766f9590baea73babfefff278c28a5b2c (patch)
tree27e5e27e056cd0b988c2e6af7e575fe974f88035
parent38413489305efad4f682534f92c5daa031f5440a (diff)
downloadrockbox-024db0a766f9590baea73babfefff278c28a5b2c.tar.gz
rockbox-024db0a766f9590baea73babfefff278c28a5b2c.zip
Basic optimizations of the Vorbis decoder for the ihp-1x0.
Capable of real-time decoding with cpu freq at 120mhz. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6527 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/Tremor/Makefile2
-rw-r--r--apps/codecs/Tremor/asm_mcf5249.h257
-rw-r--r--apps/codecs/Tremor/bitwise.c2
-rw-r--r--apps/codecs/Tremor/block.c4
-rw-r--r--apps/codecs/Tremor/codebook.c2
-rw-r--r--apps/codecs/Tremor/config-tremor.h7
-rw-r--r--apps/codecs/Tremor/floor1.c20
-rw-r--r--apps/codecs/Tremor/framing.c2
-rw-r--r--apps/codecs/Tremor/lsp_lookup.h10
-rw-r--r--apps/codecs/Tremor/mapping0.c90
-rw-r--r--apps/codecs/Tremor/mdct.c38
-rw-r--r--apps/codecs/Tremor/mdct.h4
-rw-r--r--apps/codecs/Tremor/mdct_lookup.h6
-rw-r--r--apps/codecs/Tremor/misc.h29
-rw-r--r--apps/codecs/Tremor/os.h6
-rw-r--r--apps/codecs/Tremor/os_types.h2
-rw-r--r--apps/codecs/Tremor/registry.c6
-rw-r--r--apps/codecs/Tremor/res012.c6
-rw-r--r--apps/codecs/Tremor/vorbisfile.c4
-rw-r--r--apps/codecs/Tremor/window.c12
-rw-r--r--apps/codecs/Tremor/window_lookup.h17
-rw-r--r--apps/plugins/vorbis2wav.c9
22 files changed, 428 insertions, 107 deletions
diff --git a/apps/codecs/Tremor/Makefile b/apps/codecs/Tremor/Makefile
index 20e30bbbf6..2b4adf146f 100644
--- a/apps/codecs/Tremor/Makefile
+++ b/apps/codecs/Tremor/Makefile
@@ -14,7 +14,7 @@ ifdef APPEXTRA
14INCLUDES += -I$(APPSDIR)/$(APPEXTRA) 14INCLUDES += -I$(APPSDIR)/$(APPEXTRA)
15endif 15endif
16 16
17TREMOROPTS = 17TREMOROPTS = -O2
18CFLAGS = $(GCCOPTS) $(TREMOROPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ 18CFLAGS = $(GCCOPTS) $(TREMOROPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
19-DMEM=${MEMORYSIZE} 19-DMEM=${MEMORYSIZE}
20 20
diff --git a/apps/codecs/Tremor/asm_mcf5249.h b/apps/codecs/Tremor/asm_mcf5249.h
new file mode 100644
index 0000000000..09c74671bc
--- /dev/null
+++ b/apps/codecs/Tremor/asm_mcf5249.h
@@ -0,0 +1,257 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2005 by Pedro Vasconcelos
10 *
11 * All files in this archive are subject to the GNU General Public License.
12 * See the file COPYING in the source tree root for full license agreement.
13 *
14 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
15 * KIND, either express or implied.
16 *
17 ****************************************************************************/
18/* asm routines for wide math on the MCF5249 */
19
20#include "os_types.h"
21
22#if CONFIG_CPU == MCF5249 && !defined(SIMULATOR)
23
24#ifndef _V_WIDE_MATH
25#define _V_WIDE_MATH
26
27//#define MB() asm volatile ("" : : : "memory")
28#define MB()
29
30static inline void mcf5249_init_mac(void) {
31 int r;
32 asm volatile ("move.l #0x20, %%macsr;" // frac, truncate, no saturation
33 "movclr.l %%acc0, %[r];" // clear accumulators
34 "move.l %%acc0, %%acc1;"
35 "move.l %%acc0, %%acc2;"
36 "move.l %%acc0, %%acc3;"
37 : [r] "=r" (r));
38}
39
40static inline ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
41 ogg_int32_t r;
42 asm volatile ("mac.l %[x], %[y], %%acc0;" // multiply into acc
43 "movclr.l %%acc0, %[r];" // move & clear acc
44 "asr.l #1, %[r];" // no overflow test
45 : [r] "=d" (r)
46 : [x] "r" (x), [y] "r" (y)
47 : "cc");
48 return r;
49}
50
51static inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
52 ogg_int32_t r;
53 asm volatile ("mac.l %[x], %[y], %%acc0;" // multiply
54 "movclr.l %%acc0, %[r];" // move and clear
55 : [r] "=r" (r)
56 : [x] "r" (x), [y] "r" (y)
57 : "cc");
58 return r;
59}
60
61
62static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
63 ogg_int32_t r;
64 asm volatile ("mac.l %[x], %[y], %%acc0;" // multiply
65 "movclr.l %%acc0, %[r];" // get higher half
66 "mulu.l %[y], %[x];" // get lower half
67 "asl.l #8, %[r];" // hi << 17
68 "asl.l #8, %[r];"
69 "lsr.l #8, %[x];" // (unsigned)lo >> 15
70 "lsr.l #7, %[x];"
71 "or.l %[x], %[r];" // or
72 : [r] "=&d" (r), [x] "+d" (x)
73 : [y] "d" (y)
74 : "cc");
75 return r;
76}
77
78
79static inline
80void XPROD31(ogg_int32_t a, ogg_int32_t b,
81 ogg_int32_t t, ogg_int32_t v,
82 ogg_int32_t *x, ogg_int32_t *y)
83{
84 ogg_int32_t r;
85 asm volatile ("mac.l %[a], %[t], %%acc0;"
86 "mac.l %[b], %[v], %%acc0;"
87 "mac.l %[b], %[t], %%acc1;"
88 "msac.l %[a], %[v], %%acc1;"
89 "movclr.l %%acc0, %[r];"
90 "move.l %[r], (%[x]);"
91 "movclr.l %%acc1, %[r];"
92 "move.l %[r], (%[y]);"
93 : [r] "=&r" (r)
94 : [x] "a" (x), [y] "a" (y),
95 [a] "r" (a), [b] "r" (b), [t] "r" (t), [v] "r" (v)
96 : "cc", "memory");
97}
98
99
100static inline
101void XNPROD31(ogg_int32_t a, ogg_int32_t b,
102 ogg_int32_t t, ogg_int32_t v,
103 ogg_int32_t *x, ogg_int32_t *y)
104{
105 ogg_int32_t r;
106 asm volatile ("mac.l %[a], %[t], %%acc0;"
107 "msac.l %[b], %[v], %%acc0;"
108 "mac.l %[b], %[t], %%acc1;"
109 "mac.l %[a], %[v], %%acc1;"
110 "movclr.l %%acc0, %[r];"
111 "move.l %[r], (%[x]);"
112 "movclr.l %%acc1, %[r];"
113 "move.l %[r], (%[y]);"
114 : [r] "=&r" (r)
115 : [x] "a" (x), [y] "a" (y),
116 [a] "r" (a), [b] "r" (b), [t] "r" (t), [v] "r" (v)
117 : "cc", "memory");
118}
119
120
121/* no faster way of doing this using the MAC? */
122#define XPROD32(_a, _b, _t, _v, _x, _y) \
123 { (_x)=MULT32(_a,_t)+MULT32(_b,_v); \
124 (_y)=MULT32(_b,_t)-MULT32(_a,_v); }
125
126
127/* asm versions of vector multiplication for window.c */
128/* assumes MAC is initialized & accumulators cleared */
129static inline
130void mcf5249_vect_mult_fw(ogg_int32_t *data, LOOKUP_T *window, int n)
131{
132 asm volatile ("movem.l (%[d]), %%d0-%%d3;" // loop start
133 "movem.l (%[w]), %%a0-%%a3;" // pre-fetch registers
134 "lea.l (4*4, %[w]), %[w];"
135 "bra 1f;" // jump to loop condition
136 "0:" // loop body
137 // multiply and load next window values
138 "mac.l %%d0, %%a0, (%[w])+, %%a0, %%acc0;"
139 "mac.l %%d1, %%a1, (%[w])+, %%a1, %%acc1;"
140 "mac.l %%d2, %%a2, (%[w])+, %%a2, %%acc2;"
141 "mac.l %%d3, %%a3, (%[w])+, %%a3, %%acc3;"
142 "movclr.l %%acc0, %%d0;" // get the products
143 "movclr.l %%acc1, %%d1;"
144 "movclr.l %%acc2, %%d2;"
145 "movclr.l %%acc3, %%d3;"
146 // store and advance
147 "movem.l %%d0-%%d3, (%[d]);"
148 "lea.l (4*4, %[d]), %[d];"
149 "movem.l (%[d]), %%d0-%%d3;"
150 "subq.l #4, %[n];" // done 4 elements
151 "1: cmpi.l #4, %[n];"
152 "bge 0b;"
153 // multiply final elements
154 "tst.l %[n];"
155 "beq 1f;" // n=0
156 "mac.l %%d0, %%a0, %%acc0;"
157 "movclr.l %%acc0, %%d0;"
158 "move.l %%d0, (%[d])+;"
159 "subq.l #1, %[n];"
160 "beq 1f;" // n=1
161 "mac.l %%d1, %%a1, %%acc0;"
162 "movclr.l %%acc0, %%d1;"
163 "move.l %%d1, (%[d])+;"
164 "subq.l #1, %[n];"
165 "beq 1f;" // n=2
166 // otherwise n = 3
167 "mac.l %%d2, %%a2, %%acc0;"
168 "movclr.l %%acc0, %%d2;"
169 "move.l %%d2, (%[d])+;"
170 "1:"
171 : [n] "+d" (n), [d] "+a" (data), [w] "+a" (window)
172 : : "%d0", "%d1", "%d2", "%d3", "%a0", "%a1", "%a2", "%a3",
173 "cc", "memory");
174}
175
176static inline
177void mcf5249_vect_mult_bw(ogg_int32_t *data, LOOKUP_T *window, int n)
178{
179 asm volatile ("lea.l (-3*4, %[w]), %[w];" // loop start
180 "movem.l (%[d]), %%d0-%%d3;" // pre-fetch registers
181 "movem.l (%[w]), %%a0-%%a3;"
182 "bra 1f;" // jump to loop condition
183 "0:" // loop body
184 // multiply and load next window value
185 "mac.l %%d0, %%a3, -(%[w]), %%a3, %%acc0;"
186 "mac.l %%d1, %%a2, -(%[w]), %%a2, %%acc1;"
187 "mac.l %%d2, %%a1, -(%[w]), %%a1, %%acc2;"
188 "mac.l %%d3, %%a0, -(%[w]), %%a0, %%acc3;"
189 "movclr.l %%acc0, %%d0;" // get the products
190 "movclr.l %%acc1, %%d1;"
191 "movclr.l %%acc2, %%d2;"
192 "movclr.l %%acc3, %%d3;"
193 // store and advance
194 "movem.l %%d0-%%d3, (%[d]);"
195 "lea.l (4*4, %[d]), %[d];"
196 "movem.l (%[d]), %%d0-%%d3;"
197 "subq.l #4, %[n];" // done 4 elements
198 "1: cmpi.l #4, %[n];"
199 "bge 0b;"
200 // multiply final elements
201 "tst.l %[n];"
202 "beq 1f;" // n=0
203 "mac.l %%d0, %%a3, %%acc0;"
204 "movclr.l %%acc0, %%d0;"
205 "move.l %%d0, (%[d])+;"
206 "subq.l #1, %[n];"
207 "beq 1f;" // n=1
208 "mac.l %%d1, %%a2, %%acc0;"
209 "movclr.l %%acc0, %%d1;"
210 "move.l %%d1, (%[d])+;"
211 "subq.l #1, %[n];"
212 "beq 1f;" // n=2
213 // otherwise n = 3
214 "mac.l %%d2, %%a1, %%acc0;"
215 "movclr.l %%acc0, %%d2;"
216 "move.l %%d2, (%[d])+;"
217 "1:"
218 : [n] "+d" (n), [d] "+a" (data), [w] "+a" (window)
219 : : "%d0", "%d1", "%d2", "%d3", "%a0", "%a1", "%a2", "%a3",
220 "cc", "memory");
221}
222
223
224static inline
225void mcf5249_vect_zero(ogg_int32_t *ptr, int n)
226{
227 asm volatile ("clr.l %%d0;"
228 "clr.l %%d1;"
229 "clr.l %%d2;"
230 "clr.l %%d3;"
231 // loop start
232 "tst.l %[n];"
233 "bra 1f;"
234 "0: movem.l %%d0-%%d3, (%[ptr]);"
235 "lea (4*4, %[ptr]), %[ptr];"
236 "subq.l #4, %[n];"
237 "1: bgt 0b;"
238 // remaing elements
239 "tst.l %[n];"
240 "beq 1f;" // n=0
241 "clr.l (%[ptr])+;"
242 "subq.l #1, %[n];"
243 "beq 1f;" // n=1
244 "clr.l (%[ptr])+;"
245 "subq.l #1, %[n];"
246 "beq 1f;" // n=2
247 // otherwise n = 3
248 "clr.l (%[ptr])+;"
249 "1:"
250 : [n] "+d" (n), [ptr] "+a" (ptr)
251 :
252 : "%d0","%d1","%d2","%d3","cc","memory");
253}
254
255
256#endif
257#endif
diff --git a/apps/codecs/Tremor/bitwise.c b/apps/codecs/Tremor/bitwise.c
index b75ac408b8..fa9dcd6eff 100644
--- a/apps/codecs/Tremor/bitwise.c
+++ b/apps/codecs/Tremor/bitwise.c
@@ -22,7 +22,7 @@
22#include <string.h> 22#include <string.h>
23#include "ogg.h" 23#include "ogg.h"
24 24
25static unsigned long mask[]= 25static const unsigned long mask[] IDATA_ATTR =
26{0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f, 26{0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f,
27 0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff, 27 0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff,
28 0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff, 28 0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff,
diff --git a/apps/codecs/Tremor/block.c b/apps/codecs/Tremor/block.c
index a4571c37d4..6f88fb812c 100644
--- a/apps/codecs/Tremor/block.c
+++ b/apps/codecs/Tremor/block.c
@@ -172,8 +172,12 @@ static int _vds_init(vorbis_dsp_state *v,vorbis_info *vi){
172 v->pcm_storage=ci->blocksizes[1]; 172 v->pcm_storage=ci->blocksizes[1];
173 v->pcm=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->pcm)); 173 v->pcm=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->pcm));
174 v->pcmret=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->pcmret)); 174 v->pcmret=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->pcmret));
175
176 // pbv: allow for extra padding for windowing
175 for(i=0;i<vi->channels;i++) 177 for(i=0;i<vi->channels;i++)
176 v->pcm[i]=(ogg_int32_t *)_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i])); 178 v->pcm[i]=(ogg_int32_t *)_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i]));
179 // v->pcm[i]=(ogg_int32_t *)_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i]));
180
177 181
178 /* all 1 (large block) or 0 (small block) */ 182 /* all 1 (large block) or 0 (small block) */
179 /* explicitly set for the sake of clarity */ 183 /* explicitly set for the sake of clarity */
diff --git a/apps/codecs/Tremor/codebook.c b/apps/codecs/Tremor/codebook.c
index bb99487feb..4da7641553 100644
--- a/apps/codecs/Tremor/codebook.c
+++ b/apps/codecs/Tremor/codebook.c
@@ -306,7 +306,7 @@ long vorbis_book_decodev_set(codebook *book,ogg_int32_t *a,
306 return(0); 306 return(0);
307} 307}
308 308
309long vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a,\ 309long vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a,
310 long offset,int ch, 310 long offset,int ch,
311 oggpack_buffer *b,int n,int point){ 311 oggpack_buffer *b,int n,int point){
312 long i,j,entry; 312 long i,j,entry;
diff --git a/apps/codecs/Tremor/config-tremor.h b/apps/codecs/Tremor/config-tremor.h
index 81aa5bffab..8307d87b77 100644
--- a/apps/codecs/Tremor/config-tremor.h
+++ b/apps/codecs/Tremor/config-tremor.h
@@ -1,5 +1,4 @@
1#include "../codec.h" 1#include "../codec.h"
2
3#ifdef ROCKBOX_BIG_ENDIAN 2#ifdef ROCKBOX_BIG_ENDIAN
4#define BIG_ENDIAN 1 3#define BIG_ENDIAN 1
5#define LITTLE_ENDIAN 0 4#define LITTLE_ENDIAN 0
@@ -9,4 +8,6 @@
9#define LITTLE_ENDIAN 1 8#define LITTLE_ENDIAN 1
10#define BIG_ENDIAN 0 9#define BIG_ENDIAN 0
11#endif 10#endif
12#define _LOW_ACCURACY_ 11
12
13// #define _LOW_ACCURACY_
diff --git a/apps/codecs/Tremor/floor1.c b/apps/codecs/Tremor/floor1.c
index 9bfec7e803..7f54aa76ea 100644
--- a/apps/codecs/Tremor/floor1.c
+++ b/apps/codecs/Tremor/floor1.c
@@ -124,7 +124,7 @@ static int icomp(const void *a,const void *b){
124static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,vorbis_info_mode *mi, 124static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,vorbis_info_mode *mi,
125 vorbis_info_floor *in){ 125 vorbis_info_floor *in){
126 126
127 int *sortpointer[VIF_POSIT+2]; 127 static int *sortpointer[VIF_POSIT+2] IDATA_ATTR;
128 vorbis_info_floor1 *info=(vorbis_info_floor1 *)in; 128 vorbis_info_floor1 *info=(vorbis_info_floor1 *)in;
129 vorbis_look_floor1 *look=(vorbis_look_floor1 *)_ogg_calloc(1,sizeof(*look)); 129 vorbis_look_floor1 *look=(vorbis_look_floor1 *)_ogg_calloc(1,sizeof(*look));
130 int i,j,n=0; 130 int i,j,n=0;
@@ -216,7 +216,7 @@ static int render_point(int x0,int x1,int y0,int y1,int x){
216# define XdB(n) (n) 216# define XdB(n) (n)
217#endif 217#endif
218 218
219static const ogg_int32_t FLOOR_fromdB_LOOKUP[256]={ 219static ogg_int32_t FLOOR_fromdB_LOOKUP[256] IDATA_ATTR ={
220 XdB(0x000000e5), XdB(0x000000f4), XdB(0x00000103), XdB(0x00000114), 220 XdB(0x000000e5), XdB(0x000000f4), XdB(0x00000103), XdB(0x00000114),
221 XdB(0x00000126), XdB(0x00000139), XdB(0x0000014e), XdB(0x00000163), 221 XdB(0x00000126), XdB(0x00000139), XdB(0x0000014e), XdB(0x00000163),
222 XdB(0x0000017a), XdB(0x00000193), XdB(0x000001ad), XdB(0x000001c9), 222 XdB(0x0000017a), XdB(0x00000193), XdB(0x000001ad), XdB(0x000001c9),
@@ -283,14 +283,14 @@ static const ogg_int32_t FLOOR_fromdB_LOOKUP[256]={
283 XdB(0x69f80e9a), XdB(0x70dafda8), XdB(0x78307d76), XdB(0x7fffffff), 283 XdB(0x69f80e9a), XdB(0x70dafda8), XdB(0x78307d76), XdB(0x7fffffff),
284}; 284};
285 285
286static void render_line(int x0,int x1,int y0,int y1,ogg_int32_t *d){ 286static void render_line(int x0,register int x1,int y0,int y1,ogg_int32_t *d){
287 int dy=y1-y0; 287 int dy=y1-y0;
288 int adx=x1-x0; 288 register int x=x0;
289 int ady=abs(dy); 289 register int y=y0;
290 int base=dy/adx; 290 register int adx=x1-x0;
291 int sy=(dy<0?base-1:base+1); 291 register int ady=abs(dy);
292 int x=x0; 292 register int base=dy/adx;
293 int y=y0; 293 register int sy=(dy<0?base-1:base+1);
294 int err=0; 294 int err=0;
295 295
296 ady-=abs(base*adx); 296 ady-=abs(base*adx);
@@ -433,7 +433,7 @@ static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo,
433} 433}
434 434
435/* export hooks */ 435/* export hooks */
436vorbis_func_floor floor1_exportbundle={ 436vorbis_func_floor floor1_exportbundle = {
437 &floor1_unpack,&floor1_look,&floor1_free_info, 437 &floor1_unpack,&floor1_look,&floor1_free_info,
438 &floor1_free_look,&floor1_inverse1,&floor1_inverse2 438 &floor1_free_look,&floor1_inverse1,&floor1_inverse2
439}; 439};
diff --git a/apps/codecs/Tremor/framing.c b/apps/codecs/Tremor/framing.c
index 419c7dc8a3..9133333bda 100644
--- a/apps/codecs/Tremor/framing.c
+++ b/apps/codecs/Tremor/framing.c
@@ -501,7 +501,7 @@ int ogg_page_packets(ogg_page *og){
501/* Static CRC calculation table. See older code in CVS for dead 501/* Static CRC calculation table. See older code in CVS for dead
502 run-time initialization code. */ 502 run-time initialization code. */
503 503
504static ogg_uint32_t crc_lookup[256]={ 504static ogg_uint32_t crc_lookup[256] IDATA_ATTR = {
505 0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9, 505 0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9,
506 0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005, 506 0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005,
507 0x2608edb8,0x22c9f00f,0x2f8ad6d6,0x2b4bcb61, 507 0x2608edb8,0x22c9f00f,0x2f8ad6d6,0x2b4bcb61,
diff --git a/apps/codecs/Tremor/lsp_lookup.h b/apps/codecs/Tremor/lsp_lookup.h
index fa84851887..cced7c9282 100644
--- a/apps/codecs/Tremor/lsp_lookup.h
+++ b/apps/codecs/Tremor/lsp_lookup.h
@@ -26,7 +26,7 @@
26#define FROMdB2_SHIFT 3 26#define FROMdB2_SHIFT 3
27#define FROMdB2_MASK 31 27#define FROMdB2_MASK 31
28 28
29static const ogg_int32_t FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={ 29static const ogg_int32_t FROMdB_LOOKUP[FROMdB_LOOKUP_SZ] ={
30 0x003fffff, 0x0028619b, 0x00197a96, 0x0010137a, 30 0x003fffff, 0x0028619b, 0x00197a96, 0x0010137a,
31 0x000a24b0, 0x00066666, 0x000409c3, 0x00028c42, 31 0x000a24b0, 0x00066666, 0x000409c3, 0x00028c42,
32 0x00019b8c, 0x000103ab, 0x0000a3d7, 0x00006760, 32 0x00019b8c, 0x000103ab, 0x0000a3d7, 0x00006760,
@@ -37,7 +37,7 @@ static const ogg_int32_t FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={
37 0x0000000b, 0x00000007, 0x00000004, 0x00000003, 37 0x0000000b, 0x00000007, 0x00000004, 0x00000003,
38 0x00000002, 0x00000001, 0x00000001}; 38 0x00000002, 0x00000001, 0x00000001};
39 39
40static const ogg_int32_t FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={ 40static const ogg_int32_t FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ] ={
41 0x000001fc, 0x000001f5, 0x000001ee, 0x000001e7, 41 0x000001fc, 0x000001f5, 0x000001ee, 0x000001e7,
42 0x000001e0, 0x000001d9, 0x000001d2, 0x000001cc, 42 0x000001e0, 0x000001d9, 0x000001d2, 0x000001cc,
43 0x000001c5, 0x000001bf, 0x000001b8, 0x000001b2, 43 0x000001c5, 0x000001bf, 0x000001b8, 0x000001b2,
@@ -50,7 +50,7 @@ static const ogg_int32_t FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={
50 50
51#define INVSQ_LOOKUP_I_SHIFT 10 51#define INVSQ_LOOKUP_I_SHIFT 10
52#define INVSQ_LOOKUP_I_MASK 1023 52#define INVSQ_LOOKUP_I_MASK 1023
53static const long INVSQ_LOOKUP_I[64+1]={ 53static const long INVSQ_LOOKUP_I[64+1] ={
54 92682, 91966, 91267, 90583, 54 92682, 91966, 91267, 90583,
55 89915, 89261, 88621, 87995, 55 89915, 89261, 88621, 87995,
56 87381, 86781, 86192, 85616, 56 87381, 86781, 86192, 85616,
@@ -70,7 +70,7 @@ static const long INVSQ_LOOKUP_I[64+1]={
70 65536, 70 65536,
71}; 71};
72 72
73static const long INVSQ_LOOKUP_IDel[64]={ 73static const long INVSQ_LOOKUP_IDel[64] ={
74 716, 699, 684, 668, 74 716, 699, 684, 668,
75 654, 640, 626, 614, 75 654, 640, 626, 614,
76 600, 589, 576, 565, 76 600, 589, 576, 565,
@@ -92,7 +92,7 @@ static const long INVSQ_LOOKUP_IDel[64]={
92#define COS_LOOKUP_I_SHIFT 9 92#define COS_LOOKUP_I_SHIFT 9
93#define COS_LOOKUP_I_MASK 511 93#define COS_LOOKUP_I_MASK 511
94#define COS_LOOKUP_I_SZ 128 94#define COS_LOOKUP_I_SZ 128
95static const ogg_int32_t COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={ 95static const ogg_int32_t COS_LOOKUP_I[COS_LOOKUP_I_SZ+1] ={
96 16384, 16379, 16364, 16340, 96 16384, 16379, 16364, 16340,
97 16305, 16261, 16207, 16143, 97 16305, 16261, 16207, 16143,
98 16069, 15986, 15893, 15791, 98 16069, 15986, 15893, 15791,
diff --git a/apps/codecs/Tremor/mapping0.c b/apps/codecs/Tremor/mapping0.c
index d4ab3a6a29..26d6289d4e 100644
--- a/apps/codecs/Tremor/mapping0.c
+++ b/apps/codecs/Tremor/mapping0.c
@@ -28,6 +28,8 @@
28#include "registry.h" 28#include "registry.h"
29#include "misc.h" 29#include "misc.h"
30 30
31
32
31/* simplistic, wasteful way of doing this (unique lookup for each 33/* simplistic, wasteful way of doing this (unique lookup for each
32 mode/submapping); there should be a central repository for 34 mode/submapping); there should be a central repository for
33 identical lookups. That will require minor work, so I'm putting it 35 identical lookups. That will require minor work, so I'm putting it
@@ -124,6 +126,7 @@ static int ilog(unsigned int v){
124 return(ret); 126 return(ret);
125} 127}
126 128
129
127/* also responsible for range checking */ 130/* also responsible for range checking */
128static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){ 131static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){
129 int i; 132 int i;
@@ -176,7 +179,17 @@ static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb)
176 return(NULL); 179 return(NULL);
177} 180}
178 181
179static int seq=0; 182
183/* IRAM buffer keep the pcm data; only for windows size upto 2048
184 for space restrictions. No real compromise, larger window sizes
185 are only used for very low quality settings (q<0?) */
186#define IRAM_PCM_SIZE 2048
187static ogg_int32_t pcm_iram[IRAM_PCM_SIZE] IDATA_ATTR;
188
189static int seq = 0;
190
191#define CHANNELS 2 /* max 2 channels on the ihp-1xx (stereo) */
192
180static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){ 193static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
181 vorbis_dsp_state *vd=vb->vd; 194 vorbis_dsp_state *vd=vb->vd;
182 vorbis_info *vi=vd->vi; 195 vorbis_info *vi=vd->vi;
@@ -188,12 +201,16 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
188 int i,j; 201 int i,j;
189 long n=vb->pcmend=ci->blocksizes[vb->W]; 202 long n=vb->pcmend=ci->blocksizes[vb->W];
190 203
191 ogg_int32_t **pcmbundle=(ogg_int32_t **)alloca(sizeof(*pcmbundle)*vi->channels); 204 /* statically allocate mapping structures in IRAM */
192 int *zerobundle=(int *)alloca(sizeof(*zerobundle)*vi->channels); 205 static ogg_int32_t *pcmbundle[CHANNELS] IDATA_ATTR;
193 206 static int zerobundle[CHANNELS] IDATA_ATTR;
194 int *nonzero =(int *)alloca(sizeof(*nonzero)*vi->channels); 207 static int nonzero[CHANNELS] IDATA_ATTR;
195 void **floormemo=(void **)alloca(sizeof(*floormemo)*vi->channels); 208 static void *floormemo[CHANNELS] IDATA_ATTR;
196 209
210 /* test for too many channels;
211 (maybe this is can be checked at the stream level?) */
212 if (vi->channels > CHANNELS) return (-1);
213
197 /* time domain information decode (note that applying the 214 /* time domain information decode (note that applying the
198 information would have to happen later; we'll probably add a 215 information would have to happen later; we'll probably add a
199 function entry to the harness for that later */ 216 function entry to the harness for that later */
@@ -272,38 +289,64 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
272 //for(j=0;j<vi->channels;j++) 289 //for(j=0;j<vi->channels;j++)
273 //_analysis_output("residue",seq+j,vb->pcm[j],-8,n/2,0,0); 290 //_analysis_output("residue",seq+j,vb->pcm[j],-8,n/2,0,0);
274 291
292
293/* pbv: removed this loop by fusion with the following one
294 to avoid recopying data to/from the IRAM */
295#if 0
275 /* compute and apply spectral envelope */ 296 /* compute and apply spectral envelope */
276 for(i=0;i<vi->channels;i++){ 297 for(i=0;i<vi->channels;i++){
277 ogg_int32_t *pcm=vb->pcm[i]; 298 ogg_int32_t *pcm=vb->pcm[i];
278 int submap=info->chmuxlist[i]; 299 int submap=info->chmuxlist[i];
279 look->floor_func[submap]-> 300 look->floor_func[submap]->
280 inverse2(vb,look->floor_look[submap],floormemo[i],pcm); 301 inverse2(vb,look->floor_look[submap],floormemo[i],pcm);
281 } 302 }
303#endif
282 304
283 //for(j=0;j<vi->channels;j++) 305 //for(j=0;j<vi->channels;j++)
284 //_analysis_output("mdct",seq+j,vb->pcm[j],-24,n/2,0,1); 306 //_analysis_output("mdct",seq+j,vb->pcm[j],-24,n/2,0,1);
285 307
286 /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */ 308 /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
287 /* only MDCT right now.... */ 309 /* only MDCT right now.... */
288 for(i=0;i<vi->channels;i++){ 310
289 ogg_int32_t *pcm=vb->pcm[i]; 311 /* check if we can do this in IRAM */
290 mdct_backward(n,pcm,pcm); 312 if(n <= IRAM_PCM_SIZE) { /* normal window size: yes */
313 for(i=0;i<vi->channels;i++){
314 ogg_int32_t *pcm=vb->pcm[i];
315 int submap=info->chmuxlist[i];
316
317 if(nonzero[i]) {
318 memcpy(pcm_iram, pcm, sizeof(ogg_int32_t)*n);
319 look->floor_func[submap]->
320 inverse2(vb,look->floor_look[submap],floormemo[i],pcm_iram);
321 mdct_backward(n, pcm_iram, pcm_iram);
322 /* window the data */
323 _vorbis_apply_window(pcm_iram,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
324 memcpy(pcm, pcm_iram, sizeof(ogg_int32_t)*n);
325 }
326 else
327 memset(pcm, 0, sizeof(ogg_int32_t)*n);
328 }
329 }
330 else { /* large window: no, do it in the normal memory */
331 for(i=0;i<vi->channels;i++){
332 ogg_int32_t *pcm=vb->pcm[i];
333 int submap=info->chmuxlist[i];
334
335 look->floor_func[submap]->
336 inverse2(vb,look->floor_look[submap],floormemo[i],pcm);
337 if(nonzero[i]) {
338 mdct_backward(n, pcm, pcm);
339 /* window the data */
340 _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
341 }
342 else
343 memset(pcm, 0, sizeof(ogg_int32_t)*n);
344 }
291 } 345 }
292 346
293 //for(j=0;j<vi->channels;j++) 347 //for(j=0;j<vi->channels;j++)
294 //_analysis_output("imdct",seq+j,vb->pcm[j],-24,n,0,0); 348 //_analysis_output("imdct",seq+j,vb->pcm[j],-24,n,0,0);
295 349
296 /* window the data */
297 for(i=0;i<vi->channels;i++){
298 ogg_int32_t *pcm=vb->pcm[i];
299 if(nonzero[i])
300 _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
301 else
302 for(j=0;j<n;j++)
303 pcm[j]=0;
304
305 }
306
307 //for(j=0;j<vi->channels;j++) 350 //for(j=0;j<vi->channels;j++)
308 //_analysis_output("window",seq+j,vb->pcm[j],-24,n,0,0); 351 //_analysis_output("window",seq+j,vb->pcm[j],-24,n,0,0);
309 352
@@ -313,10 +356,11 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
313} 356}
314 357
315/* export hooks */ 358/* export hooks */
316vorbis_func_mapping mapping0_exportbundle={ 359vorbis_func_mapping mapping0_exportbundle ={
317 &mapping0_unpack, 360 &mapping0_unpack,
318 &mapping0_look, 361 &mapping0_look,
319 &mapping0_free_info, 362 &mapping0_free_info,
320 &mapping0_free_look, 363 &mapping0_free_look,
321 &mapping0_inverse 364 &mapping0_inverse
322}; 365};
366
diff --git a/apps/codecs/Tremor/mdct.c b/apps/codecs/Tremor/mdct.c
index cc201b2106..2d2564f196 100644
--- a/apps/codecs/Tremor/mdct.c
+++ b/apps/codecs/Tremor/mdct.c
@@ -94,7 +94,7 @@ STIN void mdct_butterfly_16(DATA_TYPE *x){
94} 94}
95 95
96/* 32 point butterfly (in place, 4 register) */ 96/* 32 point butterfly (in place, 4 register) */
97STIN void mdct_butterfly_32(DATA_TYPE *x){ 97STIN void mdct_butterfly_32(DATA_TYPE *x){
98 98
99 REG_TYPE r0, r1; 99 REG_TYPE r0, r1;
100 100
@@ -152,7 +152,7 @@ STIN void mdct_butterfly_generic(DATA_TYPE *x,int points,int step){
152 DATA_TYPE *x2 = x + (points>>1) - 8; 152 DATA_TYPE *x2 = x + (points>>1) - 8;
153 REG_TYPE r0; 153 REG_TYPE r0;
154 REG_TYPE r1; 154 REG_TYPE r1;
155 155
156 do{ 156 do{
157 r0 = x1[6] - x2[6]; x1[6] += x2[6]; 157 r0 = x1[6] - x2[6]; x1[6] += x2[6];
158 r1 = x2[7] - x1[7]; x1[7] += x2[7]; 158 r1 = x2[7] - x1[7]; x1[7] += x2[7];
@@ -180,7 +180,7 @@ STIN void mdct_butterfly_generic(DATA_TYPE *x,int points,int step){
180 r0 = x1[4] - x2[4]; x1[4] += x2[4]; 180 r0 = x1[4] - x2[4]; x1[4] += x2[4];
181 r1 = x1[5] - x2[5]; x1[5] += x2[5]; 181 r1 = x1[5] - x2[5]; x1[5] += x2[5];
182 XNPROD31( r0, r1, T[0], T[1], &x2[4], &x2[5] ); T-=step; 182 XNPROD31( r0, r1, T[0], T[1], &x2[4], &x2[5] ); T-=step;
183 183
184 r0 = x1[2] - x2[2]; x1[2] += x2[2]; 184 r0 = x1[2] - x2[2]; x1[2] += x2[2];
185 r1 = x1[3] - x2[3]; x1[3] += x2[3]; 185 r1 = x1[3] - x2[3]; x1[3] += x2[3];
186 XNPROD31( r0, r1, T[0], T[1], &x2[2], &x2[3] ); T-=step; 186 XNPROD31( r0, r1, T[0], T[1], &x2[2], &x2[3] ); T-=step;
@@ -231,7 +231,7 @@ STIN void mdct_butterfly_generic(DATA_TYPE *x,int points,int step){
231 }while(T>sincos_lookup0); 231 }while(T>sincos_lookup0);
232} 232}
233 233
234STIN void mdct_butterflies(DATA_TYPE *x,int points,int shift){ 234STIN void mdct_butterflies(DATA_TYPE *x,int points,int shift) {
235 235
236 int stages=8-shift; 236 int stages=8-shift;
237 int i,j; 237 int i,j;
@@ -243,33 +243,34 @@ STIN void mdct_butterflies(DATA_TYPE *x,int points,int shift){
243 243
244 for(j=0;j<points;j+=32) 244 for(j=0;j<points;j+=32)
245 mdct_butterfly_32(x+j); 245 mdct_butterfly_32(x+j);
246
247} 246}
248 247
249static unsigned char bitrev[16]={0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15}; 248
249static const unsigned char bitrev[16]
250 IDATA_ATTR = {0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15};
250 251
251STIN int bitrev12(int x){ 252STIN int bitrev12(int x){
252 return bitrev[x>>8]|(bitrev[(x&0x0f0)>>4]<<4)|(((int)bitrev[x&0x00f])<<8); 253 return bitrev[x>>8]|(bitrev[(x&0x0f0)>>4]<<4)|(((int)bitrev[x&0x00f])<<8);
253} 254}
254 255
255STIN void mdct_bitreverse(DATA_TYPE *x,int n,int step,int shift){ 256STIN void mdct_bitreverse(DATA_TYPE *x,int n,int step,int shift) {
256 257
257 int bit = 0; 258 int bit = 0;
258 DATA_TYPE *w0 = x; 259 DATA_TYPE *w0 = x;
259 DATA_TYPE *w1 = x = w0+(n>>1); 260 DATA_TYPE *w1 = x = w0+(n>>1);
260 LOOKUP_T *T = (step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1; 261 LOOKUP_T *T = (step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
261 LOOKUP_T *Ttop = T+1024; 262 LOOKUP_T *Ttop = T+1024;
262 DATA_TYPE r2; 263 REG_TYPE r2;
263 264
264 do{ 265 do{
265 DATA_TYPE r3 = bitrev12(bit++); 266 REG_TYPE r3 = bitrev12(bit++);
266 DATA_TYPE *x0 = x + ((r3 ^ 0xfff)>>shift) -1; 267 DATA_TYPE *x0 = x + ((r3 ^ 0xfff)>>shift) -1;
267 DATA_TYPE *x1 = x + (r3>>shift); 268 DATA_TYPE *x1 = x + (r3>>shift);
268 269
269 REG_TYPE r0 = x0[0] + x1[0]; 270 REG_TYPE r0 = x0[0] + x1[0];
270 REG_TYPE r1 = x1[1] - x0[1]; 271 REG_TYPE r1 = x1[1] - x0[1];
271 272
272 XPROD32( r0, r1, T[1], T[0], &r2, &r3 ); T+=step; 273 XPROD32( r0, r1, T[1], T[0], r2, r3 ); T+=step;
273 274
274 w1 -= 4; 275 w1 -= 4;
275 276
@@ -287,7 +288,7 @@ STIN void mdct_bitreverse(DATA_TYPE *x,int n,int step,int shift){
287 r0 = x0[0] + x1[0]; 288 r0 = x0[0] + x1[0];
288 r1 = x1[1] - x0[1]; 289 r1 = x1[1] - x0[1];
289 290
290 XPROD32( r0, r1, T[1], T[0], &r2, &r3 ); T+=step; 291 XPROD32( r0, r1, T[1], T[0], r2, r3 ); T+=step;
291 292
292 r0 = (x0[1] + x1[1])>>1; 293 r0 = (x0[1] + x1[1])>>1;
293 r1 = (x0[0] - x1[0])>>1; 294 r1 = (x0[0] - x1[0])>>1;
@@ -299,14 +300,14 @@ STIN void mdct_bitreverse(DATA_TYPE *x,int n,int step,int shift){
299 w0 += 4; 300 w0 += 4;
300 }while(T<Ttop); 301 }while(T<Ttop);
301 do{ 302 do{
302 DATA_TYPE r3 = bitrev12(bit++); 303 REG_TYPE r3 = bitrev12(bit++);
303 DATA_TYPE *x0 = x + ((r3 ^ 0xfff)>>shift) -1; 304 DATA_TYPE *x0 = x + ((r3 ^ 0xfff)>>shift) -1;
304 DATA_TYPE *x1 = x + (r3>>shift); 305 DATA_TYPE *x1 = x + (r3>>shift);
305 306
306 REG_TYPE r0 = x0[0] + x1[0]; 307 REG_TYPE r0 = x0[0] + x1[0];
307 REG_TYPE r1 = x1[1] - x0[1]; 308 REG_TYPE r1 = x1[1] - x0[1];
308 309
309 T-=step; XPROD32( r0, r1, T[0], T[1], &r2, &r3 ); 310 T-=step; XPROD32( r0, r1, T[0], T[1], r2, r3 );
310 311
311 w1 -= 4; 312 w1 -= 4;
312 313
@@ -324,7 +325,7 @@ STIN void mdct_bitreverse(DATA_TYPE *x,int n,int step,int shift){
324 r0 = x0[0] + x1[0]; 325 r0 = x0[0] + x1[0];
325 r1 = x1[1] - x0[1]; 326 r1 = x1[1] - x0[1];
326 327
327 T-=step; XPROD32( r0, r1, T[0], T[1], &r2, &r3 ); 328 T-=step; XPROD32( r0, r1, T[0], T[1], r2, r3 );
328 329
329 r0 = (x0[1] + x1[1])>>1; 330 r0 = (x0[1] + x1[1])>>1;
330 r1 = (x0[0] - x1[0])>>1; 331 r1 = (x0[0] - x1[0])>>1;
@@ -337,7 +338,8 @@ STIN void mdct_bitreverse(DATA_TYPE *x,int n,int step,int shift){
337 }while(w0<w1); 338 }while(w0<w1);
338} 339}
339 340
340void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out){ 341
342void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out) {
341 int n2=n>>1; 343 int n2=n>>1;
342 int n4=n>>2; 344 int n4=n>>2;
343 DATA_TYPE *iX; 345 DATA_TYPE *iX;
@@ -347,6 +349,10 @@ void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out){
347 int shift; 349 int shift;
348 int step; 350 int step;
349 351
352#if CONFIG_CPU == MCF5249
353 mcf5249_init_mac(); /* should be redundant */
354#endif
355
350 for (shift=6;!(n&(1<<shift));shift++); 356 for (shift=6;!(n&(1<<shift));shift++);
351 shift=13-shift; 357 shift=13-shift;
352 step=2<<shift; 358 step=2<<shift;
@@ -389,7 +395,6 @@ void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out){
389 395
390 mdct_butterflies(out+n2,n2,shift); 396 mdct_butterflies(out+n2,n2,shift);
391 mdct_bitreverse(out,n,step,shift); 397 mdct_bitreverse(out,n,step,shift);
392
393 /* rotate + window */ 398 /* rotate + window */
394 399
395 step>>=2; 400 step>>=2;
@@ -507,4 +512,3 @@ void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out){
507 }while(oX1>oX2); 512 }while(oX1>oX2);
508 } 513 }
509} 514}
510
diff --git a/apps/codecs/Tremor/mdct.h b/apps/codecs/Tremor/mdct.h
index 6d8890720c..bdfe0e7304 100644
--- a/apps/codecs/Tremor/mdct.h
+++ b/apps/codecs/Tremor/mdct.h
@@ -34,8 +34,10 @@
34#define cPI1_8 (0x7641af3d) 34#define cPI1_8 (0x7641af3d)
35#endif 35#endif
36 36
37extern void mdct_forward(int n, DATA_TYPE *in, DATA_TYPE *out); 37//extern void mdct_forward(int n, DATA_TYPE *in, DATA_TYPE *out);
38extern void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out); 38extern void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out);
39//extern void mdct_bitreverse(DATA_TYPE *x,int n,int step,int shift);
40//extern void mdct_butterflies(DATA_TYPE *x,int points,int shift);
39 41
40#endif 42#endif
41 43
diff --git a/apps/codecs/Tremor/mdct_lookup.h b/apps/codecs/Tremor/mdct_lookup.h
index 970e199f7f..8a88997376 100644
--- a/apps/codecs/Tremor/mdct_lookup.h
+++ b/apps/codecs/Tremor/mdct_lookup.h
@@ -17,8 +17,10 @@
17 17
18#include "os_types.h" 18#include "os_types.h"
19 19
20/* keep lookup tables in fast IRAM */
21
20/* {sin(2*i*PI/4096), cos(2*i*PI/4096)}, with i = 0 to 512 */ 22/* {sin(2*i*PI/4096), cos(2*i*PI/4096)}, with i = 0 to 512 */
21static LOOKUP_T sincos_lookup0[1026] = { 23static LOOKUP_T sincos_lookup0[1026] IDATA_ATTR = {
22 X(0x00000000), X(0x7fffffff), X(0x003243f5), X(0x7ffff621), 24 X(0x00000000), X(0x7fffffff), X(0x003243f5), X(0x7ffff621),
23 X(0x006487e3), X(0x7fffd886), X(0x0096cbc1), X(0x7fffa72c), 25 X(0x006487e3), X(0x7fffd886), X(0x0096cbc1), X(0x7fffa72c),
24 X(0x00c90f88), X(0x7fff6216), X(0x00fb5330), X(0x7fff0943), 26 X(0x00c90f88), X(0x7fff6216), X(0x00fb5330), X(0x7fff0943),
@@ -279,7 +281,7 @@ static LOOKUP_T sincos_lookup0[1026] = {
279 }; 281 };
280 282
281 /* {sin((2*i+1)*PI/4096), cos((2*i+1)*PI/4096)}, with i = 0 to 511 */ 283 /* {sin((2*i+1)*PI/4096), cos((2*i+1)*PI/4096)}, with i = 0 to 511 */
282static LOOKUP_T sincos_lookup1[1024] = { 284static LOOKUP_T sincos_lookup1[1024] IDATA_ATTR = {
283 X(0x001921fb), X(0x7ffffd88), X(0x004b65ee), X(0x7fffe9cb), 285 X(0x001921fb), X(0x7ffffd88), X(0x004b65ee), X(0x7fffe9cb),
284 X(0x007da9d4), X(0x7fffc251), X(0x00afeda8), X(0x7fff8719), 286 X(0x007da9d4), X(0x7fffc251), X(0x00afeda8), X(0x7fff8719),
285 X(0x00e23160), X(0x7fff3824), X(0x011474f6), X(0x7ffed572), 287 X(0x00e23160), X(0x7fff3824), X(0x011474f6), X(0x7ffed572),
diff --git a/apps/codecs/Tremor/misc.h b/apps/codecs/Tremor/misc.h
index ed7617d0e0..dc2dccf116 100644
--- a/apps/codecs/Tremor/misc.h
+++ b/apps/codecs/Tremor/misc.h
@@ -23,6 +23,7 @@
23#include "os_types.h" 23#include "os_types.h"
24 24
25#include "asm_arm.h" 25#include "asm_arm.h"
26#include "asm_mcf5249.h"
26 27
27 28
28/* Some prototypes that were not defined elsewhere */ 29/* Some prototypes that were not defined elsewhere */
@@ -36,7 +37,6 @@ void* alloca(size_t size);
36 37
37#ifndef _LOW_ACCURACY_ 38#ifndef _LOW_ACCURACY_
38/* 64 bit multiply */ 39/* 64 bit multiply */
39
40//#include <sys/types.h> 40//#include <sys/types.h>
41 41
42#if BYTE_ORDER==LITTLE_ENDIAN 42#if BYTE_ORDER==LITTLE_ENDIAN
@@ -47,9 +47,7 @@ union magic {
47 } halves; 47 } halves;
48 ogg_int64_t whole; 48 ogg_int64_t whole;
49}; 49};
50#endif 50#elif BYTE_ORDER==BIG_ENDIAN
51
52#if BYTE_ORDER==BIG_ENDIAN
53union magic { 51union magic {
54 struct { 52 struct {
55 ogg_int32_t hi; 53 ogg_int32_t hi;
@@ -64,7 +62,6 @@ static inline ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
64 magic.whole = (ogg_int64_t)x * y; 62 magic.whole = (ogg_int64_t)x * y;
65 return magic.halves.hi; 63 return magic.halves.hi;
66} 64}
67
68static inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) { 65static inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
69 return MULT32(x,y)<<1; 66 return MULT32(x,y)<<1;
70} 67}
@@ -102,7 +99,6 @@ static inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
102static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) { 99static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
103 return (x >> 6) * y; /* y preshifted >>9 */ 100 return (x >> 6) * y; /* y preshifted >>9 */
104} 101}
105
106#endif 102#endif
107 103
108/* 104/*
@@ -122,11 +118,15 @@ static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
122 * macros. 118 * macros.
123 */ 119 */
124 120
121/* replaced XPROD32 with a macro to avoid memory reference
122 _x, _y are the results (must be l-values) */
123#define XPROD32(_a, _b, _t, _v, _x, _y) \
124 { (_x)=MULT32(_a,_t)+MULT32(_b,_v); \
125 (_y)=MULT32(_b,_t)-MULT32(_a,_v); }
126
127
125#ifdef __i386__ 128#ifdef __i386__
126 129
127#define XPROD32(_a, _b, _t, _v, _x, _y) \
128 { *(_x)=MULT32(_a,_t)+MULT32(_b,_v); \
129 *(_y)=MULT32(_b,_t)-MULT32(_a,_v); }
130#define XPROD31(_a, _b, _t, _v, _x, _y) \ 130#define XPROD31(_a, _b, _t, _v, _x, _y) \
131 { *(_x)=MULT31(_a,_t)+MULT31(_b,_v); \ 131 { *(_x)=MULT31(_a,_t)+MULT31(_b,_v); \
132 *(_y)=MULT31(_b,_t)-MULT31(_a,_v); } 132 *(_y)=MULT31(_b,_t)-MULT31(_a,_v); }
@@ -136,14 +136,6 @@ static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
136 136
137#else 137#else
138 138
139static inline void XPROD32(ogg_int32_t a, ogg_int32_t b,
140 ogg_int32_t t, ogg_int32_t v,
141 ogg_int32_t *x, ogg_int32_t *y)
142{
143 *x = MULT32(a, t) + MULT32(b, v);
144 *y = MULT32(b, t) - MULT32(a, v);
145}
146
147static inline void XPROD31(ogg_int32_t a, ogg_int32_t b, 139static inline void XPROD31(ogg_int32_t a, ogg_int32_t b,
148 ogg_int32_t t, ogg_int32_t v, 140 ogg_int32_t t, ogg_int32_t v,
149 ogg_int32_t *x, ogg_int32_t *y) 141 ogg_int32_t *x, ogg_int32_t *y)
@@ -159,9 +151,7 @@ static inline void XNPROD31(ogg_int32_t a, ogg_int32_t b,
159 *x = MULT31(a, t) - MULT31(b, v); 151 *x = MULT31(a, t) - MULT31(b, v);
160 *y = MULT31(b, t) + MULT31(a, v); 152 *y = MULT31(b, t) + MULT31(a, v);
161} 153}
162
163#endif 154#endif
164
165#endif 155#endif
166 156
167#ifndef _V_CLIP_MATH 157#ifndef _V_CLIP_MATH
@@ -245,4 +235,3 @@ static inline ogg_int32_t VFLOAT_ADD(ogg_int32_t a,ogg_int32_t ap,
245 235
246 236
247 237
248
diff --git a/apps/codecs/Tremor/os.h b/apps/codecs/Tremor/os.h
index 65a4992ffc..bb4b867e3d 100644
--- a/apps/codecs/Tremor/os.h
+++ b/apps/codecs/Tremor/os.h
@@ -24,12 +24,12 @@
24# define _V_IFDEFJAIL_H_ 24# define _V_IFDEFJAIL_H_
25 25
26# ifdef __GNUC__ 26# ifdef __GNUC__
27# define STIN static __inline__ 27# define STIN static inline
28# elif _WIN32 28# elif _WIN32
29# define STIN static __inline 29# define STIN static __inline__
30# endif 30# endif
31#else 31#else
32# define STIN static 32# define STIN static inline
33#endif 33#endif
34 34
35#ifndef M_PI 35#ifndef M_PI
diff --git a/apps/codecs/Tremor/os_types.h b/apps/codecs/Tremor/os_types.h
index fe0331770f..1e0cb1332f 100644
--- a/apps/codecs/Tremor/os_types.h
+++ b/apps/codecs/Tremor/os_types.h
@@ -21,7 +21,7 @@
21 21
22#ifdef _LOW_ACCURACY_ 22#ifdef _LOW_ACCURACY_
23# define X(n) (((((n)>>22)+1)>>1) - ((((n)>>22)+1)>>9)) 23# define X(n) (((((n)>>22)+1)>>1) - ((((n)>>22)+1)>>9))
24# define LOOKUP_T const unsigned char 24# define LOOKUP_T const unsigned char
25#else 25#else
26# define X(n) (n) 26# define X(n) (n)
27# define LOOKUP_T const ogg_int32_t 27# define LOOKUP_T const ogg_int32_t
diff --git a/apps/codecs/Tremor/registry.c b/apps/codecs/Tremor/registry.c
index c0b5fec0cc..0882309b32 100644
--- a/apps/codecs/Tremor/registry.c
+++ b/apps/codecs/Tremor/registry.c
@@ -31,18 +31,18 @@ extern vorbis_func_residue residue1_exportbundle;
31extern vorbis_func_residue residue2_exportbundle; 31extern vorbis_func_residue residue2_exportbundle;
32extern vorbis_func_mapping mapping0_exportbundle; 32extern vorbis_func_mapping mapping0_exportbundle;
33 33
34vorbis_func_floor *_floor_P[]={ 34vorbis_func_floor *_floor_P[] = {
35 &floor0_exportbundle, 35 &floor0_exportbundle,
36 &floor1_exportbundle, 36 &floor1_exportbundle,
37}; 37};
38 38
39vorbis_func_residue *_residue_P[]={ 39vorbis_func_residue *_residue_P[] = {
40 &residue0_exportbundle, 40 &residue0_exportbundle,
41 &residue1_exportbundle, 41 &residue1_exportbundle,
42 &residue2_exportbundle, 42 &residue2_exportbundle,
43}; 43};
44 44
45vorbis_func_mapping *_mapping_P[]={ 45vorbis_func_mapping *_mapping_P[] = {
46 &mapping0_exportbundle, 46 &mapping0_exportbundle,
47}; 47};
48 48
diff --git a/apps/codecs/Tremor/res012.c b/apps/codecs/Tremor/res012.c
index 1ead185d8f..3d69cee73b 100644
--- a/apps/codecs/Tremor/res012.c
+++ b/apps/codecs/Tremor/res012.c
@@ -309,7 +309,7 @@ int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
309} 309}
310 310
311 311
312vorbis_func_residue residue0_exportbundle={ 312const vorbis_func_residue residue0_exportbundle ={
313 &res0_unpack, 313 &res0_unpack,
314 &res0_look, 314 &res0_look,
315 &res0_free_info, 315 &res0_free_info,
@@ -317,7 +317,7 @@ vorbis_func_residue residue0_exportbundle={
317 &res0_inverse 317 &res0_inverse
318}; 318};
319 319
320vorbis_func_residue residue1_exportbundle={ 320const vorbis_func_residue residue1_exportbundle ={
321 &res0_unpack, 321 &res0_unpack,
322 &res0_look, 322 &res0_look,
323 &res0_free_info, 323 &res0_free_info,
@@ -325,7 +325,7 @@ vorbis_func_residue residue1_exportbundle={
325 &res1_inverse 325 &res1_inverse
326}; 326};
327 327
328vorbis_func_residue residue2_exportbundle={ 328const vorbis_func_residue residue2_exportbundle ={
329 &res0_unpack, 329 &res0_unpack,
330 &res0_look, 330 &res0_look,
331 &res0_free_info, 331 &res0_free_info,
diff --git a/apps/codecs/Tremor/vorbisfile.c b/apps/codecs/Tremor/vorbisfile.c
index d9eeed3945..74bff6a3fb 100644
--- a/apps/codecs/Tremor/vorbisfile.c
+++ b/apps/codecs/Tremor/vorbisfile.c
@@ -669,6 +669,10 @@ static int _ov_open1(void *f,OggVorbis_File *vf,char *initial,
669 int offsettest=(f?callbacks.seek_func(f,0,SEEK_CUR):-1); 669 int offsettest=(f?callbacks.seek_func(f,0,SEEK_CUR):-1);
670 int ret; 670 int ret;
671 671
672#if CONFIG_CPU == MCF5249
673 mcf5249_init_mac(); /* initialize the Coldfire MAC unit */
674#endif
675
672 memset(vf,0,sizeof(*vf)); 676 memset(vf,0,sizeof(*vf));
673 vf->datasource=f; 677 vf->datasource=f;
674 vf->callbacks = callbacks; 678 vf->callbacks = callbacks;
diff --git a/apps/codecs/Tremor/window.c b/apps/codecs/Tremor/window.c
index b50e36f413..b447ce5ad9 100644
--- a/apps/codecs/Tremor/window.c
+++ b/apps/codecs/Tremor/window.c
@@ -56,7 +56,6 @@ const void *_vorbis_window(int type, int left){
56void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2], 56void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2],
57 long *blocksizes, 57 long *blocksizes,
58 int lW,int W,int nW){ 58 int lW,int W,int nW){
59
60 LOOKUP_T *window[2]={window_p[0],window_p[1]}; 59 LOOKUP_T *window[2]={window_p[0],window_p[1]};
61 long n=blocksizes[W]; 60 long n=blocksizes[W];
62 long ln=blocksizes[lW]; 61 long ln=blocksizes[lW];
@@ -67,7 +66,14 @@ void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2],
67 66
68 long rightbegin=n/2+n/4-rn/4; 67 long rightbegin=n/2+n/4-rn/4;
69 long rightend=rightbegin+rn/2; 68 long rightend=rightbegin+rn/2;
70 69
70#if CONFIG_CPU == MCF5249
71 mcf5249_init_mac(); /* shouldn't be needed, but just in case */
72 mcf5249_vect_zero(&d[0], leftbegin);
73 mcf5249_vect_mult_fw(&d[leftbegin], &window[lW][0], leftend-leftbegin);
74 mcf5249_vect_mult_bw(&d[rightbegin], &window[nW][rn/2-1], rightend-rightbegin);
75 mcf5249_vect_zero(&d[rightend], n-rightend);
76#else
71 int i,p; 77 int i,p;
72 78
73 for(i=0;i<leftbegin;i++) 79 for(i=0;i<leftbegin;i++)
@@ -81,4 +87,6 @@ void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2],
81 87
82 for(;i<n;i++) 88 for(;i<n;i++)
83 d[i]=0; 89 d[i]=0;
90#endif
84} 91}
92
diff --git a/apps/codecs/Tremor/window_lookup.h b/apps/codecs/Tremor/window_lookup.h
index b24fc37772..f9452e1b42 100644
--- a/apps/codecs/Tremor/window_lookup.h
+++ b/apps/codecs/Tremor/window_lookup.h
@@ -18,7 +18,8 @@
18 18
19#include "os_types.h" 19#include "os_types.h"
20 20
21static LOOKUP_T vwin64[32] = { 21/* keep small window table in fast IRAM */
22static LOOKUP_T vwin64[32] IDATA_ATTR = {
22 X(0x001f0003), X(0x01168c98), X(0x030333c8), X(0x05dfe3a4), 23 X(0x001f0003), X(0x01168c98), X(0x030333c8), X(0x05dfe3a4),
23 X(0x09a49562), X(0x0e45df18), X(0x13b47ef2), X(0x19dcf676), 24 X(0x09a49562), X(0x0e45df18), X(0x13b47ef2), X(0x19dcf676),
24 X(0x20a74d83), X(0x27f7137c), X(0x2fabb05a), X(0x37a1105a), 25 X(0x20a74d83), X(0x27f7137c), X(0x2fabb05a), X(0x37a1105a),
@@ -29,7 +30,7 @@ static LOOKUP_T vwin64[32] = {
29 X(0x7fdd78a5), X(0x7ff6ec6d), X(0x7ffed0e9), X(0x7ffffc3f), 30 X(0x7fdd78a5), X(0x7ff6ec6d), X(0x7ffed0e9), X(0x7ffffc3f),
30}; 31};
31 32
32static LOOKUP_T vwin128[64] = { 33static LOOKUP_T vwin128[64] IDATA_ATTR = {
33 X(0x0007c04d), X(0x0045bb89), X(0x00c18b87), X(0x017ae294), 34 X(0x0007c04d), X(0x0045bb89), X(0x00c18b87), X(0x017ae294),
34 X(0x02714a4e), X(0x03a4217a), X(0x05129952), X(0x06bbb24f), 35 X(0x02714a4e), X(0x03a4217a), X(0x05129952), X(0x06bbb24f),
35 X(0x089e38a1), X(0x0ab8c073), X(0x0d09a228), X(0x0f8ef6bd), 36 X(0x089e38a1), X(0x0ab8c073), X(0x0d09a228), X(0x0f8ef6bd),
@@ -48,7 +49,7 @@ static LOOKUP_T vwin128[64] = {
48 X(0x7ffdcf39), X(0x7fff6dac), X(0x7fffed01), X(0x7fffffc4), 49 X(0x7ffdcf39), X(0x7fff6dac), X(0x7fffed01), X(0x7fffffc4),
49}; 50};
50 51
51static LOOKUP_T vwin256[128] = { 52static LOOKUP_T vwin256[128] IDATA_ATTR = {
52 X(0x0001f018), X(0x00117066), X(0x00306e9e), X(0x005ee5f1), 53 X(0x0001f018), X(0x00117066), X(0x00306e9e), X(0x005ee5f1),
53 X(0x009ccf26), X(0x00ea208b), X(0x0146cdea), X(0x01b2c87f), 54 X(0x009ccf26), X(0x00ea208b), X(0x0146cdea), X(0x01b2c87f),
54 X(0x022dfedf), X(0x02b85ced), X(0x0351cbbd), X(0x03fa317f), 55 X(0x022dfedf), X(0x02b85ced), X(0x0351cbbd), X(0x03fa317f),
@@ -83,7 +84,7 @@ static LOOKUP_T vwin256[128] = {
83 X(0x7fffdcd2), X(0x7ffff6d6), X(0x7ffffed0), X(0x7ffffffc), 84 X(0x7fffdcd2), X(0x7ffff6d6), X(0x7ffffed0), X(0x7ffffffc),
84}; 85};
85 86
86static LOOKUP_T vwin512[256] = { 87static LOOKUP_T vwin512[256] IDATA_ATTR = {
87 X(0x00007c06), X(0x00045c32), X(0x000c1c62), X(0x0017bc4c), 88 X(0x00007c06), X(0x00045c32), X(0x000c1c62), X(0x0017bc4c),
88 X(0x00273b7a), X(0x003a9955), X(0x0051d51c), X(0x006cede7), 89 X(0x00273b7a), X(0x003a9955), X(0x0051d51c), X(0x006cede7),
89 X(0x008be2a9), X(0x00aeb22a), X(0x00d55b0d), X(0x00ffdbcc), 90 X(0x008be2a9), X(0x00aeb22a), X(0x00d55b0d), X(0x00ffdbcc),
@@ -150,7 +151,7 @@ static LOOKUP_T vwin512[256] = {
150 X(0x7ffffdcd), X(0x7fffff6d), X(0x7fffffed), X(0x7fffffff), 151 X(0x7ffffdcd), X(0x7fffff6d), X(0x7fffffed), X(0x7fffffff),
151}; 152};
152 153
153static LOOKUP_T vwin1024[512] = { 154static LOOKUP_T vwin1024[512] IDATA_ATTR = {
154 X(0x00001f02), X(0x0001170e), X(0x00030724), X(0x0005ef40), 155 X(0x00001f02), X(0x0001170e), X(0x00030724), X(0x0005ef40),
155 X(0x0009cf59), X(0x000ea767), X(0x0014775e), X(0x001b3f2e), 156 X(0x0009cf59), X(0x000ea767), X(0x0014775e), X(0x001b3f2e),
156 X(0x0022fec8), X(0x002bb618), X(0x00356508), X(0x00400b81), 157 X(0x0022fec8), X(0x002bb618), X(0x00356508), X(0x00400b81),
@@ -281,7 +282,7 @@ static LOOKUP_T vwin1024[512] = {
281 X(0x7fffffdd), X(0x7ffffff7), X(0x7fffffff), X(0x7fffffff), 282 X(0x7fffffdd), X(0x7ffffff7), X(0x7fffffff), X(0x7fffffff),
282}; 283};
283 284
284static LOOKUP_T vwin2048[1024] = { 285static LOOKUP_T vwin2048[1024] IDATA_ATTR = {
285 X(0x000007c0), X(0x000045c4), X(0x0000c1ca), X(0x00017bd3), 286 X(0x000007c0), X(0x000045c4), X(0x0000c1ca), X(0x00017bd3),
286 X(0x000273de), X(0x0003a9eb), X(0x00051df9), X(0x0006d007), 287 X(0x000273de), X(0x0003a9eb), X(0x00051df9), X(0x0006d007),
287 X(0x0008c014), X(0x000aee1e), X(0x000d5a25), X(0x00100428), 288 X(0x0008c014), X(0x000aee1e), X(0x000d5a25), X(0x00100428),
@@ -540,6 +541,8 @@ static LOOKUP_T vwin2048[1024] = {
540 X(0x7ffffffe), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), 541 X(0x7ffffffe), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
541}; 542};
542 543
544/* The remaining large window sizes are used only for very low
545 quality Vorbis files so we don't bother to put them in IRAM */
543static LOOKUP_T vwin4096[2048] = { 546static LOOKUP_T vwin4096[2048] = {
544 X(0x000001f0), X(0x00001171), X(0x00003072), X(0x00005ef5), 547 X(0x000001f0), X(0x00001171), X(0x00003072), X(0x00005ef5),
545 X(0x00009cf8), X(0x0000ea7c), X(0x00014780), X(0x0001b405), 548 X(0x00009cf8), X(0x0000ea7c), X(0x00014780), X(0x0001b405),
@@ -1055,7 +1058,7 @@ static LOOKUP_T vwin4096[2048] = {
1055 X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), 1058 X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
1056}; 1059};
1057 1060
1058static LOOKUP_T vwin8192[4096] = { 1061static LOOKUP_T vwin8192[4096] = {
1059 X(0x0000007c), X(0x0000045c), X(0x00000c1d), X(0x000017bd), 1062 X(0x0000007c), X(0x0000045c), X(0x00000c1d), X(0x000017bd),
1060 X(0x0000273e), X(0x00003a9f), X(0x000051e0), X(0x00006d02), 1063 X(0x0000273e), X(0x00003a9f), X(0x000051e0), X(0x00006d02),
1061 X(0x00008c03), X(0x0000aee5), X(0x0000d5a7), X(0x00010049), 1064 X(0x00008c03), X(0x0000aee5), X(0x0000d5a7), X(0x00010049),
diff --git a/apps/plugins/vorbis2wav.c b/apps/plugins/vorbis2wav.c
index 93ec4cfe69..01815ab1ca 100644
--- a/apps/plugins/vorbis2wav.c
+++ b/apps/plugins/vorbis2wav.c
@@ -16,7 +16,7 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19#include "kernel.h"
20#include "plugin.h" 20#include "plugin.h"
21 21
22#if (CONFIG_HWCODEC == MASNONE) 22#if (CONFIG_HWCODEC == MASNONE)
@@ -86,6 +86,10 @@ extern char iramstart[];
86extern char iramend[]; 86extern char iramend[];
87#endif 87#endif
88 88
89
90/* reserve the PCM buffer in the IRAM area */
91static char pcmbuf[4096] IDATA_ATTR;
92
89/* this is the plugin entry point */ 93/* this is the plugin entry point */
90enum plugin_status plugin_start(struct plugin_api* api, void* file) 94enum plugin_status plugin_start(struct plugin_api* api, void* file)
91{ 95{
@@ -97,7 +101,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
97 long n; 101 long n;
98 int current_section; 102 int current_section;
99 int eof; 103 int eof;
100 static char pcmbuf[4096];
101#if BYTE_ORDER == BIG_ENDIAN 104#if BYTE_ORDER == BIG_ENDIAN
102 int i; 105 int i;
103 char x; 106 char x;
@@ -121,6 +124,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
121 return PLUGIN_ERROR; 124 return PLUGIN_ERROR;
122 } 125 }
123 126
127
124 /* Create a decoder instance */ 128 /* Create a decoder instance */
125 129
126 callbacks.read_func=read_handler; 130 callbacks.read_func=read_handler;
@@ -171,7 +175,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
171 175
172 close_wav(&file_info); 176 close_wav(&file_info);
173 rb->splash(HZ*2, true, "FINISHED!"); 177 rb->splash(HZ*2, true, "FINISHED!");
174
175 return PLUGIN_OK; 178 return PLUGIN_OK;
176} 179}
177#endif /* CONFIG_HWCODEC == MASNONE */ 180#endif /* CONFIG_HWCODEC == MASNONE */