LCOV - code coverage report
Current view: top level - lib_dec - gs_dec_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main @ da9cc8ead0679b4682d329fdff98cf1616159273 Lines: 389 413 94.2 %
Date: 2025-10-13 22:24:20 Functions: 4 4 100.0 %

          Line data    Source code
       1             : /*====================================================================================
       2             :     EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
       3             :   ====================================================================================*/
       4             : 
       5             : #include <stdint.h>
       6             : #include "options.h"
       7             : #include "cnst.h"
       8             : #include "rom_com.h"
       9             : #include "prot_fx.h"
      10             : #include "ivas_cnst.h"
      11             : /*=========================================================================*/
      12             : /* FUNCTION : void decod_audio_fx();                                                                   */
      13             : /*-------------------------------------------------------------------------*/
      14             : /* PURPOSE :  Decode audio (AC) frames                                             */
      15             : /*-------------------------------------------------------------------------*/
      16             : /*    INPUT ARGUMENTS :                                                                                                */
      17             : /* _ (Word16[]) Aq                      : LP filter coefficient         Q12                        */
      18             : /* _ (Word16) coder_type                : coding type                           Q0                         */
      19             : /* _(Word16) Q_exc              :Q format of excitation                    */
      20             : /*-------------------------------------------------------------------------*/
      21             : /* OUTPUT ARGUMENTS :                                                                                                      */
      22             : /* _ (Word16[]) pitch_buf_fx    : floating pitch values for each subframe Q6*/
      23             : /* _ (Word16[]) voice_factors_fx: frame error rate                              Q15                 */
      24             : /*--------------------------------------------------------------------------*/
      25             : /* INPUT/OUTPUT ARGUMENTS :                                                                                         */
      26             : /*  Decoder_State *st_fx        : decoder  memory structure                 */
      27             : /* _ (Word16[]) exc_fx                  : adapt. excitation exc (Q_exc)                     */
      28             : /* _ (Word16[]) exc2_fx                 : adapt. excitation/total exc (Q_exc)       */
      29             : /*--------------------------------------------------------------------------*/
      30             : /* RETURN ARGUMENTS :                                                                                                       */
      31             : /* _ None                                                                                                                                   */
      32             : /*==========================================================================*/
      33             : 
      34       13668 : void decod_audio_fx(
      35             :     Decoder_State *st_fx,              /* i/o: decoder static memory                                            */
      36             :     Word16 dct_epit[],                 /* o  : GSC excitation in DCT domain              Qx*/
      37             :     const Word16 *Aq,                  /* i  : LP filter coefficient                     Q12*/
      38             :     Word16 *pitch_buf,                 /* o  : Word16 pitch values for each subframe      Q6*/
      39             :     Word16 *voice_factors,             /* o  : voicing factors                           Q15*/
      40             :     Word16 *exc,                       /* i/o: adapt. excitation exc                     Q_exc*/
      41             :     Word16 *exc2,                      /* i/o: adapt. excitation/total exc               Q_exc*/
      42             :     Word16 *bwe_exc,                   /* o  : excitation for SWB TBE                    Q_exc*/
      43             :     Word16 *lsf_new,                   /* i  : ISFs at the end of the frame              Qx*/
      44             :     Word16 *gain_buf,                  /* o  : Word16 pitch gain for each subframe              Q14*/
      45             :     const Word16 tdm_lp_reuse_flag,    /* i  : LPC reuse flag                            Q0*/
      46             :     const Word16 tdm_low_rate_mode,    /* i  : secondary channel low rate mode flag      Q0*/
      47             :     const Word16 tdm_Pitch_reuse_flag, /* i  : primary channel pitch reuse flag          Q0*/
      48             :     const Word16 tdm_Pri_pitch_buf[]   /* i  : primary channel pitch buffer              Q6*/
      49             : )
      50             : {
      51             :     Word16 tmp_nb_bits_tot, pit_band_idx;
      52             :     Word16 code[4 * L_SUBFR];
      53             :     Word16 Diff_len, nb_subfr, i;
      54             :     Word16 nb_frame_flg;
      55       13668 :     Word16 Es_pred = 0;
      56             :     Word16 Len, max_len;
      57             :     Word16 gsc_attack_flag;
      58             : 
      59             :     Word16 low_pit;
      60             :     Word16 last_bin;
      61             :     Word16 nbits;
      62             : 
      63             :     Word16 exc_wo_nf[L_FRAME16k];
      64             :     GSC_DEC_HANDLE hGSCDec;
      65       13668 :     hGSCDec = st_fx->hGSCDec;
      66             : 
      67       13668 :     move16(); // Es_pred
      68             : 
      69             :     /*---------------------------------------------------------------*
      70             :      * Initialization
      71             :      *---------------------------------------------------------------*/
      72             : 
      73       13668 :     Diff_len = 0;
      74       13668 :     move16();
      75             : 
      76             :     /* decode GSC attack flag (used to reduce possible pre-echo) */
      77       13668 :     gsc_attack_flag = (Word16) get_next_indice_fx( st_fx, 1 ); /* Q0 */
      78       13668 :     move16();
      79             : 
      80             :     /* decode GSC SWB speech flag */
      81       13668 :     test();
      82       13668 :     test();
      83       13668 :     test();
      84       13668 :     test();
      85       13668 :     test();
      86       13668 :     test();
      87       13668 :     test();
      88       13668 :     IF( GE_16( st_fx->GSC_IVAS_mode, 1 ) || ( st_fx->coder_type != INACTIVE && ( ( st_fx->element_mode == EVS_MONO && GE_32( st_fx->total_brate, ACELP_13k20 ) ) ||
      89             :                                                                                  ( st_fx->element_mode > EVS_MONO && GT_32( st_fx->total_brate, MIN_BRATE_GSC_NOISY_FLAG ) && GE_16( st_fx->bwidth, SWB ) && !st_fx->flag_ACELP16k ) ) ) )
      90             :     {
      91        4569 :         st_fx->GSC_noisy_speech = (Word16) get_next_indice_fx( st_fx, 1 ); /* Q0 */
      92        4569 :         move16();
      93             :     }
      94             : 
      95             :     /* safety check in case of bit errors */
      96       13668 :     test();
      97       13668 :     test();
      98       13668 :     IF( st_fx->GSC_noisy_speech && LT_16( st_fx->bwidth, SWB ) && st_fx->GSC_IVAS_mode == 0 )
      99             :     {
     100           0 :         st_fx->BER_detect = 1; /* Q0 */
     101           0 :         move16();
     102           0 :         st_fx->GSC_noisy_speech = 0;
     103           0 :         move16();
     104             :     }
     105             : 
     106             :     /* set bit-allocation */
     107       13668 :     config_acelp1_fx( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, st_fx->inactive_coder_type_flag, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode );
     108             : 
     109             :     /*---------------------------------------------------------------*
     110             :      * Decode energy dynamics
     111             :      *---------------------------------------------------------------*/
     112             : 
     113       13668 :     test();
     114       13668 :     test();
     115       13668 :     IF( GE_16( st_fx->GSC_IVAS_mode, 1 ) || ( EQ_16( st_fx->GSC_noisy_speech, 1 ) && st_fx->GSC_IVAS_mode == 0 ) )
     116             :     {
     117        4569 :         nb_subfr = NB_SUBFR; /* Q0 */
     118        4569 :         move16();
     119        4569 :         hGSCDec->cor_strong_limit = 0;
     120        4569 :         move16();
     121        4569 :         hGSCDec->noise_lev = NOISE_LEVEL_SP3; /* Q0 */
     122        4569 :         move16();
     123             : 
     124        4569 :         IF( GE_16( st_fx->GSC_IVAS_mode, 1 ) )
     125             :         {
     126        3887 :             test();
     127        3887 :             if ( LT_32( st_fx->core_brate, GSC_L_RATE_STG ) && LT_32( st_fx->GSC_IVAS_mode, 3 ) )
     128             :             {
     129        1683 :                 nb_subfr = 2; /* Q0 */
     130        1683 :                 move16();
     131             :             }
     132        3887 :             hGSCDec->noise_lev = NOISE_LEVEL_SP2; /* Q0 */
     133        3887 :             move16();
     134             : 
     135        3887 :             IF( EQ_16( st_fx->GSC_IVAS_mode, 3 ) ) /* Music like */
     136             :             {
     137        2189 :                 hGSCDec->noise_lev = NOISE_LEVEL_SP0; /* Q0 */
     138        2189 :                 move16();
     139             :             }
     140        1698 :             ELSE IF( st_fx->GSC_noisy_speech == 0 ) /* speech like but not noisy */
     141             :             {
     142        1612 :                 hGSCDec->noise_lev = NOISE_LEVEL_SP3; /* Q0 */
     143        1612 :                 move16();
     144             :             }
     145             :         }
     146             :     }
     147             :     ELSE
     148             :     {
     149        9099 :         IF( LE_32( st_fx->core_brate, ACELP_8k00 ) )
     150             :         {
     151        4692 :             hGSCDec->noise_lev = add( (Word16) get_next_indice_fx( st_fx, 2 ), NOISE_LEVEL_SP2 ); /* Q0 */
     152        4692 :             move16();
     153             :         }
     154             :         ELSE
     155             :         {
     156        4407 :             hGSCDec->noise_lev = add( (Word16) get_next_indice_fx( st_fx, 3 ), NOISE_LEVEL_SP0 ); /* Q0 */
     157        4407 :             move16();
     158             :         }
     159             : 
     160             :         /*---------------------------------------------------------------*
     161             :          * Decode number of subframes
     162             :          *---------------------------------------------------------------*/
     163             : 
     164        9099 :         test();
     165        9099 :         test();
     166        9099 :         IF( EQ_16( st_fx->L_frame, L_FRAME16k ) && ( LE_32( st_fx->core_brate, ACELP_13k20 ) || st_fx->coder_type == INACTIVE ) )
     167             :         {
     168        2547 :             hGSCDec->cor_strong_limit = 0;
     169        2547 :             move16();
     170        2547 :             nb_subfr = 1; /* Q0 */
     171        2547 :             move16();
     172             :         }
     173             :         ELSE
     174             :         {
     175        6552 :             hGSCDec->cor_strong_limit = 1; /* Q0 */
     176        6552 :             move16();
     177        6552 :             nb_subfr = SWNB_SUBFR; /* Q0 */
     178        6552 :             move16();
     179             : 
     180        6552 :             IF( GE_32( st_fx->core_brate, ACELP_9k60 ) )
     181             :             {
     182        1324 :                 nbits = 1; /* Q0 */
     183        1324 :                 move16();
     184             : 
     185        1324 :                 test();
     186        1324 :                 if ( EQ_16( st_fx->L_frame, L_FRAME16k ) && GE_32( st_fx->core_brate, MIN_RATE_4SBFR ) )
     187             :                 {
     188           0 :                     nbits = 2; /* Q0 */
     189           0 :                     move16();
     190             :                 }
     191             : 
     192        1324 :                 nb_frame_flg = (Word16) get_next_indice_fx( st_fx, nbits ); /* Q0 */
     193        1324 :                 move16();
     194             : 
     195        1324 :                 test();
     196        1324 :                 IF( s_and( nb_frame_flg, 0x1 ) == 0 )
     197             :                 {
     198        1316 :                     nb_subfr = 2 * SWNB_SUBFR;
     199        1316 :                     move16();
     200        1316 :                     hGSCDec->cor_strong_limit = 0;
     201        1316 :                     move16();
     202             :                 }
     203           8 :                 ELSE IF( EQ_16( st_fx->L_frame, L_FRAME16k ) && GE_32( st_fx->core_brate, MIN_RATE_4SBFR ) )
     204             :                 {
     205           0 :                     nb_subfr = 2 * SWNB_SUBFR; /* cor_strong already set to 1 */
     206           0 :                     move16();
     207             :                 }
     208             : 
     209        1324 :                 if ( EQ_16( shr( nb_frame_flg, 1 ), 1 ) )
     210             :                 {
     211           0 :                     nb_subfr = shl( nb_subfr, 1 ); /* Q0 */
     212             :                 }
     213             :             }
     214             :         }
     215             :     }
     216             : 
     217       13668 :     test();
     218       13668 :     if ( EQ_16( st_fx->L_frame, L_FRAME16k ) && EQ_16( nb_subfr, NB_SUBFR ) )
     219             :     {
     220           0 :         nb_subfr = NB_SUBFR16k; /* Q0 */
     221           0 :         move16();
     222             :     }
     223             : 
     224             :     /*---------------------------------------------------------------*
     225             :      * Decode the last band where the adaptive (pitch) contribution is significant
     226             :      *---------------------------------------------------------------*/
     227             : 
     228       13668 :     IF( LT_32( st_fx->core_brate, CFREQ_BITRATE ) )
     229             :     {
     230        8555 :         nbits = 3; /* Q0 */
     231        8555 :         move16();
     232        8555 :         test();
     233        8555 :         if ( LT_32( st_fx->core_brate, ACELP_9k60 ) && ( st_fx->coder_type == INACTIVE ) )
     234             :         {
     235         310 :             nbits = 1; /* Q0 */
     236         310 :             move16();
     237             :         }
     238             :     }
     239             :     ELSE
     240             :     {
     241        5113 :         nbits = 4; /* Q0 */
     242        5113 :         move16();
     243             :     }
     244       13668 :     test();
     245       13668 :     IF( LT_32( st_fx->core_brate, ACELP_9k60 ) && st_fx->coder_type != INACTIVE )
     246             :     {
     247        6604 :         pit_band_idx = 1; /* Q0 */
     248        6604 :         move16();
     249             :     }
     250             :     ELSE
     251             :     {
     252        7064 :         pit_band_idx = (Word16) get_next_indice_fx( st_fx, nbits ); /* Q0 */
     253        7064 :         move16();
     254             :     }
     255             : 
     256       13668 :     IF( pit_band_idx != 0 )
     257             :     {
     258       11429 :         IF( LT_32( st_fx->core_brate, ACELP_9k60 ) )
     259             :         {
     260        6785 :             pit_band_idx = 7 + BAND1k2; /* Q0 */
     261        6785 :             move16();                   /* At low rate, if pitch model is chosen, then for to be use on extented and constant frequency range */
     262             :         }
     263             :         ELSE
     264             :         {
     265        4644 :             pit_band_idx = add( pit_band_idx, BAND1k2 ); /* Q0 */
     266             :         }
     267             : 
     268             :         /* detect bit errors in the bitstream */
     269       11429 :         IF( GT_16( pit_band_idx, 13 ) ) /* The maximum decodable index is 10 + BAND1k2 (3) = 13 */
     270             :         {
     271           0 :             pit_band_idx = 13; /* Q0 */
     272           0 :             move16();
     273           0 :             st_fx->BER_detect = 1; /* Q0 */
     274           0 :             move16();
     275             :         }
     276       11429 :         Diff_len = mfreq_loc_div_25[pit_band_idx]; /* Q0 */
     277       11429 :         move16();
     278             :     }
     279       13668 :     hGSCDec->Last_GSC_pit_band_idx = pit_band_idx; /* Q0 */
     280       13668 :     move16();
     281             : 
     282             :     /*--------------------------------------------------------------------------------------*
     283             :      * Decode adaptive (pitch) excitation contribution
     284             :      * Reset unvaluable part of the adaptive (pitch) excitation contribution
     285             :      *--------------------------------------------------------------------------------------*/
     286       13668 :     IF( GT_16( pit_band_idx, BAND1k2 ) )
     287             :     {
     288             :         /*---------------------------------------------------------------*
     289             :          * Decode adaptive (pitch) excitation contribution
     290             :          *---------------------------------------------------------------*/
     291       11429 :         test();
     292       11429 :         test();
     293       11429 :         test();
     294       11429 :         test();
     295       11429 :         test();
     296       11429 :         test();
     297       11429 :         test();
     298       11429 :         test();
     299       11429 :         IF( !( ( st_fx->GSC_IVAS_mode > 0 ) && EQ_16( idiv1616( st_fx->L_frame, nb_subfr ), 2 * L_SUBFR ) && LT_16( st_fx->GSC_IVAS_mode, 3 ) ) &&
     300             :             ( ( GE_32( st_fx->core_brate, MIN_RATE_FCB ) || st_fx->GSC_noisy_speech ) &&
     301             :               ( ( EQ_16( nb_subfr, NB_SUBFR ) && EQ_16( st_fx->L_frame, L_FRAME ) ) || ( EQ_16( nb_subfr, NB_SUBFR16k ) && EQ_16( st_fx->L_frame, L_FRAME16k ) ) ) ) )
     302             :         {
     303             :             Word16 indice;
     304         682 :             nbits = Es_pred_bits_tbl[BIT_ALLOC_IDX_fx( st_fx->core_brate, GENERIC, -1, -1 )]; /* Q0 */
     305         682 :             move16();
     306         682 :             if ( st_fx->element_mode > EVS_MONO )
     307             :             {
     308         682 :                 nbits = 5; /* Q0 */
     309         682 :                 move16();
     310             :             }
     311             : 
     312         682 :             indice = get_next_indice_fx( st_fx, nbits ); /* Q0 */
     313             : 
     314         682 :             Es_pred_dec_fx( &Es_pred, indice, nbits, 0 );
     315             :         }
     316             : 
     317       11429 :         dec_pit_exc_fx( st_fx, Aq, st_fx->coder_type, Es_pred, pitch_buf, code, exc, bwe_exc, nb_subfr, gain_buf, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf );
     318             : 
     319       11429 :         IF( LT_32( st_fx->core_brate, ACELP_9k60 ) )
     320             :         {
     321        6785 :             minimum_fx( pitch_buf, shr( st_fx->L_frame, 6 ), &low_pit );
     322        6785 :             low_pit = shr( low_pit, 6 ); /*Q6 -> Q0 */
     323             : 
     324        6785 :             IF( LT_16( low_pit, 64 ) )
     325             :             {
     326        3003 :                 pit_band_idx = 9 + BAND1k2; /* Q0 */
     327        3003 :                 move16();
     328        3003 :                 if ( st_fx->bwidth == NB )
     329             :                 {
     330           0 :                     pit_band_idx = 7 + BAND1k2; /* Q0 */
     331           0 :                     move16();
     332             :                 }
     333             :             }
     334        3782 :             ELSE IF( LT_16( low_pit, 128 ) )
     335             :             {
     336        2096 :                 pit_band_idx = 5 + BAND1k2; /* Q0 */
     337        2096 :                 move16();
     338             :             }
     339             :             ELSE
     340             :             {
     341        1686 :                 pit_band_idx = 3 + BAND1k2; /* Q0 */
     342        1686 :                 move16();
     343             :             }
     344             : 
     345        6785 :             Diff_len = mfreq_loc_div_25[pit_band_idx]; /* Q0 */
     346        6785 :             move16();
     347        6785 :             hGSCDec->Last_GSC_pit_band_idx = pit_band_idx; /* Q0 */
     348        6785 :             move16();
     349             :         }
     350             : 
     351             :         /*---------------------------------------------------------------*
     352             :          * DCT transform
     353             :          *---------------------------------------------------------------*/
     354       11429 :         edct_16fx( exc, dct_epit, st_fx->L_frame, 7, st_fx->element_mode );
     355             : 
     356             :         /*---------------------------------------------------------------*
     357             :          * Reset unvaluable part of the adaptive (pitch) excitation contribution
     358             :          *---------------------------------------------------------------*/
     359             : 
     360       11429 :         max_len = sub( st_fx->L_frame, Diff_len ); /* Q0 */
     361             : 
     362       11429 :         if ( st_fx->bwidth == NB )
     363             :         {
     364           0 :             max_len = sub( 160, Diff_len ); /* Q0 */
     365             :         }
     366             : 
     367       11429 :         Len = 80;
     368       11429 :         move16();
     369       11429 :         if ( LT_16( max_len, 80 ) )
     370             :         {
     371        3190 :             Len = max_len; /* Q0 */
     372        3190 :             move16();
     373             :         }
     374             : 
     375       11429 :         test();
     376       11429 :         IF( EQ_32( st_fx->core_brate, ACELP_8k00 ) && st_fx->bwidth != NB )
     377             :         {
     378        2026 :             FOR( i = 0; i < max_len; i++ )
     379             :             {
     380        2005 :                 dct_epit[i + Diff_len] = 0;
     381        2005 :                 move16();
     382             :             }
     383             :         }
     384             :         ELSE
     385             :         {
     386      874410 :             FOR( i = 0; i < Len; i++ )
     387             :             {
     388      863002 :                 dct_epit[i + Diff_len] = mult_r( dct_epit[i + Diff_len], sm_table_fx[i] ); /* Qx */
     389      863002 :                 move16();
     390             :             }
     391             : 
     392      608182 :             FOR( ; i < max_len; i++ )
     393             :             {
     394      596774 :                 dct_epit[i + Diff_len] = 0;
     395      596774 :                 move16();
     396             :             }
     397             :         }
     398             :         // PMT("in the rare case of 4 subfr, bfi_pitch_fx might be wrong")
     399       11429 :         st_fx->bfi_pitch_fx = mean_fx( pitch_buf, nb_subfr ); /* Q6 */
     400       11429 :         move16();
     401       11429 :         st_fx->bfi_pitch_frame = st_fx->L_frame; /* Q0 */
     402       11429 :         move16();
     403             : 
     404       11429 :         Diff_len = add( Diff_len, 1 ); /* Q0 */
     405       11429 :         st_fx->bpf_off = 0;
     406       11429 :         move16();
     407             :     }
     408             :     ELSE
     409             :     {
     410             :         /* No adaptive (pitch) excitation contribution */
     411        2239 :         st_fx->bpf_off = 1;
     412        2239 :         move16();
     413        2239 :         set16_fx( dct_epit, 0, st_fx->L_frame );
     414             : 
     415        2239 :         IF( EQ_16( st_fx->L_frame, L_FRAME16k ) )
     416             :         {
     417        1504 :             set16_fx( pitch_buf, ( L_SUBFR16k * 64 ), NB_SUBFR16k );
     418             :         }
     419             :         ELSE
     420             :         {
     421         735 :             set16_fx( pitch_buf, L_SUBFR * 64, NB_SUBFR );
     422             :         }
     423             : 
     424        2239 :         set16_fx( gain_buf, 0, NB_SUBFR16k );
     425             : 
     426        2239 :         st_fx->bfi_pitch_fx = L_SUBFR * 64;
     427        2239 :         move16();
     428        2239 :         st_fx->bfi_pitch_frame = st_fx->L_frame; /* Q0 */
     429        2239 :         move16();
     430        2239 :         st_fx->lp_gainp_fx = 0;
     431        2239 :         move16();
     432        2239 :         st_fx->lp_gainc_fx = 0;
     433        2239 :         move16();
     434        2239 :         st_fx->tilt_code_fx = 0;
     435        2239 :         move16();
     436        2239 :         pit_band_idx = 0;
     437        2239 :         move16();
     438        2239 :         Diff_len = 0;
     439        2239 :         move16();
     440             :     }
     441             : 
     442             :     /*--------------------------------------------------------------------------------------*
     443             :      * GSC decoder
     444             :      *--------------------------------------------------------------------------------------*/
     445             : 
     446             :     /* find the current total number of bits used */
     447             : 
     448       13668 :     tmp_nb_bits_tot = st_fx->next_bit_pos; /* Q0 */
     449       13668 :     move16();
     450             : 
     451       13668 :     if ( st_fx->extl_brate_orig > 0 )
     452             :     {
     453             :         /* subtract 1 bit for TBE/BWE BWE flag (bit counted in extl_brate) */
     454       13553 :         tmp_nb_bits_tot = sub( tmp_nb_bits_tot, 1 ); /* Q0 */
     455             :     }
     456             : 
     457       13668 :     test();
     458       13668 :     test();
     459       13668 :     if ( st_fx->coder_type == INACTIVE && LE_32( st_fx->core_brate, ACELP_9k60 ) && st_fx->idchan == 0 )
     460             :     {
     461         325 :         tmp_nb_bits_tot = add( tmp_nb_bits_tot, 5 ); /* Q0 */
     462             :     }
     463             : 
     464       13668 :     IF( EQ_16( st_fx->idchan, 1 ) )
     465             :     {
     466           0 :         tmp_nb_bits_tot = add( tmp_nb_bits_tot, TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS ); /* Q0 */
     467           0 :         if ( EQ_16( st_fx->tdm_LRTD_flag, 1 ) )
     468             :         {
     469           0 :             tmp_nb_bits_tot = sub( tmp_nb_bits_tot, STEREO_BITS_TCA ); /* Q0 */
     470             :         }
     471             :     }
     472             : 
     473             : 
     474       13668 :     Word16 Q_exc_old = st_fx->Q_exc;
     475       13668 :     move16();
     476       13668 :     gsc_dec_fx( st_fx, dct_epit, pit_band_idx, Diff_len, tmp_nb_bits_tot, nb_subfr, st_fx->coder_type, &last_bin, lsf_new, exc_wo_nf, &st_fx->Q_exc );
     477             : 
     478       13668 :     IF( NE_16( Q_exc_old, st_fx->Q_exc ) )
     479             :     {
     480           5 :         Q_exc_old = sub( Q_exc_old, st_fx->Q_exc );
     481           5 :         IF( st_fx->hGSCDec )
     482             :         {
     483           5 :             Scale_sig( st_fx->hGSCDec->last_exc_dct_in_fx, L_FRAME16k, Q_exc_old ); /* Q_exc_old */
     484             :         }
     485           5 :         IF( bwe_exc )
     486             :         {
     487           5 :             Scale_sig( bwe_exc - PIT16k_MAX * 2, ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2, Q_exc_old ); /* Q_exc_old */
     488             :         }
     489             :     }
     490             :     /*--------------------------------------------------------------------------------------*
     491             :      * iDCT transform
     492             :      *--------------------------------------------------------------------------------------*/
     493             : 
     494       13668 :     edct_16fx( dct_epit, exc, st_fx->L_frame, 7, st_fx->element_mode );
     495       13668 :     edct_16fx( exc_wo_nf, exc_wo_nf, st_fx->L_frame, 7, st_fx->element_mode );
     496             :     /*----------------------------------------------------------------------*
     497             :      * Remove potential pre-echo in case an onset has been detected
     498             :      *----------------------------------------------------------------------*/
     499             : 
     500       13668 :     pre_echo_att_fx( &hGSCDec->Last_frame_ener_fx, exc, gsc_attack_flag, st_fx->Q_exc, st_fx->last_coder_type, st_fx->L_frame );
     501             : 
     502             :     /*--------------------------------------------------------------------------------------*
     503             :      * Update BWE excitation
     504             :      *--------------------------------------------------------------------------------------*/
     505             : 
     506       13668 :     IF( st_fx->hBWE_TD != NULL )
     507             :     {
     508       13668 :         set16_fx( voice_factors, 0, NB_SUBFR16k );
     509       13668 :         IF( EQ_16( st_fx->L_frame, L_FRAME16k ) )
     510             :         {
     511        2547 :             interp_code_4over2_fx( exc, bwe_exc, st_fx->L_frame );
     512             :         }
     513             :         ELSE
     514             :         {
     515       11121 :             interp_code_5over2_fx( exc, bwe_exc, L_FRAME );
     516             :         }
     517             :     }
     518             :     /*--------------------------------------------------------------------------------------*
     519             :      * Updates
     520             :      *--------------------------------------------------------------------------------------*/
     521             : 
     522       13668 :     Copy( exc, exc2, st_fx->L_frame );      /* Q_exc */
     523       13668 :     Copy( exc_wo_nf, exc, st_fx->L_frame ); /* Q_exc */
     524             : 
     525             :     /*--------------------------------------------------------------------------------------*
     526             :      * Channel aware mode parameters
     527             :      *--------------------------------------------------------------------------------------*/
     528             : 
     529       13668 :     set16_fx( st_fx->tilt_code_dec_fx, 0, NB_SUBFR16k );
     530             : 
     531       13668 :     return;
     532             : }
     533             : 
     534             : /*==========================================================================*/
     535             : /* FUNCTION : void gsc_dec_fx   ()                                                                  */
     536             : /*--------------------------------------------------------------------------*/
     537             : /* PURPOSE  :  Generic audio signal decoder                                 */
     538             : /*--------------------------------------------------------------------------*/
     539             : /*    INPUT ARGUMENTS :                                                                                                 */
     540             : /* _ (Word16) pit_band_idx       : bin position of the cut-off frequency Q0 */
     541             : /* _ (Word16) Diff_len           : Lenght of the difference signal       Q0 */
     542             : /* _ (Word16) coder_type         : coding type                                       Q0 */
     543             : /* _ (Word16) bits_used          : Number of bit used before frequency Q Q0 */
     544             : /* _ (Word16) nb_subfr           : Number of subframe considered         Q0 */
     545             : /* _ (Word16)  Qexc              : Q format of exc_dct_in                               */
     546             : /*--------------------------------------------------------------------------*/
     547             : /* OUTPUT ARGUMENTS :                                                                                                       */
     548             : /* _ None                                                                   */
     549             : /*--------------------------------------------------------------------------*/
     550             : /* INPUT/OUTPUT ARGUMENTS :                                                                                         */
     551             : /*   Decoder_State *st_fx:Decoder State Structure                        */
     552             : /* _ (Word16[]) exc_dct_in : dctof pitch-only excitation / total excitation Qexc*/
     553             : /*--------------------------------------------------------------------------*/
     554             : /* RETURN ARGUMENTS :                                                                                                       */
     555             : /* _None                                                                            */
     556             : /*==========================================================================*/
     557             : 
     558       20618 : void gsc_dec_fx(
     559             :     Decoder_State *st_fx,      /* i/o: State structure                                            */
     560             :     Word16 exc_dct_in[],       /* i/o: dct of pitch-only excitation / total excitation       Q_exc*/
     561             :     const Word16 pit_band_idx, /* i  : bin position of the cut-off frequency               `    Q0*/
     562             :     const Word16 Diff_len,     /* i  : Lenght of the difference signal (before pure spectral)   Q0*/
     563             :     const Word16 bits_used,    /* i  : Number of bit used before frequency Q                                    Q0*/
     564             :     const Word16 nb_subfr,     /* i  : Number of subframe considered                                                    Q0*/
     565             :     const Word16 coder_type,   /* i  : coding type                                                                                              Q0*/
     566             :     Word16 *last_bin,          /* i  : last bin of bit allocation                                                               Q0*/
     567             :     const Word16 *lsf_new,     /* i  : ISFs at the end of the frame                             Qx*/
     568             :     Word16 *exc_wo_nf,         /* o  : excitation (in f domain) without noisefill            Q_exc*/
     569             :     Word16 *Q_exc )
     570             : {
     571             :     Word16 i, j, bit, nb_subbands, pvq_len;
     572             :     Word16 bitallocation_band[MBANDS_GN_BITALLOC16k];
     573             :     Word16 bitallocation_exc[2];
     574             :     Word16 Ener_per_bd_iQ[MBANDS_GN_BITALLOC16k];
     575             :     Word16 max_ener_band[MBANDS_GN_BITALLOC16k];
     576             :     Word16 exc_diffQ[L_FRAME16k];
     577             :     Word16 bits_per_bands[MBANDS_GN_BITALLOC16k];
     578             :     Word16 concat_out[L_FRAME16k];
     579             :     Word16 max_eq, max_eq_val;
     580             :     Word16 inpulses_fx[NB_SFM];
     581             :     Word16 imaxpulse_fx[NB_SFM];
     582             :     Word16 mean_gain;
     583       20618 :     Word16 Mbands_gn = MBANDS_GN;
     584       20618 :     Word16 Qexc_diffQ = Q_PVQ_OUT;
     585             :     Word32 L_tmp;
     586             :     Word16 Q_tmp;
     587             :     Word16 seed_init;
     588             :     GSC_DEC_HANDLE hGSCDec;
     589       20618 :     hGSCDec = st_fx->hGSCDec;
     590             : 
     591       20618 :     move16(); /* for Mbands_gn */
     592       20618 :     move16(); /* for Qexc_diffQ */
     593       20618 :     set16_fx( inpulses_fx, 0, NB_SFM );
     594       20618 :     set16_fx( imaxpulse_fx, 0, NB_SFM );
     595             : 
     596             :     /*--------------------------------------------------------------------------------------*
     597             :      * Initialization
     598             :      *--------------------------------------------------------------------------------------*/
     599       20618 :     bit = bits_used;
     600       20618 :     move16();
     601             : 
     602       20618 :     test();
     603       20618 :     test();
     604       20618 :     test();
     605       20618 :     if ( coder_type == INACTIVE && ( EQ_16( st_fx->tdm_LRTD_flag, 1 ) || EQ_16( st_fx->element_mode, IVAS_SCE ) ) && LE_32( st_fx->core_brate, GSC_LRES_GAINQ_LIMIT ) )
     606             :     {
     607        6303 :         bit = add( bit, GSC_LRES_NB_NITS ); /* Q0 */
     608             :     }
     609             : 
     610       20618 :     if ( EQ_16( st_fx->L_frame, L_FRAME16k ) )
     611             :     {
     612        2551 :         Mbands_gn = MBANDS_GN16k; /* Q0 */
     613        2551 :         move16();
     614             :     }
     615             : 
     616       20618 :     set16_fx( exc_diffQ, 0, st_fx->L_frame );
     617             : 
     618             :     /*--------------------------------------------------------------------------------------*
     619             :      * Gain decoding
     620             :      *--------------------------------------------------------------------------------------*/
     621             : 
     622       20618 :     test();
     623       20618 :     IF( st_fx->bfi || st_fx->BER_detect )
     624             :     {
     625             :         /* copy old gain */
     626         196 :         Copy( hGSCDec->old_y_gain_fx, Ener_per_bd_iQ, Mbands_gn ); /* Q_old_gain */
     627         196 :         mean_gain = mult_r( st_fx->lp_gainc_fx, 3277 );            /*Q3*/
     628        3340 :         FOR( i = 0; i < Mbands_gn; i++ )
     629             :         {
     630        3144 :             Ener_per_bd_iQ[i] = add( Ener_per_bd_iQ[i], shl( mean_gain, 9 ) ); /*Q12*/
     631        3144 :             move16();
     632             :         }
     633             : 
     634         196 :         st_fx->lp_gainc_fx = mult_r( st_fx->lp_gainc_fx, 32112 ); /*Q3*/
     635         196 :         move16();
     636             :     }
     637             :     ELSE
     638             :     {
     639       20422 :         i = 0;
     640       20422 :         move16();
     641       96698 :         WHILE( LT_16( i, SIZE_BRATE_INTERMED_TBL ) )
     642             :         {
     643       96698 :             if ( LE_32( st_fx->core_brate, brate_intermed_tbl[i] ) )
     644             :             {
     645       20422 :                 break;
     646             :             }
     647       76276 :             i++;
     648             :         }
     649             : 
     650       20422 :         test();
     651       20422 :         test();
     652       20422 :         test();
     653       30053 :         if ( st_fx->element_mode > EVS_MONO && EQ_16( coder_type, AUDIO ) &&
     654       15866 :              LE_32( st_fx->core_brate, STEREO_GSC_BIT_RATE_ALLOC ) && EQ_32( brate_intermed_tbl[i], ACELP_9k60 ) ) /* Bit allocation is mapped to 8 kb/s instead of 9.6 kb/s in this case */
     655             :         {
     656        1074 :             i--;
     657             :         }
     658             : 
     659       20422 :         IF( EQ_16( st_fx->element_mode, EVS_MONO ) )
     660             :         {
     661           8 :             mean_gain = gsc_gaindec_fx( st_fx, Ener_per_bd_iQ, brate_intermed_tbl[i], hGSCDec->old_y_gain_fx, coder_type, st_fx->bwidth ); /* Q3 */
     662             :         }
     663             :         ELSE
     664             :         {
     665       20414 :             mean_gain = gsc_gaindec_ivas_fx( st_fx, Ener_per_bd_iQ, brate_intermed_tbl[i], hGSCDec->old_y_gain_fx, coder_type, st_fx->bwidth ); /* Q3 */
     666             :         }
     667             : 
     668       20422 :         st_fx->lp_gainc_fx = mult_r( 640, mean_gain ); /*10 in Q6 x Q12 -> lp_gainc in Q3 */
     669       20422 :         move16();
     670             :     }
     671             : 
     672       20618 :     *last_bin = 0;
     673       20618 :     move16();
     674       20618 :     test();
     675       20618 :     IF( EQ_32( st_fx->core_brate, ACELP_8k00 ) && st_fx->bwidth != NB )
     676             :     {
     677          21 :         bitallocation_exc[0] = 0;
     678          21 :         move16();
     679          21 :         bitallocation_exc[1] = 0;
     680          21 :         move16();
     681             :     }
     682             : 
     683       20618 :     set16_fx( bitallocation_band, 0, MBANDS_GN );
     684             : 
     685       20618 :     test();
     686       20618 :     IF( ( EQ_16( st_fx->bfi, 1 ) ) || st_fx->BER_detect )
     687             :     {
     688             :         /*--------------------------------------------------------------------------------------*
     689             :          * Copy old spectrum
     690             :          * reduce spectral dynamic
     691             :          * save spectrum
     692             :          *--------------------------------------------------------------------------------------*/
     693             : 
     694         196 :         max_eq = 32767;
     695         196 :         move16();
     696             : 
     697         196 :         test();
     698         196 :         IF( EQ_16( st_fx->last_good, INACTIVE_CLAS ) || EQ_16( st_fx->Last_GSC_noisy_speech_flag, 1 ) )
     699             :         {
     700       28526 :             FOR( i = 0; i < st_fx->L_frame; i++ )
     701             :             {
     702       28416 :                 L_tmp = L_shr( L_mult( Random( &hGSCDec->seed_tcx ), 26214 ), 5 ); /*Q10*/
     703       28416 :                 L_tmp = L_mac( L_tmp, hGSCDec->Last_GSC_spectrum_fx[i], 6554 );    /*Q10*/
     704       28416 :                 hGSCDec->Last_GSC_spectrum_fx[i] = round_fx( L_tmp );              /*Q10*/
     705       28416 :                 move16();
     706             :             }
     707             :         }
     708             : 
     709         196 :         Copy( hGSCDec->Last_GSC_spectrum_fx, exc_diffQ, st_fx->L_frame ); /* Q10 */
     710             : 
     711       50628 :         FOR( i = 0; i < st_fx->L_frame; i++ )
     712             :         {
     713       50432 :             hGSCDec->Last_GSC_spectrum_fx[i] = mult_r( hGSCDec->Last_GSC_spectrum_fx[i], 24576 ); /*Q10*/
     714       50432 :             move16();
     715             :         }
     716             :     }
     717             :     ELSE
     718             :     {
     719             :         /*--------------------------------------------------------------------------------------*
     720             :          * PVQ decoder
     721             :          *--------------------------------------------------------------------------------------*/
     722             : 
     723       20422 :         bands_and_bit_alloc_ivas_fx( hGSCDec->cor_strong_limit, hGSCDec->noise_lev, st_fx->core_brate, Diff_len, bit, &bit, Ener_per_bd_iQ,
     724       20422 :                                      max_ener_band, bits_per_bands, &nb_subbands, NULL, NULL, &pvq_len, coder_type, st_fx->bwidth, st_fx->GSC_noisy_speech,
     725       20422 :                                      st_fx->L_frame, st_fx->element_mode, st_fx->GSC_IVAS_mode );
     726             : 
     727       20422 :         IF( bit == 0 )
     728             :         {
     729           0 :             set16_fx( concat_out, 0, L_FRAME16k );
     730             :         }
     731             : 
     732       20422 :         pvq_core_dec_fx( st_fx, gsc_sfm_start, gsc_sfm_end, gsc_sfm_size, concat_out, &Q_tmp, bit, nb_subbands, bits_per_bands, NULL, inpulses_fx, imaxpulse_fx, ACELP_CORE );
     733       20422 :         IF( nb_subbands > 0 )
     734             :         {
     735       20422 :             Scale_sig( concat_out, gsc_sfm_end[nb_subbands - 1], sub( Q_PVQ_OUT, Q_tmp ) ); /* Q_PVQ_OUT */
     736             :         }
     737             : 
     738       20422 :         seed_init = 0;
     739       20422 :         move16();
     740             : 
     741       20422 :         max_eq = 0;
     742       20422 :         move16();
     743       20422 :         max_eq_val = 32767; /* 1.0f in Q15 */
     744       20422 :         move16();
     745             : 
     746       20422 :         test();
     747       20422 :         test();
     748       20422 :         test();
     749       20422 :         IF( ( ( LT_32( st_fx->core_brate, ACELP_7k20 ) && EQ_16( st_fx->GSC_noisy_speech, 1 ) ) || LT_32( st_fx->core_brate, 6000 ) ) && LE_16( coder_type, UNVOICED ) )
     750             :         {
     751        6692 :             j = maximum_fx( concat_out, imult1616( nb_subbands, 16 ), &max_eq );
     752        6692 :             Word16 temp_max_eq = add( abs_s( concat_out[j] ), 10 ) /*0.01f in Q10*/;
     753        6692 :             if ( LE_16( temp_max_eq, ONE_IN_Q10 ) )
     754             :             {
     755        6306 :                 max_eq = max_eq_val; /* Q15 */
     756        6306 :                 move16();
     757             :             }
     758             :             ELSE
     759             :             {
     760         386 :                 Word16 exp = 5;
     761         386 :                 move16();
     762         386 :                 max_eq = Inv16( temp_max_eq, &exp );
     763         386 :                 max_eq = shl( max_eq, exp ); /* Q15 */
     764             :             }
     765             :         }
     766             : 
     767             :         /* Reorder Q bands */
     768      166295 :         FOR( j = 0; j < nb_subbands; j++ )
     769             :         {
     770      145873 :             Copy( concat_out + imult1616( j, 16 ), exc_diffQ + imult1616( max_ener_band[j], 16 ), 16 ); /* Q_PVQ_OUT */
     771             : 
     772      145873 :             *last_bin = s_max( *last_bin, max_ener_band[j] ); /* Q0 */
     773      145873 :             move16();
     774             : 
     775      145873 :             bitallocation_band[max_ener_band[j]] = 1; /* Q0 */
     776      145873 :             move16();
     777             : 
     778      145873 :             seed_init = add( seed_init, inpulses_fx[j] ); /* Q0 */
     779             :         }
     780       20422 :         test();
     781       20422 :         IF( NE_16( st_fx->last_coder_type, AUDIO )         /* First audio frame */
     782             :             && NE_16( st_fx->last_coder_type, UNVOICED ) ) /* last_coder_type == INACTIVE is overwritten in update_dec to UNVOICED */
     783             :         {
     784      376681 :             FOR( j = 0; j < shl( nb_subbands, 4 ); j++ )
     785             :             {
     786      373856 :                 IF( concat_out[j] > 0 )
     787             :                 {
     788       57456 :                     seed_init = extract_l( L_shl( seed_init, 3 ) ); /* Q0 */
     789             :                 }
     790      373856 :                 if ( concat_out[j] < 0 )
     791             :                 {
     792       57594 :                     seed_init = add_sat( seed_init, 3 ); /* Q0 */
     793             :                 }
     794             :             }
     795             : 
     796        2825 :             hGSCDec->seed_tcx = seed_init; /* Q0 */
     797        2825 :             move16();
     798             :         }
     799       20422 :         test();
     800       20422 :         IF( EQ_32( st_fx->core_brate, ACELP_8k00 ) && st_fx->bwidth != NB )
     801             :         {
     802          21 :             if ( exc_diffQ[L_FRAME8k - 2] != 0 )
     803             :             {
     804           0 :                 bitallocation_exc[0] = 1; /* Q0 */
     805           0 :                 move16();
     806             :             }
     807             : 
     808          21 :             if ( exc_diffQ[L_FRAME8k - 1] != 0 )
     809             :             {
     810           3 :                 bitallocation_exc[1] = 1; /* Q0 */
     811           3 :                 move16();
     812             :             }
     813             :         }
     814             : 
     815       20422 :         Copy( exc_diffQ, hGSCDec->Last_GSC_spectrum_fx, st_fx->L_frame ); /* Q_PVQ_OUT */
     816             : 
     817             :         /*--------------------------------------------------------------------------------------*
     818             :          * Skip adaptive (pitch) contribution frequency band (no noise added over the time contribution)
     819             :          * Find x pulses between 1.6-3.2kHz to code in the spectrum of the residual signal
     820             :          * Gain is based on the inter-correlation gain between the pulses found and residual signal
     821             :          *--------------------------------------------------------------------------------------*/
     822             : 
     823       20422 :         test();
     824       20422 :         test();
     825       20422 :         test();
     826       20422 :         test();
     827       20422 :         IF( GE_16( st_fx->GSC_IVAS_mode, 1 ) && EQ_16( st_fx->GSC_noisy_speech, 1 ) )
     828             :         {
     829       16598 :             FOR( i = 64; i < st_fx->L_frame; i++ )
     830             :             {
     831       16512 :                 exc_diffQ[i] = mult_r( exc_diffQ[i], max_eq ); /* Q_PVQ_OUT */
     832       16512 :                 move16();
     833             :             }
     834             :         }
     835       20336 :         ELSE IF( ( ( LT_32( st_fx->core_brate, ACELP_7k20 ) && EQ_16( st_fx->GSC_noisy_speech, 1 ) ) || LT_32( st_fx->core_brate, 6000 ) ) && LE_16( st_fx->coder_type, UNVOICED ) )
     836             :         {
     837     1719844 :             FOR( i = 0; i < L_FRAME; i++ )
     838             :             {
     839     1713152 :                 exc_diffQ[i] = mult_r( exc_diffQ[i], max_eq ); /* Q_PVQ_OUT */
     840     1713152 :                 move16();
     841             :             }
     842             :         }
     843             :         ELSE
     844             :         {
     845       13644 :             freq_dnw_scaling_fx( hGSCDec->cor_strong_limit, st_fx->coder_type, hGSCDec->noise_lev, st_fx->core_brate, exc_diffQ, Qexc_diffQ, st_fx->L_frame );
     846             :         }
     847             :     }
     848             : 
     849             :     /*--------------------------------------------------------------------------------------*
     850             :      * Estimate noise level
     851             :      *--------------------------------------------------------------------------------------*/
     852             : 
     853       20618 :     highband_exc_dct_in_ivas_fx( st_fx->core_brate, mfreq_bindiv_loc, *last_bin, Diff_len, hGSCDec->noise_lev, pit_band_idx, exc_diffQ,
     854       20618 :                                  &hGSCDec->seed_tcx, Ener_per_bd_iQ, nb_subfr, exc_dct_in, st_fx->last_coder_type, bitallocation_band, lsf_new,
     855       20618 :                                  hGSCDec->last_exc_dct_in_fx, &hGSCDec->last_ener_fx, hGSCDec->last_bitallocation_band, bitallocation_exc, st_fx->bfi, coder_type,
     856       20618 :                                  st_fx->bwidth, exc_wo_nf, Qexc_diffQ, Q_exc, st_fx->GSC_noisy_speech, hGSCDec->lt_ener_per_band_fx, st_fx->L_frame, st_fx->element_mode, st_fx->GSC_IVAS_mode );
     857             : 
     858       20618 :     exc_dct_in[0] = 0;
     859       20618 :     move16();
     860             : 
     861       20618 :     return;
     862             : }
     863             : 
     864             : /*-------------------------------------------------------------------*
     865             :  * GSC_dec_init()
     866             :  *
     867             :  * Initialize GSC decoder state structure
     868             :  *-------------------------------------------------------------------*/
     869             : 
     870           3 : void GSC_dec_init(
     871             :     GSC_DEC_HANDLE hGSCDec /* i/o: GSC data handle  */
     872             : )
     873             : {
     874           3 :     hGSCDec->seed_tcx = 15687; /* Q0 */
     875           3 :     hGSCDec->cor_strong_limit = 1;
     876           3 :     move16();
     877           3 :     move16();
     878             : 
     879           3 :     hGSCDec->noise_lev = NOISE_LEVEL_SP0; /* Q0 */
     880           3 :     hGSCDec->Last_GSC_pit_band_idx = 0;
     881           3 :     move16();
     882           3 :     move16();
     883             : 
     884           3 :     set16_fx( hGSCDec->Last_GSC_spectrum_fx, 0, L_FRAME );
     885           3 :     set16_fx( hGSCDec->last_exc_dct_in_fx, 0, L_FRAME );
     886           3 :     set16_fx( hGSCDec->old_y_gain_fx, 0, MBANDS_GN );
     887           3 :     set16_fx( hGSCDec->lt_ener_per_band_fx, 4096, MBANDS_GN ); /*Q12*/
     888             : 
     889           3 :     hGSCDec->last_ener_fx = 0;
     890           3 :     move16();
     891           3 :     set16_fx( hGSCDec->last_bitallocation_band, 0, 6 );
     892             : 
     893           3 :     hGSCDec->Last_frame_ener_fx = MAX_32;
     894           3 :     move32();
     895           3 :     return;
     896             : }
     897             : 
     898        3445 : void GSC_dec_init_ivas_fx(
     899             :     GSC_DEC_HANDLE hGSCDec /* i/o: GSC data handle  */
     900             : )
     901             : {
     902        3445 :     hGSCDec->seed_tcx = 15687; /* Q0 */
     903        3445 :     move16();
     904        3445 :     hGSCDec->cor_strong_limit = 1;
     905        3445 :     move16();
     906        3445 :     set16_fx( hGSCDec->old_y_gain_fx, 0, MBANDS_GN );
     907        3445 :     hGSCDec->noise_lev = NOISE_LEVEL_SP0;
     908        3445 :     move16();
     909        3445 :     set16_fx( hGSCDec->Last_GSC_spectrum_fx, 0, L_FRAME16k );
     910        3445 :     hGSCDec->Last_GSC_pit_band_idx = 0;
     911        3445 :     move16();
     912             : 
     913        3445 :     set16_fx( hGSCDec->lt_ener_per_band_fx, 4096, MBANDS_GN16k ); /*Q12*/
     914        3445 :     set16_fx( hGSCDec->last_exc_dct_in_fx, 0, L_FRAME16k );
     915        3445 :     hGSCDec->last_ener_fx = 0;
     916        3445 :     move16();
     917        3445 :     set16_fx( hGSCDec->last_bitallocation_band, 0, 6 );
     918             : 
     919        3445 :     hGSCDec->Last_frame_ener_fx = MAX_32;
     920        3445 :     move32();
     921             : 
     922        3445 :     return;
     923             : }

Generated by: LCOV version 1.14