Commit 8b2772da authored by norvell's avatar norvell
Browse files

Merge branch 'main' into Ericsson/ci-split-self-test-into-separate-jobs

Merge with main
parents 40eb9a56 c85daa3a
Loading
Loading
Loading
Loading
Loading
+37 −3
Original line number Diff line number Diff line
@@ -169,22 +169,36 @@ void ivas_spar_covar_smooth_enc_close(

static void ivas_compute_smooth_cov(
    ivas_cov_smooth_state_t *hCovState,
#ifndef SBA_SPAR_HARM
    ivas_cov_smooth_in_buf_t *pIn_buf,
#endif
    ivas_filterbank_t *pFb,
    float *pCov_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
    float *pPrior_cov_buf[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
    const float fac,
    const int16_t start_band,
    const int16_t end_band )
    const int16_t end_band
#ifdef SBA_SPAR_HARM
    ,
    const int16_t num_ch,
    const int16_t transient_det
#endif
)
{
    int16_t i, j, k;
    int16_t prev_idx = hCovState->prior_bank_idx;
#ifndef SBA_SPAR_HARM
    int16_t num_ch = pIn_buf->num_ch;
#endif
    float factor = 0;

    assert( end_band <= pFb->filterbank_num_bands );

#ifdef SBA_SPAR_HARM
    if ( prev_idx == -1 || transient_det == 1 )
#else
    if ( prev_idx == -1 || pIn_buf->reset_cov == 1 )
#endif
    {
        for ( i = 0; i < num_ch; i++ )
        {
@@ -229,22 +243,42 @@ static void ivas_compute_smooth_cov(

void ivas_cov_smooth_process(
    ivas_cov_smooth_state_t *hCovState, /* i/o: Covariance state handle */
#ifdef SBA_SPAR_HARM
    float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
#else
    ivas_cov_smooth_in_buf_t *pIn_buf,
#endif
    ivas_filterbank_t *pFb, /* i/o: FB handle               */
    const int16_t start_band,
    const int16_t end_band )
    const int16_t end_band
#ifdef SBA_SPAR_HARM
    ,
    const int16_t num_ch,
    const int16_t transient_det
#endif
)
{
    int16_t i, j;
#ifndef SBA_SPAR_HARM
    int16_t num_ch = pIn_buf->num_ch;
#endif
    int16_t num_bands = end_band - start_band;

    ivas_compute_smooth_cov( hCovState, pIn_buf, pFb, pIn_buf->cov_real, hCovState->pPrior_cov_real, 1e-20f, start_band, end_band );
#ifdef SBA_SPAR_HARM
    ivas_compute_smooth_cov( hCovState, pFb, cov_real, hCovState->pPrior_cov_real, 1e-20f, start_band, end_band, num_ch, transient_det );
#else
    ivas_compute_smooth_cov( hCovState, pFb, pIn_buf->cov_real, hCovState->pPrior_cov_real, 1e-20f, start_band, end_band, num_ch, transient_det );
#endif

    for ( i = 0; i < num_ch; i++ )
    {
        for ( j = 0; j < num_ch; j++ )
        {
#ifdef SBA_SPAR_HARM
            mvr2r( &cov_real[i][j][start_band], &hCovState->pPrior_cov_real[i][j][start_band], num_bands );
#else
            mvr2r( &pIn_buf->cov_real[i][j][start_band], &hCovState->pPrior_cov_real[i][j][start_band], num_bands );
#endif
        }
    }

+33 −1
Original line number Diff line number Diff line
@@ -3910,9 +3910,19 @@ void ivas_spar_md_enc_close(
ivas_error ivas_spar_md_enc_process(
    ivas_spar_md_enc_state_t *hMdEnc,                           /* i/o: SPAR MD encoder handle                  */
    const ENCODER_CONFIG_HANDLE hEncoderConfig,                 /* i  : configuration structure                 */
#ifdef SBA_SPAR_HARM
    float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
    float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
#else
    ivas_spar_md_enc_in_buf_t *pIn_buf,
#endif
    BSTR_ENC_HANDLE hMetaData,                                  /* i/o: MetaData handle                         */
#ifdef SBA_SPAR_HARM
    int16_t dtx_vad,
    const int16_t nchan_inp,
#else
    const int16_t dtx_silence_mode,
#endif
    const int16_t sba_order                                     /* i  : Ambisonic (SBA) order                   */
);

@@ -4048,12 +4058,25 @@ void ivas_spar_covar_enc_close(

void ivas_enc_cov_handler_process( 
    ivas_enc_cov_handler_state_t *hCovEnc,                      /* i/o: SPAR Covar. encoder handle              */
#ifdef SBA_SPAR_HARM
    float **ppIn_FR_real,
    float **ppIn_FR_imag,
    float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
    float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
#else
    ivas_enc_cov_handler_in_buf_t *pIn_buf, 
    float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
    float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
#endif
    ivas_filterbank_t *pFb,                                     /* i/o: FB handle                               */
    const int16_t start_band,
    const int16_t end_band );
    const int16_t end_band 
#ifdef SBA_SPAR_HARM
   ,const int16_t nchan_inp,
    const int16_t dtx_vad,
    const int16_t transient_det
#endif
);

ivas_error ivas_spar_covar_smooth_enc_open( 
    ivas_cov_smooth_state_t **hCovState,                        /* i/o: SPAR Covar. smoothing handle            */
@@ -4069,10 +4092,19 @@ void ivas_spar_covar_smooth_enc_close(

void ivas_cov_smooth_process( 
    ivas_cov_smooth_state_t *hCovState,                         /* i/o: Covariance state handle                 */
#ifdef SBA_SPAR_HARM
    float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
#else
    ivas_cov_smooth_in_buf_t *pIn_buf, 
#endif
    ivas_filterbank_t *pFb,                                     /* i/o: FB handle                               */
    const int16_t start_band,
    const int16_t end_band
#ifdef SBA_SPAR_HARM
    ,
    const int16_t num_ch,
    const int16_t transient_det
#endif
);

/* Transient detector module */
+25 −24
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@
 * Static functions declaration
 *------------------------------------------------------------------------------------------*/


static void ivas_get_pred_coeffs( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float ppPred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], float ppDM_Fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], const int16_t in_chans, const int16_t start_band, const int16_t end_band, const int16_t active_w, const int16_t dtx_vad, const int16_t from_dirac );

static void ivas_reorder_array( float in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS], const int16_t in_chans, const int16_t order[IVAS_SPAR_MAX_CH], float ***mixer_mat, const int16_t start_band, const int16_t end_band );
@@ -448,7 +449,7 @@ int16_t ivas_get_sba_num_TCs(
 *-----------------------------------------------------------------------------------------*/

static void ivas_get_pred_coeffs(
    float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
    float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
    float ppPred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS],
    float ppDM_Fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS],
    const int16_t in_chans,
@@ -473,7 +474,7 @@ static void ivas_get_pred_coeffs(
        set_zero( pPred_temp, IVAS_MAX_NUM_BANDS );
        for ( k = start_band; k < end_band; k++ )
        {
            div_factor[k] = max( 1e-20f, pppCov_mat_re[0][0][k] );
            div_factor[k] = max( 1e-20f, cov_real[0][0][k] );
            div_factor[k] = 1 / div_factor[k];
        }

@@ -481,7 +482,7 @@ static void ivas_get_pred_coeffs(
        {
            for ( k = start_band; k < end_band; k++ )
            {
                ppPred_coeffs_re[i][k] = pppCov_mat_re[i + 1][0][k] * div_factor[k];
                ppPred_coeffs_re[i][k] = cov_real[i + 1][0][k] * div_factor[k];

                IVAS_CALCULATE_SQ_ABS_N( ppPred_coeffs_re[i][k], abs_value );

@@ -519,7 +520,7 @@ static void ivas_get_pred_coeffs(
        {
            for ( k = start_band; k < end_band; k++ )
            {
                IVAS_CALCULATE_SQ_ABS_N( pppCov_mat_re[i][0][k], abs_value );
                IVAS_CALCULATE_SQ_ABS_N( cov_real[i][0][k], abs_value );
                dm_alpha[k] += abs_value;
            }
        }
@@ -535,7 +536,7 @@ static void ivas_get_pred_coeffs(
        {
            for ( k = start_band; k < end_band; k++ )
            {
                dm_v_re[i][k] = pppCov_mat_re[i + 1][0][k] * div_factor[k];
                dm_v_re[i][k] = cov_real[i + 1][0][k] * div_factor[k];
            }
        }

@@ -558,7 +559,7 @@ static void ivas_get_pred_coeffs(
                {
                    float re;

                    IVAS_RMULT_FLOAT( pppCov_mat_re[j + 1][k][b], dm_v_re[k - 1][b], re );
                    IVAS_RMULT_FLOAT( cov_real[j + 1][k][b], dm_v_re[k - 1][b], re );
                    real[j] += re;
                }
            }
@@ -570,7 +571,7 @@ static void ivas_get_pred_coeffs(
                dm_beta_re += re;
            }

            dm_w = pppCov_mat_re[0][0][b];
            dm_w = cov_real[0][0][b];
            den_f = max( dm_w, 1e-20f );
            passive_g = dm_alpha[b] / den_f;

@@ -581,7 +582,7 @@ static void ivas_get_pred_coeffs(

                for ( k = 1; k < in_chans; k++ )
                {
                    dm_y += pppCov_mat_re[k][k][b];
                    dm_y += cov_real[k][k][b];
                }
                den_f = max( dm_y, 1e-20f );
                den_f = max( den_f, w_norm_fac * dm_w );
@@ -634,7 +635,7 @@ static void ivas_get_pred_coeffs(
 *-----------------------------------------------------------------------------------------*/

static void ivas_get_Wscaling_factor(
    float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
    float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
    float pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS],
    float ***mixer_mat,
    const int16_t start_band,
@@ -667,9 +668,9 @@ static void ivas_get_Wscaling_factor(
        {
            float Gw_sq, g_sq = 0;

            ivas_calc_post_pred_per_band( pppCov_mat_re, mixer_mat, num_ch, pNum_dmx[b * bands_bw], b, postpred_cov_re );
            ivas_calc_post_pred_per_band( cov_real, mixer_mat, num_ch, pNum_dmx[b * bands_bw], b, postpred_cov_re );

            Gw_sq = pppCov_mat_re[0][0][b] / max( postpred_cov_re[0][0], IVAS_FLT_EPS );
            Gw_sq = cov_real[0][0][b] / max( postpred_cov_re[0][0], IVAS_FLT_EPS );

            for ( ch = 0; ch < num_ch - 1; ch++ )
            {
@@ -861,7 +862,7 @@ static void ivas_reorder_array(
 *-----------------------------------------------------------------------------------------*/

static void ivas_calc_post_pred_per_band(
    float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
    float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
    float ***mixer_mat,
    const int16_t num_ch,
    const int16_t num_dmx,
@@ -898,7 +899,7 @@ static void ivas_calc_post_pred_per_band(
            temp_mat[i][j] = 0;
            for ( k = 0; k < num_ch; k++ )
            {
                IVAS_RMULT_FLOAT( pppCov_mat_re[i][k][band_idx], dmx_mat_conj[k][j], tmp_re );
                IVAS_RMULT_FLOAT( cov_real[i][k][band_idx], dmx_mat_conj[k][j], tmp_re );
                temp_mat[i][j] += tmp_re;
            }
        }
@@ -1239,7 +1240,7 @@ static void ivas_calc_c_coeffs_per_band(

void ivas_calc_c_p_coeffs(
    ivas_spar_md_t *pSparMd,
    float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
    float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
    const int16_t i_ts,
    float ***mixer_mat,
    const int16_t num_ch,
@@ -1254,7 +1255,8 @@ void ivas_calc_c_p_coeffs(

    if ( num_dmx != num_ch )
    {
        ivas_calc_post_pred_per_band( pppCov_mat_re, mixer_mat, num_ch, num_dmx, band_idx, postpred_cov_re );
        ivas_calc_post_pred_per_band( cov_real, mixer_mat, num_ch, num_dmx, band_idx, postpred_cov_re );

        if ( num_dmx != 1 )
        {
            ivas_calc_c_coeffs_per_band( pSparMd, i_ts, postpred_cov_re, num_ch, num_dmx, band_idx, dtx_vad );
@@ -1524,7 +1526,7 @@ static int16_t ivas_is_mat_inv(
 *-----------------------------------------------------------------------------------------*/

void ivas_compute_spar_params(
    float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
    float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH],
    float dm_fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS],
    const int16_t i_ts,
    float ***mixer_mat,
@@ -1542,7 +1544,7 @@ void ivas_compute_spar_params(
    float pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS];
    int16_t b, i, ndm;

    ivas_get_pred_coeffs( pppCov_mat_re, pred_coeffs_re, dm_fv_re, num_ch, start_band, end_band, active_w, dtx_vad, from_dirac );
    ivas_get_pred_coeffs( cov_real, pred_coeffs_re, dm_fv_re, num_ch, start_band, end_band, active_w, dtx_vad, from_dirac );

#ifdef SPAR_HOA_DBG
    /*fprintf(stderr, "\n\n Prediction Coefficients:\n");
@@ -1573,7 +1575,7 @@ void ivas_compute_spar_params(
    fprintf(stderr, "\n\n");*/
#endif

    ivas_get_Wscaling_factor( pppCov_mat_re, pred_coeffs_re, mixer_mat, start_band, end_band, dtx_vad, num_ch,
    ivas_get_Wscaling_factor( cov_real, pred_coeffs_re, mixer_mat, start_band, end_band, dtx_vad, num_ch,
                              hSparCfg->num_dmx_chans_per_band, bands_bw, active_w, pWscale );

    for ( b = start_band; b < end_band; b++ )
@@ -1596,7 +1598,7 @@ void ivas_compute_spar_params(

        if ( ndm != num_ch )
        {
            ivas_calc_c_p_coeffs( hSparMd, pppCov_mat_re, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1, 0 );
            ivas_calc_c_p_coeffs( hSparMd, cov_real, i_ts, mixer_mat, num_ch, ndm, b, dtx_vad, 1, 0 );

#ifdef SPAR_HOA_DBG
            /* if (b == 0) */
@@ -2137,8 +2139,8 @@ void ivas_spar_set_bitrate_config(

    for ( i = 0; i < pSpar_md_cfg->nchan_transport; i++ )
    {
        total_bits += (int16_t) ( ivas_spar_br_table_consts[table_idx].evs_brs[i][0] / FRAMES_PER_SEC );
        max_bits += (int16_t) ( ivas_spar_br_table_consts[table_idx].evs_brs[i][1] / FRAMES_PER_SEC );
        total_bits += (int16_t) ( ivas_spar_br_table_consts[table_idx].core_brs[i][0] / FRAMES_PER_SEC );
        max_bits += (int16_t) ( ivas_spar_br_table_consts[table_idx].core_brs[i][1] / FRAMES_PER_SEC );
    }
    pSpar_md_cfg->tgt_bits_per_blk = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC ) - IVAS_FORMAT_SIGNALING_NBITS_SBA - SBA_PLANAR_BITS - SBA_ORDER_BITS - length - total_bits;

@@ -2163,7 +2165,6 @@ void ivas_spar_set_bitrate_config(
 * Set SPAR bitrate distribution
 *-----------------------------------------------------------------------------------------*/

// this function is not currently used but it is kept for future use
void ivas_spar_bitrate_dist(
    int32_t core_brates_act[],      /* o  : bitrates per core-coder     */
    const int16_t nAvailBits,       /* i  : number of available bits    */
@@ -2183,7 +2184,7 @@ void ivas_spar_bitrate_dist(
    sum_core_act_bits = 0;
    for ( i = 0; i < nchan_transport; i++ )
    {
        core_bits_act[i] = (int16_t) ( ivas_spar_br_table_consts[table_idx].evs_brs[i][0] / FRAMES_PER_SEC );
        core_bits_act[i] = (int16_t) ( ivas_spar_br_table_consts[table_idx].core_brs[i][0] / FRAMES_PER_SEC );

        sum_core_act_bits += core_bits_act[i];
    }
@@ -2209,7 +2210,7 @@ void ivas_spar_bitrate_dist(
    {
        for ( i = 0; i < nchan_transport; i++ )
        {
            core_range_bits[i] = (int16_t) ( ( ivas_spar_br_table_consts[table_idx].evs_brs[i][0] - ivas_spar_br_table_consts[table_idx].evs_brs[i][1] ) / FRAMES_PER_SEC );
            core_range_bits[i] = (int16_t) ( ( ivas_spar_br_table_consts[table_idx].core_brs[i][0] - ivas_spar_br_table_consts[table_idx].evs_brs[i][1] ) / FRAMES_PER_SEC );
        }

        overflow_bits = -residual_bits;
+4 −1
Original line number Diff line number Diff line
@@ -351,6 +351,7 @@ typedef struct ivas_cov_smooth_cfg_t

} ivas_cov_smooth_cfg_t;

#ifndef SBA_SPAR_HARM
typedef struct ivas_cov_smooth_in_buf_t
{
    float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
@@ -358,6 +359,7 @@ typedef struct ivas_cov_smooth_in_buf_t
    int16_t reset_cov;

} ivas_cov_smooth_in_buf_t;
#endif

/* SPAR bitrate constant table structure */
typedef struct ivas_spar_br_table_t
@@ -371,11 +373,12 @@ typedef struct ivas_spar_br_table_t
    ivas_spar_pmx_strings_t dmx_str;
    int16_t active_w;
    int16_t tmode;
    int32_t evs_brs[FOA_CHANNELS][3];
    int32_t core_brs[FOA_CHANNELS][3];
    int16_t q_lvls[MAX_QUANT_STRATS][NUM_MD_Q_COEFS_SET];
    int16_t td_ducking;
    int16_t agc_bits_ch_idx; /* 0-3, Indicates core-coder channel index from which AGC bits have been taken from*/
    int16_t usePlanarCoeff;

} ivas_spar_br_table_t;


+1 −2
Original line number Diff line number Diff line
@@ -149,9 +149,8 @@
#define FIX_I13_TCX_TNS_ISSUE                           /* Issue 13: Fix reported artifacts. Bug in TNS with TCX5 */
#define FIX_TCX10_STEREO_PROC                           /* Issue 11 */
#define CORECODER_BITRATE_SWITCHING                     /* Issue 133: support bitrate switching in core-coder */

#define ISM_BITRATE_SWITCHING                           /* Issue 115: Support for Bitrate Switching in ISM */

#define SBA_SPAR_HARM                                   /* Issue 92: maintenance of the SBA SPAR functions */



Loading