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 43914 : 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 43914 : if ( L_frame == L_FRAME )
106 : {
107 18934 : pit_max = PIT_MAX;
108 : }
109 : else /* L_frame == L_FRAME16k */
110 : {
111 24980 : pit_max = PIT16k_MAX;
112 : }
113 :
114 : /*---------------------------------------------------------------------*
115 : * Initialization of CNG energy for the first CNG frame
116 : *---------------------------------------------------------------------*/
117 :
118 43914 : if ( *first_CNG == 0 )
119 : {
120 340 : 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 340 : if ( element_mode == EVS_MONO )
127 : {
128 110 : *lp_ener = *Enew;
129 : }
130 : }
131 :
132 : /*---------------------------------------------------------------------*
133 : * Update CNG energy
134 : *---------------------------------------------------------------------*/
135 :
136 43914 : 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 3572 : if ( allow_cn_step == 0 && *last_allow_cn_step == 0 )
140 : {
141 2939 : if ( num_ho < 3 || *Enew < 1.5f * *lp_ener )
142 : {
143 2472 : *lp_ener = 0.8f * *lp_ener + 0.2f * *Enew;
144 : }
145 : else
146 : {
147 467 : *lp_ener = 0.95f * *lp_ener + 0.05f * *Enew;
148 : }
149 : }
150 : else
151 : {
152 633 : *lp_ener = *Enew;
153 633 : *last_allow_cn_step = 0;
154 : }
155 : }
156 : else
157 : {
158 : /* normal CNG update */
159 40342 : if ( *last_allow_cn_step == 0 )
160 : {
161 39474 : *lp_ener = (float) ( A2 * *Enew + ( 1 - A2 ) * *lp_ener );
162 : }
163 : else
164 : {
165 868 : if ( core_brate == SID_1k75 || core_brate == SID_2k40 )
166 : {
167 33 : *last_allow_cn_step = 0;
168 : }
169 :
170 868 : *lp_ener = *Enew;
171 : }
172 : }
173 :
174 43914 : if ( allow_cn_step == 1 )
175 : {
176 381 : *last_allow_cn_step = 1;
177 : }
178 :
179 : /* If not mono, skip CNG here */
180 43914 : if ( element_mode > IVAS_SCE )
181 : {
182 13972 : return;
183 : }
184 :
185 : /*---------------------------------------------------------------------*
186 : * Generate white noise vector
187 : *---------------------------------------------------------------------*/
188 :
189 8657718 : for ( i = 0; i < L_frame; i++ )
190 : {
191 8627776 : 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 164751 : for ( i_subfr = 0; i_subfr < L_frame; i_subfr += L_SUBFR )
200 : {
201 134809 : ener_lp = ( ( own_random( cng_ener_seed ) * ( *lp_ener ) ) * GAIN_VAR ) + ( *lp_ener );
202 :
203 134809 : if ( ener_lp < 0.0f )
204 : {
205 0 : ener_lp = 0.01f;
206 : }
207 134809 : enr = dotp( &exc2[i_subfr], &exc2[i_subfr], L_SUBFR ) + 0.01f;
208 :
209 134809 : enr = (float) sqrt( ener_lp * L_SUBFR / enr );
210 :
211 8762585 : for ( i = 0; i < L_SUBFR; i++ )
212 : {
213 8627776 : exc2[i_subfr + i] *= enr;
214 : }
215 : }
216 :
217 29942 : if ( Opt_AMR_WB != 1 )
218 : {
219 28157 : mvr2r( exc2, exc3, L_FRAME16k );
220 :
221 28157 : enr1 = (float) log10( *Enew * L_frame + 0.1f ) / (float) log10( 2.0f );
222 :
223 28157 : if ( core_brate == SID_2k40 )
224 : {
225 4853 : if ( *sid_bw == 0 )
226 : {
227 9009 : for ( i = 0; i < NUM_ENV_CNG; i++ )
228 : {
229 : /* get quantized envelope */
230 8580 : env[i] = powf( 2.0f, ( enr1 - q_env[i] ) );
231 : }
232 : }
233 :
234 : /* initialize CNG envelope */
235 4853 : if ( *first_CNG == 0 && *sid_bw == 0 )
236 : {
237 10 : mvr2r( env, lp_env, NUM_ENV_CNG );
238 : }
239 :
240 4853 : if ( *sid_bw == 0 )
241 : {
242 429 : mvr2r( env, old_env, NUM_ENV_CNG );
243 : }
244 : }
245 :
246 591297 : for ( i = 0; i < NUM_ENV_CNG; i++ )
247 : {
248 : /* get AR low-passed envelope */
249 563140 : 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 28157 : mvr2r( exc2, fft_io, L_frame );
254 :
255 28157 : if ( L_frame == L_FRAME16k )
256 : {
257 15041 : modify_Fs( fft_io, L_FRAME16k, 16000, fft_io, 12800, exc_mem1, 0 );
258 : }
259 :
260 28157 : fft_rel( fft_io, L_FFT, LOG2_L_FFT );
261 28157 : ptR = &fft_io[1];
262 28157 : ptI = &fft_io[L_FFT - 1];
263 591297 : for ( i = 0; i < NUM_ENV_CNG; i++ )
264 : {
265 563140 : env[i] = 2.0f * ( *ptR * *ptR + *ptI * *ptI ) / L_FFT;
266 563140 : ptR++;
267 563140 : ptI--;
268 : }
269 :
270 591297 : for ( i = 0; i < NUM_ENV_CNG; i++ )
271 : {
272 563140 : denv[i] = lp_env[i] + 2 * ( *lp_ener ) - env[i];
273 :
274 563140 : if ( denv[i] < 0 )
275 : {
276 183228 : denv[i] = 0;
277 : }
278 : }
279 28157 : set_f( itmp, 0.0f, NUM_ENV_CNG );
280 :
281 28157 : set_f( fft_io, 0.0f, L_FFT );
282 28157 : ptR = &fft_io[1];
283 28157 : ptI = &fft_io[L_FFT - 1];
284 591297 : for ( i = 0; i < NUM_ENV_CNG; i++ )
285 : {
286 563140 : *ptR = own_random( cng_ener_seed1 );
287 563140 : *ptI = own_random( cng_ener_seed1 );
288 :
289 563140 : env[i] = 2.0f * ( *ptR * *ptR + *ptI * *ptI ) / L_FFT;
290 563140 : ptR++;
291 563140 : ptI--;
292 : }
293 :
294 591297 : for ( i = 0; i < NUM_ENV_CNG; i++ )
295 : {
296 563140 : itmp[i] += own_random( cng_ener_seed1 ) * denv[i] * 0.000011f + denv[i];
297 :
298 563140 : if ( itmp[i] < 0.0f )
299 : {
300 0 : itmp[i] = 0;
301 : }
302 : }
303 :
304 28157 : ptR = &fft_io[1];
305 28157 : ptI = &fft_io[L_FFT - 1];
306 591297 : for ( i = 0; i < NUM_ENV_CNG; i++ )
307 : {
308 563140 : *ptR = (float) ( *ptR * sqrt( itmp[i] / env[i] ) );
309 563140 : *ptI = (float) ( *ptI * sqrt( itmp[i] / env[i] ) );
310 :
311 563140 : ptR++;
312 563140 : ptI--;
313 : }
314 :
315 28157 : ifft_rel( fft_io, L_FFT, LOG2_L_FFT );
316 :
317 28157 : if ( L_frame == L_FRAME16k )
318 : {
319 15041 : modify_Fs( fft_io, L_FFT, 12800, fft_io, 16000, exc_mem, 0 );
320 : }
321 :
322 28157 : enr1 = dotp( fft_io, fft_io, L_frame ) / L_frame;
323 :
324 : /* add time domain randomization */
325 155826 : for ( i_subfr = 0; i_subfr < L_frame; i_subfr += L_SUBFR )
326 : {
327 127669 : enr = dotp( &fft_io[i_subfr], &fft_io[i_subfr], L_SUBFR ) + 0.01f;
328 127669 : ener_lp = ( ( own_random( cng_ener_seed1 ) * ( enr1 ) ) * 0.000011f ) + ( enr1 );
329 127669 : ener_lp *= L_SUBFR;
330 127669 : enr = (float) sqrt( ener_lp / enr );
331 :
332 127669 : if ( last_core_brate != SID_2k40 && last_core_brate != SID_1k75 && last_core_brate != FRAME_NO_DATA && core_brate == SID_2k40 )
333 : {
334 10341 : if ( enr > 1 )
335 : {
336 5733 : enr = 1;
337 : }
338 : }
339 :
340 8298485 : for ( i = 0; i < L_SUBFR; i++ )
341 : {
342 8170816 : fft_io[i_subfr + i] *= enr;
343 : }
344 : }
345 :
346 8198973 : for ( i = 0; i < L_frame; i++ )
347 : {
348 8170816 : fft_io[i] = 0.75f * fft_io[i] + exc2[i];
349 : }
350 :
351 28157 : enr = ( dotp( fft_io, fft_io, L_frame ) / L_frame ) + 0.01f;
352 28157 : enr = ( *lp_ener ) / enr;
353 :
354 28157 : if ( enr > 1 )
355 : {
356 7610 : enr = 1;
357 : }
358 :
359 28157 : ftmp = sqrtf( enr );
360 8198973 : for ( i = 0; i < L_frame; i++ )
361 : {
362 8170816 : fft_io[i] *= ftmp;
363 : }
364 :
365 28157 : mvr2r( fft_io, exc2, L_frame );
366 : }
367 29942 : if ( Opt_AMR_WB != 1 )
368 : {
369 28157 : mvr2r( exc3, exc, L_frame );
370 : }
371 : else
372 : {
373 1785 : mvr2r( exc2, exc, L_frame );
374 : }
375 :
376 29942 : if ( L_frame == L_FRAME )
377 : {
378 14901 : interp_code_5over2( exc2, bwe_exc, L_frame );
379 : }
380 : else
381 : {
382 15041 : interp_code_4over2( exc2, bwe_exc, L_frame );
383 : }
384 :
385 29942 : return;
386 : }
387 :
388 :
389 : /*-------------------------------------------------------*
390 : * cng_params_postupd
391 : *
392 : * Post-update of CNG parameters
393 : *-------------------------------------------------------*/
394 :
395 11445 : 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 11445 : ptr = ho_circ_ptr - *cng_buf_cnt + 1;
417 11445 : if ( ptr < 0 )
418 : {
419 506 : ptr += HO_HIST_SIZE;
420 : }
421 :
422 16298 : for ( j = 0; j < *cng_buf_cnt; j++ )
423 : {
424 4853 : exc2 = &cng_exc2_buf[ptr * L_FFT];
425 4853 : last_active_brate = cng_brate_buf[ptr];
426 :
427 : /* calculate the spectrum of residual signal */
428 : /* calculate the spectrum of residual signal */
429 4853 : mvr2r( exc2, fft_io, L_FFT );
430 :
431 4853 : fft_rel( fft_io, L_FFT, LOG2_L_FFT );
432 :
433 4853 : ptR = &fft_io[1];
434 4853 : ptI = &fft_io[L_FFT - 1];
435 101913 : for ( i = 0; i < NUM_ENV_CNG; i++ )
436 : {
437 97060 : sp[i] = 2.0f * ( *ptR * *ptR + *ptI * *ptI ) / L_FFT;
438 97060 : ptR++;
439 97060 : ptI--;
440 : }
441 :
442 4853 : mvr2r( sp, env, NUM_ENV_CNG );
443 :
444 4853 : if ( element_mode == IVAS_SCE || element_mode == IVAS_CPE_DFT )
445 : {
446 4813 : att = 0.0f;
447 4813 : apply_scale( &att, bwidth, last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO );
448 4813 : 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 101913 : for ( i = 0; i < NUM_ENV_CNG; i++ )
457 : {
458 97060 : env[i] *= att;
459 : }
460 :
461 : /* update the circular buffer of old residual envelope */
462 4853 : mvr2r( env, &( ho_env_circ[(ho_circ_ptr) *NUM_ENV_CNG] ), NUM_ENV_CNG );
463 :
464 4853 : ptr++;
465 4853 : if ( ptr == HO_HIST_SIZE )
466 : {
467 607 : ptr = 0;
468 : }
469 : }
470 :
471 11445 : *cng_buf_cnt = 0;
472 :
473 11445 : return;
474 : }
475 :
476 :
477 : /*-------------------------------------------------------*
478 : * cng_params_upd()
479 : *
480 : * update CNG parameters
481 : *-------------------------------------------------------*/
482 :
483 10130391 : 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 10130391 : ( *ho_circ_ptr )++;
512 10130391 : if ( *ho_circ_ptr == HO_HIST_SIZE )
513 : {
514 1224147 : *ho_circ_ptr = 0;
515 : }
516 :
517 : /* update the circular buffer of old LSP vectors with the new LSP vector */
518 10130391 : mvr2r( lsp_new, &( ho_lsp_circ[( *ho_circ_ptr ) * M] ), M );
519 :
520 : /* calculate the residual signal energy */
521 10130391 : enr = dotp( exc2, exc2, L_frame ) / L_frame;
522 :
523 : /* update the circular buffer of old energies */
524 10130391 : ho_ener_circ[*ho_circ_ptr] = enr;
525 :
526 10130391 : if ( enc_dec_flag == ENC )
527 : {
528 : /* Store residual signal for postponed FFT-processing*/
529 686058 : ( *cng_buf_cnt )++;
530 686058 : if ( *cng_buf_cnt > HO_HIST_SIZE )
531 : {
532 668784 : *cng_buf_cnt = HO_HIST_SIZE;
533 : }
534 686058 : mvr2r( exc2, &( cng_exc2_buf[( *ho_circ_ptr ) * L_FFT] ), L_FFT );
535 686058 : cng_brate_buf[*ho_circ_ptr] = last_active_brate;
536 : }
537 : else
538 : {
539 :
540 : /* calculate the spectrum of residual signal */
541 9444333 : mvr2r( exc2, fft_io, L_frame );
542 :
543 9444333 : fft_rel( fft_io, L_FFT, LOG2_L_FFT );
544 :
545 9444333 : ptR = &fft_io[1];
546 9444333 : ptI = &fft_io[L_FFT - 1];
547 198330993 : for ( i = 0; i < NUM_ENV_CNG; i++ )
548 : {
549 188886660 : sp[i] = 2.0f * ( *ptR * *ptR + *ptI * *ptI ) / L_FFT;
550 188886660 : ptR++;
551 188886660 : ptI--;
552 : }
553 :
554 9444333 : mvr2r( sp, env, NUM_ENV_CNG );
555 :
556 9444333 : if ( element_mode == IVAS_SCE || element_mode == IVAS_CPE_DFT )
557 : {
558 9205255 : att = 0.0f;
559 9205255 : apply_scale( &att, bwidth, last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO );
560 9205255 : att = powf( 10, att / 10.0f );
561 : }
562 : else
563 : {
564 239078 : CNG_mode = get_cng_mode( last_active_brate );
565 239078 : att = (float) ( 1 / pow( 2, ENR_ATT[CNG_mode] ) );
566 : }
567 :
568 198330993 : for ( i = 0; i < NUM_ENV_CNG; i++ )
569 : {
570 188886660 : env[i] *= att;
571 : }
572 :
573 : /* update the circular buffer of old residual envelope */
574 9444333 : mvr2r( env, &( ho_env_circ[( *ho_circ_ptr ) * NUM_ENV_CNG] ), NUM_ENV_CNG );
575 : }
576 :
577 10130391 : ( *ho_circ_size )++;
578 10130391 : if ( *ho_circ_size > HO_HIST_SIZE )
579 : {
580 9395886 : *ho_circ_size = HO_HIST_SIZE;
581 : }
582 :
583 10130391 : return;
584 : }
585 :
586 :
587 : /*---------------------------------------------------------------------*
588 : * get_cng_mode()
589 : *
590 : *
591 : *---------------------------------------------------------------------*/
592 :
593 239300 : 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 239300 : if ( last_active_brate > ACELP_13k20 )
600 : {
601 156978 : CNG_mode = 4;
602 : }
603 82322 : else if ( last_active_brate > ACELP_9k60 )
604 : {
605 62183 : CNG_mode = 3;
606 : }
607 20139 : else if ( last_active_brate > ACELP_8k00 )
608 : {
609 8651 : CNG_mode = 2;
610 : }
611 11488 : else if ( last_active_brate > ACELP_7k20 )
612 : {
613 5137 : CNG_mode = 1;
614 : }
615 : else
616 : {
617 6351 : CNG_mode = 0;
618 : }
619 :
620 239300 : return ( CNG_mode );
621 : }
|