Line data Source code
1 : /******************************************************************************************************
2 :
3 : (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
4 : Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
5 : Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
6 : Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
7 : contributors to this repository. All Rights Reserved.
8 :
9 : This software is protected by copyright law and by international treaties.
10 : The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
11 : Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
12 : Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
13 : Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
14 : contributors to this repository retain full ownership rights in their respective contributions in
15 : the software. This notice grants no license of any kind, including but not limited to patent
16 : license, nor is any license granted by implication, estoppel or otherwise.
17 :
18 : Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
19 : contributions.
20 :
21 : This software is provided "AS IS", without any express or implied warranties. The software is in the
22 : development stage. It is intended exclusively for experts who have experience with such software and
23 : solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
24 : and fitness for a particular purpose are hereby disclaimed and excluded.
25 :
26 : Any dispute, controversy or claim arising under or in relation to providing this software shall be
27 : submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
28 : accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
29 : the United Nations Convention on Contracts on the International Sales of Goods.
30 :
31 : *******************************************************************************************************/
32 :
33 : /*====================================================================================
34 : EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
35 : ====================================================================================*/
36 :
37 : #include <stdint.h>
38 : #include "options.h"
39 : #ifdef DEBUGGING
40 : #include "debug.h"
41 : #endif
42 : #include <math.h>
43 : #include "cnst.h"
44 : #include "prot.h"
45 : #include "rom_com.h"
46 : #include "wmc_auto.h"
47 :
48 : /*---------------------------------------------------------------------*
49 : * Local constants
50 : *---------------------------------------------------------------------*/
51 :
52 : #define A2 0.2f
53 : #define GAIN_VAR 0.000011f
54 :
55 : /*-------------------------------------------------------*
56 : * CNG_exc()
57 : *
58 : * Comfort noise generation routine
59 : *-------------------------------------------------------*/
60 :
61 26917 : void CNG_exc(
62 : const int32_t core_brate, /* i : core bitrate */
63 : const int16_t L_frame, /* i : length of the frame */
64 : float *Enew, /* i/o: decoded SID energy */
65 : int16_t *seed, /* i/o: random generator seed */
66 : float exc[], /* o : current non-enhanced excitation */
67 : float exc2[], /* o : current enhanced excitation */
68 : float *lp_ener, /* i/o: LP filtered E */
69 : const int32_t last_core_brate, /* i : previous frame core bitrate */
70 : int16_t *first_CNG, /* i/o: first CNG frame flag for energy init. */
71 : int16_t *cng_ener_seed, /* i/o: random generator seed for CNG energy */
72 : float bwe_exc[], /* o : excitation for SWB TBE */
73 : const int16_t allow_cn_step, /* i : allow CN step */
74 : int16_t *last_allow_cn_step, /* i/o: last allow step */
75 : const int16_t num_ho, /* i : number of selected hangover frames */
76 : float q_env[],
77 : float *lp_env,
78 : float *old_env,
79 : float *exc_mem,
80 : float *exc_mem1,
81 : int16_t *sid_bw,
82 : int16_t *cng_ener_seed1,
83 : float exc3[],
84 : const int16_t Opt_AMR_WB, /* i : AMR-WB interop flag */
85 : const int16_t element_mode /* i : IVAS Element mode */
86 : )
87 : {
88 : float enr;
89 : int16_t i;
90 : float ener_lp;
91 : int16_t i_subfr;
92 : int16_t pit_max;
93 : float ftmp;
94 : float *ptR, *ptI;
95 : float fft_io[L_FRAME16k];
96 : float itmp[129];
97 : float env[NUM_ENV_CNG];
98 : float enr1;
99 : float denv[NUM_ENV_CNG];
100 :
101 : /*------------------------------------------------------------------*
102 : * Initializations
103 : *------------------------------------------------------------------*/
104 :
105 26917 : if ( L_frame == L_FRAME )
106 : {
107 12140 : pit_max = PIT_MAX;
108 : }
109 : else /* L_frame == L_FRAME16k */
110 : {
111 14777 : pit_max = PIT16k_MAX;
112 : }
113 :
114 : /*---------------------------------------------------------------------*
115 : * Initialization of CNG energy for the first CNG frame
116 : *---------------------------------------------------------------------*/
117 :
118 26917 : if ( *first_CNG == 0 )
119 : {
120 222 : if ( core_brate == FRAME_NO_DATA )
121 : {
122 : /* needed only in decoder when the very first SID frame was erased and this frame is FRAME_NO_DATA frame */
123 0 : *Enew = dotp( exc - pit_max, exc - pit_max, pit_max ) / pit_max;
124 : }
125 :
126 222 : if ( element_mode == EVS_MONO )
127 : {
128 96 : *lp_ener = *Enew;
129 : }
130 : }
131 :
132 : /*---------------------------------------------------------------------*
133 : * Update CNG energy
134 : *---------------------------------------------------------------------*/
135 :
136 26917 : if ( last_core_brate != SID_1k75 && last_core_brate != FRAME_NO_DATA && last_core_brate != SID_2k40 )
137 : {
138 : /* Partially reset CNG energy after active speech period */
139 2094 : if ( allow_cn_step == 0 && *last_allow_cn_step == 0 )
140 : {
141 1750 : if ( num_ho < 3 || *Enew < 1.5f * *lp_ener )
142 : {
143 1491 : *lp_ener = 0.8f * *lp_ener + 0.2f * *Enew;
144 : }
145 : else
146 : {
147 259 : *lp_ener = 0.95f * *lp_ener + 0.05f * *Enew;
148 : }
149 : }
150 : else
151 : {
152 344 : *lp_ener = *Enew;
153 344 : *last_allow_cn_step = 0;
154 : }
155 : }
156 : else
157 : {
158 : /* normal CNG update */
159 24823 : if ( *last_allow_cn_step == 0 )
160 : {
161 24299 : *lp_ener = (float) ( A2 * *Enew + ( 1 - A2 ) * *lp_ener );
162 : }
163 : else
164 : {
165 524 : if ( core_brate == SID_1k75 || core_brate == SID_2k40 )
166 : {
167 19 : *last_allow_cn_step = 0;
168 : }
169 :
170 524 : *lp_ener = *Enew;
171 : }
172 : }
173 :
174 26917 : if ( allow_cn_step == 1 )
175 : {
176 212 : *last_allow_cn_step = 1;
177 : }
178 :
179 : /* If not mono, skip CNG here */
180 26917 : if ( element_mode > IVAS_SCE )
181 : {
182 6928 : return;
183 : }
184 :
185 : /*---------------------------------------------------------------------*
186 : * Generate white noise vector
187 : *---------------------------------------------------------------------*/
188 :
189 5770709 : for ( i = 0; i < L_frame; i++ )
190 : {
191 5750720 : exc2[i] = (float) own_random( seed );
192 : }
193 :
194 : /*------------------------------------------------------------*
195 : * Insert random variation for excitation energy
196 : * (random variation is scaled according to *lp_ener value)
197 : *------------------------------------------------------------*/
198 :
199 109844 : for ( i_subfr = 0; i_subfr < L_frame; i_subfr += L_SUBFR )
200 : {
201 89855 : ener_lp = ( ( own_random( cng_ener_seed ) * ( *lp_ener ) ) * GAIN_VAR ) + ( *lp_ener );
202 :
203 89855 : if ( ener_lp < 0.0f )
204 : {
205 0 : ener_lp = 0.01f;
206 : }
207 89855 : enr = dotp( &exc2[i_subfr], &exc2[i_subfr], L_SUBFR ) + 0.01f;
208 :
209 89855 : enr = (float) sqrt( ener_lp * L_SUBFR / enr );
210 :
211 5840575 : for ( i = 0; i < L_SUBFR; i++ )
212 : {
213 5750720 : exc2[i_subfr + i] *= enr;
214 : }
215 : }
216 :
217 19989 : if ( Opt_AMR_WB != 1 )
218 : {
219 18204 : mvr2r( exc2, exc3, L_FRAME16k );
220 :
221 18204 : enr1 = (float) log10( *Enew * L_frame + 0.1f ) / (float) log10( 2.0f );
222 :
223 18204 : if ( core_brate == SID_2k40 )
224 : {
225 3149 : if ( *sid_bw == 0 )
226 : {
227 5649 : for ( i = 0; i < NUM_ENV_CNG; i++ )
228 : {
229 : /* get quantized envelope */
230 5380 : env[i] = powf( 2.0f, ( enr1 - q_env[i] ) );
231 : }
232 : }
233 :
234 : /* initialize CNG envelope */
235 3149 : if ( *first_CNG == 0 && *sid_bw == 0 )
236 : {
237 10 : mvr2r( env, lp_env, NUM_ENV_CNG );
238 : }
239 :
240 3149 : if ( *sid_bw == 0 )
241 : {
242 269 : mvr2r( env, old_env, NUM_ENV_CNG );
243 : }
244 : }
245 :
246 382284 : for ( i = 0; i < NUM_ENV_CNG; i++ )
247 : {
248 : /* get AR low-passed envelope */
249 364080 : lp_env[i] = 0.9f * lp_env[i] + ( 1 - 0.9f ) * old_env[i];
250 : }
251 :
252 : /* calculate the spectrum of random excitation signal */
253 18204 : mvr2r( exc2, fft_io, L_frame );
254 :
255 18204 : if ( L_frame == L_FRAME16k )
256 : {
257 9899 : modify_Fs( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0 );
258 : }
259 :
260 18204 : fft_rel( fft_io, L_FFT, LOG2_L_FFT );
261 18204 : ptR = &fft_io[1];
262 18204 : ptI = &fft_io[L_FFT - 1];
263 382284 : for ( i = 0; i < NUM_ENV_CNG; i++ )
264 : {
265 364080 : env[i] = 2.0f * ( *ptR * *ptR + *ptI * *ptI ) / L_FFT;
266 364080 : ptR++;
267 364080 : ptI--;
268 : }
269 :
270 382284 : for ( i = 0; i < NUM_ENV_CNG; i++ )
271 : {
272 364080 : denv[i] = lp_env[i] + 2 * ( *lp_ener ) - env[i];
273 :
274 364080 : if ( denv[i] < 0 )
275 : {
276 116242 : denv[i] = 0;
277 : }
278 : }
279 18204 : set_f( itmp, 0.0f, NUM_ENV_CNG );
280 :
281 18204 : set_f( fft_io, 0.0f, L_FFT );
282 18204 : ptR = &fft_io[1];
283 18204 : ptI = &fft_io[L_FFT - 1];
284 382284 : for ( i = 0; i < NUM_ENV_CNG; i++ )
285 : {
286 364080 : *ptR = own_random( cng_ener_seed1 );
287 364080 : *ptI = own_random( cng_ener_seed1 );
288 :
289 364080 : env[i] = 2.0f * ( *ptR * *ptR + *ptI * *ptI ) / L_FFT;
290 364080 : ptR++;
291 364080 : ptI--;
292 : }
293 :
294 382284 : for ( i = 0; i < NUM_ENV_CNG; i++ )
295 : {
296 364080 : itmp[i] += own_random( cng_ener_seed1 ) * denv[i] * 0.000011f + denv[i];
297 :
298 364080 : if ( itmp[i] < 0.0f )
299 : {
300 0 : itmp[i] = 0;
301 : }
302 : }
303 :
304 18204 : ptR = &fft_io[1];
305 18204 : ptI = &fft_io[L_FFT - 1];
306 382284 : for ( i = 0; i < NUM_ENV_CNG; i++ )
307 : {
308 364080 : *ptR = (float) ( *ptR * sqrt( itmp[i] / env[i] ) );
309 364080 : *ptI = (float) ( *ptI * sqrt( itmp[i] / env[i] ) );
310 :
311 364080 : ptR++;
312 364080 : ptI--;
313 : }
314 :
315 18204 : ifft_rel( fft_io, L_FFT, LOG2_L_FFT );
316 :
317 18204 : if ( L_frame == L_FRAME16k )
318 : {
319 9899 : modify_Fs( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0 );
320 : }
321 :
322 18204 : enr1 = dotp( fft_io, fft_io, L_frame ) / L_frame;
323 :
324 : /* add time domain randomization */
325 100919 : for ( i_subfr = 0; i_subfr < L_frame; i_subfr += L_SUBFR )
326 : {
327 82715 : enr = dotp( &fft_io[i_subfr], &fft_io[i_subfr], L_SUBFR ) + 0.01f;
328 82715 : ener_lp = ( ( own_random( cng_ener_seed1 ) * ( enr1 ) ) * 0.000011f ) + ( enr1 );
329 82715 : ener_lp *= L_SUBFR;
330 82715 : enr = (float) sqrt( ener_lp / enr );
331 :
332 82715 : if ( last_core_brate != SID_2k40 && last_core_brate != SID_1k75 && last_core_brate != FRAME_NO_DATA && core_brate == SID_2k40 )
333 : {
334 6674 : if ( enr > 1 )
335 : {
336 3720 : enr = 1;
337 : }
338 : }
339 :
340 5376475 : for ( i = 0; i < L_SUBFR; i++ )
341 : {
342 5293760 : fft_io[i_subfr + i] *= enr;
343 : }
344 : }
345 :
346 5311964 : for ( i = 0; i < L_frame; i++ )
347 : {
348 5293760 : fft_io[i] = 0.75f * fft_io[i] + exc2[i];
349 : }
350 :
351 18204 : enr = ( dotp( fft_io, fft_io, L_frame ) / L_frame ) + 0.01f;
352 18204 : enr = ( *lp_ener ) / enr;
353 :
354 18204 : if ( enr > 1 )
355 : {
356 4908 : enr = 1;
357 : }
358 :
359 18204 : ftmp = sqrtf( enr );
360 5311964 : for ( i = 0; i < L_frame; i++ )
361 : {
362 5293760 : fft_io[i] *= ftmp;
363 : }
364 :
365 18204 : mvr2r( fft_io, exc2, L_frame );
366 : }
367 19989 : if ( Opt_AMR_WB != 1 )
368 : {
369 18204 : mvr2r( exc3, exc, L_frame );
370 : }
371 : else
372 : {
373 1785 : mvr2r( exc2, exc, L_frame );
374 : }
375 :
376 19989 : if ( L_frame == L_FRAME )
377 : {
378 10090 : interp_code_5over2( exc2, bwe_exc, L_frame );
379 : }
380 : else
381 : {
382 9899 : interp_code_4over2( exc2, bwe_exc, L_frame );
383 : }
384 :
385 19989 : return;
386 : }
387 :
388 :
389 : /*-------------------------------------------------------*
390 : * cng_params_postupd
391 : *
392 : * Post-update of CNG parameters
393 : *-------------------------------------------------------*/
394 :
395 10098 : void cng_params_postupd(
396 : const int16_t ho_circ_ptr, /* i : pointer for CNG averaging buffers */
397 : int16_t *cng_buf_cnt, /* i/o: counter for CNG store buffers */
398 : const float *cng_exc2_buf, /* i : Excitation buffer */
399 : const int32_t *cng_brate_buf, /* i : bitrate buffer */
400 : float ho_env_circ[], /* i/o: Envelope buffer */
401 : const int16_t element_mode, /* i : Element mode */
402 : const int16_t bwidth /* i : Audio bandwidth */
403 : )
404 : {
405 : int16_t i, j;
406 : const float *exc2;
407 : float fft_io[L_FFT];
408 : float sp[129];
409 : float *ptR, *ptI;
410 : float env[NUM_ENV_CNG];
411 : int16_t CNG_mode;
412 : int16_t ptr;
413 : float att;
414 : int32_t last_active_brate;
415 :
416 10098 : ptr = ho_circ_ptr - *cng_buf_cnt + 1;
417 10098 : if ( ptr < 0 )
418 : {
419 460 : ptr += HO_HIST_SIZE;
420 : }
421 :
422 14541 : for ( j = 0; j < *cng_buf_cnt; j++ )
423 : {
424 4443 : exc2 = &cng_exc2_buf[ptr * L_FFT];
425 4443 : last_active_brate = cng_brate_buf[ptr];
426 :
427 : /* calculate the spectrum of residual signal */
428 : /* calculate the spectrum of residual signal */
429 4443 : mvr2r( exc2, fft_io, L_FFT );
430 :
431 4443 : fft_rel( fft_io, L_FFT, LOG2_L_FFT );
432 :
433 4443 : ptR = &fft_io[1];
434 4443 : ptI = &fft_io[L_FFT - 1];
435 93303 : for ( i = 0; i < NUM_ENV_CNG; i++ )
436 : {
437 88860 : sp[i] = 2.0f * ( *ptR * *ptR + *ptI * *ptI ) / L_FFT;
438 88860 : ptR++;
439 88860 : ptI--;
440 : }
441 :
442 4443 : mvr2r( sp, env, NUM_ENV_CNG );
443 :
444 4443 : if ( element_mode == IVAS_SCE || element_mode == IVAS_CPE_DFT )
445 : {
446 4403 : att = 0.0f;
447 4403 : apply_scale( &att, bwidth, last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO );
448 4403 : att = powf( 10, att / 10.0f );
449 : }
450 : else
451 : {
452 40 : CNG_mode = get_cng_mode( last_active_brate );
453 40 : att = (float) ( 1 / pow( 2, ENR_ATT[CNG_mode] ) );
454 : }
455 :
456 93303 : for ( i = 0; i < NUM_ENV_CNG; i++ )
457 : {
458 88860 : env[i] *= att;
459 : }
460 :
461 : /* update the circular buffer of old residual envelope */
462 4443 : mvr2r( env, &( ho_env_circ[(ho_circ_ptr) *NUM_ENV_CNG] ), NUM_ENV_CNG );
463 :
464 4443 : ptr++;
465 4443 : if ( ptr == HO_HIST_SIZE )
466 : {
467 554 : ptr = 0;
468 : }
469 : }
470 :
471 10098 : *cng_buf_cnt = 0;
472 :
473 10098 : return;
474 : }
475 :
476 :
477 : /*-------------------------------------------------------*
478 : * cng_params_upd()
479 : *
480 : * update CNG parameters
481 : *-------------------------------------------------------*/
482 :
483 6153960 : void cng_params_upd(
484 : const float lsp_new[], /* i : LSP parameters */
485 : const float exc2[], /* i : current enhanced excitation */
486 : const int16_t L_frame, /* i : frame length */
487 : int16_t *ho_circ_ptr, /* i/o: pointer for CNG averaging buffers */
488 : float ho_ener_circ[], /* o : energy buffer for CNG averaging */
489 : int16_t *ho_circ_size, /* i/o: size of DTX hangover history buffer for averaging */
490 : float ho_lsp_circ[], /* o : old LSP buffer for CNG averaging */
491 : const int16_t enc_dec_flag, /* i : Flag indicating encoder or decoder (ENC,DEC) */
492 : float ho_env_circ[], /* i/o: Envelope buffer */
493 : int16_t *cng_buf_cnt, /* i/o: Counter of postponed FFT-processing instances */
494 : float cng_exc2_buf[], /* i/o: Excitation buffer */
495 : int32_t cng_brate_buf[], /* i/o: last_active_brate buffer */
496 : const int32_t last_active_brate, /* i : Last active bitrate */
497 : const int16_t element_mode, /* i : element mode */
498 : const int16_t bwidth /* i : audio bandwidth */
499 : )
500 : {
501 : float enr;
502 : float fft_io[L_FRAME16k];
503 : float sp[129];
504 : float *ptR, *ptI;
505 : float env[NUM_ENV_CNG];
506 : int16_t i;
507 : int16_t CNG_mode;
508 : float att;
509 :
510 : /* update the pointer to circular buffer of old LSP vectors */
511 6153960 : ( *ho_circ_ptr )++;
512 6153960 : if ( *ho_circ_ptr == HO_HIST_SIZE )
513 : {
514 747120 : *ho_circ_ptr = 0;
515 : }
516 :
517 : /* update the circular buffer of old LSP vectors with the new LSP vector */
518 6153960 : mvr2r( lsp_new, &( ho_lsp_circ[( *ho_circ_ptr ) * M] ), M );
519 :
520 : /* calculate the residual signal energy */
521 6153960 : enr = dotp( exc2, exc2, L_frame ) / L_frame;
522 :
523 : /* update the circular buffer of old energies */
524 6153960 : ho_ener_circ[*ho_circ_ptr] = enr;
525 :
526 6153960 : if ( enc_dec_flag == ENC )
527 : {
528 : /* Store residual signal for postponed FFT-processing*/
529 667696 : ( *cng_buf_cnt )++;
530 667696 : if ( *cng_buf_cnt > HO_HIST_SIZE )
531 : {
532 651973 : *cng_buf_cnt = HO_HIST_SIZE;
533 : }
534 667696 : mvr2r( exc2, &( cng_exc2_buf[( *ho_circ_ptr ) * L_FFT] ), L_FFT );
535 667696 : cng_brate_buf[*ho_circ_ptr] = last_active_brate;
536 : }
537 : else
538 : {
539 :
540 : /* calculate the spectrum of residual signal */
541 5486264 : mvr2r( exc2, fft_io, L_frame );
542 :
543 5486264 : fft_rel( fft_io, L_FFT, LOG2_L_FFT );
544 :
545 5486264 : ptR = &fft_io[1];
546 5486264 : ptI = &fft_io[L_FFT - 1];
547 115211544 : for ( i = 0; i < NUM_ENV_CNG; i++ )
548 : {
549 109725280 : sp[i] = 2.0f * ( *ptR * *ptR + *ptI * *ptI ) / L_FFT;
550 109725280 : ptR++;
551 109725280 : ptI--;
552 : }
553 :
554 5486264 : mvr2r( sp, env, NUM_ENV_CNG );
555 :
556 5486264 : if ( element_mode == IVAS_SCE || element_mode == IVAS_CPE_DFT )
557 : {
558 5361702 : att = 0.0f;
559 5361702 : apply_scale( &att, bwidth, last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO );
560 5361702 : att = powf( 10, att / 10.0f );
561 : }
562 : else
563 : {
564 124562 : CNG_mode = get_cng_mode( last_active_brate );
565 124562 : att = (float) ( 1 / pow( 2, ENR_ATT[CNG_mode] ) );
566 : }
567 :
568 115211544 : for ( i = 0; i < NUM_ENV_CNG; i++ )
569 : {
570 109725280 : env[i] *= att;
571 : }
572 :
573 : /* update the circular buffer of old residual envelope */
574 5486264 : mvr2r( env, &( ho_env_circ[( *ho_circ_ptr ) * NUM_ENV_CNG] ), NUM_ENV_CNG );
575 : }
576 :
577 6153960 : ( *ho_circ_size )++;
578 6153960 : if ( *ho_circ_size > HO_HIST_SIZE )
579 : {
580 5663205 : *ho_circ_size = HO_HIST_SIZE;
581 : }
582 :
583 6153960 : return;
584 : }
585 :
586 :
587 : /*---------------------------------------------------------------------*
588 : * get_cng_mode()
589 : *
590 : *
591 : *---------------------------------------------------------------------*/
592 :
593 124687 : int16_t get_cng_mode(
594 : const int32_t last_active_brate /* i : last active bitrate */
595 : )
596 : {
597 : int16_t CNG_mode;
598 :
599 124687 : if ( last_active_brate > ACELP_13k20 )
600 : {
601 73398 : CNG_mode = 4;
602 : }
603 51289 : else if ( last_active_brate > ACELP_9k60 )
604 : {
605 33239 : CNG_mode = 3;
606 : }
607 18050 : else if ( last_active_brate > ACELP_8k00 )
608 : {
609 7324 : CNG_mode = 2;
610 : }
611 10726 : else if ( last_active_brate > ACELP_7k20 )
612 : {
613 4408 : CNG_mode = 1;
614 : }
615 : else
616 : {
617 6318 : CNG_mode = 0;
618 : }
619 :
620 124687 : return ( CNG_mode );
621 : }
|