LCOV - code coverage report
Current view: top level - lib_lc3plus - sns_interpolate_scf_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main -- dec/rend @ 633e3f2e309758d10805ef21e0436356fe719b7a Lines: 0 36 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 processSnsInterpolateScf_fx(
      13             : #ifdef ENABLE_HR_MODE
      14             :                                  Word32 *scf_q, Word32 mdct_scf[],
      15             : #else
      16             :                                  Word16 *scf_q, Word16 mdct_scf[],
      17             : #endif
      18             :                                  Word16 mdct_scf_exp[], Word16 inv_scf,
      19             :                                  Word16 n_bands, Word8 *scratchBuffer)
      20             : {
      21             : #ifdef ENABLE_HR_MODE
      22             :     Dyn_Mem_Deluxe_In(
      23             :         Word32  i, tmp2; 
      24             :         Word32 *scf_int; 
      25             :         Word32  tmp; 
      26             :         Word32 *scf_tmp;
      27             :     );
      28             : #else
      29             :     Dyn_Mem_Deluxe_In(
      30             :         Word16  i, tmp2;
      31             :         Word16 *scf_int;
      32             :         Word16  tmp;
      33             :         Word16 *scf_tmp;
      34             :     );
      35             : #endif
      36             : 
      37             : #ifdef ENABLE_HR_MODE
      38           0 :     scf_int = (Word32 *)scratchAlign(scratchBuffer, 0);              /* Size = 2 * MAX_BANDS_NUMBER = 128 bytes */
      39           0 :     scf_tmp = (Word32 *)scratchAlign(scf_int, 4 * MAX_BANDS_NUMBER); /* 2 * MAX_BANDS_NUMBER = 128 bytes */
      40             : #else
      41             :     scf_int = (Word16 *)scratchAlign(scratchBuffer, 0);              /* Size = 2 * MAX_BANDS_NUMBER = 128 bytes */
      42             :     scf_tmp = (Word16 *)scratchAlign(scf_int, 2 * MAX_BANDS_NUMBER); /* 2 * MAX_BANDS_NUMBER = 128 bytes */
      43             : #endif
      44             : 
      45             :     /* Interpolation */
      46           0 :     scf_int[0] = scf_q[0];
      47           0 :     scf_int[1] = scf_q[0];
      48           0 :     FOR (i = 1; i < M; i++)
      49             :     {
      50             : #ifdef ENABLE_HR_MODE
      51           0 :         tmp                = L_sub(scf_q[i], scf_q[i - 1]);
      52           0 :         tmp2               = L_shr(tmp, 2);
      53           0 :         tmp                = L_shr(tmp, 3);
      54           0 :         scf_int[i * 4 - 2] = L_add(scf_q[i - 1], tmp);
      55           0 :         scf_int[i * 4 - 1] = L_add(scf_int[i * 4 - 2], tmp2);
      56           0 :         scf_int[i * 4]     = L_add(scf_int[i * 4 - 1], tmp2);
      57           0 :         scf_int[i * 4 + 1] = L_add(scf_int[i * 4], tmp2);
      58             : #else
      59             :         tmp                = sub(scf_q[i], scf_q[i - 1]);
      60             :         tmp2               = mult_r(tmp, 8192);
      61             :         tmp                = mult_r(tmp, 4096);
      62             :         scf_int[i * 4 - 2] = add(scf_q[i - 1], tmp);
      63             :         scf_int[i * 4 - 1] = add(scf_int[i * 4 - 2], tmp2);
      64             :         scf_int[i * 4]     = add(scf_int[i * 4 - 1], tmp2);
      65             :         scf_int[i * 4 + 1] = add(scf_int[i * 4], tmp2);
      66             : #endif
      67             :     }
      68             : #ifdef ENABLE_HR_MODE
      69           0 :     scf_int[62] = L_add(scf_int[61], tmp2);
      70           0 :     scf_int[63] = L_add(scf_int[62], tmp2);
      71             : #else
      72             :     scf_int[62] = add(scf_int[61], tmp2);
      73             :     scf_int[63] = add(scf_int[62], tmp2);
      74             : #endif
      75             : 
      76             :     /* 8 kHz mode for 2.5 ms */
      77           0 :     IF (sub(n_bands, 32) < 0)
      78             :     {
      79             : #ifdef ENABLE_HR_MODE
      80           0 :         basop_memmove(scf_tmp, scf_int, 64 * sizeof(Word32));
      81             : #else
      82             :         basop_memmove(scf_tmp, scf_int, 64 * sizeof(Word16));
      83             : #endif
      84           0 :         tmp = sub(32, n_bands);
      85           0 :         FOR (i = 0; i < tmp; i++)
      86             :         {
      87             : #ifdef ENABLE_HR_MODE
      88           0 :             scf_int[i] = L_add(L_shr(L_add(scf_tmp[4 * i], scf_tmp[4 * i + 1]), 2),
      89           0 :                                L_shr(L_add(scf_tmp[4 * i + 2], scf_tmp[4 * i + 3]), 2));
      90             : #else
      91             :             /* 8192 = 0.25 * 2^15 */
      92             :             scf_int[i] = add(mac_r(L_mult(scf_tmp[4 * i], 8192), scf_tmp[4 * i + 1], 8192),
      93             :                              mac_r(L_mult(scf_tmp[4 * i + 2], 8192), scf_tmp[4 * i + 3], 8192));
      94             : #endif
      95             :         }
      96             : 
      97           0 :         FOR (i = 0; i < n_bands - tmp; i++)
      98             :         {
      99             : #ifdef ENABLE_HR_MODE
     100           0 :             scf_int[tmp + i] = L_shr(L_add(scf_tmp[4 * tmp + 2 * i], scf_tmp[4 * tmp + 2 * i + 1]), 1);
     101             : #else
     102             :             scf_int[tmp + i] = mac_r(L_mult(scf_tmp[4 * tmp + 2 * i], 16384), scf_tmp[4 * tmp + 2 * i + 1], 16384);
     103             : #endif
     104             :         }
     105             :     }
     106             :     ELSE
     107             :         /* For 5ms */
     108           0 :         IF (sub(n_bands, 64) < 0)
     109             :     {
     110           0 :         tmp = sub(64, n_bands);
     111           0 :         FOR (i = 0; i < tmp; i++)
     112             :         {
     113             : #ifdef ENABLE_HR_MODE
     114           0 :             scf_int[i] = L_shr(L_add(scf_int[2 * i], scf_int[2 * i + 1]), 1);
     115             : #else
     116             :             scf_int[i] = mac_r(L_mult(scf_int[2 * i], 16384), scf_int[2 * i + 1], 16384);
     117             : #endif
     118             :         }
     119           0 :         FOR (; i < n_bands; i++)
     120             :         {
     121           0 :             scf_int[i] = scf_int[tmp + i]; move16();
     122             :         }
     123             : #ifdef ENABLE_HR_MODE 
     124           0 :         move16(); // 32 bit operations have twice the complexity weight of 16 bit operations
     125             : #endif
     126             :     }
     127             : 
     128             :     /* Inversion at encoder-side*/
     129           0 :     IF (inv_scf == 1)
     130             :     {
     131           0 :         FOR (i = 0; i < n_bands; i++)
     132             :         {
     133             : #ifdef ENABLE_HR_MODE 
     134           0 :             scf_int[i] = L_negate(scf_int[i]);
     135             : #else
     136             :             scf_int[i] = negate(scf_int[i]);
     137             : #endif
     138             :         }
     139             :     }
     140             : 
     141             : /* Linear Domain */
     142           0 :     FOR (i = 0; i < n_bands; i++)
     143             :     {
     144             : #ifdef ENABLE_HR_MODE 
     145             :         /* scf_int is in Q26, BASOP_Util_InvLog2_pos requires Q25 data */
     146           0 :         mdct_scf[i] = BASOP_Util_InvLog2_pos(L_shr(scf_int[i], 1), &mdct_scf_exp[i]);
     147             : #else
     148             :         mdct_scf[i] = BASOP_Util_InvLog2_16(scf_int[i], &mdct_scf_exp[i]);
     149             : #endif
     150             :     }
     151             :     
     152             :     Dyn_Mem_Deluxe_Out();
     153           0 : }
     154             : 

Generated by: LCOV version 1.14