LCOV - code coverage report
Current view: top level - lib_lc3plus - apply_global_gain_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main -- dec/rend @ 633e3f2e309758d10805ef21e0436356fe719b7a Lines: 0 11 0.0 %
Date: 2025-08-23 01:22:27 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             : *                        ETSI TS 103 634 V1.5.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 "functions.h"
      11             : 
      12           0 : void processApplyGlobalGain_fx(Word32 x[], Word16 *x_e, Word16 xLen, Word16 global_gain_idx, Word16 global_gain_off)
      13             : {
      14             :     Word32 i;
      15             : #ifdef ENABLE_HR_MODE
      16             :     Word32 global_gain;
      17             : #else
      18             :     Word16 global_gain;
      19             : #endif
      20             :     Word16 global_gain_e;
      21             :     Word32 tmp32;
      22             : 
      23             : #ifdef DYNMEM_COUNT
      24             :     Dyn_Mem_In("processApplyGlobalGain_fx", sizeof(struct {
      25             :                    Counter i;
      26             :                    Word16  global_gain, global_gain_e;
      27             :                    Word32  tmp32;
      28             :                }));
      29             : #endif
      30             : 
      31             : #ifdef ENABLE_HR_MODE
      32             :     /* 1 / (28 * log 2) is 0x797D in Q18, L_shl_pos by 7 results in Q25 tmp32 */
      33             :     /* round(2^31 / (28 * log10(2))) = 254778081 */
      34             :     //tmp32 = L_shl_pos(Mpy_32_16_lc3plus(254778081, add(global_gain_idx, global_gain_off)), 9);
      35             :     Word32  mh;
      36             :     UWord16 ml;
      37             : 
      38           0 :     Mpy_32_16_ss(254778081, add(global_gain_idx, global_gain_off), &mh, &ml);
      39           0 :     tmp32 = L_shl_pos(mh, 9) | L_deposit_l((shr((Word16)ml, 7)) & 0x1ff);
      40           0 :     move16();
      41             :     /* Uses an argument in Q25 */
      42           0 :     global_gain = BASOP_Util_InvLog2_lc3plus(L_or(tmp32, (Word32)0xFE000000));
      43             : #else
      44             :     tmp32         = L_shl_pos(L_mult0(add(global_gain_idx, global_gain_off), 0x797D), 7);
      45             :     /* Uses an argument in Q25 */
      46             :     global_gain = round_fx(BASOP_Util_InvLog2_lc3plus(L_or(tmp32, (Word32)0xFE000000)));
      47             : #endif
      48           0 :     global_gain_e = add(extract_l(L_shr_pos(tmp32, 25)), 1);
      49             : 
      50           0 :     FOR (i = 0; i < xLen; i++)
      51             :     {
      52             : #ifdef ENABLE_HR_MODE
      53           0 :         x[i] = Mpy_32_32_lc3plus(x[i], global_gain);
      54             : #else
      55             :         x[i] = Mpy_32_16_lc3plus(x[i], global_gain);
      56             : #endif
      57           0 :         move32();
      58             :     }
      59             : 
      60           0 :     *x_e = add(*x_e, global_gain_e); move16();
      61             : 
      62             : #ifdef DYNMEM_COUNT
      63             :     Dyn_Mem_Out();
      64             : #endif
      65           0 : }
      66             : 

Generated by: LCOV version 1.14