LCOV - code coverage report
Current view: top level - lib_com - gain_inov_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main enc/dec/rend @ 3b2f07138c61dcf997bbf4165d0882f794b2995f Lines: 17 18 94.4 %
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 <stdint.h>
       6             : #include <assert.h>
       7             : #include "options.h"
       8             : #include "prot_fx.h"
       9             : #include "basop_util.h"
      10             : #include "rom_com.h"
      11             : 
      12       33062 : Word32 calc_gain_inov(                     /* returns innovation gain              Q16 */
      13             :                        const Word16 *code, /* i  : algebraic excitation            Q9  */
      14             :                        const Word16 lcode, /* i  : Subframe size                   Q0  */
      15             :                        Word32 *dotp,       /* o  : intermediate result           Q31-e */
      16             :                        Word16 *dotp_e      /* o  : intermediate result exponent    Q0  */
      17             : )
      18             : {
      19             :     Word32 L_tmp;
      20             :     Word16 exp_L_tmp, i;
      21             : 
      22             :     /* L_tmp = dot_product(code, code, lcode) + 0.01 */
      23       33062 :     L_tmp = Dot_product12_offs( code, code, lcode, &exp_L_tmp, 2621l /*0.01f/2.0f Q19*/ );
      24       33062 :     exp_L_tmp = sub( exp_L_tmp, 18 );
      25             : 
      26             :     /* gain_inov = 1.0f / sqrt((dot_product(code, code, lcode) + 0.01) / lcode) */
      27             :     /* Note: lcode is in range: 32,40,64,80 */
      28       33062 :     assert( ( lcode == 32 ) || ( lcode == 40 ) || ( lcode == 64 ) || ( lcode == 80 ) );
      29       33062 :     if ( s_and( lcode, sub( lcode, 1 ) ) != 0 )
      30             :     {
      31           0 :         L_tmp = Mpy_32_32( L_tmp, 1717986918l /*64.0/80.0 Q31*/ );
      32             :     }
      33       33062 :     exp_L_tmp = sub( exp_L_tmp, sub( 14, norm_s( lcode ) ) );
      34             : 
      35       33062 :     i = norm_l( L_tmp );
      36       33062 :     L_tmp = L_shl( L_tmp, i );
      37       33062 :     exp_L_tmp = sub( exp_L_tmp, i );
      38             : 
      39       33062 :     if ( dotp != NULL )
      40             :     {
      41        6070 :         *dotp = L_tmp;
      42        6070 :         move32();
      43             :     }
      44       33062 :     if ( dotp_e != NULL )
      45             :     {
      46        6070 :         *dotp_e = exp_L_tmp;
      47        6070 :         move16();
      48             :     }
      49             : 
      50       33062 :     L_tmp = ISqrt32norm( L_tmp, &exp_L_tmp );
      51             : 
      52       33062 :     return L_shl( L_tmp, sub( exp_L_tmp, 15 ) ); /* 15Q16 */
      53             : }

Generated by: LCOV version 1.14