LCOV - code coverage report
Current view: top level - lib_com - interpol_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main enc/dec/rend @ 574a190e3c6896c6c4ed10d7f23649709a0c4347 Lines: 24 24 100.0 %
Date: 2025-06-27 02:59:36 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /******************************************************************************************************
       2             : 
       3             :    (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
       4             :    Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
       5             :    Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
       6             :    Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
       7             :    contributors to this repository. All Rights Reserved.
       8             : 
       9             :    This software is protected by copyright law and by international treaties.
      10             :    The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
      11             :    Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
      12             :    Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
      13             :    Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
      14             :    contributors to this repository retain full ownership rights in their respective contributions in
      15             :    the software. This notice grants no license of any kind, including but not limited to patent
      16             :    license, nor is any license granted by implication, estoppel or otherwise.
      17             : 
      18             :    Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
      19             :    contributions.
      20             : 
      21             :    This software is provided "AS IS", without any express or implied warranties. The software is in the
      22             :    development stage. It is intended exclusively for experts who have experience with such software and
      23             :    solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
      24             :    and fitness for a particular purpose are hereby disclaimed and excluded.
      25             : 
      26             :    Any dispute, controversy or claim arising under or in relation to providing this software shall be
      27             :    submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
      28             :    accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
      29             :    the United Nations Convention on Contracts on the International Sales of Goods.
      30             : 
      31             : *******************************************************************************************************/
      32             : 
      33             : /*====================================================================================
      34             :     EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
      35             :   ====================================================================================*/
      36             : 
      37             : #include <stdint.h>
      38             : #include "options.h"
      39             : #include "prot_fx.h"
      40             : #include "wmc_auto.h"
      41             : #include "rom_com.h"
      42             : #include "prot_fx_enc.h"
      43             : 
      44             : 
      45   524992055 : Word32 Interpol_lc_fx(                       /* o  : interpolated value               Q15 */
      46             :                        const Word16 *x,      /* i  : input vector                     Q0  */
      47             :                        const Word16 *win,    /* i  : interpolation window             Q14 */
      48             :                        const Word16 frac,    /* i  : fraction (0..up_samp)            Q0  */
      49             :                        const Word16 up_samp, /* i  : upsampling factor                Q0  */
      50             :                        const Word16 nb_coef  /* i  : number of coefficients           Q0  */
      51             : )
      52             : {
      53             :     Word16 i;
      54             :     const Word16 *c1, *c2, *x2;
      55             :     Word32 L_sum;
      56             : 
      57   524992055 :     x2 = &x[1];
      58   524992055 :     c1 = &win[frac];
      59   524992055 :     c2 = &win[sub( up_samp, frac )];
      60             :     {
      61   524992055 :         Word64 L_sum64 = 0;
      62   524992055 :         move64();
      63 22025625305 :         FOR( i = 0; i < nb_coef; i++ )
      64             :         {
      65             :             /* Using L_mac0 limits the risk of saturation during the loop, saturation may occures after the loop */
      66 21500633250 :             L_sum64 = W_mac0_16_16( L_sum64, *x, *c1 ); /*Q14*/
      67 21500633250 :             --x;
      68 21500633250 :             L_sum64 = W_mac0_16_16( L_sum64, *x2, *c2 ); /*Q14*/
      69 21500633250 :             ++x2;
      70 21500633250 :             c2 += up_samp; /* move16() not needed, since the coefficient can be rearrange in bit exact way */
      71 21500633250 :             c1 += up_samp;
      72             :         }
      73             : #ifdef OPT_SBA_ENC_V2_BE
      74   524992055 :         L_sum = W_shl_sat_l( L_sum64, 1 ); /*Q15*/
      75             :     }
      76             : #else
      77             :         L_sum = W_sat_l( L_sum64 ); /*Q14*/
      78             :     }
      79             :     L_sum = L_shl_sat( L_sum, 1 ); /*Q15*/
      80             : #endif
      81   524992055 :     return L_sum;
      82             : }
      83             : 
      84             : 
      85    12127937 : Word16 Interpol_4(             /* Qx o  : interpolated value  */
      86             :                    Word16 *x,  /* Qx i  : input vector        */
      87             :                    Word16 frac /* Q0 i  : fraction (-4..+3)   */
      88             : )
      89             : {
      90             :     Word16 i;
      91             :     Word32 L_sum;
      92             : #ifdef BASOP_NOGLOB_DECLARE_LOCAL
      93    12127937 :     Flag Overflow = 0;
      94             : #endif
      95             : 
      96    12127937 :     x = x - L_INTERPOL1 + 1;
      97             : 
      98    12127937 :     L_sum = L_mult( x[0], ( inter4_1_fx + UP_SAMP - 1 )[-frac] ); /*Qx+14+1*/
      99    97023496 :     FOR( i = 1; i < 2 * L_INTERPOL1; i++ )
     100             :     {
     101             :         /*
     102             :          * Here, additions with UP_SAMP are not counted
     103             :          * because, the window could easily be modified
     104             :          * so that the values needed are contiguous.
     105             :          */
     106    84895559 :         frac -= UP_SAMP;
     107    84895559 :         L_sum = L_mac( L_sum, x[i], ( inter4_1_fx + UP_SAMP - 1 )[-frac] ); /*Qx+14+1*/
     108             :     }
     109             :     BASOP_SATURATE_WARNING_OFF_EVS
     110             :     /* Here, saturation might occur by intention */
     111    12127937 :     L_sum = L_shl_o( L_sum, 1, &Overflow ); /*Qx+14+2*/
     112             :     BASOP_SATURATE_WARNING_ON_EVS
     113    12127937 :     return round_fx_o( L_sum, &Overflow ); /*Qx*/
     114             : }

Generated by: LCOV version 1.14