LCOV - code coverage report
Current view: top level - lib_com - vlpc_2st_com_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main enc/dec/rend @ 3b2f07138c61dcf997bbf4165d0882f794b2995f Lines: 20 20 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 <stdint.h>
       6             : #include "options.h"
       7             : #include "cnst.h"
       8             : #include "prot_fx.h"
       9             : #include "basop_util.h"
      10             : 
      11             : 
      12      325082 : void lsf_weight_2st(
      13             :     const Word16 *lsfq, /* input: quantized lsf coefficients            (14Q1*1.28) */
      14             :     Word16 *w,          /* output: weighting function                           (0Q15*1.28) */
      15             :     const Word16 mode   /* input: operational mode                           Q0 */
      16             : )
      17             : {
      18             :     Word16 i;
      19             :     Word16 d[M + 1], weight;
      20             : 
      21             :     /* compute lsf distance */
      22      325082 :     d[0] = lsfq[0];
      23      325082 :     move16(); /*14Q1*1.28*/
      24     5201312 :     FOR( i = 1; i < M; i++ )
      25             :     {
      26     4876230 :         d[i] = sub( lsfq[i], lsfq[i - 1] );
      27     4876230 :         move16(); /*14Q1*1.28*/
      28             :     }
      29      325082 :     d[M] = sub( FREQ_MAX, lsfq[M - 1] );
      30      325082 :     move16(); /*14Q1*1.28*/
      31             : 
      32             :     /* weighting function */
      33      325082 :     weight = W_MODE_ELSE;
      34      325082 :     move16(); /* rel2 */
      35      325082 :     IF( mode == 0 )
      36             :     {
      37      211164 :         weight = W_MODE0;
      38      211164 :         move16(); /* abs */
      39             :     }
      40      113918 :     ELSE IF( EQ_16( mode, 1 ) )
      41             :     {
      42      110992 :         weight = W_MODE1;
      43      110992 :         move16(); /* mid */
      44             :     }
      45             : 
      46     5526394 :     FOR( i = 0; i < M; i++ )
      47             :     {
      48             :         /* assert(d[i]>0); */
      49             : 
      50             :         /*w[i] = (weight * sqrt(d[i]*d[i+1])));*/
      51             : 
      52     5201312 :         w[i] = mult_r( weight, getSqrtWord32( L_shl( L_mult0( d[i], d[i + 1] ), 6 ) ) ); /* Q15 * 1.28 */
      53     5201312 :         move16();
      54             :     }
      55             : 
      56             : 
      57      325082 :     return;
      58             : }

Generated by: LCOV version 1.14