comparison libgsmefr/e_homing.c @ 68:aacdf352576c

libgsmefr: e_homing.c compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 26 Nov 2022 05:21:50 +0000
parents 49dd1ac8e75b
children 035424a6ca83
comparison
equal deleted inserted replaced
67:58b64224d4ac 68:aacdf352576c
15 * variables for the encoder and VAD, and 15 * variables for the encoder and VAD, and
16 * for the transmit DTX and Comfort Noise. 16 * for the transmit DTX and Comfort Noise.
17 * 17 *
18 **************************************************************************/ 18 **************************************************************************/
19 19
20 #include "gsm_efr.h"
20 #include "typedef.h" 21 #include "typedef.h"
22 #include "namespace.h"
21 #include "cnst.h" 23 #include "cnst.h"
22 #include "vad.h" 24 #include "vad.h"
23 #include "dtx.h" 25 #include "dtx.h"
24 #include "codec.h" 26 #include "codec.h"
25 #include "sig_proc.h" 27 #include "sig_proc.h"
28 #include "memops.h"
29 #include "enc_state.h"
26 #include "e_homing.h" 30 #include "e_homing.h"
27 31
28 /*************************************************************************** 32 /***************************************************************************
29 * 33 *
30 * FUNCTION NAME: encoder_homing_frame_test 34 * FUNCTION NAME: encoder_homing_frame_test
76 * RETURN: 80 * RETURN:
77 * None 81 * None
78 * 82 *
79 **************************************************************************/ 83 **************************************************************************/
80 84
81 void encoder_reset (void) 85 void encoder_reset (struct EFR_encoder_state *st)
82 { 86 {
83 /* External declarations for encoder variables which need to be reset */
84
85 /* Variables defined in levinson.c */
86 /* ------------------------------- */
87 extern Word16 old_A[M + 1]; /* Last A(z) for case of unstable filter */
88
89 /* Variables defined in q_gains.c */
90 /* ------------------------------- */
91 /* Memories of gain quantization: */
92 extern Word16 past_qua_en[4], pred[4];
93
94 /* Variables defined in q_plsf_5.c */
95 /* ------------------------------- */
96 /* Past quantized prediction error */
97 extern Word16 past_r2_q[M];
98
99 Word16 i; 87 Word16 i;
100 88
101 /* reset all the encoder state variables */ 89 /* reset all the encoder state variables */
102 /* ------------------------------------- */ 90 /* ------------------------------------- */
103 91
104 /* Variables in cod_12k2.c: */ 92 /* Variables in cod_12k2.c: */
105 Init_Coder_12k2 (); 93 Init_Coder_12k2 (st);
106 94
107 /* Variables in levinson.c: */ 95 /* Variables in levinson.c: */
108 old_A[0] = 4096; /* Last A(z) for case of unstable filter */ 96 st->old_A[0] = 4096; /* Last A(z) for case of unstable filter */
109 for (i = 1; i < M + 1; i++) 97 for (i = 1; i < M + 1; i++)
110 { 98 {
111 old_A[i] = 0; 99 st->old_A[i] = 0;
112 } 100 }
113 101
114 /* Variables in pre_proc.c: */ 102 /* Variables in pre_proc.c: */
115 Init_Pre_Process (); 103 Init_Pre_Process (st);
116 104
117 /* Variables in q_gains.c: */ 105 /* Variables in q_gains.c: */
118 for (i = 0; i < 4; i++) 106 for (i = 0; i < 4; i++)
119 { 107 {
120 past_qua_en[i] = -2381; /* past quantized energies */ 108 st->past_qua_en[i] = -2381; /* past quantized energies */
121 } 109 }
122 110
123 pred[0] = 44; /* MA prediction coeff */ 111 st->pred[0] = 44; /* MA prediction coeff */
124 pred[1] = 37; /* MA prediction coeff */ 112 st->pred[1] = 37; /* MA prediction coeff */
125 pred[2] = 22; /* MA prediction coeff */ 113 st->pred[2] = 22; /* MA prediction coeff */
126 pred[3] = 12; /* MA prediction coeff */ 114 st->pred[3] = 12; /* MA prediction coeff */
127 115
128 /* Variables in q_plsf_5.c: */ 116 /* Variables in q_plsf_5.c: */
129 for (i = 0; i < M; i++) 117 for (i = 0; i < M; i++)
130 { 118 {
131 past_r2_q[i] = 0; /* Past quantized prediction error */ 119 st->past_r2_q[i] = 0; /* Past quantized prediction error */
132 } 120 }
133 121
134 return; 122 return;
135 } 123 }
136 124
151 * RETURN: 139 * RETURN:
152 * None 140 * None
153 * 141 *
154 **************************************************************************/ 142 **************************************************************************/
155 143
156 void reset_enc (void) 144 void EFR_encoder_reset (struct EFR_encoder_state *st, int dtx)
157 { 145 {
158 encoder_reset (); /* reset all the state variables in the speech encoder*/ 146 st->dtx_mode = dtx;
159 vad_reset (); /* reset all the VAD state variables */ 147
160 reset_tx_dtx (); /* reset all the transmit DTX and CN variables */ 148 encoder_reset (st); /* reset all the state variables in the speech encoder*/
149 vad_reset (st); /* reset all the VAD state variables */
150 reset_tx_dtx (st); /* reset all the transmit DTX and CN variables */
161 151
162 return; 152 return;
163 } 153 }