LCOV - code coverage report
Current view: top level - lib_lc3plus - noise_filling_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main -- dec/rend @ 633e3f2e309758d10805ef21e0436356fe719b7a Lines: 0 62 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             : /*************************************************************************/
      13             : 
      14             : 
      15             : 
      16           0 : void processNoiseFilling_fx(Word32 xq[], Word16 nfseed, Word16 xq_e, Word16 fac_ns_idx, Word16 BW_cutoff_idx,
      17             :                             Word16 frame_dms, Word16 fac_ns_pc, Word16 spec_inv_idx, Word8 *scratchBuffer
      18             : #ifdef ENABLE_HR_MODE
      19             :                             , Word16 hrmode
      20             : #endif
      21             : )
      22             : {
      23             :     Dyn_Mem_Deluxe_In(
      24             :         Counter k;
      25             :         Word16  nzeros, fac_ns, *ind, c;
      26             :         Word16  noisefillwidth, noisefillstart, N;
      27             :         Word32  L_tmp, L_tmp_neg, L_tmp_pc, L_tmp_neg_pc;
      28             :     );
      29             : 
      30           0 :     ind = (Word16 *)scratchAlign(scratchBuffer, 0); /* Size = 2 * MAX_LEN bytes */
      31             : 
      32           0 :     c = 0;                                move16();
      33             :     
      34             : #ifdef ENABLE_HR_MODE
      35           0 :     if (hrmode == 1)
      36             :     {
      37           0 :         N = BW_cutoff_bin_all_HR[BW_cutoff_idx];
      38           0 :         move16();
      39             :     }
      40             :     else
      41             : #endif
      42             :     {
      43           0 :         N = BW_cutoff_bin_all[BW_cutoff_idx];
      44           0 :         move16();
      45             :     }
      46             : 
      47           0 :     SWITCH (frame_dms)
      48             :     {
      49           0 :     case 25:
      50           0 :         N              = shr_pos(N, 2);
      51           0 :         noisefillwidth = NOISEFILLWIDTH_2_5MS;
      52           0 :         noisefillstart = NOISEFILLSTART_2_5MS;
      53           0 :         BREAK;
      54           0 :     case 50:
      55           0 :         N              = shr_pos(N, 1);
      56           0 :         noisefillwidth = NOISEFILLWIDTH_5MS;
      57           0 :         noisefillstart = NOISEFILLSTART_5MS;
      58           0 :         BREAK;
      59           0 :     case 75:
      60           0 :         N              = add(shr_pos(N, 2), add(shr_pos(N, 2), shr_pos(N, 2)));
      61           0 :         noisefillwidth = NOISEFILLWIDTH_7_5MS;
      62           0 :         noisefillstart = NOISEFILLSTART_7_5MS;
      63           0 :         BREAK;
      64           0 :     default: /* 100 */
      65           0 :         noisefillwidth = NOISEFILLWIDTH;
      66           0 :         noisefillstart = NOISEFILLSTART;
      67           0 :         BREAK;
      68             :     }
      69             : 
      70           0 :     nzeros = -2 * noisefillwidth - 1; move16();
      71             : 
      72           0 :     FOR (k = noisefillstart - noisefillwidth; k < noisefillstart + noisefillwidth; k++)
      73             :     {
      74           0 :         if (xq[k] != 0)
      75             :         {
      76           0 :             nzeros = -2 * noisefillwidth - 1; move16();
      77             :         }
      78           0 :         if (xq[k] == 0)
      79             :         {
      80           0 :             nzeros = add(nzeros, 1);
      81             :         }
      82             :     }
      83             : 
      84           0 :     FOR (k = noisefillstart; k < N - noisefillwidth; k++)
      85             :     {
      86           0 :         if (xq[k + noisefillwidth] != 0)
      87             :         {
      88           0 :             nzeros = -2 * noisefillwidth - 1; move16();
      89             :         }
      90           0 :         if (xq[k + noisefillwidth] == 0)
      91             :         {
      92           0 :             nzeros = add(nzeros, 1);
      93             :         }
      94           0 :         if (nzeros >= 0)
      95             :         {
      96           0 :             ind[c++] = k; move16();
      97             :         }
      98             :     }
      99             : 
     100           0 :     FOR (k = N - noisefillwidth; k < N; k++)
     101             :     {
     102           0 :         nzeros = add(nzeros, 1);
     103           0 :         if (nzeros >= 0)
     104             :         {
     105           0 :             ind[c++] = k; move16();
     106             :         }
     107             :     }
     108             : 
     109           0 :     IF (c > 0)
     110             :     {
     111           0 :         fac_ns       = shl_pos(sub(8, fac_ns_idx), 11);
     112           0 :         L_tmp        = L_shr_sat(L_deposit_l(fac_ns), sub(xq_e, 16));
     113           0 :         L_tmp_neg    = L_negate(L_tmp);
     114           0 :         L_tmp_pc     = L_shr_sat(L_deposit_l(fac_ns_pc), sub(xq_e, 16));
     115           0 :         L_tmp_neg_pc = L_negate(L_tmp_pc);
     116             : 
     117           0 :         FOR (k = 0; k < c; k++)
     118             :         {
     119           0 :             nfseed = extract_l(L_mac0(13849, nfseed, 31821));
     120           0 :             IF (nfseed >= 0)
     121             :             {
     122           0 :                 IF (ind[k] < spec_inv_idx)
     123             :                 {
     124           0 :                     xq[ind[k]] = L_tmp; move32();
     125             :                 }
     126             :                 ELSE
     127             :                 {
     128           0 :                     xq[ind[k]] = L_tmp_pc; move32();
     129             :                 }
     130             :             }
     131           0 :             IF (nfseed < 0)
     132             :             {
     133           0 :                 IF (ind[k] < spec_inv_idx)
     134             :                 {
     135           0 :                     xq[ind[k]] = L_tmp_neg; move32();
     136             :                 }
     137             :                 ELSE
     138             :                 {
     139           0 :                     xq[ind[k]] = L_tmp_neg_pc; move32();
     140             :                 }
     141             :             }
     142             :         }
     143             :     }
     144             : 
     145             :     Dyn_Mem_Deluxe_Out();
     146           0 : }
     147             : 

Generated by: LCOV version 1.14