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

          Line data    Source code
       1             : /*====================================================================================
       2             :     EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
       3             :   ====================================================================================*/
       4             : 
       5             : #include "options.h" /* Compilation switches                   */
       6             : #include "stl.h"
       7             : #include "cnst.h"    /* Common constants                       */
       8             : #include "rom_com.h" /* Static table prototypes                */
       9             : #include "prot_fx.h" /* Function prototypes                    */
      10             : 
      11             : /*----------------------------------------------------------------------------------*
      12             :  * CNG_reset_dec()
      13             :  *
      14             :  * Reset decoder static variables in case of CNG frame
      15             :  *----------------------------------------------------------------------------------*/
      16             : 
      17       19522 : void CNG_reset_dec_fx(
      18             :     Decoder_State *st_fx, /* i/o: decoder state structure              */
      19             :     Word16 *pitch_buf,    /* o  : floating pitch for each subframe Q6  */
      20             :     Word16 *voice_factors /* o  : voicing factors                  Q15 */
      21             : )
      22             : {
      23             :     Word16 tmp, exp;
      24             :     Word32 L_tmp;
      25       19522 :     Copy( UVWB_Ave_fx, st_fx->mem_AR_fx, M );
      26       19522 :     set16_fx( st_fx->mem_MA_fx, 0, M );
      27             :     /*set16_fx( st_fx->dispMem_fx, 0, 8 );*/
      28       19522 :     set16_fx( st_fx->dm_fx.prev_gain_pit, 0, 6 );
      29       19522 :     st_fx->dm_fx.prev_gain_code = L_deposit_l( 0 );
      30       19522 :     move32();
      31       19522 :     st_fx->dm_fx.prev_state = 0;
      32       19522 :     move16();
      33             : 
      34       19522 :     st_fx->tilt_code_fx = 0;
      35       19522 :     move16();
      36       19522 :     st_fx->gc_threshold_fx = 0;
      37       19522 :     move16();
      38             : 
      39             :     /* last good received frame for FEC in ACELP */
      40       19522 :     st_fx->clas_dec = UNVOICED_CLAS;
      41       19522 :     move16();
      42       19522 :     st_fx->last_good = UNVOICED_CLAS;
      43       19522 :     move16();
      44             : 
      45             :     /* LP-filtered pitch gain set to 0 */
      46       19522 :     st_fx->lp_gainp_fx = 0; // Q14
      47       19522 :     move16();
      48             : 
      49             :     /* convert CNG energy into CNG gain for ACELP FEC */
      50             :     /* st->lp_gainc = sqrt( st->lp_ener ); */
      51       19522 :     st_fx->lp_gainc_fx = 0; // Q3
      52       19522 :     move16();
      53             : 
      54       19522 :     IF( st_fx->lp_ener_fx != 0 )
      55             :     {
      56       17487 :         exp = norm_l( st_fx->lp_ener_fx ); /* In Q6 */
      57       17487 :         tmp = extract_h( L_shl( st_fx->lp_ener_fx, exp ) );
      58       17487 :         exp = sub( exp, 30 - 6 );
      59             : 
      60       17487 :         tmp = div_s( 16384, tmp );
      61       17487 :         L_tmp = L_deposit_h( tmp );
      62       17487 :         L_tmp = Isqrt_lc( L_tmp, &exp );
      63             : 
      64       17487 :         st_fx->lp_gainc_fx = round_fx_sat( L_shl_sat( L_tmp, sub( exp, 12 ) ) ); /* In Q3 */
      65       17487 :         move16();
      66             :     }
      67             :     /* reset the pitch buffer in case of FRAME_NO_DATA or SID frames */
      68       19522 :     IF( EQ_16( st_fx->L_frame, L_FRAME ) )
      69             :     {
      70        7348 :         set16_fx( pitch_buf, L_SUBFR << 6, NB_SUBFR );
      71             :     }
      72             :     ELSE /* st->L_frame == L_FRAME16k */
      73             :     {
      74       12174 :         set16_fx( pitch_buf, L_SUBFR16k << 6, NB_SUBFR16k );
      75             :     }
      76             : 
      77       19522 :     set16_fx( voice_factors, 32767, NB_SUBFR16k );
      78             : 
      79             :     /* deactivate bass post-filter */
      80       19522 :     st_fx->bpf_off = 1;
      81       19522 :     move16();
      82             :     /* Reset active frame counter */
      83       19522 :     if ( st_fx->hTdCngDec != NULL )
      84             :     {
      85        9138 :         st_fx->hTdCngDec->act_cnt2 = 0;
      86        9138 :         move16();
      87             :     }
      88             : 
      89       19522 :     return;
      90             : }

Generated by: LCOV version 1.14