-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSKP_Silk_schur.go
52 lines (51 loc) · 1.05 KB
/
SKP_Silk_schur.go
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
package silk
func SKP_Silk_schur(rc_Q15 []int16, c []int32, order int32) int32 {
var (
k int32
n int32
lz int32
C [17][2]int32
Ctmp1 int32
Ctmp2 int32
rc_tmp_Q15 int32
)
lz = SKP_Silk_CLZ32(c[0])
if lz < 2 {
for k = 0; k < order+1; k++ {
C[k][0] = func() int32 {
p := &C[k][1]
C[k][1] = (c[k]) >> 1
return *p
}()
}
} else if lz > 2 {
lz -= 2
for k = 0; k < order+1; k++ {
C[k][0] = func() int32 {
p := &C[k][1]
C[k][1] = (c[k]) << lz
return *p
}()
}
} else {
for k = 0; k < order+1; k++ {
C[k][0] = func() int32 {
p := &C[k][1]
C[k][1] = c[k]
return *p
}()
}
}
for k = 0; k < order; k++ {
rc_tmp_Q15 = -((C[k+1][0]) / SKP_max_32((C[0][1])>>15, 1))
rc_tmp_Q15 = int32(SKP_SAT16(rc_tmp_Q15))
rc_Q15[k] = int16(rc_tmp_Q15)
for n = 0; n < order-k; n++ {
Ctmp1 = C[n+k+1][0]
Ctmp2 = C[n][1]
C[n+k+1][0] = SKP_SMLAWB(Ctmp1, Ctmp2<<1, rc_tmp_Q15)
C[n][1] = SKP_SMLAWB(Ctmp2, Ctmp1<<1, rc_tmp_Q15)
}
}
return C[0][1]
}