Commit f1d1b014 authored by kinuthia's avatar kinuthia
Browse files

Merge branch 'main' into 612-ubsan-left-shift-of-negative-values-in-1st-stage-of-msvq

parents 2a60a6d6 b16321be
Loading
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -44,6 +44,9 @@
#include "prot.h"
#include "rom_com.h"
#include "wmc_auto.h"
#ifdef FIX_594_STL_INCLUDE
#include "stl.h"
#endif
#ifdef DEBUGGING
#include "assert.h"
#endif
@@ -92,8 +95,12 @@ float env_stability(
#ifdef BASOP_NOGLOB
        Overflow = 0;
        env_delta = shl_o( *mem_env_delta, 1, &Overflow );
#else
#ifdef FIX_595_SHL_NOGLOB
        env_delta = shl( *mem_env_delta, 1 );
#else
        env_delta = shl_o( *mem_env_delta, 1 );
#endif
#endif
    }
    else
+4 −0
Original line number Diff line number Diff line
@@ -229,7 +229,11 @@ void ifft_rel(
     *-----------------------------------------------------------------*/

    idx = fft256_read_indexes;
#ifdef FIX_622_SILENCE_USAN_WARNING
    xi0 = &temp[0] - 1;
#else
    xi0 = temp - 1;
#endif
    if ( n == 128 )
    {
        for ( i = 0; i < n; i++ )
+5 −0
Original line number Diff line number Diff line
@@ -887,7 +887,12 @@ enum fea_names
#define MDCT_ST_PLC_FADEOUT_DELAY_4_LSP_FADE    3

typedef enum {
#ifdef FIX_619_ADD_UNDEF_VAL_FOR_CONCEALMENT_MODE
    NOISE_GEN_MODE_UNDEF = -1,
    EQUAL_CORES = 0,
#else
    EQUAL_CORES,
#endif
    TCX10_IN_0_TCX20_IN_1,
    TCX20_IN_0_TCX10_IN_1,
} TONALMDCTCONC_NOISE_GEN_MODE;
+87 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
#include "prot.h"

#define BAND_SMOOTH_REST_START_IDX ( 2 )
#ifndef CODE_CLEAN_UP_DIRAC
/*-----------------------------------------------------------------------------------------*
 * Function ivas_set_up_cov_smoothing()
 *
@@ -138,7 +139,93 @@ static void ivas_set_up_cov_smoothing(

    return;
}
#else

/*-----------------------------------------------------------------------------------------*
 * Function ivas_calculate_update_factor()
 *
 * To calculate the update factor
 *-----------------------------------------------------------------------------------------*/

static float ivas_calculate_update_factor( float *p_bin_to_band, int16_t active_bins )
{
    float update_factor_temp = 0.0f;
    int16_t k;
    for ( k = 0; k < active_bins; k++ )
    {
        update_factor_temp += p_bin_to_band[k];
    }
    return update_factor_temp;
}

/*-----------------------------------------------------------------------------------------*
 * Function ivas_calculate_smoothning_factor()
 *
 * To calculate the Smoothning factor
 *-----------------------------------------------------------------------------------------*/

static void ivas_calculate_smoothning_factor( float *Smoothing_factor, float update_factor, const int16_t min_pool_size, const float max_update_rate, const COV_SMOOTHING_TYPE smooth_mode, const int32_t ivas_total_brate, int16_t j )
{
    float smooth_fact;
    *Smoothing_factor = update_factor / min_pool_size;
    if ( smooth_mode != COV_SMOOTH_MC )
    {
        if ( ivas_total_brate < IVAS_24k4 )
        {
            smooth_fact = 0.5f;
        }
        else
        {
            smooth_fact = 0.75f;
        }
        *Smoothing_factor *= ( j + 1 ) * smooth_fact;
    }
    if ( *Smoothing_factor > max_update_rate )
    {
        *Smoothing_factor = max_update_rate;
    }
}

/*-----------------------------------------------------------------------------------------*
 * Function ivas_set_up_cov_smoothing()
 *
 * Setup for covariance smoothing
 *-----------------------------------------------------------------------------------------*/

static void ivas_set_up_cov_smoothing(
    ivas_cov_smooth_state_t *hCovState,
    ivas_filterbank_t *pFb,
    const float max_update_rate,
    const int16_t min_pool_size,
    const COV_SMOOTHING_TYPE smooth_mode, /* i  : flag multichannel vs SPAR       */
    const int32_t ivas_total_brate )
{
    int16_t j;
    float update_factor;
    if ( smooth_mode == COV_SMOOTH_MC )
    {
        for ( j = 0; j < pFb->filterbank_num_bands; j++ )
        {
            int16_t active_bins = pFb->fb_bin_to_band.pFb_active_bins_per_band[j];
            update_factor = ivas_calculate_update_factor( pFb->fb_bin_to_band.pFb_bin_to_band[j], active_bins );
            ivas_calculate_smoothning_factor( &hCovState->pSmoothing_factor[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j );
        }
    }
    else
    {
        for ( j = 0; j < pFb->filterbank_num_bands; j++ )
        {
            float *p_bin_to_band = pFb->fb_bin_to_band.pp_short_stride_bin_to_band[j];
            int16_t active_bins = pFb->fb_bin_to_band.p_short_stride_num_bins_per_band[j];
            update_factor = ivas_calculate_update_factor( p_bin_to_band, active_bins );
            ivas_calculate_smoothning_factor( &hCovState->pSmoothing_factor[j], update_factor, min_pool_size, max_update_rate, smooth_mode, ivas_total_brate, j );
        }
    }

    hCovState->prior_bank_idx = -1;
}

#endif

/*-------------------------------------------------------------------------
 * ivas_spar_covar_smooth_enc_open()
+16 −0
Original line number Diff line number Diff line
@@ -111,12 +111,20 @@ ivas_error ivas_dirac_config(
        if ( ( (Encoder_Struct *) st_ivas )->hSpar != NULL )
        {
            hFbMdft = ( (Encoder_Struct *) st_ivas )->hSpar->hFbMixer;
#ifdef FIX_613_DIRAC_NULL_PTR_USAN
            dirac_to_spar_md_bands = ( (Encoder_Struct *) st_ivas )->hSpar->dirac_to_spar_md_bands;
#endif
        }
        else
        {
            hFbMdft = NULL;
#ifdef FIX_613_DIRAC_NULL_PTR_USAN
            dirac_to_spar_md_bands = NULL;
#endif
        }
#ifndef FIX_613_DIRAC_NULL_PTR_USAN
        dirac_to_spar_md_bands = ( (Encoder_Struct *) st_ivas )->hSpar->dirac_to_spar_md_bands;
#endif
    }
    else
    {
@@ -131,13 +139,21 @@ ivas_error ivas_dirac_config(
        if ( ( (Decoder_Struct *) st_ivas )->hSpar != NULL )
        {
            hFbMdft = ( (Decoder_Struct *) st_ivas )->hSpar->hFbMixer;
#ifdef FIX_613_DIRAC_NULL_PTR_USAN
            dirac_to_spar_md_bands = ( (Decoder_Struct *) st_ivas )->hSpar->dirac_to_spar_md_bands;
#endif
        }
        else
        {
            hFbMdft = NULL;
#ifdef FIX_613_DIRAC_NULL_PTR_USAN
            dirac_to_spar_md_bands = NULL;
#endif
        }
        ( (Decoder_Struct *) st_ivas )->hDirAC->hFbMdft = hFbMdft;
#ifndef FIX_613_DIRAC_NULL_PTR_USAN
        dirac_to_spar_md_bands = ( (Decoder_Struct *) st_ivas )->hSpar->dirac_to_spar_md_bands;
#endif
    }

    if ( ivas_format == SBA_FORMAT )
Loading