LCOV - code coverage report
Current view: top level - lib_enc - normalizecoefs_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main @ cede165d26d1b794bfc5f5f6f9ec19d4d64a9a3b Lines: 19 19 100.0 %
Date: 2025-11-01 03:16:20 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*====================================================================================
       2             :     EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
       3             :   ====================================================================================*/
       4             : #include <stdint.h>
       5             : #include "options.h" /* Compilation switches                   */
       6             : #include "cnst.h"    /* Common constants                       */
       7             : //#include "basop_mpy.h"
       8             : //#include "prot_fx.h"
       9             : #include "prot_fx.h"     /* Function prototypes                    */
      10             : #include "prot_fx_enc.h" /* Function prototypes                    */
      11             : 
      12             : 
      13             : /*--------------------------------------------------------------------------
      14             :  * normalizecoefs_fx()
      15             :  *
      16             :  * Normalize MDCT coefficients with quantized norms
      17             :  *--------------------------------------------------------------------------*/
      18             : 
      19        8193 : void normalizecoefs_fx(
      20             :     Word32 *coefs,            /* i  : Input vector (Q12)                  */
      21             :     const Word16 *ynrm,       /* i  : quantization indices for norms      */
      22             :     const Word16 num_bands,   /* i  : Number of bands                     */
      23             :     const Word16 *band_start, /* i  : Start of bands                      */
      24             :     const Word16 *band_end,   /* i  : End of bands                        */
      25             :     Word16 *coefs_norm        /* o  : Normalized output vector            */
      26             : )
      27             : {
      28             :     Word16 band, j, k, r, v;
      29             :     Word16 *pcoefs16;
      30             :     Word32 *pcoefs;
      31             :     Word16 subvec_start, subvec_end, num_coefs;
      32             : 
      33        8193 :     pcoefs = coefs;
      34        8193 :     pcoefs16 = coefs_norm;
      35             : 
      36      282873 :     FOR( band = 0; band < num_bands; band++ )
      37             :     {
      38      274680 :         r = s_and( ynrm[band], 1 );
      39      274680 :         v = shr( ynrm[band], 1 );
      40      274680 :         k = sub( sub( 17, r ), v );
      41             : 
      42      274680 :         subvec_start = band_start[band];
      43      274680 :         move16();
      44      274680 :         subvec_end = band_end[band];
      45      274680 :         move16();
      46      274680 :         num_coefs = sub( subvec_end, subvec_start );
      47             : 
      48     5309456 :         FOR( j = 0; j < num_coefs; j++ )
      49             :         {
      50     5034776 :             IF( r != 0 )
      51             :             {
      52     2434588 :                 *pcoefs = Mpy_32_16_1( *pcoefs, INV2POWHALF );
      53     2434588 :                 move32();
      54             :             }
      55     5034776 :             *pcoefs16++ = round_fx_sat( L_shl_sat( *pcoefs++, 16 - k ) ); /* Q12 */
      56     5034776 :             move16();
      57             :         }
      58             :     }
      59             : 
      60        8193 :     return;
      61             : }

Generated by: LCOV version 1.14