LCOV - code coverage report
Current view: top level - lib_enc - normalizecoefs_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main enc/dec/rend @ 3b2f07138c61dcf997bbf4165d0882f794b2995f Lines: 21 21 100.0 %
Date: 2025-05-03 01:55:50 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        8185 : 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             : #ifdef BASOP_NOGLOB_DECLARE_LOCAL
      33        8185 :     Flag Overflow = 0;
      34        8185 :     move16();
      35             : #endif
      36        8185 :     pcoefs = coefs;
      37        8185 :     pcoefs16 = coefs_norm;
      38             : 
      39      282762 :     FOR( band = 0; band < num_bands; band++ )
      40             :     {
      41      274577 :         r = s_and( ynrm[band], 1 );
      42      274577 :         v = shr( ynrm[band], 1 );
      43      274577 :         k = sub( sub( 17, r ), v );
      44             : 
      45      274577 :         subvec_start = band_start[band];
      46      274577 :         move16();
      47      274577 :         subvec_end = band_end[band];
      48      274577 :         move16();
      49      274577 :         num_coefs = sub( subvec_end, subvec_start );
      50             : 
      51     5307849 :         FOR( j = 0; j < num_coefs; j++ )
      52             :         {
      53     5033272 :             IF( r != 0 )
      54             :             {
      55     2433748 :                 *pcoefs = Mpy_32_16_1( *pcoefs, INV2POWHALF );
      56     2433748 :                 move32();
      57             :             }
      58     5033272 :             *pcoefs16++ = round_fx_o( L_shl_o( *pcoefs++, 16 - k, &Overflow ), &Overflow ); /* Q12 */
      59     5033272 :             move16();
      60             :         }
      61             :     }
      62             : 
      63        8185 :     return;
      64             : }

Generated by: LCOV version 1.14