Commit 217a3134 authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'main' into '619-ubsan-type-conversion-changes-value-in-ivas_mdct_core_invq'

# Conflicts:
#   lib_com/options.h
parents 0c5f9f03 9e6507fb
Loading
Loading
Loading
Loading
Loading
+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++ )
+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()
+8 −2
Original line number Diff line number Diff line
@@ -4525,8 +4525,11 @@ void ivas_calc_c_p_coeffs(
    const int16_t num_dmx,
    const int16_t band_idx,
    const int16_t dtx_vad,
    const int16_t compute_p_flag,
    const int16_t compute_p_flag
#ifndef FIX_280_PLANAR_CP
    ,
    const int16_t planarCP 
#endif
);

void ivas_get_spar_md_from_dirac(
@@ -4995,8 +4998,11 @@ void ivas_copy_band_coeffs_idx_to_arr(
    const int16_t nB, 
    int16_t *pSymbol_re, 
    ivas_cell_dim_t *pCell_dims, 
    const ivas_coeffs_type_t coeff_type,
    const ivas_coeffs_type_t coeff_type
#ifndef FIX_280_PLANAR_CP
    ,
    const int16_t planarCP
#endif
);

void ivas_clear_band_coeffs( 
+4 −0
Original line number Diff line number Diff line
@@ -224,8 +224,12 @@ int16_t ivas_sba_get_nchan_metadata(
    {
        if ( ivas_total_brate >= IVAS_512k )
        {
#ifndef COVARIANCE_MEMORY_OPT
            nb_channels = ( SBA_HOA2_ORDER + 1 ) * ( SBA_HOA2_ORDER + 1 );
            nb_channels += 2;
#else
            nb_channels = IVAS_SPAR_MAX_CH;
#endif
            nb_channels = min( nb_channels, ( sba_order + 1 ) * ( sba_order + 1 ) );
        }
        else
+18 −2
Original line number Diff line number Diff line
@@ -802,6 +802,7 @@ void ivas_create_fullr_dmx_mat(
    {
        ivas_reorder_array( down_mix_mat1_re, in_chans, order, mixer_mat, start_band, end_band );
    }
#ifndef CODE_CLEAN_UP_DIRAC
    else
    {
        /* Custom 4x4 mult for WYiX case */
@@ -823,6 +824,7 @@ void ivas_create_fullr_dmx_mat(
            }
        }
    }
#endif

    return;
}
@@ -1253,10 +1255,16 @@ void ivas_calc_c_p_coeffs(
    const int16_t num_dmx,
    const int16_t band_idx,
    const int16_t dtx_vad,
    const int16_t compute_p_flag,
    const int16_t planarCP )
    const int16_t compute_p_flag
#ifndef FIX_280_PLANAR_CP
    ,
    const int16_t planarCP
#endif
)
{
#ifndef FIX_280_PLANAR_CP
    int16_t i, j;
#endif
    float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];

    if ( num_dmx != num_ch )
@@ -1268,6 +1276,7 @@ void ivas_calc_c_p_coeffs(
            ivas_calc_c_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, num_dmx, band_idx, dtx_vad );
        }

#ifndef FIX_280_PLANAR_CP
        if ( planarCP )
        {
            for ( i = 0; i < num_ch - num_dmx; i++ )
@@ -1281,12 +1290,14 @@ void ivas_calc_c_p_coeffs(
                }
            }
        }
#endif

        if ( compute_p_flag == 1 )
        {
            ivas_calc_p_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, dtx_vad, num_dmx, band_idx );
        }

#ifndef FIX_280_PLANAR_CP
        if ( planarCP )
        {
            for ( i = num_dmx; i < num_ch; i++ )
@@ -1297,6 +1308,7 @@ void ivas_calc_c_p_coeffs(
                }
            }
        }
#endif
    }

    return;
@@ -1611,7 +1623,11 @@ void ivas_compute_spar_params(

        if ( ndm != num_ch )
        {
#ifndef FIX_280_PLANAR_CP
            ivas_calc_c_p_coeffs( hSparMd, cov_real, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1, 0 );
#else
            ivas_calc_c_p_coeffs( hSparMd, cov_real, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1 );
#endif

#ifdef SPAR_HOA_DBG
            /* if (b == 0) */
Loading