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