LCOV - code coverage report
Current view: top level - lib_enc - normalizecoefs_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main @ e95243e9e67ddeb69dddf129509de1b3d95b402e Lines: 19 19 100.0 %
Date: 2025-09-14 03:13:15 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             : #ifndef ISSUE_1867_replace_overflow_libenc
      33             : #ifdef BASOP_NOGLOB_DECLARE_LOCAL
      34             :     Flag Overflow = 0;
      35             :     move16();
      36             : #endif
      37             : #endif
      38        8193 :     pcoefs = coefs;
      39        8193 :     pcoefs16 = coefs_norm;
      40             : 
      41      282873 :     FOR( band = 0; band < num_bands; band++ )
      42             :     {
      43      274680 :         r = s_and( ynrm[band], 1 );
      44      274680 :         v = shr( ynrm[band], 1 );
      45      274680 :         k = sub( sub( 17, r ), v );
      46             : 
      47      274680 :         subvec_start = band_start[band];
      48      274680 :         move16();
      49      274680 :         subvec_end = band_end[band];
      50      274680 :         move16();
      51      274680 :         num_coefs = sub( subvec_end, subvec_start );
      52             : 
      53     5309456 :         FOR( j = 0; j < num_coefs; j++ )
      54             :         {
      55     5034776 :             IF( r != 0 )
      56             :             {
      57     2434588 :                 *pcoefs = Mpy_32_16_1( *pcoefs, INV2POWHALF );
      58     2434588 :                 move32();
      59             :             }
      60             : #ifdef ISSUE_1867_replace_overflow_libenc
      61     5034776 :             *pcoefs16++ = round_fx_sat( L_shl_sat( *pcoefs++, 16 - k ) ); /* Q12 */
      62             : #else
      63             :             *pcoefs16++ = round_fx_o( L_shl_o( *pcoefs++, 16 - k, &Overflow ), &Overflow ); /* Q12 */
      64             : #endif
      65     5034776 :             move16();
      66             :         }
      67             :     }
      68             : 
      69        8193 :     return;
      70             : }

Generated by: LCOV version 1.14