Commit 69755e01 authored by brownstef's avatar brownstef
Browse files

Merge branch 'dlb/cont-47-low-bitrate-SBA-update2' into 'main'

[non-BE] Merging dlb/cont-47-low-bitrate-SBA-update2 into main

See merge request !588
parents 65ef6ef7 269979ba
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1801,7 +1801,11 @@ ivas_error preview_indices(
                if ( bit_stream[2] == 0 )
                {
                    st_ivas->ivas_format = SBA_FORMAT;
#ifndef LBR_SBA
                    st_ivas->sba_mode = ivas_sba_mode_select( total_brate );
#else
                    st_ivas->sba_mode = ivas_sba_mode_select();
#endif
                }
                else
                {
+7 −0
Original line number Diff line number Diff line
@@ -986,6 +986,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
@@ -1018,7 +1021,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 */ // VE: not all 16CH are currently supported -> t be revisited later
enum
+54 −3
Original line number Diff line number Diff line
@@ -52,10 +52,54 @@ static void ivas_set_up_cov_smoothing(
    const float max_update_rate,
    const int16_t min_pool_size,
    const int16_t nchan_inp /* i  : number of input channels       */
#ifdef LBR_SBA_EXTRA_COV_SMOOTH
    ,
    const int32_t ivas_total_brate
#endif
)
{
    int16_t j, k;
#ifdef LBR_SBA_DM_COV_FIX
    if ( ivas_total_brate < IVAS_24k4 )
    {
        for ( j = 0; j < pFb->filterbank_num_bands; j++ )
        {
            float update_factor;
            float *p_bin_to_band;
            update_factor = 0.0f;
            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];
            }

            hCovState->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;
            }
            hCovState->pSmoothing_factor[j] *= ( j + 1 ) * smooth_fact;
#else
            hCovState->pSmoothing_factor[j] *= ( j + 1 ) * 0.75f;
#endif

            if ( hCovState->pSmoothing_factor[j] > max_update_rate )
            {
                hCovState->pSmoothing_factor[j] = max_update_rate;
            }
        }
    }
    else
#endif
        if ( nchan_inp <= FOA_CHANNELS )
    {
        for ( j = 0; j < pFb->filterbank_num_bands; j++ )
@@ -115,6 +159,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;
@@ -142,8 +190,11 @@ ivas_error ivas_spar_covar_smooth_enc_open(
        }
    }

    ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size,
                               nchan_inp );
#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, nchan_inp, ivas_total_brate );
#else
    ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size, nchan_inp );
#endif

    *hCovState_out = hCovState;

+8 −0
Original line number Diff line number Diff line
@@ -259,10 +259,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
            {

lib_com/ivas_prot.h

100755 → 100644
+28 −0
Original line number Diff line number Diff line
@@ -3184,7 +3184,11 @@ void ivas_dirac_param_est_enc(

/*! r: SBA format mode */
SBA_MODE ivas_sba_mode_select( 
#ifndef LBR_SBA
    const int32_t ivas_total_brate                              /* i  : IVAS total bitrate                      */
#else
    void
#endif
);

void ivas_sba_config(
@@ -4086,6 +4090,10 @@ ivas_error ivas_spar_md_enc_process(
    const int16_t dtx_vad,
    const int16_t nchan_inp,
    const int16_t sba_order                                     /* i  : Ambisonic (SBA) order                   */
#ifdef LBR_SBA
    ,
    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(
@@ -4099,6 +4107,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_md_com_cfg *hSparCfg,
    ivas_spar_md_t *hSparMd,
    float *pWscale,
@@ -4142,6 +4153,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_md_dec_open(
@@ -4185,6 +4201,10 @@ void ivas_spar_to_dirac(
    ivas_spar_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_update_md_hist(
@@ -4214,6 +4234,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( 
@@ -4240,6 +4264,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( 
Loading