Lines Matching refs:inst

66 int WebRtcVad_InitCore(VadInstT *inst, short mode)
71 inst->vad = 1;
72 inst->frame_counter = 0;
73 inst->over_hang = 0;
74 inst->num_of_speech = 0;
77 inst->downsampling_filter_states[0] = 0;
78 inst->downsampling_filter_states[1] = 0;
79 inst->downsampling_filter_states[2] = 0;
80 inst->downsampling_filter_states[3] = 0;
85 inst->noise_means[i] = kNoiseDataMeans[i];
86 inst->speech_means[i] = kSpeechDataMeans[i];
87 inst->noise_stds[i] = kNoiseDataStds[i];
88 inst->speech_stds[i] = kSpeechDataStds[i];
94 inst->low_value_vector[i] = 10000;
95 inst->index_vector[i] = 0;
100 inst->upper_state[i] = 0;
101 inst->lower_state[i] = 0;
106 inst->hp_filter_state[i] = 0;
110 inst->mean_value[0] = 1600;
111 inst->mean_value[1] = 1600;
112 inst->mean_value[2] = 1600;
113 inst->mean_value[3] = 1600;
114 inst->mean_value[4] = 1600;
115 inst->mean_value[5] = 1600;
120 inst->over_hang_max_1[0] = OHMAX1_10MS_Q; // Overhang short speech burst
121 inst->over_hang_max_1[1] = OHMAX1_20MS_Q; // Overhang short speech burst
122 inst->over_hang_max_1[2] = OHMAX1_30MS_Q; // Overhang short speech burst
123 inst->over_hang_max_2[0] = OHMAX2_10MS_Q; // Overhang long speech burst
124 inst->over_hang_max_2[1] = OHMAX2_20MS_Q; // Overhang long speech burst
125 inst->over_hang_max_2[2] = OHMAX2_30MS_Q; // Overhang long speech burst
127 inst->individual[0] = INDIVIDUAL_10MS_Q;
128 inst->individual[1] = INDIVIDUAL_20MS_Q;
129 inst->individual[2] = INDIVIDUAL_30MS_Q;
131 inst->total[0] = TOTAL_10MS_Q;
132 inst->total[1] = TOTAL_20MS_Q;
133 inst->total[2] = TOTAL_30MS_Q;
137 inst->over_hang_max_1[0] = OHMAX1_10MS_LBR; // Overhang short speech burst
138 inst->over_hang_max_1[1] = OHMAX1_20MS_LBR; // Overhang short speech burst
139 inst->over_hang_max_1[2] = OHMAX1_30MS_LBR; // Overhang short speech burst
140 inst->over_hang_max_2[0] = OHMAX2_10MS_LBR; // Overhang long speech burst
141 inst->over_hang_max_2[1] = OHMAX2_20MS_LBR; // Overhang long speech burst
142 inst->over_hang_max_2[2] = OHMAX2_30MS_LBR; // Overhang long speech burst
144 inst->individual[0] = INDIVIDUAL_10MS_LBR;
145 inst->individual[1] = INDIVIDUAL_20MS_LBR;
146 inst->individual[2] = INDIVIDUAL_30MS_LBR;
148 inst->total[0] = TOTAL_10MS_LBR;
149 inst->total[1] = TOTAL_20MS_LBR;
150 inst->total[2] = TOTAL_30MS_LBR;
154 inst->over_hang_max_1[0] = OHMAX1_10MS_AGG; // Overhang short speech burst
155 inst->over_hang_max_1[1] = OHMAX1_20MS_AGG; // Overhang short speech burst
156 inst->over_hang_max_1[2] = OHMAX1_30MS_AGG; // Overhang short speech burst
157 inst->over_hang_max_2[0] = OHMAX2_10MS_AGG; // Overhang long speech burst
158 inst->over_hang_max_2[1] = OHMAX2_20MS_AGG; // Overhang long speech burst
159 inst->over_hang_max_2[2] = OHMAX2_30MS_AGG; // Overhang long speech burst
161 inst->individual[0] = INDIVIDUAL_10MS_AGG;
162 inst->individual[1] = INDIVIDUAL_20MS_AGG;
163 inst->individual[2] = INDIVIDUAL_30MS_AGG;
165 inst->total[0] = TOTAL_10MS_AGG;
166 inst->total[1] = TOTAL_20MS_AGG;
167 inst->total[2] = TOTAL_30MS_AGG;
171 inst->over_hang_max_1[0] = OHMAX1_10MS_VAG; // Overhang short speech burst
172 inst->over_hang_max_1[1] = OHMAX1_20MS_VAG; // Overhang short speech burst
173 inst->over_hang_max_1[2] = OHMAX1_30MS_VAG; // Overhang short speech burst
174 inst->over_hang_max_2[0] = OHMAX2_10MS_VAG; // Overhang long speech burst
175 inst->over_hang_max_2[1] = OHMAX2_20MS_VAG; // Overhang long speech burst
176 inst->over_hang_max_2[2] = OHMAX2_30MS_VAG; // Overhang long speech burst
178 inst->individual[0] = INDIVIDUAL_10MS_VAG;
179 inst->individual[1] = INDIVIDUAL_20MS_VAG;
180 inst->individual[2] = INDIVIDUAL_30MS_VAG;
182 inst->total[0] = TOTAL_10MS_VAG;
183 inst->total[1] = TOTAL_20MS_VAG;
184 inst->total[2] = TOTAL_30MS_VAG;
187 inst->init_flag = kInitCheck;
193 int WebRtcVad_set_mode_core(VadInstT *inst, short mode)
199 inst->over_hang_max_1[0] = OHMAX1_10MS_Q; // Overhang short speech burst
200 inst->over_hang_max_1[1] = OHMAX1_20MS_Q; // Overhang short speech burst
201 inst->over_hang_max_1[2] = OHMAX1_30MS_Q; // Overhang short speech burst
202 inst->over_hang_max_2[0] = OHMAX2_10MS_Q; // Overhang long speech burst
203 inst->over_hang_max_2[1] = OHMAX2_20MS_Q; // Overhang long speech burst
204 inst->over_hang_max_2[2] = OHMAX2_30MS_Q; // Overhang long speech burst
206 inst->individual[0] = INDIVIDUAL_10MS_Q;
207 inst->individual[1] = INDIVIDUAL_20MS_Q;
208 inst->individual[2] = INDIVIDUAL_30MS_Q;
210 inst->total[0] = TOTAL_10MS_Q;
211 inst->total[1] = TOTAL_20MS_Q;
212 inst->total[2] = TOTAL_30MS_Q;
216 inst->over_hang_max_1[0] = OHMAX1_10MS_LBR; // Overhang short speech burst
217 inst->over_hang_max_1[1] = OHMAX1_20MS_LBR; // Overhang short speech burst
218 inst->over_hang_max_1[2] = OHMAX1_30MS_LBR; // Overhang short speech burst
219 inst->over_hang_max_2[0] = OHMAX2_10MS_LBR; // Overhang long speech burst
220 inst->over_hang_max_2[1] = OHMAX2_20MS_LBR; // Overhang long speech burst
221 inst->over_hang_max_2[2] = OHMAX2_30MS_LBR; // Overhang long speech burst
223 inst->individual[0] = INDIVIDUAL_10MS_LBR;
224 inst->individual[1] = INDIVIDUAL_20MS_LBR;
225 inst->individual[2] = INDIVIDUAL_30MS_LBR;
227 inst->total[0] = TOTAL_10MS_LBR;
228 inst->total[1] = TOTAL_20MS_LBR;
229 inst->total[2] = TOTAL_30MS_LBR;
233 inst->over_hang_max_1[0] = OHMAX1_10MS_AGG; // Overhang short speech burst
234 inst->over_hang_max_1[1] = OHMAX1_20MS_AGG; // Overhang short speech burst
235 inst->over_hang_max_1[2] = OHMAX1_30MS_AGG; // Overhang short speech burst
236 inst->over_hang_max_2[0] = OHMAX2_10MS_AGG; // Overhang long speech burst
237 inst->over_hang_max_2[1] = OHMAX2_20MS_AGG; // Overhang long speech burst
238 inst->over_hang_max_2[2] = OHMAX2_30MS_AGG; // Overhang long speech burst
240 inst->individual[0] = INDIVIDUAL_10MS_AGG;
241 inst->individual[1] = INDIVIDUAL_20MS_AGG;
242 inst->individual[2] = INDIVIDUAL_30MS_AGG;
244 inst->total[0] = TOTAL_10MS_AGG;
245 inst->total[1] = TOTAL_20MS_AGG;
246 inst->total[2] = TOTAL_30MS_AGG;
250 inst->over_hang_max_1[0] = OHMAX1_10MS_VAG; // Overhang short speech burst
251 inst->over_hang_max_1[1] = OHMAX1_20MS_VAG; // Overhang short speech burst
252 inst->over_hang_max_1[2] = OHMAX1_30MS_VAG; // Overhang short speech burst
253 inst->over_hang_max_2[0] = OHMAX2_10MS_VAG; // Overhang long speech burst
254 inst->over_hang_max_2[1] = OHMAX2_20MS_VAG; // Overhang long speech burst
255 inst->over_hang_max_2[2] = OHMAX2_30MS_VAG; // Overhang long speech burst
257 inst->individual[0] = INDIVIDUAL_10MS_VAG;
258 inst->individual[1] = INDIVIDUAL_20MS_VAG;
259 inst->individual[2] = INDIVIDUAL_30MS_VAG;
261 inst->total[0] = TOTAL_10MS_VAG;
262 inst->total[1] = TOTAL_20MS_VAG;
263 inst->total[2] = TOTAL_30MS_VAG;
275 WebRtc_Word16 WebRtcVad_CalcVad32khz(VadInstT *inst, WebRtc_Word16 *speech_frame,
284 WebRtcVad_Downsampling(speech_frame, speechWB, &(inst->downsampling_filter_states[2]),
288 WebRtcVad_Downsampling(speechWB, speechNB, inst->downsampling_filter_states, len);
292 vad = WebRtcVad_CalcVad8khz(inst, speechNB, len);
297 WebRtc_Word16 WebRtcVad_CalcVad16khz(VadInstT *inst, WebRtc_Word16 *speech_frame,
304 WebRtcVad_Downsampling(speech_frame, speechNB, inst->downsampling_filter_states,
308 vad = WebRtcVad_CalcVad8khz(inst, speechNB, len);
313 WebRtc_Word16 WebRtcVad_CalcVad8khz(VadInstT *inst, WebRtc_Word16 *speech_frame,
319 total_power = WebRtcVad_get_features(inst, speech_frame, frame_length, feature_vector);
322 inst->vad = WebRtcVad_GmmProbability(inst, feature_vector, total_power, frame_length);
324 return inst->vad;
329 WebRtc_Word16 WebRtcVad_GmmProbability(VadInstT *inst, WebRtc_Word16 *feature_vector,
358 overhead1 = inst->over_hang_max_1[0];
359 overhead2 = inst->over_hang_max_2[0];
360 individualTest = inst->individual[0];
361 totalTest = inst->total[0];
365 overhead1 = inst->over_hang_max_1[1];
366 overhead2 = inst->over_hang_max_2[1];
367 individualTest = inst->individual[1];
368 totalTest = inst->total[1];
372 overhead1 = inst->over_hang_max_1[2];
373 overhead2 = inst->over_hang_max_2[2];
374 individualTest = inst->individual[2];
375 totalTest = inst->total[2];
382 nmean1ptr = &inst->noise_means[0];
383 nmean2ptr = &inst->noise_means[NUM_CHANNELS];
384 smean1ptr = &inst->speech_means[0];
385 smean2ptr = &inst->speech_means[NUM_CHANNELS];
386 nstd1ptr = &inst->noise_stds[0];
387 nstd2ptr = &inst->noise_stds[NUM_CHANNELS];
388 sstd1ptr = &inst->speech_stds[0];
389 sstd2ptr = &inst->speech_stds[NUM_CHANNELS];
480 nmean1ptr = &inst->noise_means[0];
481 smean1ptr = &inst->speech_means[0];
482 nstd1ptr = &inst->noise_stds[0];
483 sstd1ptr = &inst->speech_stds[0];
494 backval = WebRtcVad_FindMinimum(inst, feature_vector[n], n); // Q4
697 inst->frame_counter++;
706 if (inst->over_hang > 0)
708 vadflag = 2 + inst->over_hang;
709 inst->over_hang = inst->over_hang - 1;
711 inst->num_of_speech = 0;
714 inst->num_of_speech = inst->num_of_speech + 1;
715 if (inst->num_of_speech > NSP_MAX)
717 inst->num_of_speech = NSP_MAX;
718 inst->over_hang = overhead2;
720 inst->over_hang = overhead1;