amixer.s
1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
* amixer.s
*
* Single precision mixer. Takes an input buffer, output buffer,
* count and a gain and mixes the input into the output.
* Assumes double quad alignment.
*
*/
/* Semi-permanent scalar registers */
.name dm_in, $20 # DMEM Input - points to samples
.name dm_out, $19 # DMEM output
.name ocount, $18 # Actual number of bytes (2 per sample)
.name gain, $17
.name tmp0, $16
/* Semi-permanent vector registers */
.name vconst, $v31
.name vgain, $v30
.name vin0, $v29
.name vin1, $v28
.name vout0, $v27
.name vout1, $v26
# Get address of input and output
case_A_MIXER:
lqv vconst[0], VCONST_OFFSET(zero)
lhu ocount, RSP_PARAMETER_COUNT(parbase)
beq ocount, zero, MIXdone
nop
andi dm_out, aud1, 0xffff
addi dm_out, dm_out, RSP_BUFFER_OFFSET
srl dm_in, aud1, 16
addi dm_in, dm_in, RSP_BUFFER_OFFSET
andi gain, aud0, 0xffff
mtc2 gain, vgain
lqv vout0[0], 0(dm_out)
lqv vin0[0], 0(dm_in)
lqv vout1[0], 16(dm_out)
lqv vin1[0], 16(dm_in)
MIXloop:
vmulf vout0, vout0, vconst[6]
addi ocount, ocount, -32
vmacf vout0, vin0, vgain[0]
addi dm_in, dm_in, 32
sqv vout0[0], 0(dm_out)
vmulf vout1, vout1, vconst[6]
lqv vin0[0], 0(dm_in)
vmacf vout1, vin1, vgain[0]
lqv vin1[0], 16(dm_in)
sqv vout1[0], 16(dm_out)
addi dm_out, dm_out, 32
lqv vout0[0], 0(dm_out)
bgtz ocount, MIXloop
lqv vout1[0], 16(dm_out)
MIXdone:
j AudDone
nop
.unname dm_in
.unname dm_out
.unname ocount
.unname gain
.unname tmp0
.unname vconst
.unname vgain
.unname vin0
.unname vin1
.unname vout0
.unname vout1