Commit e36cf300 authored by Brown, Stefanie's avatar Brown, Stefanie
Browse files

Low bitrate SBA changes under LBR_SBA; (planar operation currently disabled)

parent 9815baa2
Loading
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -936,6 +936,9 @@ typedef enum
/* Common SPAR metadata constants */
#define IVAS_ACTIVEW_DM_F_SCALE                 0.5f
#define IVAS_ACTIVEW_DM_F_SCALE_DTX             0.25f
#ifdef LBR_SBA
#define IVAS_ACTIVEW_DM_F_SCALE_VLBR            0.25f
#endif
#define IVAS_SPAR_FOA_DFLT_FREQ_PER_CHAN        24000

#define MAX_QUANT_STRATS                        3
@@ -968,7 +971,11 @@ typedef enum
    DECX_COEFF
} ivas_coeffs_type_t;

#ifdef LBR_SBA
#define IVAS_SPAR_BR_TABLE_LEN                  20
#else
#define IVAS_SPAR_BR_TABLE_LEN                  18
#endif

/* TD decorr */
enum
+86 −3
Original line number Diff line number Diff line
@@ -50,7 +50,12 @@ static void ivas_set_up_cov_smoothing(
    ivas_cov_smooth_state_t *pState,
    ivas_filterbank_t *pFb,
    const float max_update_rate,
    const int16_t min_pool_size )
    const int16_t min_pool_size 
#ifdef LBR_SBA_EXTRA_COV_SMOOTH
    ,
    const int32_t ivas_total_brate
#endif
)
{
    int16_t j, k;

@@ -71,6 +76,44 @@ static void ivas_set_up_cov_smoothing(
        }
    }

#ifdef LBR_SBA_DM_COV_FIX
    for ( j = 0; j < pFb->filterbank_num_bands; j++ )
    {
        float update_factor;
		update_factor = 0.0f;
        float *p_bin_to_band;
		p_bin_to_band = pFb->fb_bin_to_band.pp_short_stride_bin_to_band[j];
        int16_t active_bins;
		active_bins = pFb->fb_bin_to_band.p_short_stride_num_bins_per_band[j];

        for ( k = 0; k < active_bins; k++ )
        {
            update_factor += p_bin_to_band[k];
        }

        pState->pSmoothing_factor[j] = update_factor / min_pool_size;
#ifdef LBR_SBA_EXTRA_COV_SMOOTH
        float smooth_fact;
		if (ivas_total_brate < IVAS_24k4)
		{
            smooth_fact = 0.5f;
		}
        else
        {
            smooth_fact = 0.75;
		}
        pState->pSmoothing_factor[j] *= ( j + 1 ) * smooth_fact;
#else
        pState->pSmoothing_factor[j] *= ( j + 1 ) * 0.75f;
#endif

        if ( pState->pSmoothing_factor[j] > max_update_rate )
        {
            pState->pSmoothing_factor[j] = max_update_rate;
        }
    }
#endif

    pState->prior_bank_idx = -1;
    return;
}
@@ -87,6 +130,10 @@ ivas_error ivas_spar_covar_smooth_enc_open(
    const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i  : SPAR config. handle            */
    ivas_filterbank_t *pFb,                      /* i/o: FB handle                      */
    const int16_t nchan_inp                      /* i  : number of input channels       */
#ifdef LBR_SBA_EXTRA_COV_SMOOTH
    ,
    const int32_t ivas_total_brate               /* i  : IVAS total bitrate             */
#endif
)
{
    ivas_cov_smooth_state_t *hCovState;
@@ -113,9 +160,11 @@ ivas_error ivas_spar_covar_smooth_enc_open(
            set_zero( hCovState->pPrior_cov_real[i][j], cov_smooth_cfg->max_bands );
        }
    }

#ifdef LBR_SBA_EXTRA_COV_SMOOTH
    ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size, ivas_total_brate );
#else
    ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size );

#endif
    *hCovState_out = hCovState;

    return IVAS_ERR_OK;
@@ -180,14 +229,48 @@ static void ivas_compute_smooth_cov(
    int16_t prev_idx = hCovState->prior_bank_idx;
    int16_t num_ch = pIn_buf->num_ch;
    float factor = 0;
#ifdef LBR_SBA_DM_COV_FIX
    int16_t sm_b = 2;
    int16_t non_sm_b_idx;
#endif

    assert( end_band <= pFb->filterbank_num_bands );

    if ( prev_idx == -1 || pIn_buf->reset_cov == 1 )
    {
#ifdef LBR_SBA_DM_COV_FIX
        non_sm_b_idx = start_band;
        if ( prev_idx != -1 )
        {
            non_sm_b_idx = min( sm_b, end_band );
            for ( i = 0; i < num_ch; i++ )
            {
                for ( j = 0; j < num_ch; j++ )
                {
                    if ( i == j )
                    {
                        factor = fac;
                    }
                    else
                    {
                        factor = 0.0f;
                    }

                    for ( k = start_band; k < non_sm_b_idx; k++ )
                    {
                        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 ) );
                    }
                }
            }
        }
