LCOV - code coverage report
Current view: top level - lib_lc3plus - setup_com_lc3plus.c (source / functions) Hit Total Coverage
Test: Coverage on main -- short test vectors @ 867217ee32c8e8cd2cf5aae69e60c58e00160b49 Lines: 6 14 42.9 %
Date: 2025-12-13 06:47:12 Functions: 1 2 50.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             : *                        ETSI TS 103 634 V1.6.1                               *
       3             : *              Low Complexity Communication Codec Plus (LC3plus)              *
       4             : *                                                                             *
       5             : * Copyright licence is solely granted through ETSI Intellectual Property      *
       6             : * Rights Policy, 3rd April 2019. No patent licence is granted by implication, *
       7             : * estoppel or otherwise.                                                      *
       8             : ******************************************************************************/
       9             :                                                                           
      10             : #include "options.h"
      11             : #include "wmc_auto.h"
      12             : #include "functions.h"
      13             : 
      14             : #ifdef FIX_BOTH_1p25_WB_GLOBGAINOFFSET_NONBE  
      15             : /* tilt factor in gainOffset quantized and adjusted for low Fs  and  1p25ms framing */
      16           0 : LC3_INT16 calc_GGainOffset_1p25(LC3_INT16 total_bits, LC3_INT16 fs_idx)
      17             : {
      18           0 :     LC3_INT16 gain_off_tilt_1p25_Q19[6] = { 20480, 17408, 17476, 13107, 10486, 8738 }; /*  vector of 1p25 tilts for  NB to UB */
      19             :    /* Corresponding FLT =  gain_off_tilt_1p25 = {0.039062500000000   0.033203125000000   0.033333333333333   0.025000000000000   0.020000000000000   0.016666666666667 }*/
      20             : 
      21             : 
      22           0 :     LC3_INT16 tmp1 = (LC3_INT16)(  ( ((LC3_INT32)total_bits)*((LC3_INT32)gain_off_tilt_1p25_Q19[fs_idx]) ) >> (3 + 16)  ); /*no rounding on purpose */
      23           0 :     LC3_INT16 tmp2 = 105 + 5 * (fs_idx + 1);
      24             : 
      25           0 :     tmp2 = -(MIN(115, tmp1) + tmp2);
      26             : 
      27             : #ifdef FIX_BOTH_1p25_WB_GLOBGAINOFFSET_LOWLIM_NONBE 
      28           0 :     if (fs_idx <= 1)
      29             :     {   /* only NB and WB additionally limited to -135 */
      30           0 :         tmp2 = MAX(tmp2, FIX_BOTH_1p25_WB_GLOBGAINOFFSET_LOWLIM_NONBE);
      31             :     }
      32             : #endif 
      33             : 
      34           0 :     return tmp2;
      35             : }
      36             : #endif 
      37             : 
      38     1189311 : LC3_FLOAT array_max_abs(LC3_FLOAT *in, LC3_INT32 len)
      39             : {
      40             :         LC3_FLOAT max;
      41             :         LC3_INT32 i;
      42             :     
      43     1189311 :     max = LC3_FABS(in[0]);
      44             :     
      45   249043031 :     for (i = 0; i < len; i++)
      46             :     {
      47   247853720 :         if (LC3_FABS(in[i]) > LC3_FABS(max))
      48             :         {
      49     2914541 :             max = LC3_FABS(in[i]);
      50             :         }
      51             :     }
      52             :     
      53     1189311 :     return max;
      54             : }
      55             : 

Generated by: LCOV version 1.14