LCOV - code coverage report
Current view: top level - lib_com - trans_direct.c (source / functions) Hit Total Coverage
Test: Coverage on main -- short test vectors @ 6c9ddc4024a9c0e1ecb8f643f114a84a0e26ec6b Lines: 52 55 94.5 %
Date: 2025-05-23 08:37:30 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       97865 : 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       97865 :     segment_length = L / 2;
      78             : 
      79       97865 :     if ( is_transient )
      80             :     {
      81         629 :         if ( L == L_FRAME48k )
      82             :         {
      83         590 :             win = wscw16q15;
      84             :         }
      85          39 :         else if ( L == L_FRAME32k )
      86             :         {
      87          39 :             win = wscw16q15_32;
      88             :         }
      89           0 :         else if ( L == L_FRAME8k )
      90             :         {
      91           0 :             win = wscw16q15_8;
      92             :         }
      93             :         else
      94             :         {
      95           0 :             win = wscw16q15_16;
      96             :         }
      97             : 
      98      296309 :         for ( i = 0; i < L / 2; i++ )
      99             :         {
     100      295680 :             in32_r16[i] = in32[L - 1 - i];
     101      295680 :             in32_r16[L - 1 - i] = in32[i];
     102             :         }
     103         629 :         iseg = in32_r16 - segment_length / 4;
     104         629 :         oseg = out32;
     105             : 
     106         629 :         wh = win + segment_length / 4;
     107         629 :         wl = win + segment_length / 4 - 1;
     108         629 :         sh = iseg + 3 * segment_length / 4;
     109         629 :         sl = iseg + 3 * segment_length / 4 - 1;
     110       74549 :         for ( i = 0; i < segment_length / 4; i++ )
     111             :         {
     112       73920 :             dctin32[i] = ( ( *wl-- * *sl-- ) - ( *wh++ * *sh++ ) );
     113             :         }
     114             : 
     115         629 :         sl = iseg + segment_length / 2 - 1;
     116             : 
     117       74549 :         for ( i = 0; i < segment_length / 4; i++ )
     118             :         {
     119       73920 :             dctin32[segment_length / 4 + i] = -( *sl-- );
     120             :         }
     121             : 
     122         629 :         edct( dctin32, oseg, segment_length / 2, element_mode );
     123             : 
     124         629 :         iseg = iseg + segment_length / 2;
     125         629 :         oseg = oseg + segment_length / 2;
     126             : 
     127        1887 :         for ( seg = 1; seg < NUM_TIME_SWITCHING_BLOCKS - 1; seg++ )
     128             :         {
     129        1258 :             wh = win + segment_length / 4;
     130        1258 :             wl = win + segment_length / 4 - 1;
     131        1258 :             sh = iseg + 3 * segment_length / 4;
     132        1258 :             sl = iseg + 3 * segment_length / 4 - 1;
     133      149098 :             for ( i = 0; i < segment_length / 4; i++ )
     134             :             {
     135      147840 :                 dctin32[i] = ( ( *wl-- * *sl-- ) - ( *wh++ * *sh++ ) );
     136             :             }
     137             : 
     138        1258 :             sh = iseg;
     139        1258 :             sl = iseg + segment_length / 2 - 1;
     140        1258 :             wh = win + segment_length / 2 - 1;
     141        1258 :             wl = win + 0;
     142             : 
     143      149098 :             for ( i = 0; i < segment_length / 4; i++ )
     144             :             {
     145      147840 :                 dctin32[segment_length / 4 + i] = ( ( *wl++ * *sl-- ) + ( *wh-- * *sh++ ) );
     146             :             }
     147             : 
     148        1258 :             edct( dctin32, oseg, segment_length / 2, element_mode );
     149             : 
     150        1258 :             iseg = iseg + segment_length / 2;
     151        1258 :             oseg = oseg + segment_length / 2;
     152             :         }
     153             : 
     154         629 :         sh = iseg + 3 * segment_length / 4 - 1;
     155       74549 :         for ( i = 0; i < segment_length / 4; i++ )
     156             :         {
     157       73920 :             dctin32[i] = -( *sh-- );
     158             :         }
     159             : 
     160         629 :         sh = iseg;
     161         629 :         sl = iseg + segment_length / 2 - 1;
     162         629 :         wh = win + segment_length / 2 - 1;
     163         629 :         wl = win + 0;
     164             : 
     165       74549 :         for ( i = 0; i < segment_length / 4; i++ )
     166             :         {
     167       73920 :             dctin32[segment_length / 4 + i] = ( ( *wh-- * *sh++ ) + ( *wl++ * *sl-- ) );
     168             :         }
     169             : 
     170         629 :         edct( dctin32, oseg, segment_length / 2, element_mode );
     171             :     }
     172             :     else
     173             :     {
     174       97236 :         edct( in32, out32, L, element_mode );
     175             :     }
     176             : 
     177       97865 :     return;
     178             : }

Generated by: LCOV version 1.14