Commit 44f2f1d6 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'msan_omasa_ism_stereo_osba_fixes_float_cleanup' into 'main'

MSAN fixes for stereo, isma, omasa, osba, float cleanup.

See merge request !325
parents 6c9382ad 30de5886
Loading
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -51,9 +51,7 @@
 * Local function prototypes
 *-------------------------------------------------------------------*/

#ifndef IVAS_FLOAT_FIXED
static void mhvals_flt( const int16_t d, float *m );
#endif

static void getmidbands( int16_t *part, const int16_t npart, int16_t *midband, float *psize_flt, float *psize_inv_flt );

@@ -93,7 +91,6 @@ void initFdCngCom_flt(
    const float scale
)
{
#ifndef IVAS_FLOAT_FIXED
    /* Calculate FFT scaling factor */
    hFdCngCom->scalingFactor_flt = 1 / ( scale * scale * 8.f );

@@ -104,7 +101,6 @@ void initFdCngCom_flt(

    /* Initialize the comfort noise generation */
    set_f( hFdCngCom->fftBuffer_flt, 0.0f, FFTLEN );
#endif
    UNUSED_PARAM(scale);
    set_f( hFdCngCom->cngNoiseLevel_flt, 0.0f, FFTCLDFBLEN );
    set_f( hFdCngCom->olapBufferSynth2_flt, 0.0f, FFTLEN );
@@ -137,7 +133,6 @@ void initFdCngCom_flt(
    hFdCngCom->seed2 = 1;
    hFdCngCom->seed3 = 2;
    hFdCngCom->CngBitrate = -1;
#ifndef IVAS_FLOAT_FIXED
    /* Initialize noise estimation algorithm */
    set_f( hFdCngCom->periodog_flt, 0.0f, PERIODOGLEN );
    mhvals_flt( MSNUMSUBFR * MSSUBFRLEN, &( hFdCngCom->msM_win_flt ) );
@@ -147,17 +142,14 @@ void initFdCngCom_flt(
    set_f( hFdCngCom->msSlope_flt, 0.0f, 2 );
    set_f( hFdCngCom->msQeqInvAv_flt, 0.0f, 2 );
    hFdCngCom->init_old_flt = 0;
#endif
    hFdCngCom->msFrCnt_init_counter = 0;
    hFdCngCom->msFrCnt_init_thresh = 1;
    hFdCngCom->offsetflag = 0;
    hFdCngCom->msFrCnt = MSSUBFRLEN;
    hFdCngCom->msMinBufferPtr = 0;
#ifndef IVAS_FLOAT_FIXED
    set_f( hFdCngCom->msAlphaCor_flt, 0.3f, 2 );

    hFdCngCom->coherence_flt = 0.5f;
#endif

    return;
}
@@ -1217,7 +1209,6 @@ void SynthesisSTFT_dirac_fx(
 * Compute some values used in the bias correction of the minimum statistics algorithm
 *-------------------------------------------------------------------*/

#ifndef IVAS_FLOAT_FIXED
static void mhvals_flt(
    const int16_t d,
    float *m )
@@ -1257,7 +1248,6 @@ static void mhvals_flt(

    return;
}
#endif

/*-------------------------------------------------------------------
 * rand_gauss_flt()
+2 −2
Original line number Diff line number Diff line
@@ -12,11 +12,11 @@ Word32 floatToFixed(float f, Word16 Q)
	if (f == 1.0f && Q == Q31)
		return MAXVAL_WORD32;
	if (Q < 0)
		return (Word32)((float)(f) / (float)(((unsigned)1) << (-Q)) + (f >= 0 ? 0.5 : -0.5));
		return (Word32)((float)(f) / (double)(1llu << (-Q)) + (f >= 0 ? 0.5 : -0.5));
	else
	{
		Word64 result_32;
		result_32=(Word64)(f * (float)((unsigned int)1 << Q) + (f >= 0 ? 0.5 : -0.5));
		result_32=(Word64)(f * (double)(1llu << Q) + (f >= 0 ? 0.5 : -0.5));
		if (result_32 > MAX_32)
			return MAX_32;
		if (result_32 < MIN_32)
+3 −0
Original line number Diff line number Diff line
@@ -2107,6 +2107,9 @@ void td_bwe_dec_init_ivas_fx(
void ivas_dirac_dec_render_sf_fx(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    float *output_f[],                                          /* i/o: synthesized core-coder transport channels/DirAC output  */
#ifdef MSAN_FIX
    Word32 *output_fx[],           /* i/o: synthesized core-coder transport channels/DirAC output  */
#endif // MSAN_FIX
    const int16_t nchan_transport,                              /* i  : number of transport channels            */
    float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX],
    float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX]
+4 −2
Original line number Diff line number Diff line
@@ -6644,7 +6644,9 @@ void ivas_spar_set_bitrate_config_fx(

  pSpar_md_cfg->active_w = ivas_spar_br_table_consts[table_idx].active_w;
  pSpar_md_cfg->agc_bits_ch_idx = ivas_spar_br_table_consts[table_idx].agc_bits_ch_idx;
#if 1 //Some issues
#ifdef IVAS_FLOAT_FIXED
    ivas_spar_get_uniform_quant_strat_fx( pSpar_md_cfg, table_idx );
#else
    ivas_spar_get_uniform_quant_strat( pSpar_md_cfg, table_idx );
#endif
  pSpar_md_cfg->quant_strat_bits = ivas_get_bits_to_encode(MAX_QUANT_STRATS);
+108 −62
Original line number Diff line number Diff line
@@ -135,7 +135,6 @@ void ivas_quantise_real_values_fx(
}


#ifndef IVAS_FLOAT_FIXED
/*-----------------------------------------------------------------------------------------*
 * Function ivas_spar_get_uniform_quant_strat()
 *
@@ -214,73 +213,120 @@ void ivas_spar_get_uniform_quant_strat(

    return;
}
#else
void ivas_spar_get_uniform_quant_strat(


#ifdef IVAS_FLOAT_FIXED
/*-----------------------------------------------------------------------------------------*
 * Function ivas_spar_get_uniform_quant_strat_fx()
 *
 * Sets the quant strat values
 *-----------------------------------------------------------------------------------------*/
void ivas_spar_get_uniform_quant_strat_fx(
    ivas_spar_md_com_cfg *pSpar_md_com_cfg,
    const Word16 table_idx )
{
    Word16 i;
    Word16 active_w = ivas_spar_br_table_consts[table_idx].active_w;
    move16();
    Word16 PQ_q_lvl, C_q_lvl, Pr_q_lvl, Pc_q_lvl;

    pSpar_md_com_cfg->num_quant_strats = MAX_QUANT_STRATS;
    move16();

  for ( i = 0; i < pSpar_md_com_cfg->num_quant_strats; i++ )
    FOR( i = 0; i < pSpar_md_com_cfg->num_quant_strats; i++ )
    {
        PQ_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][0];
        move16();
        C_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][1];
        move16();
        Pr_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][2];
        move16();
        Pc_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][3];
        move16();

        if ( active_w )
        {
            pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl;
            move16();
            pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl;
		  pSpar_md_com_cfg->quant_strat[i].PR.min_fx = -322122547;//1.2*Q28
            move16();
            pSpar_md_com_cfg->quant_strat[i].PR.min_fx = L_negate( 322122547 ); // -1.2*Q28
            move32();
            pSpar_md_com_cfg->quant_strat[i].PR.max_fx = 322122547; // 1.2*Q28
            move32();

            pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl;
            move16();
            pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl;
		  pSpar_md_com_cfg->quant_strat[i].C.min_fx = -214748364;
            move16();
            pSpar_md_com_cfg->quant_strat[i].C.min_fx = L_negate( 214748364 ); //-.8*Q28
            move32();
            pSpar_md_com_cfg->quant_strat[i].C.max_fx = 214748364; //.8*Q28
            move32();

            pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl;
            move16();
            pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[1] = Pr_q_lvl;
            move16();
            pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0;
            move32();
            pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = 214748364; //.8*Q28
            move32();

            pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[0] = Pc_q_lvl;
            move16();
            pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl;
		  pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = -214748364;//.8*Q28
            move16();
            pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = L_negate( 214748364 ); //-.8*Q28
            move32();
            pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = 214748364; //.8*Q28
            move32();
        }
        else
        {
            pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl;
            move16();
            pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl;
		  pSpar_md_com_cfg->quant_strat[i].PR.max_fx = ONE_IN_Q28;
		  pSpar_md_com_cfg->quant_strat[i].PR.min_fx = -ONE_IN_Q28;
            move16();
            pSpar_md_com_cfg->quant_strat[i].PR.max_fx = ONE_IN_Q28; // Q28
            move32();
            pSpar_md_com_cfg->quant_strat[i].PR.min_fx = L_negate( ONE_IN_Q28 ); // Q28
            move32();

            pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl;
            move16();
            pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl;
		  pSpar_md_com_cfg->quant_strat[i].C.max_fx = 2 *ONE_IN_Q28;
		  pSpar_md_com_cfg->quant_strat[i].C.min_fx = -2*ONE_IN_Q28;
            move16();
            pSpar_md_com_cfg->quant_strat[i].C.max_fx = ONE_IN_Q29; // Q28
            move32();
            pSpar_md_com_cfg->quant_strat[i].C.min_fx = L_negate( ONE_IN_Q29 ); // Q28
            move32();

            pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl;
            move16();
            pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[1] = Pr_q_lvl;
		  pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = ONE_IN_Q28;
		  pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0;
            move16();
            pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = ONE_IN_Q28; // Q28
            move32();
            pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0; // Q28
            move32();

            pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[0] = Pc_q_lvl;
            move16();
            pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl;
		  pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = ONE_IN_Q27; //.5* Q28
		  pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = -ONE_IN_Q27;//.5* Q28
            move16();
            pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = ONE_IN_Q27; // Q28
            move32();
            pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = L_negate( ONE_IN_Q27 ); // Q28
            move32();
        }
    }

    return;
}
#endif


/*-----------------------------------------------------------------------------------------*
 * Function ivas_map_prior_coeffs_quant()
 *
Loading