summaryrefslogtreecommitdiff
path: root/apps/codecs
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2007-10-26 11:34:08 +0000
committerThom Johansen <thomj@rockbox.org>2007-10-26 11:34:08 +0000
commit8431c08b7d3a271ad34ce512e2bdcb0e53e39c38 (patch)
tree28c87d56f5391defa58449acb60a311c21668a94 /apps/codecs
parent530abe84fdc7ea04a6c638c05abfde1dbdde38d9 (diff)
downloadrockbox-8431c08b7d3a271ad34ce512e2bdcb0e53e39c38.tar.gz
rockbox-8431c08b7d3a271ad34ce512e2bdcb0e53e39c38.zip
QMF filter memory doesn't need to be 32 bits, so convert it to 16 bits. Alter assembler code to reflect this. Also do a small optimization in the reverse block copy of the qmf_synth() Coldfire assembler.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15315 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs')
-rw-r--r--apps/codecs/libspeex/filters.c2
-rw-r--r--apps/codecs/libspeex/filters.h2
-rw-r--r--apps/codecs/libspeex/filters_cf.S38
-rw-r--r--apps/codecs/libspeex/sb_celp.h2
4 files changed, 21 insertions, 23 deletions
diff --git a/apps/codecs/libspeex/filters.c b/apps/codecs/libspeex/filters.c
index e64f087a5d..0e76e27e84 100644
--- a/apps/codecs/libspeex/filters.c
+++ b/apps/codecs/libspeex/filters.c
@@ -478,7 +478,7 @@ void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *y1
478 478
479#ifndef OVERRIDE_QMF_SYNTH 479#ifndef OVERRIDE_QMF_SYNTH
480/* Re-synthesised a signal from the QMF low-band and high-band signals */ 480/* Re-synthesised a signal from the QMF low-band and high-band signals */
481void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_t *a, spx_word16_t *y, int N, int M, spx_word32_t *mem1, spx_word32_t *mem2, char *stack) 481void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_t *a, spx_word16_t *y, int N, int M, spx_word16_t *mem1, spx_word16_t *mem2, char *stack)
482 /* assumptions: 482 /* assumptions:
483 all odd x[i] are zero -- well, actually they are left out of the array now 483 all odd x[i] are zero -- well, actually they are left out of the array now
484 N and M are multiples of 4 */ 484 N and M are multiples of 4 */
diff --git a/apps/codecs/libspeex/filters.h b/apps/codecs/libspeex/filters.h
index b363a9a683..b08e94d320 100644
--- a/apps/codecs/libspeex/filters.h
+++ b/apps/codecs/libspeex/filters.h
@@ -59,7 +59,7 @@ void highpass(const spx_word16_t *x, spx_word16_t *y, int len, int filtID, spx_m
59 59
60 60
61void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *, spx_word16_t *y2, int N, int M, spx_word16_t *mem, char *stack); 61void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *, spx_word16_t *y2, int N, int M, spx_word16_t *mem, char *stack);
62void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_t *a, spx_word16_t *y, int N, int M, spx_word32_t *mem1, spx_word32_t *mem2, char *stack); 62void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_t *a, spx_word16_t *y, int N, int M, spx_word16_t *mem1, spx_word16_t *mem2, char *stack);
63 63
64void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack); 64void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
65void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack); 65void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
diff --git a/apps/codecs/libspeex/filters_cf.S b/apps/codecs/libspeex/filters_cf.S
index c9aa742b6f..b0367025e1 100644
--- a/apps/codecs/libspeex/filters_cf.S
+++ b/apps/codecs/libspeex/filters_cf.S
@@ -194,30 +194,32 @@ qmf_synth:
194 move.l %a6, %sp | Update sp 194 move.l %a6, %sp | Update sp
195 move.l %d3, -(%sp) | Stack old %sp 195 move.l %d3, -(%sp) | Stack old %sp
196 196
197 | Backwards copy x1 and x2 arrays to xx1 and xx2 197 | Backwards copy x1 and x2 arrays to xx1 and xx2, assume N2 is power of two
198 | TODO: these copying loops probably have more potential for optimization 198 | TODO: these copying loops probably have more potential for optimization
199 lea.l (%a0, %d0.l*2), %a0 | x1 += N2 199 lea.l (%a0, %d0.l*2), %a0 | x1 += N2
200 lea.l (%a1, %d0.l*2), %a1 | x2 += N2 200 lea.l (%a1, %d0.l*2), %a1 | x2 += N2
201 move.l %d0, %d2 | Loop counter is N2 201 move.l %d0, %d2 | Loop counter is N2
2020: 2020:
203 move.w -(%a0), (%a2)+ 203 move.l -(%a0), %d3
204 move.w -(%a1), (%a6)+ 204 swap.w %d3
205 subq.l #1, %d2 205 move.l %d3, (%a2)+
206 move.l -(%a1), %d3
207 swap.w %d3
208 move.l %d3, (%a6)+
209 subq.l #2, %d2
206 jne 0b 210 jne 0b
207 211
208 | Copy alternate members of mem1 and mem2 to last part of xx1 and xx2 212 | Copy alternate members of mem1 and mem2 to last part of xx1 and xx2
209 move.l %d1, %d2 | Loop counter is M2 213 move.l %d1, %d2 | Loop counter is M2
210 addq.l #4, %a4 | a4 = &mem1[1] 214 addq.l #2, %a4 | a4 = &mem1[1]
211 addq.l #4, %a5 | a5 = &mem2[1] 215 addq.l #2, %a5 | a5 = &mem2[1]
212 move.l %a4, %d3 | Backup mem1 and mem2 216 move.l %a4, %d3 | Backup mem1 and mem2
213 move.l %a5, %d4 217 move.l %a5, %d4
2140: 2180:
215 move.l (%a4), %d5 219 move.w (%a4), (%a2)+
216 move.w %d5, (%a2)+ 220 move.w (%a5), (%a6)+
217 move.l (%a5), %d5 221 addq.l #4, %a4
218 move.w %d5, (%a6)+ 222 addq.l #4, %a5
219 addq.l #8, %a4
220 addq.l #8, %a5
221 subq.l #1, %d2 223 subq.l #1, %d2
222 jne 0b 224 jne 0b
223 move.l %d3, %a4 | a4 = &mem1[1] 225 move.l %d3, %a4 | a4 = &mem1[1]
@@ -295,14 +297,10 @@ qmf_synth:
295 addq.l #4, %a0 | a0 = &xx1[0] 297 addq.l #4, %a0 | a0 = &xx1[0]
296 addq.l #4, %a1 | a1 = &xx2[0] 298 addq.l #4, %a1 | a1 = &xx2[0]
2970: 2990:
298 move.w (%a0)+, %d2 300 move.w (%a0)+, (%a4)
299 move.w (%a1)+, %d3 301 move.w (%a1)+, (%a5)
300 ext.l %d2 302 addq.l #4, %a4
301 ext.l %d3 303 addq.l #4, %a5
302 move.l %d2, (%a4)
303 move.l %d3, (%a5)
304 addq.l #8, %a4
305 addq.l #8, %a5
306 subq.l #1, %d1 304 subq.l #1, %d1
307 jne 0b 305 jne 0b
308 306
diff --git a/apps/codecs/libspeex/sb_celp.h b/apps/codecs/libspeex/sb_celp.h
index 9fb2241a83..da3545d943 100644
--- a/apps/codecs/libspeex/sb_celp.h
+++ b/apps/codecs/libspeex/sb_celp.h
@@ -109,7 +109,7 @@ typedef struct SBDecState {
109 int lpc_enh_enabled; 109 int lpc_enh_enabled;
110 110
111 char *stack; 111 char *stack;
112 spx_word32_t g0_mem[64], g1_mem[64]; 112 spx_word16_t g0_mem[64], g1_mem[64];
113 113
114 spx_word16_t excBuf[80]; 114 spx_word16_t excBuf[80];
115 spx_lsp_t old_qlsp[10]; 115 spx_lsp_t old_qlsp[10];