LCOV - code coverage report
Current view: top level - lib_dec - jbm_pcmdsp_window.c (source / functions) Hit Total Coverage
Test: Coverage on main enc/dec/rend @ 3b2f07138c61dcf997bbf4165d0882f794b2995f Lines: 12 38 31.6 %
Date: 2025-05-03 01:55:50 Functions: 1 3 33.3 %

          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 <math.h>
      38             : #include <stdlib.h>
      39             : #include <stdint.h>
      40             : #include "options.h"
      41             : #include "jbm_pcmdsp_window.h"
      42             : #include "cnst.h"
      43             : #include "basop_util.h"
      44             : #include "wmc_auto.h"
      45             : 
      46             : /*-----------------------------------------------------------------------*
      47             :  * overlapAdd()
      48             :  *
      49             :  *  Overlap/Add of two signal with a given window
      50             :  *-----------------------------------------------------------------------*/
      51         110 : void overlapAdd( const Word16 *fadeOut, const Word16 *fadeIn, Word16 *out, Word16 n, Word16 nChannels, const Word16 *fadeOutWin, const Word16 *fadeInWin, Word16 hannIncrementor )
      52             : {
      53             :     Word32 fdOutVal, fdInVal;
      54             :     Word16 i, j, hannIter, combinedVal;
      55             : 
      56             : 
      57         322 :     FOR( j = 0; j < nChannels; j++ )
      58             :     {
      59             :         /* reset Hann window iterator to beginning (both channels use same window) */
      60         212 :         hannIter = 0;
      61         212 :         move16();
      62       87092 :         FOR( i = j; i < n; i += nChannels )
      63             :         {
      64       86880 :             fdOutVal = L_mult( fadeOut[i], fadeOutWin[hannIter] );
      65       86880 :             fdInVal = L_mult( fadeIn[i], fadeInWin[hannIter] );
      66             :             /* round to 16bit value and saturate (L_add already applies saturation) */
      67       86880 :             combinedVal = round_fx( L_add( fdOutVal, fdInVal ) );
      68             : 
      69       86880 :             out[i] = combinedVal;
      70       86880 :             move16();
      71             :             /* advance the Hann window iterator by incrementor (dependent on sample rate). */
      72       86880 :             hannIter = add( hannIter, hannIncrementor );
      73             :         }
      74             :     }
      75         110 : }
      76             : 
      77             : 
      78           0 : void overlapAdd_fx( const Word16 *fadeOut, const Word16 *fadeIn, Word16 *out, Word16 n, Word16 nChannels, const Word16 *fadeOutWin, const Word16 *fadeInWin )
      79             : {
      80             :     Word32 fdOutVal, fdInVal;
      81             :     Word16 i, j, hannIter, combinedVal;
      82             : 
      83             : 
      84           0 :     FOR( j = 0; j < nChannels; j++ )
      85             :     {
      86             :         /* reset Hann window iterator to beginning (both channels use same window) */
      87           0 :         hannIter = 0;
      88           0 :         move16();
      89           0 :         FOR( i = j; i < n; i += nChannels )
      90             :         {
      91           0 :             fdOutVal = L_mult( fadeOut[i], fadeOutWin[hannIter] );
      92           0 :             fdInVal = L_mult( fadeIn[i], fadeInWin[hannIter] );
      93             :             /* round to 16bit value and saturate (L_add already applies saturation) */
      94           0 :             combinedVal = round_fx( L_add( fdOutVal, fdInVal ) );
      95             : 
      96           0 :             out[i] = combinedVal;
      97           0 :             move16();
      98             :             /* advance the Hann window iterator by incrementor (dependent on sample rate). */
      99           0 :             hannIter = add( hannIter, 1 );
     100             :         }
     101             :     }
     102           0 : }
     103             : 
     104           0 : void overlapAddEvs_fx(
     105             :     const Word16 *fadeOut,
     106             :     const Word16 *fadeIn,
     107             :     Word16 *out,
     108             :     UWord16 n,
     109             :     UWord16 nChannels,
     110             :     const Word16 *fadeOutWin,
     111             :     const Word16 *fadeInWin )
     112             : {
     113             :     Word32 fdOutVal, fdInVal;
     114             :     Word16 i, j, hannIter, combinedVal;
     115             : 
     116           0 :     FOR( j = 0; j < nChannels; j++ )
     117             :     {
     118             :         /* reset Hann window iterator to beginning (both channels use same window) */
     119           0 :         hannIter = 0;
     120           0 :         move16();
     121           0 :         FOR( i = j; i < n; i += nChannels )
     122             :         {
     123           0 :             fdOutVal = L_mult( fadeOut[i], fadeOutWin[hannIter] );
     124           0 :             fdInVal = L_mult( fadeIn[i], fadeInWin[hannIter] );
     125             :             /* round combinedVal value (taking care of sign) */
     126             : 
     127           0 :             combinedVal = round_fx( L_add( fdOutVal, fdInVal ) );
     128           0 :             IF( L_add( fdInVal, fdOutVal ) < 0 )
     129             :             {
     130           0 :                 combinedVal = round_fx( L_add( fdOutVal, fdInVal ) );
     131             :             }
     132           0 :             out[i] = combinedVal;
     133           0 :             move16();
     134             : 
     135           0 :             hannIter = add( hannIter, 1 );
     136             :         }
     137             :     }
     138             : 
     139           0 :     return;
     140             : }

Generated by: LCOV version 1.14