-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSKP_Silk_setup_complexity.go
50 lines (49 loc) · 1.91 KB
/
SKP_Silk_setup_complexity.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
package silk
func SKP_Silk_setup_complexity(psEncC *SKP_Silk_encoder_state, Complexity int32) int32 {
var ret int32 = SKP_SILK_NO_ERROR
if LOW_COMPLEXITY_ONLY != 0 && Complexity != 0 {
ret = -6
}
if Complexity == 0 || LOW_COMPLEXITY_ONLY != 0 {
psEncC.Complexity = 0
psEncC.PitchEstimationComplexity = SKP_Silk_PITCH_EST_MIN_COMPLEX
psEncC.PitchEstimationThreshold_Q16 = SKP_FIX_CONST(0.8, 16)
psEncC.PitchEstimationLPCOrder = 6
psEncC.ShapingLPCOrder = 8
psEncC.La_shape = psEncC.Fs_kHz * 3
psEncC.NStatesDelayedDecision = 1
psEncC.UseInterpolatedNLSFs = 0
psEncC.LTPQuantLowComplexity = 1
psEncC.NLSF_MSVQ_Survivors = MAX_NLSF_MSVQ_SURVIVORS_LC_MODE
psEncC.Warping_Q16 = 0
} else if Complexity == 1 {
psEncC.Complexity = 1
psEncC.PitchEstimationComplexity = SKP_Silk_PITCH_EST_MID_COMPLEX
psEncC.PitchEstimationThreshold_Q16 = SKP_FIX_CONST(0.75, 16)
psEncC.PitchEstimationLPCOrder = 12
psEncC.ShapingLPCOrder = 12
psEncC.La_shape = psEncC.Fs_kHz * 5
psEncC.NStatesDelayedDecision = 2
psEncC.UseInterpolatedNLSFs = 0
psEncC.LTPQuantLowComplexity = 0
psEncC.NLSF_MSVQ_Survivors = MAX_NLSF_MSVQ_SURVIVORS_MC_MODE
psEncC.Warping_Q16 = psEncC.Fs_kHz * SKP_FIX_CONST(0.015, 16)
} else if Complexity == 2 {
psEncC.Complexity = 2
psEncC.PitchEstimationComplexity = SKP_Silk_PITCH_EST_MAX_COMPLEX
psEncC.PitchEstimationThreshold_Q16 = SKP_FIX_CONST(0.7, 16)
psEncC.PitchEstimationLPCOrder = 16
psEncC.ShapingLPCOrder = 16
psEncC.La_shape = psEncC.Fs_kHz * 5
psEncC.NStatesDelayedDecision = MAX_DEL_DEC_STATES
psEncC.UseInterpolatedNLSFs = 1
psEncC.LTPQuantLowComplexity = 0
psEncC.NLSF_MSVQ_Survivors = MAX_NLSF_MSVQ_SURVIVORS
psEncC.Warping_Q16 = psEncC.Fs_kHz * SKP_FIX_CONST(0.015, 16)
} else {
ret = -6
}
psEncC.PitchEstimationLPCOrder = SKP_min_int(psEncC.PitchEstimationLPCOrder, psEncC.PredictLPCOrder)
psEncC.ShapeWinLength = psEncC.Fs_kHz*5 + psEncC.La_shape*2
return ret
}