Commit 690c1ed4 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'MSAN_fix_STEREO_OSBA_High_MLD_Fix' into 'main'

MSAN fixes for STEREO, OSBA High MLD fix

See merge request !304
parents d567c2c8 b82e8fec
Loading
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -775,7 +775,12 @@ ivas_error acelp_core_dec_ivas_fx(
                /* Check LSF stability (distance between old LSFs and current LSFs) */
                st->stab_fac_fx = lsf_stab_ivas_fx( lsf_new_fx, st->lsf_old_fx, 0, st->L_frame );
            }
#ifndef MSAN_FIX
            for (int nsf = 0; nsf < NB_SUBFR16k; nsf++) {
#else
            FOR( int nsf = 0; nsf < st->nb_subfr; nsf++ )
#endif
            {
                Scale_sig(Aq_fx + (nsf * (M + 1)), M + 1, norm_s(Aq_fx[nsf * (M + 1)]) - Q2);
                Aq_fx[nsf * (M + 1)] = ONE_IN_Q12;
            }
@@ -1518,9 +1523,14 @@ ivas_error acelp_core_dec_ivas_fx(
            pRealSave_fx[i] = realBufferSave_fx[i];
            pImagSave_fx[i] = imagBufferSave_fx[i];
        }
#ifndef MSAN_FIX
        Copy_Scale_sig_16_32(bpf_error_signal_16fx, bpf_error_signal_fx, st->L_frame, -1); //Q_syn-1
#endif
        IF(st->p_bpf_noise_buf_32)
        {
#ifdef MSAN_FIX
            Copy_Scale_sig_16_32( bpf_error_signal_16fx, bpf_error_signal_fx, st->L_frame, -1 ); // Q_syn-1
#endif
            Copy32(bpf_error_signal_fx, st->p_bpf_noise_buf_32, st->L_frame);
            Scale_sig32( st->p_bpf_noise_buf_32, st->L_frame, sub( Q11, sub( st->Q_syn, 1 ) ) );
        }
@@ -1703,7 +1713,11 @@ ivas_error acelp_core_dec_ivas_fx(
        int16_t nSamples = NS2SA(st->L_frame * FRAMES_PER_SEC, FRAME_SIZE_NS /*DELAY_CLDFB_NS*/); /* IVAS-64: optimization is likely possible here (don't resample the whole frame) */

        /* analysis of the synthesis at internal sampling rate - needed for DFT stereo -> TD stereo switching */
#ifndef MSAN_FIX
        for (i = 0; i < L_FRAME16k; i++)
#else
        FOR( i = 0; i < st->L_frame; i++ )
#endif
        {
            syn_32_fx[i] = L_shr(L_deposit_h(psyn_fx[i]), 4 + st->Q_syn);
        }
@@ -1763,11 +1777,17 @@ ivas_error acelp_core_dec_ivas_fx(
            Scale_sig32(imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real);
        }
        Scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, (Q_real - 1) - Q10); //(Q_real - 1)
#ifndef MSAN_FIX
        Scale_sig32( synth_fx, L_FRAME48k, Q_real - 1);
#endif

        cldfbSynthesis_ivas_fx(realBuffer_fx, imagBuffer_fx, synth_fx /*dummy*/, NS2SA(st->output_Fs, FRAME_SIZE_NS /*DELAY_CLDFB_NS*/), st->cldfbSyn);

#ifdef MSAN_FIX
        Scale_sig32(synth_fx, output_frame, -(Q_real - 1));
#else
        Scale_sig32(synth_fx, L_FRAME48k, -(Q_real - 1));
#endif
        Scale_sig32(st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, Q10 - (Q_real - 1));

        if (st->p_bpf_noise_buf_32)
@@ -1783,7 +1803,11 @@ ivas_error acelp_core_dec_ivas_fx(
    }

    /* Copy output signal */
#ifndef MSAN_FIX
    Scale_sig(syn_tmp_fx, L_FRAME16k + L_SUBFR, -st->Q_syn);
#else
    Scale_sig(syn_tmp_fx, st->L_frame + L_SUBFR, -st->Q_syn);
#endif
    if (st->element_mode > EVS_MONO)
    {
        Copy(psyn_fx, output_fx, st->L_frame);
+5 −2
Original line number Diff line number Diff line
@@ -1142,10 +1142,13 @@ ivas_error ivas_core_dec(
            }
            Scale_sig( tmp_buffer_fx, L_FRAME48k, Q11 - Q_white_exc );
            stereo_icBWE_dec_fx( hCPE, hb_synth_32_fx[0], hb_synth_32_fx[1], tmp_buffer_fx /*fb_synth_ref*/, voice_factors_fx[0], output_frame, &q );

#ifdef MSAN_FIX
			Scale_sig32(hb_synth_32_fx[0], output_frame, sub(Q11 , q));
			Scale_sig32(hb_synth_32_fx[1], output_frame, sub(Q11 , q));
#else
			Scale_sig32(hb_synth_32_fx[0], L_FRAME48k, sub(Q11 , q));
			Scale_sig32(hb_synth_32_fx[1], L_FRAME48k, sub(Q11 , q));

#endif
        }

        IF( EQ_16( st->element_mode, EVS_MONO ) )
+2 −0
Original line number Diff line number Diff line
@@ -100,6 +100,8 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx(
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) );
        }
        h_dirac_output_synthesis_state->cx_old_len = nchan_in * nchan_in;
        move16();
        if ( ( h_dirac_output_synthesis_state->cy_old_fx[idx] = (Word32 *) malloc( nchan_out * nchan_out * sizeof(Word32) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) );
+1 −1
Original line number Diff line number Diff line
@@ -1976,7 +1976,7 @@ ivas_error ivas_init_decoder_fx(
                //        }
                //    }
                //}
                fixedToFloat_arrL( hParamMC->proto_matrix_int_fx, hParamMC->proto_matrix_int, Q31, nchan_out_transport * nchan_transport );
                fixedToFloat_arrL( hParamMC->proto_matrix_int_fx, hParamMC->proto_matrix_int, Q31, s_min(hParamMC->proto_matrix_int_len, nchan_out_transport * nchan_transport) );
                //if ( hParamMC->ls_conv_dmx_matrix )
                //    fixedToFloat_arrL( hParamMC->ls_conv_dmx_matrix_fx, hParamMC->ls_conv_dmx_matrix, Q30, nchan_out_transport * nchan_out_cov );
                if ( hParamMC->hoa_encoder_fx )
+4 −4
Original line number Diff line number Diff line
@@ -1339,7 +1339,7 @@ ivas_error ivas_jbm_dec_tc(
#endif
#endif // IVAS_FLOAT_FIXED
        }
        ELSE IF( st_ivas->renderer_type != RENDERER_DISABLE && NE_16( st_ivas->sba_dirac_stereo_flag, 0 ) )
        ELSE IF( st_ivas->renderer_type != RENDERER_DISABLE && EQ_16( st_ivas->sba_dirac_stereo_flag, 0 ) )
        {
            Word16 size = st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport + sba_ch_idx;
            IF( EQ_16( size, 3 ) )
@@ -3842,10 +3842,10 @@ void ivas_jbm_dec_feed_tc_to_renderer(

            FOR(Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->num_param_bands_synth; param_band_idx++)
            {
                f2me_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx], nchan_transport * nchan_transport);
                f2me_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx], s_min(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_len, nchan_transport * nchan_transport));
                f2me_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx], nchan_out_cov * nchan_out_cov);
            }
            f2me_buf(st_ivas->hParamMC->proto_matrix_int, st_ivas->hParamMC->proto_matrix_int_fx, &st_ivas->hParamMC->proto_matrix_int_e, nchan_transport * nchan_out_transport);
            f2me_buf(st_ivas->hParamMC->proto_matrix_int, st_ivas->hParamMC->proto_matrix_int_fx, &st_ivas->hParamMC->proto_matrix_int_e, s_min(st_ivas->hParamMC->proto_matrix_int_len, nchan_transport * nchan_out_transport));

            ivas_param_mc_dec_digest_tc_fx( st_ivas, (uint8_t) n_render_timeslots, (Word32 **)p_data_f_fx, in_q );

@@ -3863,7 +3863,7 @@ void ivas_jbm_dec_feed_tc_to_renderer(

            FOR(Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->num_param_bands_synth; param_band_idx++)
            {
                me2f_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx], nchan_transport * nchan_transport);
                me2f_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx], s_min(st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_len, nchan_transport * nchan_transport));
                me2f_buf(st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old[param_band_idx], nchan_out_cov * nchan_out_cov);
            }

Loading