summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2010-04-11 19:02:43 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2010-04-11 19:02:43 +0000
commitefb702dc9b84242da815e303590dfc16020fe0d3 (patch)
treeab02eddae8395d566e9be5f25505cc106ce97d4a
parent3b1c3881f05c9a0645a21ca0d9d2bb8d7aea10c9 (diff)
downloadrockbox-efb702dc9b84242da815e303590dfc16020fe0d3.tar.gz
rockbox-efb702dc9b84242da815e303590dfc16020fe0d3.zip
Add arm assembler for dsp_apply_gain(). Speeds up this routine by 30-40% on PP502x.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25596 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/dsp_arm.S39
-rw-r--r--apps/dsp_asm.h1
2 files changed, 40 insertions, 0 deletions
diff --git a/apps/dsp_arm.S b/apps/dsp_arm.S
index df05520e85..75e28e21e9 100644
--- a/apps/dsp_arm.S
+++ b/apps/dsp_arm.S
@@ -381,3 +381,42 @@ dsp_upsample:
381.usend: 381.usend:
382 .size dsp_upsample,.usend-dsp_upsample 382 .size dsp_upsample,.usend-dsp_upsample
383 383
384/****************************************************************************
385 * void dsp_apply_gain(int count, struct dsp_data *data, int32_t *buf[])
386 * NOTE: The following code processes two samples at once. When count is odd,
387 * there is an additional obsolete sample processed, which will not be
388 * used by the calling functions.
389 */
390 .section .icode, "ax", %progbits
391 .align 2
392 .global dsp_apply_gain
393 .type dsp_apply_gain, %function
394dsp_apply_gain:
395 @ input: r0 = count, r1 = data, r2 = buf[]
396 stmfd sp!, {r4-r8, lr}
397
398 ldr r3, [r1, #4] @ r3 = data->num_channels
399 ldr r4, [r1, #32] @ r5 = data->gain
400
401.dag_outerloop:
402 ldr r1, [r2], #4 @ r1 = buf[0] and increment index of buf[]
403 mov lr, r0 @ lr = r0 = count
404
405.dag_innerloop:
406 ldmia r1, {r5, r6} @ load r5, r6 from r1
407 smull r7, r8, r5, r4 @ r5 = FRACMUL_SHL(r5, r4, 8)
408 mov r8, r8, asl #9
409 orr r5, r8, r7, lsr #23
410 smull r7, r8, r6, r4 @ r6 = FRACMUL_SHL(r6, r4, 8)
411 mov r8, r8, asl #9
412 orr r6, r8, r7, lsr #23
413 stmia r1!, {r5, r6} @ save r5, r6 to r1 and increment r1
414 subs lr, lr, #2
415 bgt .dag_innerloop @ end of inner loop
416
417 subs r3, r3, #1
418 bgt .dag_outerloop @ end of outer loop
419
420 ldmfd sp!, {r4-r8, pc}
421.dagend:
422 .size dsp_apply_gain,.dagend-dsp_apply_gain
diff --git a/apps/dsp_asm.h b/apps/dsp_asm.h
index 85db57b6ef..9204266c53 100644
--- a/apps/dsp_asm.h
+++ b/apps/dsp_asm.h
@@ -26,6 +26,7 @@
26 26
27/* Set the appropriate #defines based on CPU or whatever matters */ 27/* Set the appropriate #defines based on CPU or whatever matters */
28#if defined(CPU_ARM) 28#if defined(CPU_ARM)
29#define DSP_HAVE_ASM_APPLY_GAIN
29#define DSP_HAVE_ASM_RESAMPLING 30#define DSP_HAVE_ASM_RESAMPLING
30#define DSP_HAVE_ASM_CROSSFEED 31#define DSP_HAVE_ASM_CROSSFEED
31#define DSP_HAVE_ASM_SOUND_CHAN_MONO 32#define DSP_HAVE_ASM_SOUND_CHAN_MONO