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

Generated by: LCOV version 1.14