LCOV - code coverage report
Current view: top level - lib_com - trans_direct.c (source / functions) Hit Total Coverage
Test: Coverage on main @ 6baab0c613aa6c7100498ed7b93676aa8198a493 Lines: 55 55 100.0 %
Date: 2025-05-29 08:28:55 Functions: 1 1 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             : #ifdef DEBUGGING
      40             : #include "debug.h"
      41             : #endif
      42             : #include "cnst.h"
      43             : #include "prot.h"
      44             : #include "rom_com.h"
      45             : #include "wmc_auto.h"
      46             : 
      47             : /*-------------------------------------------------------------------
      48             :  * direct_transform()
      49             :  *
      50             :  * Transformation of the signal to DCT domain
      51             :  *-------------------------------------------------------------------*/
      52             : 
      53      737474 : void direct_transform(
      54             :     const float *in32,          /* i  : input signal                        */
      55             :     float *out32,               /* o  : transformation                      */
      56             :     const int16_t is_transient, /* i  : is transient                        */
      57             :     const int16_t L,            /* i  : length                              */
      58             :     const int16_t element_mode  /* i  : IVAS element mode   */
      59             : )
      60             : {
      61             :     int16_t i;
      62             :     int16_t seg;
      63             :     int16_t segment_length;
      64             : 
      65             :     const float *wh;
      66             :     const float *wl;
      67             :     float *sh;
      68             :     float *sl;
      69             :     float *iseg;
      70             :     float *oseg;
      71             :     float dctin32[L_FRAME48k];
      72             :     float in32_r16[L_FRAME48k];
      73             : 
      74             :     const float *win;
      75             : 
      76             : 
      77      737474 :     segment_length = L / 2;
      78             : 
      79      737474 :     if ( is_transient )
      80             :     {
      81        4408 :         if ( L == L_FRAME48k )
      82             :         {
      83        3004 :             win = wscw16q15;
      84             :         }
      85        1404 :         else if ( L == L_FRAME32k )
      86             :         {
      87         986 :             win = wscw16q15_32;
      88             :         }
      89         418 :         else if ( L == L_FRAME8k )
      90             :         {
      91          39 :             win = wscw16q15_8;
      92             :         }
      93             :         else
      94             :         {
      95         379 :             win = wscw16q15_16;
      96             :         }
      97             : 
      98     1825608 :         for ( i = 0; i < L / 2; i++ )
      99             :         {
     100     1821200 :             in32_r16[i] = in32[L - 1 - i];
     101     1821200 :             in32_r16[L - 1 - i] = in32[i];
     102             :         }
     103        4408 :         iseg = in32_r16 - segment_length / 4;
     104        4408 :         oseg = out32;
     105             : 
     106        4408 :         wh = win + segment_length / 4;
     107        4408 :         wl = win + segment_length / 4 - 1;
     108        4408 :         sh = iseg + 3 * segment_length / 4;
     109        4408 :         sl = iseg + 3 * segment_length / 4 - 1;
     110      459708 :         for ( i = 0; i < segment_length / 4; i++ )
     111             :         {
     112      455300 :             dctin32[i] = ( ( *wl-- * *sl-- ) - ( *wh++ * *sh++ ) );
     113             :         }
     114             : 
     115        4408 :         sl = iseg + segment_length / 2 - 1;
     116             : 
     117      459708 :         for ( i = 0; i < segment_length / 4; i++ )
     118             :         {
     119      455300 :             dctin32[segment_length / 4 + i] = -( *sl-- );
     120             :         }
     121             : 
     122        4408 :         edct( dctin32, oseg, segment_length / 2, element_mode );
     123             : 
     124        4408 :         iseg = iseg + segment_length / 2;
     125        4408 :         oseg = oseg + segment_length / 2;
     126             : 
     127       13224 :         for ( seg = 1; seg < NUM_TIME_SWITCHING_BLOCKS - 1; seg++ )
     128             :         {
     129        8816 :             wh = win + segment_length / 4;
     130        8816 :             wl = win + segment_length / 4 - 1;
     131        8816 :             sh = iseg + 3 * segment_length / 4;
     132        8816 :             sl = iseg + 3 * segment_length / 4 - 1;
     133      919416 :             for ( i = 0; i < segment_length / 4; i++ )
     134             :             {
     135      910600 :                 dctin32[i] = ( ( *wl-- * *sl-- ) - ( *wh++ * *sh++ ) );
     136             :             }
     137             : 
     138        8816 :             sh = iseg;
     139        8816 :             sl = iseg + segment_length / 2 - 1;
     140        8816 :             wh = win + segment_length / 2 - 1;
     141        8816 :             wl = win + 0;
     142             : 
     143      919416 :             for ( i = 0; i < segment_length / 4; i++ )
     144             :             {
     145      910600 :                 dctin32[segment_length / 4 + i] = ( ( *wl++ * *sl-- ) + ( *wh-- * *sh++ ) );
     146             :             }
     147             : 
     148        8816 :             edct( dctin32, oseg, segment_length / 2, element_mode );
     149             : 
     150        8816 :             iseg = iseg + segment_length / 2;
     151        8816 :             oseg = oseg + segment_length / 2;
     152             :         }
     153             : 
     154        4408 :         sh = iseg + 3 * segment_length / 4 - 1;
     155      459708 :         for ( i = 0; i < segment_length / 4; i++ )
     156             :         {
     157      455300 :             dctin32[i] = -( *sh-- );
     158             :         }
     159             : 
     160        4408 :         sh = iseg;
     161        4408 :         sl = iseg + segment_length / 2 - 1;
     162        4408 :         wh = win + segment_length / 2 - 1;
     163        4408 :         wl = win + 0;
     164             : 
     165      459708 :         for ( i = 0; i < segment_length / 4; i++ )
     166             :         {
     167      455300 :             dctin32[segment_length / 4 + i] = ( ( *wh-- * *sh++ ) + ( *wl++ * *sl-- ) );
     168             :         }
     169             : 
     170        4408 :         edct( dctin32, oseg, segment_length / 2, element_mode );
     171             :     }
     172             :     else
     173             :     {
     174      733066 :         edct( in32, out32, L, element_mode );
     175             :     }
     176             : 
     177      737474 :     return;
     178             : }

Generated by: LCOV version 1.14