LCOV - code coverage report
Current view: top level - lib_enc - plc_enc_ext_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main enc/dec/rend @ 3b2f07138c61dcf997bbf4165d0882f794b2995f Lines: 68 68 100.0 %
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             : 
       5             : 
       6             : #include <stdint.h>
       7             : #include "options.h"
       8             : #include "cnst.h"
       9             : #include "stat_enc.h"
      10             : //#include "prot_fx.h"
      11             : #include "rom_com.h"     /* Common constants                       */
      12             : #include "prot_fx.h"     /* Function prototypes                    */
      13             : #include "prot_fx_enc.h" /* Function prototypes                    */
      14             : #include "basop_util.h"  /* Function prototypes                    */
      15             : 
      16             : #define NBITS_GACELP 5
      17             : 
      18             : // extern const Word16 lsf_init_fx[16];
      19             : 
      20             : /*-------------------------------------------------------------------*
      21             :  * init_PLC_enc_fx()
      22             :  *
      23             :  *
      24             :  *-------------------------------------------------------------------*/
      25             : 
      26          66 : void init_PLC_enc_fx(
      27             :     PLC_ENC_EVS_HANDLE hPlcExt,
      28             :     Word32 sampleRate /* core coder SR */
      29             : )
      30             : {
      31             :     Word16 itr;
      32             : 
      33             : 
      34          66 :     hPlcExt->enableGplc = 0;
      35          66 :     move16();
      36          66 :     hPlcExt->calcOnlylsf = 1;
      37          66 :     move16();
      38          66 :     hPlcExt->nBits = NBITS_GACELP;
      39          66 :     move16();
      40             : 
      41          66 :     hPlcExt->Q_exp = 0;
      42          66 :     move16();
      43          66 :     hPlcExt->Q_new = 0;
      44          66 :     move16();
      45             : 
      46          66 :     set16_fx( hPlcExt->mem_MA_14Q1, 0, M );
      47          66 :     set16_fx( hPlcExt->mem_AR, 0, M );
      48          66 :     set16_fx( hPlcExt->lsfold_14Q1, 0, M );
      49          66 :     set16_fx( hPlcExt->lspold_Q15, 0, M );
      50             : 
      51          66 :     set16_fx( hPlcExt->old_exc_Qold, 0, 8 );
      52             : 
      53          66 :     set16_fx( hPlcExt->lsfoldbfi0_14Q1, 0, M );
      54          66 :     set16_fx( hPlcExt->lsfoldbfi1_14Q1, 0, M );
      55          66 :     set16_fx( hPlcExt->lsf_adaptive_mean_14Q1, 0, M );
      56          66 :     hPlcExt->stab_fac_Q15 = 0;
      57          66 :     move16();
      58          66 :     IF( EQ_32( sampleRate, INT_FS_12k8 ) )
      59             :     {
      60          21 :         hPlcExt->T0_4th = L_SUBFR;
      61          21 :         move16();
      62          21 :         hPlcExt->T0 = L_SUBFR;
      63          21 :         move16();
      64         357 :         FOR( itr = 0; itr < M; itr++ )
      65             :         {
      66         336 :             hPlcExt->lsf_con[itr] = lsf_init_fx[itr];
      67         336 :             move16();
      68         336 :             hPlcExt->last_lsf_ref[itr] = lsf_init_fx[itr];
      69         336 :             move16();
      70         336 :             hPlcExt->last_lsf_con[itr] = lsf_init_fx[itr];
      71         336 :             move16();
      72             :         }
      73             :     }
      74             :     ELSE
      75             :     {
      76          45 :         hPlcExt->T0_4th = L_SUBFR;
      77          45 :         move16();
      78          45 :         hPlcExt->T0 = L_SUBFR;
      79          45 :         move16();
      80         765 :         FOR( itr = 0; itr < M; itr++ )
      81             :         {
      82         720 :             hPlcExt->lsf_con[itr] = add( lsf_init_fx[itr], shr( lsf_init_fx[itr], 2 ) );
      83         720 :             hPlcExt->last_lsf_ref[itr] = add( lsf_init_fx[itr], shr( lsf_init_fx[itr], 2 ) );
      84         720 :             hPlcExt->last_lsf_con[itr] = add( lsf_init_fx[itr], shr( lsf_init_fx[itr], 2 ) );
      85         720 :             move16();
      86         720 :             move16();
      87         720 :             move16();
      88             :         }
      89             :     }
      90             : 
      91          66 :     return;
      92             : }
      93             : 
      94             : /*-------------------------------------------------------------------*
      95             :  * gPLC_encInfo_fx()
      96             :  *
      97             :  * Function to extract and write guided information
      98             :  *-------------------------------------------------------------------*/
      99        1266 : void gPLC_encInfo_fx(
     100             :     PLC_ENC_EVS_HANDLE hPlcExt,
     101             :     const Word32 total_brate,
     102             :     const Word16 bwidth,
     103             :     const Word16 last_clas,
     104             :     const Word16 coder_type )
     105             : {
     106             : 
     107             : 
     108        1266 :     IF( hPlcExt )
     109             :     {
     110        1266 :         hPlcExt->calcOnlylsf = 1;
     111        1266 :         move16();
     112        1266 :         test();
     113        1266 :         IF( ( GE_16( bwidth, WB ) && EQ_32( total_brate, ACELP_24k40 ) ) )
     114             :         {
     115        1006 :             hPlcExt->enableGplc = 1;
     116        1006 :             move16();
     117        1006 :             hPlcExt->nBits = 1;
     118        1006 :             move16();
     119        1006 :             test();
     120        1006 :             test();
     121        1006 :             test();
     122        1006 :             IF( ( EQ_16( last_clas, VOICED_CLAS ) || EQ_16( last_clas, ONSET ) ) &&
     123             :                 ( EQ_16( coder_type, VOICED ) || EQ_16( coder_type, GENERIC ) ) )
     124             :             {
     125         440 :                 hPlcExt->nBits = NBITS_GACELP;
     126         440 :                 move16();
     127         440 :                 hPlcExt->calcOnlylsf = 0;
     128         440 :                 move16();
     129             :             }
     130             :         }
     131             :         ELSE
     132             :         {
     133         260 :             hPlcExt->enableGplc = 0;
     134         260 :             move16();
     135         260 :             hPlcExt->nBits = NBITS_GACELP;
     136         260 :             move16();
     137             :         }
     138             :     }
     139        1266 : }

Generated by: LCOV version 1.14