diff options
author | Pedro Vasconcelos <pbv@rockbox.org> | 2005-06-10 22:34:57 +0000 |
---|---|---|
committer | Pedro Vasconcelos <pbv@rockbox.org> | 2005-06-10 22:34:57 +0000 |
commit | 6b9350b4d355a7598b737c00a2a3c02dd99bb1ec (patch) | |
tree | 432e50cfab8b7dc676605f1617424e0cfa0c8c1d | |
parent | cd1d87c8cf1b16e47e5c862c90a5f700087c2a5b (diff) | |
download | rockbox-6b9350b4d355a7598b737c00a2a3c02dd99bb1ec.tar.gz rockbox-6b9350b4d355a7598b737c00a2a3c02dd99bb1ec.zip |
A little improvement on Vorbis block synthesis.
Added myself to the list of contributors.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6664 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/codecs/Tremor/asm_mcf5249.h | 117 | ||||
-rw-r--r-- | apps/codecs/Tremor/block.c | 163 | ||||
-rw-r--r-- | apps/codecs/Tremor/mapping0.c | 12 | ||||
-rw-r--r-- | apps/codecs/Tremor/mdct.c | 4 | ||||
-rw-r--r-- | apps/codecs/Tremor/synthesis.c | 6 | ||||
-rw-r--r-- | apps/codecs/Tremor/window_lookup.h | 8 | ||||
-rw-r--r-- | docs/CREDITS | 1 |
7 files changed, 204 insertions, 107 deletions
diff --git a/apps/codecs/Tremor/asm_mcf5249.h b/apps/codecs/Tremor/asm_mcf5249.h index 811148a8c8..9844cc05a4 100644 --- a/apps/codecs/Tremor/asm_mcf5249.h +++ b/apps/codecs/Tremor/asm_mcf5249.h | |||
@@ -21,6 +21,9 @@ | |||
21 | 21 | ||
22 | #if CONFIG_CPU == MCF5249 && !defined(SIMULATOR) | 22 | #if CONFIG_CPU == MCF5249 && !defined(SIMULATOR) |
23 | 23 | ||
24 | /* attribute for 16-byte alignment */ | ||
25 | #define LINE_ATTR __attribute__ ((aligned (16))) | ||
26 | |||
24 | #ifndef _V_WIDE_MATH | 27 | #ifndef _V_WIDE_MATH |
25 | #define _V_WIDE_MATH | 28 | #define _V_WIDE_MATH |
26 | 29 | ||
@@ -107,15 +110,14 @@ void XNPROD31(ogg_int32_t a, ogg_int32_t b, | |||
107 | } | 110 | } |
108 | 111 | ||
109 | 112 | ||
110 | 113 | #if 1 | |
111 | 114 | /* canonical definition */ | |
112 | #if 1 /* Canonical definition */ | ||
113 | #define XPROD32(_a, _b, _t, _v, _x, _y) \ | 115 | #define XPROD32(_a, _b, _t, _v, _x, _y) \ |
114 | { (_x)=MULT32(_a,_t)+MULT32(_b,_v); \ | 116 | { (_x)=MULT32(_a,_t)+MULT32(_b,_v); \ |
115 | (_y)=MULT32(_b,_t)-MULT32(_a,_v); } | 117 | (_y)=MULT32(_b,_t)-MULT32(_a,_v); } |
116 | #else | 118 | #else |
117 | /* Thom Johansen suggestion; this could loose the lsb by overflow | 119 | /* Thom Johansen's suggestion; this could loose the LSB by overflow; |
118 | but does it matter in practice? */ | 120 | Does it matter in practice? */ |
119 | #define XPROD32(_a, _b, _t, _v, _x, _y) \ | 121 | #define XPROD32(_a, _b, _t, _v, _x, _y) \ |
120 | asm volatile ("mac.l %[a], %[t], %%acc0;" \ | 122 | asm volatile ("mac.l %[a], %[t], %%acc0;" \ |
121 | "mac.l %[b], %[v], %%acc0;" \ | 123 | "mac.l %[b], %[v], %%acc0;" \ |
@@ -129,14 +131,82 @@ void XNPROD31(ogg_int32_t a, ogg_int32_t b, | |||
129 | : [a] "r" (_a), [b] "r" (_b), \ | 131 | : [a] "r" (_a), [b] "r" (_b), \ |
130 | [t] "r" (_t), [v] "r" (_v) \ | 132 | [t] "r" (_t), [v] "r" (_v) \ |
131 | : "cc"); | 133 | : "cc"); |
132 | #endif | 134 | #endif |
133 | 135 | ||
134 | 136 | ||
135 | /* asm versions of vector multiplication for window.c */ | 137 | /* asm versions of vector operations for block.c, window.c */ |
136 | /* assumes MAC is initialized & accumulators cleared */ | 138 | /* assumes MAC is initialized & accumulators cleared */ |
137 | static inline | 139 | static inline |
140 | void mcf5249_vect_add(ogg_int32_t *x, ogg_int32_t *y, int n) | ||
141 | { | ||
142 | /* align to 16 bytes */ | ||
143 | while(n>0 && (int)x&16) { | ||
144 | *x++ += *y++; | ||
145 | n--; | ||
146 | } | ||
147 | asm volatile ("bra 1f;" | ||
148 | "0:" /* loop start */ | ||
149 | "movem.l (%[x]), %%d0-%%d3;" /* fetch values */ | ||
150 | "movem.l (%[y]), %%a0-%%a3;" | ||
151 | /* add */ | ||
152 | "add.l %%a0, %%d0;" | ||
153 | "add.l %%a1, %%d1;" | ||
154 | "add.l %%a2, %%d2;" | ||
155 | "add.l %%a3, %%d3;" | ||
156 | /* store and advance */ | ||
157 | "movem.l %%d0-%%d3, (%[x]);" | ||
158 | "lea.l (4*4, %[x]), %[x];" | ||
159 | "lea.l (4*4, %[y]), %[y];" | ||
160 | "subq.l #4, %[n];" /* done 4 elements */ | ||
161 | "1: cmpi.l #4, %[n];" | ||
162 | "bge 0b;" | ||
163 | : [n] "+d" (n), [x] "+a" (x), [y] "+a" (y) | ||
164 | : : "%d0", "%d1", "%d2", "%d3", "%a0", "%a1", "%a2", "%a3", | ||
165 | "cc", "memory"); | ||
166 | /* add final elements */ | ||
167 | while (n>0) { | ||
168 | *x++ += *y++; | ||
169 | n--; | ||
170 | } | ||
171 | } | ||
172 | |||
173 | static inline | ||
174 | void mcf5249_vect_copy(ogg_int32_t *x, ogg_int32_t *y, int n) | ||
175 | { | ||
176 | /* align to 16 bytes */ | ||
177 | while(n>0 && (int)x&16) { | ||
178 | *x++ = *y++; | ||
179 | n--; | ||
180 | } | ||
181 | asm volatile ("bra 1f;" | ||
182 | "0:" /* loop start */ | ||
183 | "movem.l (%[y]), %%d0-%%d3;" /* fetch values */ | ||
184 | "movem.l %%d0-%%d3, (%[x]);" /* store */ | ||
185 | "lea.l (4*4, %[x]), %[x];" /* advance */ | ||
186 | "lea.l (4*4, %[y]), %[y];" | ||
187 | "subq.l #4, %[n];" /* done 4 elements */ | ||
188 | "1: cmpi.l #4, %[n];" | ||
189 | "bge 0b;" | ||
190 | : [n] "+d" (n), [x] "+a" (x), [y] "+a" (y) | ||
191 | : : "%d0", "%d1", "%d2", "%d3", "cc", "memory"); | ||
192 | /* copy final elements */ | ||
193 | while (n>0) { | ||
194 | *x++ = *y++; | ||
195 | n--; | ||
196 | } | ||
197 | } | ||
198 | |||
199 | |||
200 | static inline | ||
138 | void mcf5249_vect_mult_fw(ogg_int32_t *data, LOOKUP_T *window, int n) | 201 | void mcf5249_vect_mult_fw(ogg_int32_t *data, LOOKUP_T *window, int n) |
139 | { | 202 | { |
203 | /* ensure data is aligned to 16-bytes */ | ||
204 | while(n>0 && (int)data%16) { | ||
205 | *data = MULT31(*data, *window); | ||
206 | data++; | ||
207 | window++; | ||
208 | n--; | ||
209 | } | ||
140 | asm volatile ("movem.l (%[d]), %%d0-%%d3;" /* loop start */ | 210 | asm volatile ("movem.l (%[d]), %%d0-%%d3;" /* loop start */ |
141 | "movem.l (%[w]), %%a0-%%a3;" /* pre-fetch registers */ | 211 | "movem.l (%[w]), %%a0-%%a3;" /* pre-fetch registers */ |
142 | "lea.l (4*4, %[w]), %[w];" | 212 | "lea.l (4*4, %[w]), %[w];" |
@@ -184,6 +254,13 @@ void mcf5249_vect_mult_fw(ogg_int32_t *data, LOOKUP_T *window, int n) | |||
184 | static inline | 254 | static inline |
185 | void mcf5249_vect_mult_bw(ogg_int32_t *data, LOOKUP_T *window, int n) | 255 | void mcf5249_vect_mult_bw(ogg_int32_t *data, LOOKUP_T *window, int n) |
186 | { | 256 | { |
257 | /* ensure at least data is aligned to 16-bytes */ | ||
258 | while(n>0 && (int)data%16) { | ||
259 | *data = MULT31(*data, *window); | ||
260 | data++; | ||
261 | window--; | ||
262 | n--; | ||
263 | } | ||
187 | asm volatile ("lea.l (-3*4, %[w]), %[w];" /* loop start */ | 264 | asm volatile ("lea.l (-3*4, %[w]), %[w];" /* loop start */ |
188 | "movem.l (%[d]), %%d0-%%d3;" /* pre-fetch registers */ | 265 | "movem.l (%[d]), %%d0-%%d3;" /* pre-fetch registers */ |
189 | "movem.l (%[w]), %%a0-%%a3;" | 266 | "movem.l (%[w]), %%a0-%%a3;" |
@@ -232,6 +309,11 @@ void mcf5249_vect_mult_bw(ogg_int32_t *data, LOOKUP_T *window, int n) | |||
232 | static inline | 309 | static inline |
233 | void mcf5249_vect_zero(ogg_int32_t *ptr, int n) | 310 | void mcf5249_vect_zero(ogg_int32_t *ptr, int n) |
234 | { | 311 | { |
312 | /* ensure ptr is aligned to 16-bytes */ | ||
313 | while(n>0 && (int)ptr%16) { | ||
314 | *ptr++ = 0; | ||
315 | n--; | ||
316 | } | ||
235 | asm volatile ("clr.l %%d0;" | 317 | asm volatile ("clr.l %%d0;" |
236 | "clr.l %%d1;" | 318 | "clr.l %%d1;" |
237 | "clr.l %%d2;" | 319 | "clr.l %%d2;" |
@@ -241,23 +323,16 @@ void mcf5249_vect_zero(ogg_int32_t *ptr, int n) | |||
241 | "bra 1f;" | 323 | "bra 1f;" |
242 | "0: movem.l %%d0-%%d3, (%[ptr]);" | 324 | "0: movem.l %%d0-%%d3, (%[ptr]);" |
243 | "lea (4*4, %[ptr]), %[ptr];" | 325 | "lea (4*4, %[ptr]), %[ptr];" |
244 | "subq.l #4, %[n];" | 326 | "subq.l #4, %[n];" /* done 4 elements */ |
245 | "1: bgt 0b;" | 327 | "1: bgt 0b;" |
246 | /* remaing elements */ | ||
247 | "tst.l %[n];" | ||
248 | "beq 1f;" /* n=0 */ | ||
249 | "clr.l (%[ptr])+;" | ||
250 | "subq.l #1, %[n];" | ||
251 | "beq 1f;" /* n=1 */ | ||
252 | "clr.l (%[ptr])+;" | ||
253 | "subq.l #1, %[n];" | ||
254 | "beq 1f;" /* n=2 */ | ||
255 | /* otherwise n = 3 */ | ||
256 | "clr.l (%[ptr])+;" | ||
257 | "1:" | ||
258 | : [n] "+d" (n), [ptr] "+a" (ptr) | 328 | : [n] "+d" (n), [ptr] "+a" (ptr) |
259 | : | 329 | : |
260 | : "%d0","%d1","%d2","%d3","cc","memory"); | 330 | : "%d0","%d1","%d2","%d3","cc","memory"); |
331 | /* clear remaining elements */ | ||
332 | while(n>0) { | ||
333 | *ptr++ = 0; | ||
334 | n--; | ||
335 | } | ||
261 | } | 336 | } |
262 | 337 | ||
263 | #endif | 338 | #endif |
@@ -272,4 +347,6 @@ static inline ogg_int32_t CLIP_TO_15(register ogg_int32_t x) { | |||
272 | } | 347 | } |
273 | 348 | ||
274 | #endif | 349 | #endif |
350 | #else | ||
351 | #define LINE_ATTR | ||
275 | #endif | 352 | #endif |
diff --git a/apps/codecs/Tremor/block.c b/apps/codecs/Tremor/block.c index 6f88fb812c..f51622b5ed 100644 --- a/apps/codecs/Tremor/block.c +++ b/apps/codecs/Tremor/block.c | |||
@@ -70,8 +70,8 @@ static int ilog(unsigned int v){ | |||
70 | | | |endSr | 70 | | | |endSr |
71 | | |beginSr | 71 | | |beginSr |
72 | | |endSl | 72 | | |endSl |
73 | |beginSl | 73 | |beginSl |
74 | |beginW | 74 | |beginW |
75 | */ | 75 | */ |
76 | 76 | ||
77 | /* block abstraction setup *********************************************/ | 77 | /* block abstraction setup *********************************************/ |
@@ -173,10 +173,8 @@ static int _vds_init(vorbis_dsp_state *v,vorbis_info *vi){ | |||
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 | 175 | ||
176 | // pbv: allow for extra padding for windowing | ||
177 | for(i=0;i<vi->channels;i++) | 176 | for(i=0;i<vi->channels;i++) |
178 | v->pcm[i]=(ogg_int32_t *)_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i])); | 177 | 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 | 178 | ||
181 | 179 | ||
182 | /* all 1 (large block) or 0 (small block) */ | 180 | /* all 1 (large block) or 0 (small block) */ |
@@ -190,7 +188,7 @@ static int _vds_init(vorbis_dsp_state *v,vorbis_info *vi){ | |||
190 | int mapnum=ci->mode_param[i]->mapping; | 188 | int mapnum=ci->mode_param[i]->mapping; |
191 | int maptype=ci->map_type[mapnum]; | 189 | int maptype=ci->map_type[mapnum]; |
192 | b->mode[i]=_mapping_P[maptype]->look(v,ci->mode_param[i], | 190 | b->mode[i]=_mapping_P[maptype]->look(v,ci->mode_param[i], |
193 | ci->map_param[mapnum]); | 191 | ci->map_param[mapnum]); |
194 | } | 192 | } |
195 | return(0); | 193 | return(0); |
196 | } | 194 | } |
@@ -231,7 +229,7 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){ | |||
231 | 229 | ||
232 | if(v->pcm){ | 230 | if(v->pcm){ |
233 | for(i=0;i<vi->channels;i++) | 231 | for(i=0;i<vi->channels;i++) |
234 | if(v->pcm[i])_ogg_free(v->pcm[i]); | 232 | if(v->pcm[i])_ogg_free(v->pcm[i]); |
235 | _ogg_free(v->pcm); | 233 | _ogg_free(v->pcm); |
236 | if(v->pcmret)_ogg_free(v->pcmret); | 234 | if(v->pcmret)_ogg_free(v->pcmret); |
237 | } | 235 | } |
@@ -239,9 +237,9 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){ | |||
239 | /* free mode lookups; these are actually vorbis_look_mapping structs */ | 237 | /* free mode lookups; these are actually vorbis_look_mapping structs */ |
240 | if(ci){ | 238 | if(ci){ |
241 | for(i=0;i<ci->modes;i++){ | 239 | for(i=0;i<ci->modes;i++){ |
242 | int mapnum=ci->mode_param[i]->mapping; | 240 | int mapnum=ci->mode_param[i]->mapping; |
243 | int maptype=ci->map_type[mapnum]; | 241 | int maptype=ci->map_type[mapnum]; |
244 | if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]); | 242 | if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]); |
245 | } | 243 | } |
246 | } | 244 | } |
247 | 245 | ||
@@ -262,7 +260,11 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ | |||
262 | vorbis_info *vi=v->vi; | 260 | vorbis_info *vi=v->vi; |
263 | codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; | 261 | codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; |
264 | private_state *b=v->backend_state; | 262 | private_state *b=v->backend_state; |
263 | #if CONFIG_CPU == MCF5249 | ||
264 | int j; | ||
265 | #else | ||
265 | int i,j; | 266 | int i,j; |
267 | #endif | ||
266 | 268 | ||
267 | if(v->pcm_current>v->pcm_returned && v->pcm_returned!=-1)return(OV_EINVAL); | 269 | if(v->pcm_current>v->pcm_returned && v->pcm_returned!=-1)return(OV_EINVAL); |
268 | 270 | ||
@@ -304,43 +306,64 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ | |||
304 | for(j=0;j<vi->channels;j++){ | 306 | for(j=0;j<vi->channels;j++){ |
305 | /* the overlap/add section */ | 307 | /* the overlap/add section */ |
306 | if(v->lW){ | 308 | if(v->lW){ |
307 | if(v->W){ | 309 | if(v->W){ |
308 | /* large/large */ | 310 | /* large/large */ |
309 | ogg_int32_t *pcm=v->pcm[j]+prevCenter; | 311 | ogg_int32_t *pcm=v->pcm[j]+prevCenter; |
310 | ogg_int32_t *p=vb->pcm[j]; | 312 | ogg_int32_t *p=vb->pcm[j]; |
311 | for(i=0;i<n1;i++) | 313 | #if CONFIG_CPU == MCF5249 |
312 | pcm[i]+=p[i]; | 314 | mcf5249_vect_add(pcm, p, n1); |
313 | }else{ | 315 | #else |
314 | /* large/small */ | 316 | for(i=0;i<n1;i++) |
315 | ogg_int32_t *pcm=v->pcm[j]+prevCenter+n1/2-n0/2; | 317 | pcm[i]+=p[i]; |
316 | ogg_int32_t *p=vb->pcm[j]; | 318 | #endif |
317 | for(i=0;i<n0;i++) | 319 | }else{ |
318 | pcm[i]+=p[i]; | 320 | /* large/small */ |
319 | } | 321 | ogg_int32_t *pcm=v->pcm[j]+prevCenter+n1/2-n0/2; |
322 | ogg_int32_t *p=vb->pcm[j]; | ||
323 | #if CONFIG_CPU == MCF5249 | ||
324 | mcf5249_vect_add(pcm, p, n0); | ||
325 | #else | ||
326 | for(i=0;i<n0;i++) | ||
327 | pcm[i]+=p[i]; | ||
328 | #endif | ||
329 | } | ||
320 | }else{ | 330 | }else{ |
321 | if(v->W){ | 331 | if(v->W){ |
322 | /* small/large */ | 332 | /* small/large */ |
323 | ogg_int32_t *pcm=v->pcm[j]+prevCenter; | 333 | ogg_int32_t *pcm=v->pcm[j]+prevCenter; |
324 | ogg_int32_t *p=vb->pcm[j]+n1/2-n0/2; | 334 | ogg_int32_t *p=vb->pcm[j]+n1/2-n0/2; |
325 | for(i=0;i<n0;i++) | 335 | #if CONFIG_CPU == MCF5249 |
326 | pcm[i]+=p[i]; | 336 | mcf5249_vect_add(pcm, p, n0); |
327 | for(;i<n1/2+n0/2;i++) | 337 | mcf5249_vect_copy(&pcm[n0], &p[n0], n1/2-n0/2); |
328 | pcm[i]=p[i]; | 338 | #else |
329 | }else{ | 339 | for(i=0;i<n0;i++) |
330 | /* small/small */ | 340 | pcm[i]+=p[i]; |
331 | ogg_int32_t *pcm=v->pcm[j]+prevCenter; | 341 | for(;i<n1/2+n0/2;i++) |
332 | ogg_int32_t *p=vb->pcm[j]; | 342 | pcm[i]=p[i]; |
333 | for(i=0;i<n0;i++) | 343 | #endif |
334 | pcm[i]+=p[i]; | 344 | }else{ |
335 | } | 345 | /* small/small */ |
346 | ogg_int32_t *pcm=v->pcm[j]+prevCenter; | ||
347 | ogg_int32_t *p=vb->pcm[j]; | ||
348 | #if CONFIG_CPU == MCF5249 | ||
349 | mcf5249_vect_add(pcm, p, n0); | ||
350 | #else | ||
351 | for(i=0;i<n0;i++) | ||
352 | pcm[i]+=p[i]; | ||
353 | #endif | ||
354 | } | ||
336 | } | 355 | } |
337 | 356 | ||
338 | /* the copy section */ | 357 | /* the copy section */ |
339 | { | 358 | { |
340 | ogg_int32_t *pcm=v->pcm[j]+thisCenter; | 359 | ogg_int32_t *pcm=v->pcm[j]+thisCenter; |
341 | ogg_int32_t *p=vb->pcm[j]+n; | 360 | ogg_int32_t *p=vb->pcm[j]+n; |
342 | for(i=0;i<n;i++) | 361 | #if CONFIG_CPU == MCF5249 |
343 | pcm[i]=p[i]; | 362 | mcf5249_vect_copy(pcm, p, n); |
363 | #else | ||
364 | for(i=0;i<n;i++) | ||
365 | pcm[i]=p[i]; | ||
366 | #endif | ||
344 | } | 367 | } |
345 | } | 368 | } |
346 | 369 | ||
@@ -359,8 +382,8 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ | |||
359 | }else{ | 382 | }else{ |
360 | v->pcm_returned=prevCenter; | 383 | v->pcm_returned=prevCenter; |
361 | v->pcm_current=prevCenter+ | 384 | v->pcm_current=prevCenter+ |
362 | ci->blocksizes[v->lW]/4+ | 385 | ci->blocksizes[v->lW]/4+ |
363 | ci->blocksizes[v->W]/4; | 386 | ci->blocksizes[v->W]/4; |
364 | } | 387 | } |
365 | 388 | ||
366 | } | 389 | } |
@@ -389,23 +412,23 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ | |||
389 | 412 | ||
390 | /* is this a short page? */ | 413 | /* is this a short page? */ |
391 | if(b->sample_count>v->granulepos){ | 414 | if(b->sample_count>v->granulepos){ |
392 | /* corner case; if this is both the first and last audio page, | 415 | /* corner case; if this is both the first and last audio page, |
393 | then spec says the end is cut, not beginning */ | 416 | then spec says the end is cut, not beginning */ |
394 | if(vb->eofflag){ | 417 | if(vb->eofflag){ |
395 | /* trim the end */ | 418 | /* trim the end */ |
396 | /* no preceeding granulepos; assume we started at zero (we'd | 419 | /* no preceeding granulepos; assume we started at zero (we'd |
397 | have to in a short single-page stream) */ | 420 | have to in a short single-page stream) */ |
398 | /* granulepos could be -1 due to a seek, but that would result | 421 | /* granulepos could be -1 due to a seek, but that would result |
399 | in a long coun`t, not short count */ | 422 | in a long coun`t, not short count */ |
400 | 423 | ||
401 | v->pcm_current-=(b->sample_count-v->granulepos); | 424 | v->pcm_current-=(b->sample_count-v->granulepos); |
402 | }else{ | 425 | }else{ |
403 | /* trim the beginning */ | 426 | /* trim the beginning */ |
404 | v->pcm_returned+=(b->sample_count-v->granulepos); | 427 | v->pcm_returned+=(b->sample_count-v->granulepos); |
405 | if(v->pcm_returned>v->pcm_current) | 428 | if(v->pcm_returned>v->pcm_current) |
406 | v->pcm_returned=v->pcm_current; | 429 | v->pcm_returned=v->pcm_current; |
407 | } | 430 | } |
408 | 431 | ||
409 | } | 432 | } |
410 | 433 | ||
411 | } | 434 | } |
@@ -414,16 +437,16 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ | |||
414 | if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){ | 437 | if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){ |
415 | 438 | ||
416 | if(v->granulepos>vb->granulepos){ | 439 | if(v->granulepos>vb->granulepos){ |
417 | long extra=v->granulepos-vb->granulepos; | 440 | long extra=v->granulepos-vb->granulepos; |
418 | 441 | ||
419 | if(extra) | 442 | if(extra) |
420 | if(vb->eofflag){ | 443 | if(vb->eofflag){ |
421 | /* partial last frame. Strip the extra samples off */ | 444 | /* partial last frame. Strip the extra samples off */ |
422 | v->pcm_current-=extra; | 445 | v->pcm_current-=extra; |
423 | } /* else {Shouldn't happen *unless* the bitstream is out of | 446 | } /* else {Shouldn't happen *unless* the bitstream is out of |
424 | spec. Either way, believe the bitstream } */ | 447 | spec. Either way, believe the bitstream } */ |
425 | } /* else {Shouldn't happen *unless* the bitstream is out of | 448 | } /* else {Shouldn't happen *unless* the bitstream is out of |
426 | spec. Either way, believe the bitstream } */ | 449 | spec. Either way, believe the bitstream } */ |
427 | v->granulepos=vb->granulepos; | 450 | v->granulepos=vb->granulepos; |
428 | } | 451 | } |
429 | } | 452 | } |
@@ -441,7 +464,7 @@ int vorbis_synthesis_pcmout(vorbis_dsp_state *v,ogg_int32_t ***pcm){ | |||
441 | if(pcm){ | 464 | if(pcm){ |
442 | int i; | 465 | int i; |
443 | for(i=0;i<vi->channels;i++) | 466 | for(i=0;i<vi->channels;i++) |
444 | v->pcmret[i]=v->pcm[i]+v->pcm_returned; | 467 | v->pcmret[i]=v->pcm[i]+v->pcm_returned; |
445 | *pcm=v->pcmret; | 468 | *pcm=v->pcmret; |
446 | } | 469 | } |
447 | return(v->pcm_current-v->pcm_returned); | 470 | return(v->pcm_current-v->pcm_returned); |
diff --git a/apps/codecs/Tremor/mapping0.c b/apps/codecs/Tremor/mapping0.c index c53383de8f..6154f5de6b 100644 --- a/apps/codecs/Tremor/mapping0.c +++ b/apps/codecs/Tremor/mapping0.c | |||
@@ -202,10 +202,6 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){ | |||
202 | int nonzero[CHANNELS]; | 202 | int nonzero[CHANNELS]; |
203 | void *floormemo[CHANNELS]; | 203 | void *floormemo[CHANNELS]; |
204 | 204 | ||
205 | /* test for too many channels; | ||
206 | (maybe this is can be checked at the stream level?) */ | ||
207 | if (vi->channels > CHANNELS) return (-1); | ||
208 | |||
209 | /* time domain information decode (note that applying the | 205 | /* time domain information decode (note that applying the |
210 | information would have to happen later; we'll probably add a | 206 | information would have to happen later; we'll probably add a |
211 | function entry to the harness for that later */ | 207 | function entry to the harness for that later */ |
@@ -286,13 +282,14 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){ | |||
286 | //_analysis_output("residue",seq+j,vb->pcm[j],-8,n/2,0,0); | 282 | //_analysis_output("residue",seq+j,vb->pcm[j],-8,n/2,0,0); |
287 | 283 | ||
288 | /* compute and apply spectral envelope */ | 284 | /* compute and apply spectral envelope */ |
285 | #if 0 | ||
289 | for(i=0;i<vi->channels;i++){ | 286 | for(i=0;i<vi->channels;i++){ |
290 | ogg_int32_t *pcm=vb->pcm[i]; | 287 | ogg_int32_t *pcm=vb->pcm[i]; |
291 | int submap=info->chmuxlist[i]; | 288 | int submap=info->chmuxlist[i]; |
292 | look->floor_func[submap]-> | 289 | look->floor_func[submap]-> |
293 | inverse2(vb,look->floor_look[submap],floormemo[i],pcm); | 290 | inverse2(vb,look->floor_look[submap],floormemo[i],pcm); |
294 | } | 291 | } |
295 | 292 | #endif | |
296 | //for(j=0;j<vi->channels;j++) | 293 | //for(j=0;j<vi->channels;j++) |
297 | //_analysis_output("mdct",seq+j,vb->pcm[j],-24,n/2,0,1); | 294 | //_analysis_output("mdct",seq+j,vb->pcm[j],-24,n/2,0,1); |
298 | 295 | ||
@@ -301,8 +298,11 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){ | |||
301 | 298 | ||
302 | for(i=0;i<vi->channels;i++){ | 299 | for(i=0;i<vi->channels;i++){ |
303 | ogg_int32_t *pcm=vb->pcm[i]; | 300 | ogg_int32_t *pcm=vb->pcm[i]; |
301 | int submap=info->chmuxlist[i]; | ||
304 | 302 | ||
305 | if(nonzero[i]) { | 303 | if(nonzero[i]) { |
304 | look->floor_func[submap]-> | ||
305 | inverse2(vb,look->floor_look[submap],floormemo[i],pcm); | ||
306 | mdct_backward(n, pcm, pcm); | 306 | mdct_backward(n, pcm, pcm); |
307 | /* window the data */ | 307 | /* window the data */ |
308 | _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW); | 308 | _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW); |
diff --git a/apps/codecs/Tremor/mdct.c b/apps/codecs/Tremor/mdct.c index 27a340bcad..9bdfdce2e2 100644 --- a/apps/codecs/Tremor/mdct.c +++ b/apps/codecs/Tremor/mdct.c | |||
@@ -341,10 +341,6 @@ void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out) { | |||
341 | int shift; | 341 | int shift; |
342 | int step; | 342 | int step; |
343 | 343 | ||
344 | #if CONFIG_CPU == MCF5249 | ||
345 | /* mcf5249_init_mac(); */ /* should be redundant */ | ||
346 | #endif | ||
347 | |||
348 | for (shift=6;!(n&(1<<shift));shift++); | 344 | for (shift=6;!(n&(1<<shift));shift++); |
349 | shift=13-shift; | 345 | shift=13-shift; |
350 | step=2<<shift; | 346 | step=2<<shift; |
diff --git a/apps/codecs/Tremor/synthesis.c b/apps/codecs/Tremor/synthesis.c index db178e7e9f..d01a7aaa64 100644 --- a/apps/codecs/Tremor/synthesis.c +++ b/apps/codecs/Tremor/synthesis.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #define CHANNELS 2 | 33 | #define CHANNELS 2 |
34 | 34 | ||
35 | static ogg_int32_t *ipcm_vect[CHANNELS] IDATA_ATTR; | 35 | static ogg_int32_t *ipcm_vect[CHANNELS] IDATA_ATTR; |
36 | static ogg_int32_t ipcm_buff[CHANNELS*IRAM_PCM_END] IDATA_ATTR; | 36 | static ogg_int32_t ipcm_buff[CHANNELS*IRAM_PCM_END] IDATA_ATTR LINE_ATTR; |
37 | 37 | ||
38 | int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep){ | 38 | int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep){ |
39 | vorbis_dsp_state *vd=vb->vd; | 39 | vorbis_dsp_state *vd=vb->vd; |
@@ -73,10 +73,10 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep){ | |||
73 | vb->sequence=op->packetno-3; /* first block is third packet */ | 73 | vb->sequence=op->packetno-3; /* first block is third packet */ |
74 | vb->eofflag=op->e_o_s; | 74 | vb->eofflag=op->e_o_s; |
75 | 75 | ||
76 | if(decodep){ | 76 | if(decodep && vi->channels<=CHANNELS){ |
77 | /* alloc pcm passback storage */ | 77 | /* alloc pcm passback storage */ |
78 | vb->pcmend=ci->blocksizes[vb->W]; | 78 | vb->pcmend=ci->blocksizes[vb->W]; |
79 | if (vi->channels <= CHANNELS && vb->pcmend<=IRAM_PCM_END) { | 79 | if (vb->pcmend<=IRAM_PCM_END) { |
80 | /* use statically allocated iram buffer */ | 80 | /* use statically allocated iram buffer */ |
81 | vb->pcm = ipcm_vect; | 81 | vb->pcm = ipcm_vect; |
82 | for(i=0; i<CHANNELS; i++) | 82 | for(i=0; i<CHANNELS; i++) |
diff --git a/apps/codecs/Tremor/window_lookup.h b/apps/codecs/Tremor/window_lookup.h index 71a413bcd5..64350d8fba 100644 --- a/apps/codecs/Tremor/window_lookup.h +++ b/apps/codecs/Tremor/window_lookup.h | |||
@@ -32,7 +32,7 @@ static LOOKUP_T vwin64[32] = { | |||
32 | X(0x7fdd78a5), X(0x7ff6ec6d), X(0x7ffed0e9), X(0x7ffffc3f), | 32 | X(0x7fdd78a5), X(0x7ff6ec6d), X(0x7ffed0e9), X(0x7ffffc3f), |
33 | }; | 33 | }; |
34 | 34 | ||
35 | static LOOKUP_T vwin128[64] IDATA_ATTR = { | 35 | static LOOKUP_T vwin128[64] IDATA_ATTR LINE_ATTR = { |
36 | X(0x0007c04d), X(0x0045bb89), X(0x00c18b87), X(0x017ae294), | 36 | X(0x0007c04d), X(0x0045bb89), X(0x00c18b87), X(0x017ae294), |
37 | X(0x02714a4e), X(0x03a4217a), X(0x05129952), X(0x06bbb24f), | 37 | X(0x02714a4e), X(0x03a4217a), X(0x05129952), X(0x06bbb24f), |
38 | X(0x089e38a1), X(0x0ab8c073), X(0x0d09a228), X(0x0f8ef6bd), | 38 | X(0x089e38a1), X(0x0ab8c073), X(0x0d09a228), X(0x0f8ef6bd), |
@@ -51,7 +51,7 @@ static LOOKUP_T vwin128[64] IDATA_ATTR = { | |||
51 | X(0x7ffdcf39), X(0x7fff6dac), X(0x7fffed01), X(0x7fffffc4), | 51 | X(0x7ffdcf39), X(0x7fff6dac), X(0x7fffed01), X(0x7fffffc4), |
52 | }; | 52 | }; |
53 | 53 | ||
54 | static LOOKUP_T vwin256[128] IDATA_ATTR = { | 54 | static LOOKUP_T vwin256[128] IDATA_ATTR LINE_ATTR = { |
55 | X(0x0001f018), X(0x00117066), X(0x00306e9e), X(0x005ee5f1), | 55 | X(0x0001f018), X(0x00117066), X(0x00306e9e), X(0x005ee5f1), |
56 | X(0x009ccf26), X(0x00ea208b), X(0x0146cdea), X(0x01b2c87f), | 56 | X(0x009ccf26), X(0x00ea208b), X(0x0146cdea), X(0x01b2c87f), |
57 | X(0x022dfedf), X(0x02b85ced), X(0x0351cbbd), X(0x03fa317f), | 57 | X(0x022dfedf), X(0x02b85ced), X(0x0351cbbd), X(0x03fa317f), |
@@ -86,7 +86,7 @@ static LOOKUP_T vwin256[128] IDATA_ATTR = { | |||
86 | X(0x7fffdcd2), X(0x7ffff6d6), X(0x7ffffed0), X(0x7ffffffc), | 86 | X(0x7fffdcd2), X(0x7ffff6d6), X(0x7ffffed0), X(0x7ffffffc), |
87 | }; | 87 | }; |
88 | 88 | ||
89 | static LOOKUP_T vwin512[256] IDATA_ATTR = { | 89 | static LOOKUP_T vwin512[256] IDATA_ATTR LINE_ATTR = { |
90 | X(0x00007c06), X(0x00045c32), X(0x000c1c62), X(0x0017bc4c), | 90 | X(0x00007c06), X(0x00045c32), X(0x000c1c62), X(0x0017bc4c), |
91 | X(0x00273b7a), X(0x003a9955), X(0x0051d51c), X(0x006cede7), | 91 | X(0x00273b7a), X(0x003a9955), X(0x0051d51c), X(0x006cede7), |
92 | X(0x008be2a9), X(0x00aeb22a), X(0x00d55b0d), X(0x00ffdbcc), | 92 | X(0x008be2a9), X(0x00aeb22a), X(0x00d55b0d), X(0x00ffdbcc), |
@@ -284,7 +284,7 @@ static LOOKUP_T vwin1024[512] = { | |||
284 | X(0x7fffffdd), X(0x7ffffff7), X(0x7fffffff), X(0x7fffffff), | 284 | X(0x7fffffdd), X(0x7ffffff7), X(0x7fffffff), X(0x7fffffff), |
285 | }; | 285 | }; |
286 | 286 | ||
287 | static LOOKUP_T vwin2048[1024] IDATA_ATTR = { | 287 | static LOOKUP_T vwin2048[1024] IDATA_ATTR LINE_ATTR = { |
288 | X(0x000007c0), X(0x000045c4), X(0x0000c1ca), X(0x00017bd3), | 288 | X(0x000007c0), X(0x000045c4), X(0x0000c1ca), X(0x00017bd3), |
289 | X(0x000273de), X(0x0003a9eb), X(0x00051df9), X(0x0006d007), | 289 | X(0x000273de), X(0x0003a9eb), X(0x00051df9), X(0x0006d007), |
290 | X(0x0008c014), X(0x000aee1e), X(0x000d5a25), X(0x00100428), | 290 | X(0x0008c014), X(0x000aee1e), X(0x000d5a25), X(0x00100428), |
diff --git a/docs/CREDITS b/docs/CREDITS index 0167b9df08..d531078910 100644 --- a/docs/CREDITS +++ b/docs/CREDITS | |||
@@ -115,3 +115,4 @@ Alessio Lenzi | |||
115 | David Bryant | 115 | David Bryant |
116 | Martin Arver | 116 | Martin Arver |
117 | Alexander Spyridakis | 117 | Alexander Spyridakis |
118 | Pedro Baltazar Vasconcelos | ||