#endif
        for ( i = 0; i < num_ch; i++ )
        {
#ifdef LBR_SBA_DM_COV_FIX
            for ( k = non_sm_b_idx; k < end_band; k++ )
#else
            for ( k = start_band; k < end_band; k++ )
#endif
            {
                pCov_buf[i][i][k] += ( hCovState->pSmoothing_factor[k] * fac );
            }
+8 −0
Original line number Diff line number Diff line
@@ -264,10 +264,18 @@ void ivas_dirac_config_bands(
                {
                    band_grouping[reduced_band] = max_band;
                }
#ifdef LBR_SBA
                for ( band = enc_param_start_band + ( DIRAC_MAX_NBANDS - enc_param_start_band ) / 2 - 1, reduced_band = DIRAC_MAX_NBANDS - 1; band >= enc_param_start_band; band--, reduced_band -= step )
                {
                    dirac_to_spar_md_bands[reduced_band] = dirac_to_spar_md_bands[band];
                    dirac_to_spar_md_bands[reduced_band - 1] = dirac_to_spar_md_bands[band];
                }
#else
                for ( band = enc_param_start_band + 1; band < DIRAC_MAX_NBANDS; band++ )
                {
                    dirac_to_spar_md_bands[band] = dirac_to_spar_md_bands[band - 1];
                }
#endif
            }
            else
            {
+23 −0
Original line number Diff line number Diff line
@@ -3892,6 +3892,10 @@ ivas_error ivas_spar_foa_md_enc_process(
    ivas_spar_foa_md_enc_in_buf_t *pIn_buf,
    BSTR_ENC_HANDLE hMetaData,                                  /* i/o: MetaData handle                         */
    const int16_t dtx_silence_mode
#ifdef LBR_SBA
    ,
    const float *prior_mixer[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH]                                  /* i  : prior mixer_matrix     */
#endif
);

void ivas_compute_spar_params(
@@ -3905,6 +3909,9 @@ void ivas_compute_spar_params(
    const int16_t num_ch,
    const int16_t bands_bw,
    const int16_t active_w,
#ifdef LBR_SBA
    const int16_t active_w_vlbr,
#endif
    ivas_spar_foa_md_com_cfg *hSparCfg,
    ivas_spar_md_t *hSparMd,
    float *pWscale,
@@ -3948,6 +3955,11 @@ void ivas_get_spar_md_from_dirac(
    const int16_t order,
    const int16_t dtx_vad,
    float Wscale_d[IVAS_MAX_NUM_BANDS]
#ifdef LBR_SBA
	,
    const uint8_t useLowerRes,
    const int16_t active_w_vlbr
#endif
);

ivas_error ivas_spar_foa_md_dec_open(
@@ -3993,6 +4005,9 @@ void ivas_spar_to_dirac(
    ivas_spar_foa_md_dec_state_t *hMdDec,                       /* i/o: SPAR MD decoder handle                  */
    const int16_t dtx_vad,                                      /* i  : DTX frame flag                          */
    const int16_t num_bands_out                                 /* i  : number of output bands                  */
#ifdef LBR_SBA
			, const int16_t bw									/* i  : band joining factor                     */
#endif
);

void ivas_spar_foa_update_md_hist( 
@@ -4022,6 +4037,10 @@ ivas_error ivas_spar_covar_enc_open(
    ivas_filterbank_t *pFb,                                     /* i/o: FB handle                               */
    const int32_t input_Fs,                                     /* i  : input sampling rate                     */
    const int16_t nchan_inp                                     /* i  : number of input channels                */
#ifdef LBR_SBA_EXTRA_COV_SMOOTH
	,
	const int32_t ivas_total_brate                              /* i  : IVAS total bitrate                      */
#endif
);

void ivas_spar_covar_enc_close( 
@@ -4043,6 +4062,10 @@ ivas_error ivas_spar_covar_smooth_enc_open(
    const ivas_cov_smooth_cfg_t *cov_smooth_cfg,                /* i  : SPAR config. handle                     */
    ivas_filterbank_t *pFb,                                     /* i/o: FB handle                               */
    const int16_t nchan_inp                                     /* i  : number of input channels                */
#ifdef LBR_SBA_EXTRA_COV_SMOOTH
    ,
    const int32_t ivas_total_brate                              /* i  : IVAS total bitrate                      */
#endif
);

void ivas_spar_covar_smooth_enc_close( 
+518 −0

File changed.

Preview size limit exceeded, changes collapsed.

Loading