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 : #include <stdint.h>
34 : #include "options.h"
35 : #include "stat_dec.h"
36 : #include "rom_com.h"
37 : #include "prot_fx.h"
38 : #include "ivas_cnst.h"
39 : #include "wmc_auto.h"
40 : #include "ivas_prot_fx.h"
41 :
42 : /*-----------------------------------------------------------------*
43 : * ivas_decision_matrix_dec()
44 : *
45 : * ACELP/TCX/HQ core selection
46 : * Read ACELP signaling bits from the bitstream
47 : * Set extension layers
48 : *-----------------------------------------------------------------*/
49 : static Word16 get_next_index_4_by_15[16] = {
50 : 0, 2184, 4369, 6553, 8738, 10922, 13107, 15291, 17476, 19660, 21845, 24029, 26214, 28398, 30583, 32767
51 : };
52 1066218 : void ivas_decision_matrix_dec_fx(
53 : Decoder_State *st, /* i/o: decoder state structure */
54 : Word16 *sharpFlag, /* o : formant sharpening flag */
55 : Word16 *core_switching_flag, /* o : ACELP->HQ switching frame flag */
56 : const Word32 element_brate, /* i : element bitrate */
57 : const Word16 nchan_out /* i : Number of output channels */
58 : )
59 : {
60 : Word16 tmp;
61 : Word32 icbwe_brate;
62 :
63 : /* init */
64 1066218 : icbwe_brate = 0;
65 1066218 : move32();
66 1066218 : st->core = -1;
67 1066218 : move16();
68 1066218 : st->core_brate = 0;
69 1066218 : move32();
70 1066218 : st->extl = -1;
71 1066218 : move16();
72 1066218 : st->extl_brate = 0;
73 1066218 : move32();
74 1066218 : st->ppp_mode_dec = 0;
75 1066218 : move16();
76 1066218 : st->nelp_mode_dec = 0;
77 1066218 : move16();
78 1066218 : st->igf = 0;
79 1066218 : move16();
80 1066218 : st->vbr_hw_BWE_disable_dec = 0;
81 1066218 : move16();
82 :
83 : /*-----------------------------------------------------------------*
84 : * Read SID signaling bits from the bitstream
85 : *-----------------------------------------------------------------*/
86 :
87 1066218 : test();
88 1066218 : test();
89 1066218 : test();
90 1066218 : test();
91 1066218 : IF( ( st->idchan == 0 && ( ( st->total_brate == FRAME_NO_DATA ) || EQ_32( st->total_brate, SID_2k40 ) ) ) || ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && LE_32( st->total_brate, SID_2k40 ) ) )
92 : {
93 26082 : st->core = ACELP_CORE;
94 26082 : move16();
95 26082 : st->core_brate = st->total_brate;
96 26082 : move32();
97 :
98 26082 : test();
99 26082 : test();
100 26082 : test();
101 26082 : test();
102 26082 : test();
103 26082 : IF( EQ_32( st->total_brate, SID_2k40 ) && !( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_MDCT ) ) )
104 : {
105 2907 : IF( NE_16( st->element_mode, IVAS_CPE_DFT ) )
106 : {
107 1415 : st->cng_type = get_next_indice_fx( st, 1 );
108 1415 : move16();
109 :
110 1415 : IF( EQ_16( st->cng_type, FD_CNG ) )
111 : {
112 1415 : st->bwidth = get_next_indice_fx( st, 2 );
113 1415 : move16();
114 : }
115 : }
116 2907 : IF( get_next_indice_fx( st, 1 ) )
117 : {
118 1683 : st->L_frame = L_FRAME16k;
119 1683 : move16();
120 : }
121 : ELSE
122 : {
123 1224 : st->L_frame = L_FRAME;
124 1224 : move16();
125 : }
126 : }
127 23175 : ELSE IF( EQ_32( st->total_brate, SID_2k40 ) && EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_MDCT ) && st->cng_sba_flag == 0 )
128 : {
129 : /* read channel coherence */
130 : Word16 index;
131 410 : index = get_next_indice_fx( st, 4 );
132 410 : st->hFdCngDec->hFdCngCom->coherence_fx = get_next_index_4_by_15[index];
133 410 : move16();
134 :
135 :
136 : /* read flag for no side noise shape */
137 410 : st->hFdCngDec->hFdCngCom->no_side_flag = get_next_indice_fx( st, 1 );
138 410 : move16();
139 : }
140 :
141 26082 : test();
142 26082 : test();
143 26082 : test();
144 26082 : test();
145 26082 : test();
146 26082 : if ( ( GE_32( st->output_Fs, 32000 ) && GE_16( st->bwidth, SWB ) ) || ( EQ_16( st->element_mode, IVAS_CPE_DFT ) && GE_16( st->bwidth, SWB ) && EQ_16( nchan_out, 2 ) && LT_16( st->L_frame, L_FRAME16k ) ) )
147 : {
148 18733 : st->extl = SWB_CNG;
149 18733 : move16();
150 : }
151 :
152 26082 : test();
153 26082 : test();
154 26082 : test();
155 26082 : if ( ( st->total_brate == FRAME_NO_DATA ) && st->prev_bfi && !st->bfi && GT_16( st->L_frame, L_FRAME16k ) )
156 : {
157 0 : st->L_frame = st->last_CNG_L_frame;
158 0 : move16();
159 : }
160 :
161 26082 : return;
162 : }
163 :
164 : /*---------------------------------------------------------------------*
165 : * ACELP/HQ core selection
166 : *---------------------------------------------------------------------*/
167 :
168 1040136 : test();
169 1040136 : test();
170 1040136 : IF( EQ_16( st->element_mode, IVAS_CPE_TD ) && EQ_16( st->idchan, 1 ) )
171 : {
172 : /* minimal signaling for the secondary channel, most of the parameters are deduced from the primary channel */
173 3630 : st->core = ACELP_CORE;
174 3630 : move16();
175 : }
176 1036506 : ELSE IF( EQ_16( st->element_mode, IVAS_SCE ) && st->low_rate_mode )
177 : {
178 : /* ISM Low-rate mode -> always WB, ACELP core, IC coder_type */
179 6725 : st->core = ACELP_CORE;
180 6725 : move16();
181 : }
182 1029781 : ELSE IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) )
183 : {
184 674936 : st->core = TCX_20_CORE;
185 674936 : move16();
186 : }
187 : ELSE
188 : {
189 354845 : st->core = ACELP_CORE;
190 354845 : move16();
191 :
192 354845 : test();
193 354845 : IF( EQ_16( st->element_mode, IVAS_CPE_TD ) || GE_32( st->total_brate, STEREO_TCX_MIN_RATE ) )
194 : {
195 : /* ACELP/transform core selection bit */
196 347481 : IF( get_next_indice_fx( st, 1 ) )
197 : {
198 224068 : st->core = HQ_CORE;
199 224068 : move16();
200 : }
201 : ELSE
202 : {
203 123413 : st->core = ACELP_CORE;
204 123413 : move16();
205 : }
206 : }
207 : }
208 :
209 : /*-----------------------------------------------------------------*
210 : * Read ACELP signaling bits from the bitstream
211 : *-----------------------------------------------------------------*/
212 :
213 1040136 : IF( EQ_16( st->core, ACELP_CORE ) )
214 : {
215 141132 : test();
216 141132 : test();
217 141132 : IF( EQ_16( st->element_mode, IVAS_SCE ) && st->low_rate_mode )
218 : {
219 : /* ISM Low-rate mode */
220 6725 : st->bwidth = WB;
221 6725 : move16();
222 6725 : st->coder_type = INACTIVE;
223 6725 : move16();
224 6725 : *sharpFlag = 0;
225 6725 : move16();
226 : }
227 134407 : ELSE IF( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) )
228 : {
229 3630 : *sharpFlag = 0;
230 3630 : move16();
231 3630 : test();
232 3630 : if ( EQ_16( st->coder_type, GENERIC ) || EQ_16( st->coder_type, VOICED ) )
233 : {
234 3536 : *sharpFlag = 1;
235 3536 : move16();
236 : }
237 :
238 3630 : st->core_brate = st->total_brate;
239 3630 : move32();
240 3630 : st->codec_mode = MODE1;
241 3630 : move16();
242 :
243 3630 : test();
244 3630 : test();
245 3630 : if ( EQ_16( st->idchan, 1 ) && ( st->tdm_LRTD_flag == 0 || LT_16( st->bits_frame_channel, IVAS_16k4 / FRAMES_PER_SEC ) ) )
246 : {
247 81 : st->bwidth = WB; /* only WB in the secondary channel */
248 81 : move16();
249 : }
250 : }
251 : ELSE
252 : {
253 130777 : IF( LT_32( element_brate, FRMT_SHP_MIN_BRATE_IVAS ) )
254 : {
255 60330 : st->coder_type = get_next_indice_fx( st, 3 );
256 60330 : move16();
257 60330 : *sharpFlag = 0;
258 60330 : move16();
259 :
260 60330 : test();
261 60330 : test();
262 60330 : test();
263 60330 : if ( LT_32( element_brate, IVAS_24k4 ) && ( EQ_16( st->coder_type, VOICED ) || EQ_16( st->coder_type, GENERIC ) || EQ_16( st->coder_type, TRANSITION ) ) )
264 : {
265 47866 : *sharpFlag = 1;
266 47866 : move16();
267 : }
268 : }
269 : ELSE
270 : {
271 : /* get coder_type info */
272 70447 : st->coder_type = get_next_indice_fx( st, 3 );
273 70447 : move16();
274 : /* get sharpening flag */
275 70447 : *sharpFlag = get_next_indice_fx( st, 1 );
276 70447 : move16();
277 : }
278 : }
279 : }
280 :
281 : /*-----------------------------------------------------------------*
282 : * Set extension layers
283 : *-----------------------------------------------------------------*/
284 :
285 1040136 : IF( EQ_16( st->core, ACELP_CORE ) )
286 : {
287 141132 : test();
288 141132 : test();
289 141132 : test();
290 141132 : test();
291 141132 : test();
292 141132 : test();
293 141132 : test();
294 141132 : IF( EQ_16( st->bwidth, WB ) && st->low_rate_mode )
295 : {
296 6725 : st->extl = WB_BWE;
297 6725 : move16();
298 6725 : if ( GE_32( st->total_brate, MIN_BRATE_WB_BWE ) )
299 : {
300 61 : st->extl_brate = WB_BWE_0k35;
301 61 : move32();
302 : }
303 : }
304 134407 : ELSE IF( EQ_16( st->bwidth, WB ) && ( LT_32( st->total_brate, MIN_BRATE_WB_BWE ) || ( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) ) ) )
305 : {
306 857 : if ( st->vbr_hw_BWE_disable_dec == 0 )
307 : {
308 857 : st->extl = WB_BWE;
309 857 : move16();
310 : }
311 : }
312 133550 : ELSE IF( EQ_16( st->bwidth, WB ) && GE_32( st->total_brate, MIN_BRATE_WB_BWE ) && !st->flag_ACELP16k )
313 : {
314 : /* read the WB TBE/BWE selection bit */
315 10993 : IF( get_next_indice_fx( st, 1 ) )
316 : {
317 4037 : st->extl = WB_BWE;
318 4037 : move16();
319 4037 : st->extl_brate = WB_BWE_0k35;
320 4037 : move32();
321 : }
322 : ELSE
323 : {
324 6956 : st->extl = WB_TBE;
325 6956 : move16();
326 6956 : test();
327 6956 : test();
328 6956 : IF( LT_32( st->total_brate, MIN_BRATE_WB_TBE_1k05 ) || ( EQ_16( st->element_mode, IVAS_CPE_TD ) && LT_32( st->total_brate, MIN_TDM_BRATE_WB_TBE_1k05 ) ) )
329 : {
330 2446 : st->extl_brate = WB_TBE_0k35;
331 2446 : move32();
332 : }
333 : ELSE
334 : {
335 4510 : st->extl_brate = WB_TBE_1k05;
336 4510 : move32();
337 : }
338 : }
339 : }
340 122557 : ELSE IF( EQ_16( st->bwidth, SWB ) || EQ_16( st->bwidth, FB ) )
341 : {
342 114055 : test();
343 114055 : test();
344 114055 : test();
345 114055 : test();
346 114055 : test();
347 114055 : test();
348 114055 : test();
349 114055 : test();
350 114055 : IF( GE_32( st->total_brate, MIN_BRATE_SWB_BWE ) || ( GE_32( st->total_brate, MIN_MIN_BRATE_LRTD_SWB_BWE ) && EQ_16( st->element_mode, IVAS_CPE_TD ) && EQ_16( st->bwidth, SWB ) && st->tdm_LRTD_flag ) || ( LT_32( element_brate, IVAS_16k4 ) && GE_32( st->total_brate, MIN_MIN_BRATE_LRTD_SWB_BWE ) && EQ_16( st->element_mode, IVAS_CPE_TD ) && EQ_16( st->bwidth, SWB ) ) )
351 : {
352 : /* read the SWB TBE/BWE selection bit */
353 114055 : tmp = get_next_indice_fx( st, 1 );
354 :
355 114055 : IF( tmp )
356 : {
357 9864 : st->extl = SWB_BWE;
358 9864 : move16();
359 9864 : st->extl_brate = SWB_BWE_1k6;
360 9864 : move32();
361 : }
362 : ELSE
363 : {
364 104191 : st->extl = SWB_TBE;
365 104191 : move16();
366 104191 : st->extl_brate = SWB_TBE_1k6;
367 104191 : move32();
368 104191 : test();
369 104191 : test();
370 104191 : test();
371 104191 : IF( GE_32( st->total_brate, MIN_BRATE_SWB_TBE_2k80 ) && st->flag_ACELP16k && EQ_16( st->element_mode, IVAS_SCE ) )
372 : {
373 22359 : st->extl_brate = SWB_TBE_2k8;
374 22359 : move32();
375 : }
376 81832 : ELSE IF( EQ_16( st->tdm_LRTD_flag, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) )
377 : {
378 5460 : IF( LT_32( st->element_brate, IVAS_24k4 ) )
379 : {
380 880 : st->extl_brate = SWB_TBE_1k10;
381 880 : move32();
382 : }
383 : ELSE
384 : {
385 4580 : st->extl_brate = SWB_TBE_1k75;
386 4580 : move32();
387 : }
388 : }
389 76372 : ELSE IF( LT_32( st->total_brate, MIN_BRATE_SWB_TBE_1k60 ) )
390 : {
391 26072 : st->extl_brate = SWB_TBE_0k95;
392 26072 : move32();
393 : }
394 : }
395 : }
396 : ELSE
397 : {
398 0 : st->extl = WB_BWE;
399 0 : move16();
400 0 : st->extl_brate = 0;
401 0 : move32();
402 : }
403 :
404 : /* set FB TBE and FB BWE extension layers */
405 114055 : IF( EQ_16( st->bwidth, FB ) )
406 : {
407 44463 : IF( EQ_16( st->extl, SWB_BWE ) )
408 : {
409 3995 : st->extl = FB_BWE;
410 3995 : move16();
411 3995 : st->extl_brate = FB_BWE_1k8;
412 3995 : move32();
413 : }
414 40468 : ELSE IF( EQ_16( st->extl, SWB_TBE ) )
415 : {
416 40468 : st->extl = FB_TBE;
417 40468 : move16();
418 40468 : st->extl_brate = FB_TBE_1k8;
419 40468 : move32();
420 40468 : test();
421 40468 : test();
422 40468 : if ( GE_32( st->total_brate, MIN_BRATE_SWB_TBE_2k80 ) && st->flag_ACELP16k && EQ_16( st->element_mode, IVAS_SCE ) )
423 : {
424 17529 : st->extl_brate = FB_TBE_3k0;
425 17529 : move32();
426 : }
427 : }
428 : }
429 : /* set IC-BWE bitrate */
430 114055 : test();
431 114055 : test();
432 114055 : IF( EQ_16( st->element_mode, IVAS_CPE_TD ) && !( GE_16( st->bwidth, SWB ) && st->tdm_LRTD_flag ) )
433 : {
434 32 : icbwe_brate = STEREO_BITS_ICBWE * FRAMES_PER_SEC;
435 32 : move32();
436 32 : if ( st->flag_ACELP16k == 0 )
437 : {
438 12 : icbwe_brate = ( STEREO_BITS_ICBWE - STEREO_ICBWE_SPBITS ) * FRAMES_PER_SEC;
439 12 : move32();
440 : }
441 : }
442 114023 : ELSE IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) )
443 : {
444 26301 : icbwe_brate = STEREO_BITS_ICBWE_DFT * FRAMES_PER_SEC;
445 26301 : move32();
446 26301 : if ( st->flag_ACELP16k == 0 )
447 : {
448 13356 : icbwe_brate = ( STEREO_BITS_ICBWE_DFT - STEREO_ICBWE_SPBITS ) * FRAMES_PER_SEC;
449 13356 : move32();
450 : }
451 : }
452 :
453 114055 : test();
454 114055 : test();
455 114055 : test();
456 114055 : test();
457 114055 : test();
458 114055 : if ( GE_16( st->element_mode, IVAS_CPE_DFT ) && ( st->core == ACELP_CORE ) && ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && !( EQ_16( st->element_mode, IVAS_CPE_TD ) && st->tdm_LRTD_flag ) )
459 : {
460 23733 : icbwe_brate = L_add( icbwe_brate, STEREO_ICBWE_MSFLAG_BITS * FRAMES_PER_SEC );
461 : }
462 : }
463 : }
464 :
465 : /* set core bitrate */
466 1040136 : st->core_brate = L_sub( L_sub( st->total_brate, st->extl_brate ), icbwe_brate );
467 1040136 : move32();
468 :
469 : /*-----------------------------------------------------------------*
470 : * Read transform core (TCX vs. HQ) signaling bit from the bitstream
471 : *-----------------------------------------------------------------*/
472 :
473 1040136 : test();
474 1040136 : test();
475 1040136 : test();
476 1040136 : IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) && !( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) ) && EQ_16( st->core, HQ_CORE ) )
477 : {
478 224068 : IF( get_next_indice_fx( st, 1 ) )
479 : {
480 216636 : st->core = TCX_20_CORE;
481 216636 : move16();
482 : }
483 : ELSE
484 : {
485 7432 : st->core = HQ_CORE;
486 7432 : move16();
487 : }
488 : }
489 :
490 1040136 : test();
491 1040136 : IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) && EQ_16( st->core, TCX_20_CORE ) )
492 : {
493 216636 : st->extl = IGF_BWE;
494 216636 : move16();
495 216636 : st->extl_brate = 0;
496 216636 : move32();
497 : }
498 :
499 : /*-----------------------------------------------------------------*
500 : * Read ACELP->HQ core switching flag
501 : *-----------------------------------------------------------------*/
502 :
503 1040136 : test();
504 1040136 : IF( EQ_16( st->core, HQ_CORE ) || EQ_16( st->core, TCX_20_CORE ) )
505 : {
506 899004 : IF( EQ_16( st->core, HQ_CORE ) )
507 : {
508 : /* read ACELP->HQ core switching flag */
509 7432 : *core_switching_flag = get_next_indice_fx( st, 1 );
510 7432 : move16();
511 : }
512 : ELSE
513 : {
514 891572 : *core_switching_flag = 0;
515 891572 : move16();
516 : }
517 :
518 899004 : IF( EQ_16( *core_switching_flag, 1 ) )
519 : {
520 190 : st->last_core_from_bs = ACELP_CORE;
521 190 : move16();
522 :
523 190 : if ( EQ_16( st->core, st->last_core ) )
524 : {
525 : /* A mismatch between the core_switching_flag and the st->core/st->last_core
526 : indicates a frame was lost. if prev_bfi is not set the frame loss
527 : occured during CNG and the prev_bfi needs to be set. */
528 0 : st->prev_bfi = 1;
529 0 : move16();
530 : }
531 : }
532 : ELSE
533 : {
534 898814 : st->last_core_from_bs = HQ_CORE; /* Could also be TCX, but it does not make any dIFference */
535 898814 : move16();
536 : }
537 :
538 899004 : st->last_L_frame_ori = st->last_L_frame;
539 899004 : move16();
540 : }
541 :
542 : /*-----------------------------------------------------------------*
543 : * Set ACELP frame length
544 : *-----------------------------------------------------------------*/
545 :
546 1040136 : test();
547 1040136 : test();
548 1040136 : test();
549 1040136 : test();
550 1040136 : test();
551 1040136 : test();
552 1040136 : IF( EQ_32( st->core_brate, FRAME_NO_DATA ) )
553 : {
554 : /* prevent "L_frame" changes in CNG segments */
555 0 : st->L_frame = st->last_L_frame;
556 0 : move16();
557 : }
558 1040136 : ELSE IF( EQ_32( st->core_brate, SID_2k40 ) && EQ_16( st->bwidth, WB ) && st->first_CNG && LT_16( st->hTdCngDec->act_cnt2, MIN_ACT_CNG_UPD ) )
559 : {
560 : /* prevent "L_frame" changes in SID frame after short segment of active frames */
561 0 : st->L_frame = st->last_CNG_L_frame;
562 0 : move16();
563 : }
564 1040136 : ELSE IF( ( EQ_32( st->core_brate, SID_2k40 ) && GE_32( st->total_brate, ACELP_9k60 ) && EQ_16( st->bwidth, WB ) ) || st->flag_ACELP16k )
565 : {
566 921411 : st->L_frame = L_FRAME16k;
567 921411 : move16();
568 : }
569 : ELSE
570 : {
571 118725 : st->L_frame = L_FRAME;
572 118725 : move16();
573 : }
574 :
575 1040136 : IF( EQ_16( st->L_frame, L_FRAME16k ) )
576 : {
577 921411 : st->nb_subfr = NB_SUBFR16k;
578 921411 : move16();
579 : }
580 : ELSE
581 : {
582 118725 : st->nb_subfr = NB_SUBFR;
583 118725 : move16();
584 : }
585 :
586 : /*-----------------------------------------------------------------*
587 : * set inactive coder_type flag in ACELP core
588 : *-----------------------------------------------------------------*/
589 :
590 1040136 : st->inactive_coder_type_flag = 0; /* AVQ by default */
591 1040136 : move16();
592 :
593 1040136 : if ( LE_32( st->total_brate, MAX_GSC_INACTIVE_BRATE ) )
594 : {
595 212712 : st->inactive_coder_type_flag = 1; /* GSC */
596 212712 : move16();
597 : }
598 :
599 : /*-----------------------------------------------------------------*
600 : * Reconfigure in case when output_Fs < input_Fs
601 : *-----------------------------------------------------------------*/
602 :
603 1040136 : st->extl_orig = st->extl;
604 1040136 : move16();
605 1040136 : st->extl_brate_orig = st->extl_brate;
606 1040136 : move32();
607 :
608 :
609 1040136 : test();
610 1040136 : test();
611 1040136 : IF( EQ_32( st->output_Fs, 16000 ) && EQ_16( st->L_frame, L_FRAME16k ) && NE_16( st->extl, IGF_BWE ) )
612 : {
613 65264 : st->extl = -1;
614 65264 : move16();
615 65264 : st->extl_brate = 0;
616 65264 : move32();
617 : }
618 :
619 1040136 : IF( st->ini_frame == 0 )
620 : {
621 : /* avoid switching of internal ACELP Fs in the very first frame */
622 8116 : st->last_L_frame = st->L_frame;
623 8116 : move16();
624 8116 : st->last_core = st->core;
625 8116 : move16();
626 8116 : st->last_core_brate = st->core_brate;
627 8116 : move32();
628 8116 : st->last_extl = st->extl;
629 8116 : move16();
630 : }
631 :
632 1040136 : return;
633 : }
|