LCOV - code coverage report
Current view: top level - lib_com - vlpc_2st_com_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main -- dec/rend @ 4c82f1d24d39d0296b18d775f18a006f4c7d024b Lines: 18 20 90.0 %
Date: 2025-05-17 01:59:02 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      103112 : 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      103112 :     d[0] = lsfq[0];
      23      103112 :     move16(); /*14Q1*1.28*/
      24     1649792 :     FOR( i = 1; i < M; i++ )
      25             :     {
      26     1546680 :         d[i] = sub( lsfq[i], lsfq[i - 1] );
      27     1546680 :         move16(); /*14Q1*1.28*/
      28             :     }
      29      103112 :     d[M] = sub( FREQ_MAX, lsfq[M - 1] );
      30      103112 :     move16(); /*14Q1*1.28*/
      31             : 
      32             :     /* weighting function */
      33      103112 :     weight = W_MODE_ELSE;
      34      103112 :     move16(); /* rel2 */
      35      103112 :     IF( mode == 0 )
      36             :     {
      37      102245 :         weight = W_MODE0;
      38      102245 :         move16(); /* abs */
      39             :     }
      40         867 :     ELSE IF( EQ_16( mode, 1 ) )
      41             :     {
      42           0 :         weight = W_MODE1;
      43           0 :         move16(); /* mid */
      44             :     }
      45             : 
      46     1752904 :     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     1649792 :         w[i] = mult_r( weight, getSqrtWord32( L_shl( L_mult0( d[i], d[i + 1] ), 6 ) ) ); /* Q15 * 1.28 */
      53     1649792 :         move16();
      54             :     }
      55             : 
      56             : 
      57      103112 :     return;
      58             : }

Generated by: LCOV version 1.14