FreeCalypso > hg > gsm-codec-lib
comparison libgsmefr/levinson.c @ 76:0e41ca9ebf45
libgsmefr: levinson.c compiles
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 26 Nov 2022 06:48:14 +0000 |
parents | 49dd1ac8e75b |
children | 1cdbaeec7bcc |
comparison
equal
deleted
inserted
replaced
75:8d63b167a5d3 | 76:0e41ca9ebf45 |
---|---|
31 * | 31 * |
32 * END | 32 * END |
33 * | 33 * |
34 *************************************************************************/ | 34 *************************************************************************/ |
35 | 35 |
36 #include "gsm_efr.h" | |
36 #include "typedef.h" | 37 #include "typedef.h" |
38 #include "namespace.h" | |
37 #include "basic_op.h" | 39 #include "basic_op.h" |
38 #include "oper_32b.h" | 40 #include "oper_32b.h" |
39 #include "count.h" | 41 #include "no_count.h" |
42 #include "sig_proc.h" | |
43 #include "cnst.h" | |
44 #include "enc_state.h" | |
40 | 45 |
41 /* Lpc order == 10 */ | 46 /* Lpc order == 10 */ |
42 | 47 |
43 #define M 10 | 48 #define M 10 |
44 | 49 |
45 /* Last A(z) for case of unstable filter */ | |
46 | |
47 Word16 old_A[M + 1]; | |
48 | |
49 void Levinson ( | 50 void Levinson ( |
51 struct EFR_encoder_state *st, | |
50 Word16 Rh[], /* (i) : Rh[m+1] Vector of autocorrelations (msb) */ | 52 Word16 Rh[], /* (i) : Rh[m+1] Vector of autocorrelations (msb) */ |
51 Word16 Rl[], /* (i) : Rl[m+1] Vector of autocorrelations (lsb) */ | 53 Word16 Rl[], /* (i) : Rl[m+1] Vector of autocorrelations (lsb) */ |
52 Word16 A[], /* (o) : A[m] LPC coefficients (m = 10) */ | 54 Word16 A[], /* (o) : A[m] LPC coefficients (m = 10) */ |
53 Word16 rc[] /* (o) : rc[4] First 4 reflection coefficients */ | 55 Word16 rc[] /* (o) : rc[4] First 4 reflection coefficients */ |
54 | 56 |
125 { | 127 { |
126 rc[i - 1] = round (t2); move16 (); | 128 rc[i - 1] = round (t2); move16 (); |
127 } | 129 } |
128 /* Test for unstable filter. If unstable keep old A(z) */ | 130 /* Test for unstable filter. If unstable keep old A(z) */ |
129 | 131 |
130 test (); | |
131 if (sub (abs_s (Kh), 32750) > 0) | 132 if (sub (abs_s (Kh), 32750) > 0) |
132 { | 133 { |
133 for (j = 0; j <= M; j++) | 134 for (j = 0; j <= M; j++) |
134 { | 135 { |
135 A[j] = old_A[j]; move16 (); | 136 A[j] = st->old_A[j]; |
136 } | 137 } |
137 | 138 |
138 for (j = 0; j < 4; j++) | 139 for (j = 0; j < 4; j++) |
139 { | 140 { |
140 rc[j] = 0; move16 (); | 141 rc[j] = 0; |
141 } | 142 } |
142 | 143 |
143 return; | 144 return; |
144 } | 145 } |
145 /*------------------------------------------* | 146 /*------------------------------------------* |
185 | 186 |
186 A[0] = 4096; move16 (); | 187 A[0] = 4096; move16 (); |
187 for (i = 1; i <= M; i++) | 188 for (i = 1; i <= M; i++) |
188 { | 189 { |
189 t0 = L_Comp (Ah[i], Al[i]); | 190 t0 = L_Comp (Ah[i], Al[i]); |
190 old_A[i] = A[i] = round (L_shl (t0, 1));move16 (); move16 (); | 191 st->old_A[i] = A[i] = round (L_shl (t0, 1)); |
191 } | 192 } |
192 | 193 |
193 return; | 194 return; |
194 } | 195 } |