LCOV - code coverage report
Current view: top level - lib_dec - ivas_stereo_esf_dec.c (source / functions) Hit Total Coverage
Test: Coverage on main -- short test vectors @ 6c9ddc4024a9c0e1ecb8f643f114a84a0e26ec6b Lines: 34 34 100.0 %
Date: 2025-05-23 08:37:30 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             : #include <stdint.h>
      34             : #include "options.h"
      35             : #include "ivas_prot.h"
      36             : #include "ivas_stat_dec.h"
      37             : #include "ivas_cnst.h"
      38             : #ifdef DEBUGGING
      39             : #include "debug.h"
      40             : #endif
      41             : #include "wmc_auto.h"
      42             : 
      43             : /*-------------------------------------------------------------------*
      44             :  * init_basic_allpass()
      45             :  *
      46             :  *
      47             :  *-------------------------------------------------------------------*/
      48             : 
      49        8694 : void init_basic_allpass(
      50             :     basic_allpass_t *ap,
      51             :     const float *gains,
      52             :     const int16_t *delays )
      53             : {
      54             :     int16_t i, j;
      55             : 
      56       34776 :     for ( i = 0; i < 3; i++ )
      57             :     {
      58       26082 :         ap->gains[i] = gains[i];
      59       26082 :         ap->delays[i] = delays[i];
      60             : 
      61     6703074 :         for ( j = 0; j < STEREO_DFT_ALLPASS_BUFFERLEN; j++ )
      62             :         {
      63     6676992 :             ap->buffer[i][j] = 0.f;
      64             :         }
      65             :     }
      66             : 
      67        8694 :     ap->pos = 0;
      68             : 
      69        8694 :     return;
      70             : }
      71             : 
      72             : 
      73             : /*-------------------------------------------------------------------*
      74             :  * filter_with_allpass()
      75             :  *
      76             :  *
      77             :  *-------------------------------------------------------------------*/
      78             : 
      79      294390 : void filter_with_allpass(
      80             :     const float *sig,
      81             :     float *out,
      82             :     const int16_t len,
      83             :     basic_allpass_t *ap )
      84             : {
      85             :     int16_t k;
      86             :     int16_t pos, mask;
      87             :     int16_t d1, d2, d3;
      88             :     float P1, P2, P3, P4, P5;
      89             :     float g1, g2, g3, *D1, *D2, *D3;
      90             : 
      91      294390 :     P1 = P2 = P3 = P4 = P5 = 0;
      92      294390 :     mask = STEREO_DFT_ALLPASS_BUFFERLEN - 1;
      93             : 
      94      294390 :     pos = ap->pos;
      95             : 
      96      294390 :     g1 = ap->gains[0];
      97      294390 :     g2 = ap->gains[1];
      98      294390 :     g3 = ap->gains[2];
      99             : 
     100      294390 :     d1 = ap->delays[0];
     101      294390 :     d2 = ap->delays[1];
     102      294390 :     d3 = ap->delays[2];
     103             : 
     104      294390 :     D1 = ap->buffer[0];
     105      294390 :     D2 = ap->buffer[1];
     106      294390 :     D3 = ap->buffer[2];
     107             : 
     108    82924470 :     for ( k = 0; k < len; k++ )
     109             :     {
     110    82630080 :         P1 = sig[k] - g3 * D3[pos];
     111    82630080 :         P2 = P1 - g1 * D1[pos];
     112    82630080 :         P3 = D1[pos] + g1 * P2 - g2 * D2[pos];
     113    82630080 :         P4 = D2[pos] + g2 * P3;
     114    82630080 :         P5 = D3[pos] + g3 * P1;
     115             : 
     116    82630080 :         out[k] = P5; /* could overwrite sig */
     117             : 
     118    82630080 :         D1[( pos + d1 ) & mask] = P2;
     119    82630080 :         D2[( pos + d2 ) & mask] = P3;
     120    82630080 :         D3[( pos + d3 ) & mask] = P4;
     121             : 
     122    82630080 :         pos = ( pos + 1 ) & mask;
     123             :     }
     124             : 
     125      294390 :     ap->pos = pos;
     126             : 
     127      294390 :     return;
     128             : }

Generated by: LCOV version 1.14