diff options
Diffstat (limited to 'apps/dsp_cf.S')
-rw-r--r-- | apps/dsp_cf.S | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/apps/dsp_cf.S b/apps/dsp_cf.S index e5d3ee8c55..e4869b7c9a 100644 --- a/apps/dsp_cf.S +++ b/apps/dsp_cf.S | |||
@@ -22,17 +22,17 @@ | |||
22 | * void dsp_apply_gain(int count, struct dsp_data *data, int32_t *buf[]) | 22 | * void dsp_apply_gain(int count, struct dsp_data *data, int32_t *buf[]) |
23 | */ | 23 | */ |
24 | .section .text | 24 | .section .text |
25 | .align 2 | 25 | .align 2 |
26 | .global dsp_apply_gain | 26 | .global dsp_apply_gain |
27 | dsp_apply_gain: | 27 | dsp_apply_gain: |
28 | lea.l -20(%sp), %sp | save registers | 28 | lea.l -20(%sp), %sp | save registers |
29 | movem.l %d2-%d4/%a2-%a3, (%sp) | | 29 | movem.l %d2-%d4/%a2-%a3, (%sp) | |
30 | movem.l 28(%sp), %a0-%a1 | %a0 = data, | 30 | movem.l 28(%sp), %a0-%a1 | %a0 = data, |
31 | | %a1 = buf | 31 | | %a1 = buf |
32 | move.l 4(%a0), %d1 | %d1 = data->num_channels | 32 | move.l 4(%a0), %d1 | %d1 = data->num_channels |
33 | move.l 32(%a0), %a0 | %a0 = data->gain (in s8.23) | 33 | move.l 32(%a0), %a0 | %a0 = data->gain (in s8.23) |
34 | 10: | channel loop | | 34 | 10: | channel loop | |
35 | move.l 24(%sp), %d0 | %d0 = count | 35 | move.l 24(%sp), %d0 | %d0 = count |
36 | move.l -4(%a1, %d1.l*4), %a2 | %a2 = s = buf[ch-1] | 36 | move.l -4(%a1, %d1.l*4), %a2 | %a2 = s = buf[ch-1] |
37 | move.l %a2, %a3 | %a3 = d = s | 37 | move.l %a2, %a3 | %a3 = d = s |
38 | move.l (%a2)+, %d2 | %d2 = *s++, | 38 | move.l (%a2)+, %d2 | %d2 = *s++, |
@@ -54,8 +54,8 @@ dsp_apply_gain: | |||
54 | asl.l #8, %d3 | *s = (S(n-1)[40:8] << 8) | S(n-1)[7:0] | 54 | asl.l #8, %d3 | *s = (S(n-1)[40:8] << 8) | S(n-1)[7:0] |
55 | move.b %d4, %d3 | | 55 | move.b %d4, %d3 | |
56 | move.l %d3, (%a3) | | 56 | move.l %d3, (%a3) | |
57 | subq.l #1, %d1 | next channel | 57 | subq.l #1, %d1 | next channel |
58 | bgt.b 10b | channel loop | | 58 | bgt.b 10b | channel loop | |
59 | movem.l (%sp), %d2-%d4/%a2-%a3 | restore registers | 59 | movem.l (%sp), %d2-%d4/%a2-%a3 | restore registers |
60 | lea.l 20(%sp), %sp | cleanup stack | 60 | lea.l 20(%sp), %sp | cleanup stack |
61 | rts | | 61 | rts | |
@@ -65,7 +65,7 @@ dsp_apply_gain: | |||
65 | * void apply_crossfeed(int count, int32_t *buf[]) | 65 | * void apply_crossfeed(int count, int32_t *buf[]) |
66 | */ | 66 | */ |
67 | .section .text | 67 | .section .text |
68 | .align 2 | 68 | .align 2 |
69 | .global apply_crossfeed | 69 | .global apply_crossfeed |
70 | apply_crossfeed: | 70 | apply_crossfeed: |
71 | lea.l -44(%sp), %sp | | 71 | lea.l -44(%sp), %sp | |
@@ -129,7 +129,7 @@ apply_crossfeed: | |||
129 | * in32_t *src[], int32_t *dst[]) | 129 | * in32_t *src[], int32_t *dst[]) |
130 | */ | 130 | */ |
131 | .section .text | 131 | .section .text |
132 | .align 2 | 132 | .align 2 |
133 | .global dsp_downsample | 133 | .global dsp_downsample |
134 | dsp_downsample: | 134 | dsp_downsample: |
135 | lea.l -40(%sp), %sp | save non-clobberables | 135 | lea.l -40(%sp), %sp | save non-clobberables |
@@ -192,7 +192,7 @@ dsp_downsample: | |||
192 | * int32_t *src[], int32_t *dst[]) | 192 | * int32_t *src[], int32_t *dst[]) |
193 | */ | 193 | */ |
194 | .section .text | 194 | .section .text |
195 | .align 2 | 195 | .align 2 |
196 | .global dsp_upsample | 196 | .global dsp_upsample |
197 | dsp_upsample: | 197 | dsp_upsample: |
198 | lea.l -40(%sp), %sp | save non-clobberables | 198 | lea.l -40(%sp), %sp | save non-clobberables |
@@ -226,10 +226,10 @@ dsp_upsample: | |||
226 | cmp.l %d2, %d7 | past end of samples? | 226 | cmp.l %d2, %d7 | past end of samples? |
227 | bge.b 50f | skip resample loop| yes? go to next channel and collect info | 227 | bge.b 50f | skip resample loop| yes? go to next channel and collect info |
228 | lea.l (%a3, %d7.l*4), %a3 | %a3 = s = &s[pos+1] | 228 | lea.l (%a3, %d7.l*4), %a3 | %a3 = s = &s[pos+1] |
229 | movem.l -8(%a3), %d0-%d1 | %d0 = s[pos-1], %d1 = s[pos] | 229 | movem.l -8(%a3), %d0-%d1 | %d0 = s[pos-1], %d1 = s[pos] |
230 | move.l %d1, %d6 | save sample value | 230 | move.l %d1, %d6 | save sample value |
231 | sub.l %d0, %d1 | %d1 = diff = s[pos] - s[pos-1] | 231 | sub.l %d0, %d1 | %d1 = diff = s[pos] - s[pos-1] |
232 | bra.b 40f | loop start | | 232 | bra.b 40f | loop start | |
233 | 20: | next sample loop | | 233 | 20: | next sample loop | |
234 | move.l %d6, %d0 | move previous sample to %d0 | 234 | move.l %d6, %d0 | move previous sample to %d0 |
235 | move.l (%a3)+, %d1 | fetch next sample | 235 | move.l (%a3)+, %d1 | fetch next sample |
@@ -268,7 +268,7 @@ dsp_upsample: | |||
268 | * Mix left and right channels 50/50 into a center channel. | 268 | * Mix left and right channels 50/50 into a center channel. |
269 | */ | 269 | */ |
270 | .section .text | 270 | .section .text |
271 | .align 2 | 271 | .align 2 |
272 | .global channels_process_sound_chan_mono | 272 | .global channels_process_sound_chan_mono |
273 | channels_process_sound_chan_mono: | 273 | channels_process_sound_chan_mono: |
274 | movem.l 4(%sp), %d0/%a0 | %d0 = count, %a0 = buf | 274 | movem.l 4(%sp), %d0/%a0 | %d0 = count, %a0 = buf |
@@ -308,7 +308,7 @@ channels_process_sound_chan_mono: | |||
308 | * Apply stereo width (narrowing/expanding) effect. | 308 | * Apply stereo width (narrowing/expanding) effect. |
309 | */ | 309 | */ |
310 | .section .text | 310 | .section .text |
311 | .align 2 | 311 | .align 2 |
312 | .global channels_process_sound_chan_custom | 312 | .global channels_process_sound_chan_custom |
313 | channels_process_sound_chan_custom: | 313 | channels_process_sound_chan_custom: |
314 | movem.l 4(%sp), %d0/%a0 | %d0 = count, %a0 = buf | 314 | movem.l 4(%sp), %d0/%a0 | %d0 = count, %a0 = buf |
@@ -330,7 +330,6 @@ channels_process_sound_chan_custom: | |||
330 | 10: | loop | | 330 | 10: | loop | |
331 | movclr.l %acc0, %d5 | | 331 | movclr.l %acc0, %d5 | |
332 | movclr.l %acc1, %d6 | | 332 | movclr.l %acc1, %d6 | |
333 | 15: | loop start | | ||
334 | mac.l %d1, %d3 , %acc0 | L = l*gain + r*cross | 333 | mac.l %d1, %d3 , %acc0 | L = l*gain + r*cross |
335 | mac.l %d1, %d4, (%a0)+, %d1, %acc1 | R = r*gain + l*cross | 334 | mac.l %d1, %d4, (%a0)+, %d1, %acc1 | R = r*gain + l*cross |
336 | mac.l %d2, %d4 , %acc0 | | 335 | mac.l %d2, %d4 , %acc0 | |
@@ -356,7 +355,7 @@ channels_process_sound_chan_custom: | |||
356 | * Separate channels into side channels. | 355 | * Separate channels into side channels. |
357 | */ | 356 | */ |
358 | .section .text | 357 | .section .text |
359 | .align 2 | 358 | .align 2 |
360 | .global channels_process_sound_chan_karaoke | 359 | .global channels_process_sound_chan_karaoke |
361 | channels_process_sound_chan_karaoke: | 360 | channels_process_sound_chan_karaoke: |
362 | movem.l 4(%sp), %d0/%a0 | %d0 = count, %a0 = buf | 361 | movem.l 4(%sp), %d0/%a0 | %d0 = count, %a0 = buf |
@@ -413,7 +412,7 @@ channels_process_sound_chan_karaoke: | |||
413 | * | 412 | * |
414 | */ | 413 | */ |
415 | .section .text | 414 | .section .text |
416 | .align 2 | 415 | .align 2 |
417 | .global sample_output_stereo | 416 | .global sample_output_stereo |
418 | sample_output_stereo: | 417 | sample_output_stereo: |
419 | lea.l -44(%sp), %sp | save registers | 418 | lea.l -44(%sp), %sp | save registers |
@@ -508,7 +507,7 @@ sample_output_stereo: | |||
508 | * Same treatment as sample_output_stereo but for one channel. | 507 | * Same treatment as sample_output_stereo but for one channel. |
509 | */ | 508 | */ |
510 | .section .text | 509 | .section .text |
511 | .align 2 | 510 | .align 2 |
512 | .global sample_output_mono | 511 | .global sample_output_mono |
513 | sample_output_mono: | 512 | sample_output_mono: |
514 | lea.l -28(%sp), %sp | save registers | 513 | lea.l -28(%sp), %sp | save registers |