LCOV - code coverage report
Current view: top level - lib_dec - dec_uv_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main enc/dec/rend @ 3b2f07138c61dcf997bbf4165d0882f794b2995f Lines: 100 109 91.7 %
Date: 2025-05-03 01:55:50 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /*====================================================================================
       2             :     EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
       3             :   ====================================================================================*/
       4             : #include <stdint.h>
       5             : #include "options.h" /* Compilation switches                   */
       6             : #include "cnst.h"    /* Common constants                       */
       7             : #include "prot_fx.h" /* Function prototypes                    */
       8             : static void gain_dec_gacelp_uv_fx(
       9             :     Word16 index,       /* i  : Quantization index vector        Q0  */
      10             :     Word16 *code,       /* i  : algebraic code excitation        Q9  */
      11             :     Word16 *code2,      /* i  : algebraic code excitation        Q9  */
      12             :     Word16 mean_ener,   /* i  :                                 Q8  */
      13             :     Word16 lcode,       /* i  : Subframe size                    Q0  */
      14             :     Word16 *gain_pit,   /* o  : Quantized pitch gain            1Q14 */
      15             :     Word32 *gain_code,  /* o  : Quantized codebook gain          Q16 */
      16             :     Word32 *gain_code2, /* o  : Quantized codebook gain          Q16 */
      17             :     Word16 *past_gpit,  /* i/o: past gain of pitch              1Q14 */
      18             :     Word32 *past_gcode, /* i/o: past energy of code              Q16 */
      19             :     Word16 *gain_inov   /* o  : unscaled innovation gain        3Q12 */
      20             : );
      21             : 
      22             : /*-------------------------------------------------------------------*
      23             :  * decod_unvoiced()
      24             :  *
      25             :  * Decode unvoiced (UC) frames
      26             :  *-------------------------------------------------------------------*/
      27             : 
      28             : #ifndef REMOVE_EVS_DUPLICATES
      29             : void decod_unvoiced_fx(
      30             :     Decoder_State *st_fx,     /*                                        i/o: decoder static memory                  */
      31             :     const Word16 *Aq_fx,      /*        Q12                             i  : LP filter coefficient                  */
      32             :     const Word16 coder_type,  /*        Q0                              i  : coding type                            */
      33             :     Word16 *tmp_noise_fx,     /*        Q0                              o  : long term temporary noise energy       */
      34             :     Word16 *pitch_buf_fx,     /*        Q6                              o  : floating pitch values for each subframe*/
      35             :     Word16 *voice_factors_fx, /*        Q15                             o  : voicing factors                        */
      36             :     Word16 *exc_fx,           /*        Q_X                     o  : adapt. excitation exc                  */
      37             :     Word16 *exc2_fx,          /*        Q_X                             o  : adapt. excitation/total exc            */
      38             :     Word16 *bwe_exc_fx,       /*        Q_X                             i/o: excitation for SWB TBE                                     */
      39             :     Word16 *gain_buf )
      40             : {
      41             :     Word16 gain_pit_fx;       /* Quantized pitch gain                 */
      42             :     Word32 gain_code_fx;      /* Quantized algebraic codeebook gain   */
      43             :     Word16 gain_inov_fx;      /* inovation gain                       */
      44             :     Word32 norm_gain_code_fx; /* normalized algebraic codeebook gain  */
      45             :     Word16 voice_fac_fx;      /* Voicing factor                       */
      46             :     Word16 code_fx[L_SUBFR];  /* algebraic codevector                 */
      47             :     Word16 i_subfr_fx;
      48             :     const Word16 *p_Aq_fx;
      49             :     Word16 *pt_pitch_fx;
      50             : 
      51             :     gain_pit_fx = 0;
      52             :     move16();
      53             : 
      54             :     test();
      55             :     IF( EQ_16( st_fx->last_ppp_mode_dec, 1 ) || EQ_16( st_fx->last_nelp_mode_dec, 1 ) )
      56             :     {
      57             :         /* SC_VBR - reset the decoder, to avoid memory not updated issue for this unrealistic case */
      58             :         CNG_reset_dec_fx( st_fx, pitch_buf_fx, voice_factors_fx );
      59             :     }
      60             : 
      61             :     p_Aq_fx = Aq_fx;
      62             :     move16(); /*Q12*/ /* pointer to interpolated LPC parameters */
      63             :     pt_pitch_fx = pitch_buf_fx;
      64             :     move16(); /* pointer to the pitch buffer  */
      65             : 
      66             :     FOR( i_subfr_fx = 0; i_subfr_fx < L_FRAME; i_subfr_fx += L_SUBFR )
      67             :     {
      68             :         /*----------------------------------------------------------------*
      69             :          * Unvoiced subframe processing
      70             :          *----------------------------------------------------------------*/
      71             : 
      72             :         gaus_dec_fx( st_fx, i_subfr_fx, code_fx, &norm_gain_code_fx, &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, &gain_inov_fx, &st_fx->tilt_code_fx,
      73             :                      &voice_fac_fx, &gain_pit_fx, pt_pitch_fx, exc_fx, &gain_code_fx, exc2_fx, bwe_exc_fx, &( st_fx->Q_exc ), st_fx->Q_subfr );
      74             : 
      75             :         *tmp_noise_fx = extract_h( norm_gain_code_fx ); /*Q16*/
      76             :         move16();
      77             : 
      78             :         /*----------------------------------------------------------------*
      79             :          * Excitation enhancements (update of total excitation signal)
      80             :          *----------------------------------------------------------------*/
      81             : 
      82             :         enhancer_fx( st_fx->core_brate, 0, coder_type, i_subfr_fx, L_FRAME, voice_fac_fx, st_fx->stab_fac_fx,
      83             :                      norm_gain_code_fx, gain_inov_fx, &st_fx->gc_threshold_fx, code_fx, exc2_fx, gain_pit_fx, &( st_fx->dm_fx ), st_fx->Q_exc );
      84             : 
      85             :         Word16 tmp_idx = 0;
      86             :         move16();
      87             :         IF( i_subfr_fx != 0 )
      88             :         {
      89             :             tmp_idx = idiv1616( i_subfr_fx, L_SUBFR );
      90             :         }
      91             :         voice_factors_fx[tmp_idx] = 0;
      92             :         move16();
      93             : 
      94             :         interp_code_5over2_fx( &exc_fx[i_subfr_fx], &bwe_exc_fx[( ( i_subfr_fx * 2 * HIBND_ACB_L_FAC ) >> 1 )], L_SUBFR );
      95             : 
      96             :         p_Aq_fx += ( M + 1 );
      97             :         pt_pitch_fx++;
      98             :         st_fx->tilt_code_dec_fx[tmp_idx] = st_fx->tilt_code_fx;
      99             :         move16();
     100             :     }
     101             : 
     102             :     /* SC-VBR */
     103             :     st_fx->prev_gain_pit_dec_fx = gain_pit_fx;
     104             :     move16();
     105             : 
     106             :     set16_fx( gain_buf, 0, NB_SUBFR );
     107             : 
     108             :     return;
     109             : }
     110             : 
     111             : /*-------------------------------------------------------------------*
     112             :  * decod_unvoiced()
     113             :  *
     114             :  * Decode unvoiced (UC) frames
     115             :  *-------------------------------------------------------------------*/
     116             : #endif
     117        1374 : void decod_unvoiced_ivas_fx(
     118             :     Decoder_State *st_fx,           /*                                  i/o: decoder static memory                  */
     119             :     const Word16 *Aq_fx,            /*  Q12                             i  : LP filter coefficient                  */
     120             :     const Word16 Es_pred_fx,        /* i  : predicted scaled innov. energy          */
     121             :     const Word16 uc_two_stage_flag, /* i  : flag indicating two-stage UC            */
     122             :     const Word16 coder_type,        /*  Q0                              i  : coding type                            */
     123             :     Word16 *tmp_noise_fx,           /*  Q0                              o  : long term temporary noise energy       */
     124             :     Word16 *pitch_buf_fx,           /*  Q6                              o  : floating pitch values for each subframe*/
     125             :     Word16 *voice_factors_fx,       /*  Q15                             o  : voicing factors                        */
     126             :     Word16 *exc_fx,                 /*  Q_X                     o  : adapt. excitation exc                  */
     127             :     Word16 *exc2_fx,                /*  Q_X                             o  : adapt. excitation/total exc            */
     128             :     Word16 *bwe_exc_fx,             /*  Q_X                             i/o: excitation for SWB TBE                                     */
     129             :     Word16 *gain_buf )
     130             : {
     131             :     Word16 gain_pit_fx;  /* Quantized pitch gain                 */
     132             :     Word32 gain_code_fx; /* Quantized algebraic codeebook gain   */
     133             :     Word32 gain_code2_fx;
     134             :     Word16 gain_inov_fx;      /* inovation gain                       */
     135             :     Word32 norm_gain_code_fx; /* normalized algebraic codeebook gain  */
     136             :     Word16 voice_fac_fx;      /* Voicing factor                       */
     137             :     Word16 code_fx[L_SUBFR];  /* algebraic codevector                 */
     138             :     Word16 i_subfr_fx;
     139             :     const Word16 *p_Aq_fx;
     140             :     Word16 *pt_pitch_fx;
     141             :     Word16 code2_fx[L_SUBFR];
     142             : 
     143        1374 :     gain_pit_fx = 0; /* Quantized pitch gain                 */
     144        1374 :     move16();
     145             : 
     146        1374 :     test();
     147        1374 :     IF( EQ_16( st_fx->last_ppp_mode_dec, 1 ) || EQ_16( st_fx->last_nelp_mode_dec, 1 ) )
     148             :     {
     149             :         /* SC_VBR - reset the decoder, to avoid memory not updated issue for this unrealistic case */
     150           0 :         CNG_reset_dec_fx( st_fx, pitch_buf_fx, voice_factors_fx );
     151             :     }
     152             : 
     153        1374 :     p_Aq_fx = Aq_fx; /*Q12*/    /* pointer to interpolated LPC parameters */
     154        1374 :     pt_pitch_fx = pitch_buf_fx; /* pointer to the pitch buffer  */
     155             : 
     156        6870 :     FOR( i_subfr_fx = 0; i_subfr_fx < L_FRAME; i_subfr_fx += L_SUBFR )
     157             :     {
     158        5496 :         IF( !uc_two_stage_flag )
     159             :         {
     160             :             /*----------------------------------------------------------------*
     161             :              * Unvoiced subframe processing
     162             :              *----------------------------------------------------------------*/
     163             : 
     164           0 :             gaus_dec_fx( st_fx, i_subfr_fx, code_fx, &norm_gain_code_fx, &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, &gain_inov_fx, &st_fx->tilt_code_fx,
     165           0 :                          &voice_fac_fx, &gain_pit_fx, pt_pitch_fx, exc_fx, &gain_code_fx, exc2_fx, bwe_exc_fx, &( st_fx->Q_exc ), st_fx->Q_subfr );
     166             :         }
     167             :         ELSE
     168             :         { /*----------------------------------------------------------------*
     169             :            * Unvoiced subframe processing in two stages
     170             :            *----------------------------------------------------------------*/
     171             : 
     172             :             /* No adaptive codebook (UC) */
     173        5496 :             set16_fx( exc_fx + i_subfr_fx, 0, L_SUBFR );
     174             : 
     175        5496 :             *pt_pitch_fx = shl( L_SUBFR, Q6 );
     176        5496 :             move16();
     177             : 
     178             :             /*--------------------------------------------------------------*
     179             :              * Innovation decoding
     180             :              *--------------------------------------------------------------*/
     181             : 
     182             :             // inov_decode(st, st->core_brate, 0, L_FRAME, 1, i_subfr, p_Aq, st->tilt_code, *pt_pitch, code, L_SUBFR);
     183        5496 :             inov_decode_fx( st_fx, st_fx->core_brate, 0, L_FRAME, 1, i_subfr_fx, p_Aq_fx, st_fx->tilt_code_fx, *pt_pitch_fx, code_fx, L_SUBFR );
     184             : 
     185             :             /*-------------------------------------------------------*
     186             :              * Generate Gaussian excitation                        *
     187             :              *-------------------------------------------------------*/
     188             : 
     189             :             // gaus_L2_dec_flt(code2, st->tilt_code, p_Aq, FORMANT_SHARPENING_G1_FLT, &(st->seed_acelp));
     190        5496 :             gaus_L2_dec( code2_fx, st_fx->tilt_code_fx, p_Aq_fx, FORMANT_SHARPENING_G1, &( st_fx->seed_acelp ) );
     191             : 
     192             :             /*-----------------------------------------------------------------*
     193             :              * Gain encoding
     194             :              *-----------------------------------------------------------------*/
     195             :             Word16 tmp_idx_1;
     196        5496 :             tmp_idx_1 = 0;
     197        5496 :             move16();
     198        5496 :             if ( i_subfr_fx != 0 )
     199             :             {
     200        4122 :                 tmp_idx_1 = idiv1616( i_subfr_fx, L_SUBFR );
     201             :             }
     202             :             Word16 index;
     203        5496 :             index = get_next_indice_fx( st_fx, st_fx->acelp_cfg.gains_mode[tmp_idx_1] );
     204             : 
     205        5496 :             gain_dec_gacelp_uv_fx( index, code_fx, code2_fx, Es_pred_fx, L_SUBFR, &gain_pit_fx, &gain_code_fx, &gain_code2_fx, &( st_fx->past_gpit ), &norm_gain_code_fx, &gain_inov_fx );
     206             : 
     207        5496 :             st_fx->tilt_code_fx = est_tilt_ivas_fx( exc_fx + i_subfr_fx, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, st_fx->Q_exc, L_SUBFR, 0 );
     208        5496 :             move16();
     209             : 
     210             :             /* update LP filtered gains for the case of frame erasures */
     211             : #ifdef REMOVE_EVS_DUPLICATES
     212        5496 :             IF( EQ_16( st_fx->element_mode, EVS_MONO ) )
     213             :             {
     214           0 :                 lp_gain_updt_fx( i_subfr_fx, gain_pit_fx, norm_gain_code_fx, &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, L_FRAME );
     215             :             }
     216             :             ELSE
     217             : #endif
     218             :             {
     219        5496 :                 lp_gain_updt_ivas_fx( i_subfr_fx, gain_pit_fx, norm_gain_code_fx, &st_fx->lp_gainp_fx, &st_fx->lp_gainc_fx, L_FRAME );
     220             :             }
     221             : 
     222             :             /*-------------------------------------------------------*
     223             :              * - Find the total excitation.                          *
     224             :              *-------------------------------------------------------*/
     225             : 
     226        5496 :             IF( EQ_16( st_fx->L_frame, L_FRAME ) )
     227             :             {
     228             : 
     229        5496 :                 Rescale_exc( st_fx->hMusicPF->dct_post_old_exc_fx, &exc_fx[i_subfr_fx], ( bwe_exc_fx != NULL ) ? &bwe_exc_fx[( ( i_subfr_fx * 2 * HIBND_ACB_L_FAC ) >> 1 )] : NULL, st_fx->hGSCDec->last_exc_dct_in_fx,
     230        5496 :                              L_SUBFR, L_SUBFR * HIBND_ACB_L_FAC, L_max( gain_code2_fx, gain_code_fx ), &( st_fx->Q_exc ), st_fx->Q_subfr, exc2_fx, i_subfr_fx, UNVOICED );
     231             :             }
     232             :             ELSE
     233             :             {
     234           0 :                 Rescale_exc( st_fx->hMusicPF->dct_post_old_exc_fx, &exc_fx[i_subfr_fx], ( bwe_exc_fx != NULL ) ? &bwe_exc_fx[i_subfr_fx * 2] : NULL, st_fx->hGSCDec->last_exc_dct_in_fx,
     235           0 :                              L_SUBFR, L_SUBFR * 2, L_max( gain_code2_fx, gain_code_fx ), &( st_fx->Q_exc ), st_fx->Q_subfr, exc2_fx, i_subfr_fx, UNVOICED );
     236             :             }
     237             : 
     238      357240 :             FOR( Word16 i = 0; i < L_SUBFR; i++ )
     239             :             {
     240             :                 /*exc2[i + i_subfr] = gain_pit * exc[i + i_subfr]; //Q14
     241             :                 exc2[i + i_subfr] += gain_code2 * code2[i]; //Q16
     242             :                 exc[i + i_subfr] = exc2[i + i_subfr] + gain_code * code[i];*/
     243             :                 // Q16
     244      351744 :                 exc2_fx[i + i_subfr_fx] = shl( mult_r( gain_pit_fx, exc_fx[i + i_subfr_fx] ), 2 );                                                                   // Q_exc
     245      351744 :                 exc2_fx[i + i_subfr_fx] = add( exc2_fx[i + i_subfr_fx], extract_l( L_shr( Mpy_32_16_1( gain_code2_fx, code2_fx[i] ), sub( Q10, st_fx->Q_exc ) ) ) ); // Q_exc
     246      351744 :                 exc_fx[i + i_subfr_fx] = add( exc2_fx[i + i_subfr_fx], extract_l( L_shr( Mpy_32_16_1( gain_code_fx, code_fx[i] ), sub( Q10, st_fx->Q_exc ) ) ) );    // Q_exc
     247      351744 :                 move16();
     248      351744 :                 move16();
     249      351744 :                 move16();
     250             :             }
     251             :             // Scale_sig(code_fx, L_SUBFR, 3); //Q12
     252             :         }
     253        5496 :         *tmp_noise_fx = extract_h( norm_gain_code_fx ); /*Q16*/
     254        5496 :         move16();
     255             : 
     256             :         /*----------------------------------------------------------------*
     257             :          * Excitation enhancements (update of total excitation signal)
     258             :          *----------------------------------------------------------------*/
     259             : 
     260             : #ifdef REMOVE_EVS_DUPLICATES
     261        5496 :         IF( EQ_16( st_fx->element_mode, EVS_MONO ) )
     262             :         {
     263           0 :             enhancer_fx( st_fx->core_brate, 0, coder_type, i_subfr_fx, L_FRAME, voice_fac_fx, st_fx->stab_fac_fx,
     264           0 :                          norm_gain_code_fx, gain_inov_fx, &st_fx->gc_threshold_fx, code_fx, exc2_fx, gain_pit_fx, &( st_fx->dm_fx ), st_fx->Q_exc );
     265             :         }
     266             :         ELSE
     267             : #endif
     268             :         {
     269        5496 :             enhancer_ivas_fx( MODE1, st_fx->core_brate, uc_two_stage_flag, 0, coder_type, i_subfr_fx, L_FRAME, voice_fac_fx, st_fx->stab_fac_fx,
     270        5496 :                               norm_gain_code_fx, gain_inov_fx, &st_fx->gc_threshold_fx, code_fx /*Q9/Q12?*/, exc2_fx, gain_pit_fx, &( st_fx->dm_fx ), st_fx->Q_exc );
     271             :         }
     272             : 
     273             :         Word16 tmp_idx;
     274        5496 :         tmp_idx = 0;
     275        5496 :         move16();
     276        5496 :         IF( i_subfr_fx != 0 )
     277             :         {
     278        4122 :             tmp_idx = idiv1616( i_subfr_fx, L_SUBFR );
     279             : #ifdef REMOVE_EVS_DUPLICATES
     280        4122 :             IF( EQ_16( st_fx->element_mode, EVS_MONO ) )
     281             :             {
     282           0 :                 tmp_idx = idiv1616( i_subfr_fx, L_SUBFR );
     283             :             }
     284             : #endif
     285             :         }
     286        5496 :         voice_factors_fx[tmp_idx] = 0;
     287        5496 :         move16();
     288             : 
     289        5496 :         interp_code_5over2_fx( &exc_fx[i_subfr_fx], &bwe_exc_fx[( ( i_subfr_fx * 2 * HIBND_ACB_L_FAC ) >> 1 )], L_SUBFR );
     290             : 
     291        5496 :         p_Aq_fx += ( M + 1 );
     292        5496 :         pt_pitch_fx++;
     293        5496 :         st_fx->tilt_code_dec_fx[tmp_idx] = st_fx->tilt_code_fx;
     294        5496 :         move16();
     295             :     }
     296             : 
     297             :     /* SC-VBR */
     298        1374 :     st_fx->prev_gain_pit_dec_fx = gain_pit_fx;
     299        1374 :     move16();
     300             : 
     301        1374 :     set16_fx( gain_buf, 0, NB_SUBFR );
     302             : 
     303        1374 :     return;
     304             : }
     305             : 
     306             : 
     307             : /*---------------------------------------------------------------------*
     308             :  * gain_dec_gacelp_uv_fx
     309             :  *
     310             :  * Decoding of pitch and codebook gains for Unvoiced mode
     311             :  *---------------------------------------------------------------------*/
     312             : 
     313        5496 : static void gain_dec_gacelp_uv_fx(
     314             :     Word16 index,       /* i  : Quantization index vector        Q0  */
     315             :     Word16 *code,       /* i  : algebraic code excitation        Q9  */
     316             :     Word16 *code2,      /* i  : algebraic code excitation        Q9  */
     317             :     Word16 mean_ener,   /* i  :                                 Q8  */
     318             :     Word16 lcode,       /* i  : Subframe size                    Q0  */
     319             :     Word16 *gain_pit,   /* o  : Quantized pitch gain            1Q14 */
     320             :     Word32 *gain_code,  /* o  : Quantized codebook gain          Q16 */
     321             :     Word32 *gain_code2, /* o  : Quantized codebook gain          Q16 */
     322             :     Word16 *past_gpit,  /* i/o: past gain of pitch              1Q14 */
     323             :     Word32 *past_gcode, /* i/o: past energy of code              Q16 */
     324             :     Word16 *gain_inov   /* o  : unscaled innovation gain        3Q12 */
     325             : )
     326             : {
     327             :     Word16 i, exp_L_tmp1;
     328             :     Word16 exp_gcode;
     329             :     Word16 g_code;
     330             :     Word32 L_tmp, L_tmp1;
     331             :     Word32 pred_nrg_frame;
     332             :     Word16 exp_gcode2, g_code2, norm_code2;
     333             :     Word16 index2, s;
     334             : 
     335             : 
     336             :     /* pred_nrg_frame = (float)pow(10.0,mean_ener/20.0); */
     337        5496 :     L_tmp = L_mult( mean_ener, 10885 /*0.166096f * 2 Q15*/ );                       /* 6Q25 */
     338        5496 :     pred_nrg_frame = BASOP_Util_InvLog2( L_sub( L_tmp, 503316480l /*15.f Q25*/ ) ); /* 15Q16 */
     339             : 
     340             :     /*-----------------------------------------------------------------*
     341             :      * Prediction gains
     342             :      *-----------------------------------------------------------------*/
     343             :     /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
     344        5496 :     L_tmp = calc_gain_inov( code, lcode, NULL, NULL );
     345        5496 :     *gain_inov = round_fx( L_shl( L_tmp, 15 - 3 ) ); /* gain_inov in Q12 */
     346        5496 :     move16();
     347             :     /* gcode = pred_nrg_frame * (*gain_inov); */
     348        5496 :     L_tmp = Mpy_32_16_1( pred_nrg_frame, *gain_inov ); /* 18Q13 */
     349        5496 :     i = sub( norm_l( L_tmp ), 1 );                     // gaurd-bits
     350        5496 :     g_code = round_fx( L_shl( L_tmp, i ) );
     351        5496 :     exp_gcode = sub( 18, i );
     352             : 
     353             :     /* norm_code2 = 1.0f / sqrt((dot_product(code2, code2, lcode) + 0.01f) / lcode); */
     354        5496 :     L_tmp = calc_gain_inov( code2, lcode, NULL, NULL );
     355        5496 :     norm_code2 = round_fx( L_shl( L_tmp, 15 - 3 ) ); /* Q12 */
     356             : 
     357             :     /* g_code2 = pred_nrg_frame * norm_code2; */
     358        5496 :     L_tmp = Mpy_32_16_1( pred_nrg_frame, norm_code2 ); /* 18Q13 */
     359        5496 :     i = norm_l( L_tmp );
     360        5496 :     g_code2 = round_fx_sat( L_shl_sat( L_tmp, i ) );
     361        5496 :     exp_gcode2 = sub( 18, i );
     362             : 
     363             :     /*-----------------------------------------------------------------*
     364             :      * Decode pitch gain
     365             :      *-----------------------------------------------------------------*/
     366        5496 :     *gain_pit = 0;
     367        5496 :     move16();
     368        5496 :     *past_gpit = *gain_pit;
     369        5496 :     move16();
     370             : 
     371             :     /*-----------------------------------------------------------------*
     372             :      * past gains for error concealment
     373             :      *-----------------------------------------------------------------*/
     374        5496 :     index2 = shr( index, 5 );
     375        5496 :     index = s_and( index, 0x1F );
     376             : 
     377             :     /**gain_code= (float)pow(10.f,(((index*1.25f)-20.f)/20.f))*gcode;*/
     378             : 
     379        5496 :     L_tmp = L_mac( -111465139l /*-0.166096*20.0f Q25*/, shl( index, 16 - 7 ), 6803 /*0.166096f*1.25f Q15*/ );
     380             : 
     381        5496 :     i = add( 1, extract_l( L_shr( L_tmp, 25 ) ) );
     382        5496 :     L_tmp = L_lshl( L_tmp, 6 );
     383        5496 :     L_tmp = L_and( 0x7FFFFFFF, L_tmp );
     384             : 
     385        5496 :     L_tmp = Pow2( 30, round_fx( L_tmp ) );
     386        5496 :     L_tmp = L_shl( L_tmp, i - ( 31 - 16 ) ); /* Q16 */
     387             : 
     388             :     /* *past_gcode = L_tmp * pred_nrg_frame; */
     389        5496 :     i = norm_l( L_tmp );
     390        5496 :     L_tmp1 = L_shl( L_tmp, i );
     391        5496 :     exp_L_tmp1 = sub( 15, i );
     392             : 
     393        5496 :     i = norm_l( pred_nrg_frame );
     394        5496 :     L_tmp1 = Mpy_32_32( L_tmp1, L_shl( pred_nrg_frame, i ) );
     395        5496 :     exp_L_tmp1 = add( exp_L_tmp1, sub( 15, i ) );
     396             : 
     397        5496 :     *past_gcode = L_shl( L_tmp1, sub( exp_L_tmp1, 15 ) ); /* Q16 */
     398        5496 :     move32();
     399             : 
     400        5496 :     *gain_code = L_shl_sat( Mpy_32_16_1( *past_gcode, *gain_inov ), 3 );
     401        5496 :     move32();
     402             : 
     403             : 
     404        5496 :     L_tmp = Mpy_32_16_1( *gain_code, BASOP_Util_Divide1616_Scale( g_code2, g_code, &s ) );
     405        5496 :     L_tmp = L_shl( L_tmp, sub( sub( add( s, exp_gcode2 ), exp_gcode ), 2 ) ); /* Q16 */
     406        5496 :     L_tmp1 = L_add( L_tmp, 0 );
     407       16447 :     FOR( i = 0; i < index2; i++ )
     408             :     {
     409       10951 :         L_tmp1 = L_add( L_tmp1, L_tmp );
     410             :     }
     411        5496 :     *gain_code2 = L_tmp1;
     412             : 
     413             : 
     414        5496 :     return;
     415             : }

Generated by: LCOV version 1.14