LCOV - code coverage report
Current view: top level - lib_com - ivas_cov_smooth_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main enc/dec/rend @ 3b2f07138c61dcf997bbf4165d0882f794b2995f Lines: 151 156 96.8 %
Date: 2025-05-03 01:55:50 Functions: 7 7 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             : #include <stdint.h>
      34             : #include "options.h"
      35             : #include "cnst.h"
      36             : #include "wmc_auto.h"
      37             : #include "prot_fx.h"
      38             : #include "ivas_prot_fx.h"
      39             : 
      40             : /*-----------------------------------------------------------------------------------------*
      41             :  * Local constants
      42             :  *-----------------------------------------------------------------------------------------*/
      43             : 
      44             : #define BAND_SMOOTH_REST_START_IDX ( 2 )
      45             : #define ONEeN20_Q97                0x5E728433 // 1e-20 in Q97  1.584.563.251
      46             : 
      47             : 
      48             : /*-----------------------------------------------------------------------------------------*
      49             :  * Function ivas_calculate_update_factor_fx()
      50             :  *
      51             :  * To calculate the update factor
      52             :  *-----------------------------------------------------------------------------------------*/
      53             : 
      54       38388 : static Word32 ivas_calculate_update_factor_fx( // o: Q22
      55             :     Word32 *p_bin_to_band,                     // i: Q22
      56             :     Word16 active_bins )
      57             : {
      58       38388 :     Word32 update_factor_temp = 0;
      59       38388 :     move32();
      60             :     Word16 k;
      61             : 
      62      860560 :     FOR( k = 0; k < active_bins; k++ )
      63             :     {
      64      822172 :         update_factor_temp = L_add( update_factor_temp, p_bin_to_band[k] ); // Q22
      65             :     }
      66             : 
      67       38388 :     return update_factor_temp; // Q22
      68             : }
      69             : 
      70             : 
      71             : /*-----------------------------------------------------------------------------------------*
      72             :  * Function ivas_calculate_smoothning_factor_fx()
      73             :  *
      74             :  * To calculate the Smoothning factor
      75             :  *-----------------------------------------------------------------------------------------*/
      76             : 
      77       38388 : static void ivas_calculate_smoothning_factor_fx(
      78             :     Word32 *Smoothing_factor, // o: Q31
      79             :     Word32 update_factor,     // i: Q22
      80             :     const Word16 min_pool_size,
      81             :     const Word32 max_update_rate,
      82             :     const COV_SMOOTHING_TYPE smooth_mode,
      83             :     const Word32 ivas_total_brate,
      84             :     Word16 j )
      85             : {
      86       38388 :     Word32 smooth_fact, L_tmp = 0;
      87       38388 :     Word16 tmp, exp_diff = 0;
      88       38388 :     move32();
      89       38388 :     move16();
      90             : 
      91       38388 :     tmp = BASOP_Util_Divide3232_Scale( update_factor, L_shl( L_deposit_l( min_pool_size ), Q22 ), &exp_diff ); // Q(31 - exp_diff)
      92       38388 :     *Smoothing_factor = L_shl_sat( L_deposit_h( tmp ), exp_diff );                                             // Q31
      93       38388 :     move32();
      94             : 
      95             : 
      96       38388 :     IF( NE_32( smooth_mode, COV_SMOOTH_MC ) )
      97             :     {
      98       37236 :         IF( LT_32( ivas_total_brate, IVAS_24k4 ) )
      99             :         {
     100        7272 :             smooth_fact = (Word32) ( ONE_IN_Q30 ); // 0.5 in Q31
     101        7272 :             move32();
     102             :         }
     103             :         ELSE
     104             :         {
     105       29964 :             smooth_fact = (Word32) ( 1610612735 ); // 0.75 in Q31
     106       29964 :             move32();
     107             :         }
     108             : 
     109       37236 :         L_tmp = Mpy_32_16_1( smooth_fact, add( j, 1 ) );           // (Q31 , Q0) -> Q16
     110       37236 :         *Smoothing_factor = Mpy_32_32( *Smoothing_factor, L_tmp ); // (Q31, Q16) -> Q16
     111       37236 :         move32();
     112       37236 :         *Smoothing_factor = L_shl_sat( *Smoothing_factor, Q15 ); // Q31
     113       37236 :         move32();
     114             :     }
     115             : 
     116       38388 :     IF( GT_32( *Smoothing_factor, max_update_rate ) ) // Q31
     117             :     {
     118       19972 :         *Smoothing_factor = max_update_rate; // Q31
     119       19972 :         move32();
     120             :     }
     121             : 
     122       38388 :     return;
     123             : }
     124             : 
     125             : 
     126             : /*-----------------------------------------------------------------------------------------*
     127             :  * Function ivas_set_up_cov_smoothing_fx()
     128             :  *
     129             :  * Setup for covariance smoothing
     130             :  *-----------------------------------------------------------------------------------------*/
     131             : 
     132        3212 : static void ivas_set_up_cov_smoothing_fx(
     133             :     ivas_cov_smooth_state_t *hCovState,
     134             :     ivas_filterbank_t *pFb,
     135             :     const Word32 max_update_rate, // i: Q31
     136             :     const Word16 min_pool_size,
     137             :     const COV_SMOOTHING_TYPE smooth_mode, /* i  : flag multichannel vs SPAR       */
     138             :     const Word32 ivas_total_brate )
     139             : {
     140             :     Word16 j;
     141             :     Word32 update_factor;
     142             : 
     143        3212 :     IF( EQ_32( smooth_mode, COV_SMOOTH_MC ) )
     144             :     {
     145        1248 :         FOR( j = 0; j < pFb->filterbank_num_bands; j++ )
     146             :         {
     147        1152 :             Word16 active_bins = pFb->fb_bin_to_band.pFb_active_bins_per_band[j];
     148        1152 :             move16();
     149        1152 :             update_factor = ivas_calculate_update_factor_fx( pFb->fb_bin_to_band.pFb_bin_to_band_fx[j], active_bins ); // Q22
     150        1152 :             ivas_calculate_smoothning_factor_fx( &hCovState->pSmoothing_factor_fx[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j );
     151             :         }
     152             :     }
     153             :     ELSE
     154             :     {
     155       40352 :         FOR( j = 0; j < pFb->filterbank_num_bands; j++ )
     156             :         {
     157       37236 :             Word32 *p_bin_to_band = pFb->fb_bin_to_band.pp_short_stride_bin_to_band_fx[j]; // Q22
     158       37236 :             Word16 active_bins = pFb->fb_bin_to_band.p_short_stride_num_bins_per_band[j];
     159       37236 :             move16();
     160       37236 :             update_factor = ivas_calculate_update_factor_fx( p_bin_to_band, active_bins ); // Q22
     161       37236 :             ivas_calculate_smoothning_factor_fx( &hCovState->pSmoothing_factor_fx[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j );
     162             :         }
     163             :     }
     164             : 
     165        3212 :     hCovState->prior_bank_idx = -1;
     166        3212 :     move16();
     167             : 
     168        3212 :     return;
     169             : }
     170             : 
     171             : 
     172             : /*-------------------------------------------------------------------------
     173             :  * ivas_spar_covar_smooth_enc_open_fx()
     174             :  *
     175             :  * Allocate and initialize SPAR Covar. smoothing handle
     176             :  *------------------------------------------------------------------------*/
     177             : 
     178        3212 : ivas_error ivas_spar_covar_smooth_enc_open_fx(
     179             :     ivas_cov_smooth_state_t **hCovState_out,     /* i/o: SPAR Covar. smoothing handle       */
     180             :     const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i  : SPAR config. handle                */
     181             :     ivas_filterbank_t *pFb,                      /* i/o: FB handle                          */
     182             :     const Word16 nchan_inp,                      /* i  : number of input channels           */
     183             :     const COV_SMOOTHING_TYPE smooth_mode,        /* i  : Smooth covariance for SPAR or MC   */
     184             :     const Word32 ivas_total_brate                /* i  : IVAS total bitrate                 */
     185             : )
     186             : {
     187             :     ivas_cov_smooth_state_t *hCovState;
     188             :     Word16 i, j;
     189             : 
     190        3212 :     IF( ( hCovState = (ivas_cov_smooth_state_t *) malloc( sizeof( ivas_cov_smooth_state_t ) ) ) == NULL )
     191             :     {
     192           0 :         return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder" );
     193             :     }
     194             : 
     195        3212 :     IF( ( hCovState->pSmoothing_factor_fx = (Word32 *) malloc( sizeof( Word32 ) * cov_smooth_cfg->max_bands ) ) == NULL )
     196             :     {
     197           0 :         return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder" );
     198             :     }
     199             : 
     200       18314 :     FOR( i = 0; i < nchan_inp; i++ )
     201             :     {
     202       96852 :         FOR( j = 0; j < nchan_inp; j++ )
     203             :         {
     204       81750 :             IF( ( hCovState->pPrior_cov_real_fx[i][j] = (Word32 *) malloc( sizeof( Word32 ) * cov_smooth_cfg->max_bands ) ) == NULL )
     205             :             {
     206           0 :                 return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder Fixed" );
     207             :             }
     208       81750 :             set_zero_fx( hCovState->pPrior_cov_real_fx[i][j], cov_smooth_cfg->max_bands );
     209       81750 :             IF( ( hCovState->q_cov_real_per_band[i][j] = (Word16 *) malloc( sizeof( Word16 ) * cov_smooth_cfg->max_bands ) ) == NULL )
     210             :             {
     211           0 :                 return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder Fixed" );
     212             :             }
     213       81750 :             set16_fx( hCovState->q_cov_real_per_band[i][j], Q31, cov_smooth_cfg->max_bands );
     214       81750 :             IF( ( hCovState->q_prior_cov_real_per_band[i][j] = (Word16 *) malloc( sizeof( Word16 ) * cov_smooth_cfg->max_bands ) ) == NULL )
     215             :             {
     216           0 :                 return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV encoder Fixed" );
     217             :             }
     218       81750 :             set16_fx( hCovState->q_prior_cov_real_per_band[i][j], Q31, cov_smooth_cfg->max_bands );
     219             :         }
     220             :     }
     221             : 
     222        3212 :     ivas_set_up_cov_smoothing_fx( hCovState, pFb, cov_smooth_cfg->max_update_rate_fx, cov_smooth_cfg->min_pool_size, smooth_mode, ivas_total_brate );
     223             : 
     224        3212 :     *hCovState_out = hCovState;
     225             : 
     226        3212 :     return IVAS_ERR_OK;
     227             : }
     228             : 
     229             : /*-------------------------------------------------------------------------
     230             :  * ivas_spar_covar_smooth_enc_close_fx()
     231             :  *
     232             :  * Deallocate SPAR Covar. smoothing handle
     233             :  *------------------------------------------------------------------------*/
     234             : 
     235        3212 : void ivas_spar_covar_smooth_enc_close_fx(
     236             :     ivas_cov_smooth_state_t **hCovState_out, /* i/o: SPAR Covar. smoothing handle   */
     237             :     const Word16 nchan_inp                   /* i  : number of input channels       */
     238             : )
     239             : {
     240             :     ivas_cov_smooth_state_t *hCovState;
     241             :     Word16 i, j;
     242             : 
     243        3212 :     hCovState = *hCovState_out;
     244             : 
     245        3212 :     IF( hCovState != NULL )
     246             :     {
     247        3212 :         free( hCovState->pSmoothing_factor_fx );
     248        3212 :         hCovState->pSmoothing_factor_fx = NULL;
     249             : 
     250       18314 :         FOR( i = 0; i < nchan_inp; i++ )
     251             :         {
     252       96852 :             FOR( j = 0; j < nchan_inp; j++ )
     253             :             {
     254       81750 :                 free( hCovState->pPrior_cov_real_fx[i][j] );
     255       81750 :                 hCovState->pPrior_cov_real_fx[i][j] = NULL;
     256       81750 :                 free( hCovState->q_cov_real_per_band[i][j] );
     257       81750 :                 hCovState->q_cov_real_per_band[i][j] = NULL;
     258       81750 :                 free( hCovState->q_prior_cov_real_per_band[i][j] );
     259       81750 :                 hCovState->q_prior_cov_real_per_band[i][j] = NULL;
     260             :             }
     261             :         }
     262             : 
     263        3212 :         free( hCovState );
     264        3212 :         hCovState_out = NULL;
     265             :     }
     266             : 
     267        3212 :     return;
     268             : }
     269             : 
     270             : /*-----------------------------------------------------------------------------------------*
     271             :  * Function ivas_compute_smooth_cov_fx()
     272             :  *
     273             :  * Compute smooth covariance real/imag.
     274             :  *-----------------------------------------------------------------------------------------*/
     275      166225 : static void ivas_compute_smooth_cov_fx(
     276             :     ivas_cov_smooth_state_t *hCovState,
     277             :     ivas_filterbank_t *pFb,
     278             :     Word32 *pCov_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],       // i/o: Q(q_cov[i][j])
     279             :     Word32 *pPrior_cov_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], // i: hCovState->q_cov_real_per_band[i][j][k]
     280             :     const Word32 fac,                                           // i: ONEeN20_Q97 (1e-20 in Q97)
     281             :     const Word16 start_band,
     282             :     const Word16 end_band,
     283             :     const Word16 num_ch,
     284             :     const Word16 transient_det[2],
     285             :     Word16 *q_cov[IVAS_SPAR_MAX_CH] )
     286             : {
     287             :     Word16 i, j, k;
     288      166225 :     Word16 prev_idx = hCovState->prior_bank_idx;
     289      166225 :     Word32 factor = 0, L_tmp0, L_tmp1;
     290             : 
     291      166225 :     const Word16 q_fac = 97;
     292      166225 :     const Word16 fac_e = sub( Q31, q_fac );
     293             : 
     294             :     Word16 cov_buf_e;
     295             : 
     296             :     Word16 sm_b;
     297             :     Word16 non_sm_b_idx;
     298             : 
     299      166225 :     sm_b = BAND_SMOOTH_REST_START_IDX;
     300      166225 :     move16();
     301      166225 :     move16();
     302      166225 :     move32();
     303             : 
     304      166225 :     assert( end_band <= pFb->filterbank_num_bands );
     305      166225 :     test();
     306      166225 :     IF( EQ_16( prev_idx, -1 ) || EQ_16( transient_det[1], 1 ) )
     307             :     {
     308       42390 :         FOR( i = 0; i < num_ch; i++ )
     309             :         {
     310      211698 :             FOR( j = 0; j < num_ch; j++ )
     311             :             {
     312      177143 :                 set16_fx( hCovState->q_cov_real_per_band[i][j], q_cov[i][j], sub( end_band, start_band ) ); // assign q_cov[i][j] to hCovState->q_cov_real_per_band[i][j][k]
     313             :             }
     314             :         }
     315       42390 :         FOR( i = 0; i < num_ch; i++ )
     316             :         {
     317      443379 :             FOR( k = start_band; k < end_band; k++ )
     318             :             {
     319             :                 /* ref: pCov_buf[i][i][k] += ( hCovState->pSmoothing_factor[k] * fac ); */
     320      408824 :                 pCov_buf[i][i][k] = BASOP_Util_Add_Mant32Exp( pCov_buf[i][i][k], sub( Q31, q_cov[i][i] ), Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ), fac_e, &cov_buf_e );
     321      408824 :                 move32();
     322      408824 :                 hCovState->q_cov_real_per_band[i][i][k] = sub( Q31, cov_buf_e );
     323      408824 :                 move16();
     324             :             }
     325             :         }
     326             :     }
     327      158390 :     ELSE IF( EQ_16( transient_det[0], 1 ) )
     328             :     {
     329       10189 :         non_sm_b_idx = s_min( sm_b, end_band );
     330       56858 :         FOR( i = 0; i < num_ch; i++ )
     331             :         {
     332      289058 :             FOR( j = 0; j < num_ch; j++ )
     333             :             {
     334      242389 :                 IF( EQ_16( i, j ) )
     335             :                 {
     336       46669 :                     factor = fac; // Q97
     337       46669 :                     move32();
     338             :                 }
     339             :                 ELSE
     340             :                 {
     341      195720 :                     factor = 0; // Q97
     342      195720 :                     move32();
     343             :                 }
     344             : 
     345      727167 :                 FOR( k = start_band; k < non_sm_b_idx; k++ )
     346             :                 {
     347             :                     /* ref: pCov_buf[i][j][k] = pPrior_cov_buf[i][j][k] + ( hCovState->pSmoothing_factor[k] * ( pCov_buf[i][j][k] - pPrior_cov_buf[i][j][k] + factor ) ); */
     348             :                     /* mod: pCov_buf[i][j][k] = pCov_buf[i][j][k] * hCovState->pSmoothing_factor[k] +
     349             :                                                     pPrior_cov_buf[i][j][k] * (1.0 - hCovState->pSmoothing_factor[k]) +
     350             :                                                         factor * hCovState->pSmoothing_factor[k] ); */
     351      484778 :                     L_tmp0 = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], pCov_buf[i][j][k] );                            // q_tmp0: q_cov[i][j]                                                                                  // (Q31, q_cov[i][j]) -> q_cov[i][j]
     352      484778 :                     L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // q_tmp1: hCovState->q_prior_cov_real_per_band[i][j][k]
     353      484778 :                     L_tmp0 = BASOP_Util_Add_Mant32Exp( L_tmp0, sub( Q31, q_cov[i][j] ), L_tmp1, sub( Q31, hCovState->q_prior_cov_real_per_band[i][j][k] ), &cov_buf_e );
     354      484778 :                     pCov_buf[i][j][k] = BASOP_Util_Add_Mant32Exp( L_tmp0, cov_buf_e, Mpy_32_32( hCovState->pSmoothing_factor_fx[k], factor ), fac_e, &cov_buf_e );
     355      484778 :                     move32();
     356      484778 :                     hCovState->q_cov_real_per_band[i][j][k] = sub( Q31, cov_buf_e ); // Q of pCov_buf[i][j][k]
     357      484778 :                     move16();
     358             :                 }
     359     2642487 :                 FOR( ; k < end_band; k++ )
     360             :                 {
     361     2400098 :                     hCovState->q_cov_real_per_band[i][j][k] = q_cov[i][j];
     362     2400098 :                     move16();
     363             :                 }
     364             :             }
     365             :         }
     366       56858 :         FOR( i = 0; i < num_ch; i++ )
     367             :         {
     368      507711 :             FOR( k = non_sm_b_idx; k < end_band; k++ )
     369             :             {
     370             :                 /* ref: pCov_buf[i][i][k] += ( hCovState->pSmoothing_factor[k] * fac ); */
     371      461042 :                 pCov_buf[i][i][k] = BASOP_Util_Add_Mant32Exp( pCov_buf[i][i][k], sub( Q31, q_cov[i][i] ), Mpy_32_32( hCovState->pSmoothing_factor_fx[k], fac ), fac_e, &cov_buf_e );
     372      461042 :                 move32();
     373      461042 :                 hCovState->q_cov_real_per_band[i][i][k] = sub( Q31, cov_buf_e ); // Q of pCov_buf[i][i][k]
     374      461042 :                 move16();
     375             :             }
     376             :         }
     377             :     }
     378      148201 :     ELSE IF( prev_idx == 0 )
     379             :     {
     380      822461 :         FOR( i = 0; i < num_ch; i++ )
     381             :         {
     382     4221092 :             FOR( j = 0; j < num_ch; j++ )
     383             :             {
     384     3546832 :                 IF( EQ_16( i, j ) )
     385             :                 {
     386      674260 :                     factor = fac; // Q97
     387      674260 :                     move32();
     388             :                 }
     389             :                 ELSE
     390             :                 {
     391     2872572 :                     factor = 0; // Q97
     392     2872572 :                     move32();
     393             :                 }
     394             : 
     395    45713016 :                 FOR( k = start_band; k < end_band; k++ )
     396             :                 {
     397             :                     /* ref: pCov_buf[i][j][k] = pPrior_cov_buf[i][j][k] + ( hCovState->pSmoothing_factor[k] * ( pCov_buf[i][j][k] - pPrior_cov_buf[i][j][k] + factor ) ); */
     398             :                     /* mod: pCov_buf[i][j][k] = pCov_buf[i][j][k] * hCovState->pSmoothing_factor[k] +
     399             :                                                 pPrior_cov_buf[i][j][k] * (1.0 - hCovState->pSmoothing_factor[k]) +
     400             :                                                 factor * hCovState->pSmoothing_factor[k] ); */
     401    42166184 :                     L_tmp0 = Mpy_32_32( hCovState->pSmoothing_factor_fx[k], pCov_buf[i][j][k] );                            // q_tmp0: q_cov[i][j]                                                                                  // (Q31, q_cov[i][j]) -> q_cov[i][j]
     402    42166184 :                     L_tmp1 = Mpy_32_32( L_sub( ONE_IN_Q31, hCovState->pSmoothing_factor_fx[k] ), pPrior_cov_buf[i][j][k] ); // q_tmp1: hCovState->q_prior_cov_real_per_band[i][j][k]
     403    42166184 :                     L_tmp0 = BASOP_Util_Add_Mant32Exp( L_tmp0, sub( Q31, q_cov[i][j] ), L_tmp1, sub( Q31, hCovState->q_prior_cov_real_per_band[i][j][k] ), &cov_buf_e );
     404    42166184 :                     pCov_buf[i][j][k] = BASOP_Util_Add_Mant32Exp( L_tmp0, cov_buf_e, Mpy_32_32( hCovState->pSmoothing_factor_fx[k], factor ), fac_e, &cov_buf_e );
     405    42166184 :                     move32();
     406    42166184 :                     hCovState->q_cov_real_per_band[i][j][k] = sub( Q31, cov_buf_e ); // Q of pCov_buf[i][j][k]
     407    42166184 :                     move16();
     408             :                 }
     409             :             }
     410             :         }
     411             :     }
     412             : 
     413      166225 :     return;
     414             : }
     415             : 
     416             : 
     417             : /*-----------------------------------------------------------------------------------------*
     418             :  * Function ivas_cov_smooth_process_fx()
     419             :  *
     420             :  * Covariance smoothing process
     421             :  *-----------------------------------------------------------------------------------------*/
     422             : 
     423      166225 : void ivas_cov_smooth_process_fx(
     424             :     ivas_cov_smooth_state_t *hCovState,                   /* i/o: Covariance state handle */
     425             :     Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], // Q(hCovState->q_cov_real_per_band[i][j][k])
     426             :     ivas_filterbank_t *pFb,                               /* i/o: FB handle               */
     427             :     const Word16 start_band,
     428             :     const Word16 end_band,
     429             :     const Word16 num_ch,
     430             :     const Word16 transient_det[2],
     431             :     Word16 *q_cov[IVAS_SPAR_MAX_CH] )
     432             : {
     433             :     Word16 i, j, k;
     434      166225 :     Word16 num_bands = sub( end_band, start_band );
     435             : 
     436      166225 :     ivas_compute_smooth_cov_fx( hCovState, pFb, cov_real, hCovState->pPrior_cov_real_fx, ONEeN20_Q97, start_band, end_band, num_ch, transient_det, q_cov );
     437             : 
     438      921709 :     FOR( i = 0; i < num_ch; i++ )
     439             :     {
     440     4721848 :         FOR( j = 0; j < num_ch; j++ )
     441             :         {
     442     3966364 :             Copy32( &cov_real[i][j][start_band], &hCovState->pPrior_cov_real_fx[i][j][start_band], num_bands ); // Q of hCovState->pPrior_cov_real_fx[i][j][start_band + k] will be  hCovState->q_cov_real_per_band[i][j][start_band + k]
     443    51118764 :             FOR( k = 0; k < num_bands; k++ )
     444             :             {
     445    47152400 :                 hCovState->q_prior_cov_real_per_band[i][j][start_band + k] = hCovState->q_cov_real_per_band[i][j][start_band + k];
     446    47152400 :                 move16();
     447             :             }
     448             :         }
     449             :     }
     450             : 
     451      166225 :     hCovState->prior_bank_idx = 0;
     452      166225 :     move16();
     453             : 
     454      166225 :     return;
     455             : }

Generated by: LCOV version 1.14