Commit 55c77f8d authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'High_MLD_and_LTV_crash_fix_rend_cleanup' into 'main'

High_MLD_and_LTV_crash_fix_rend_cleanup

See merge request !309
parents 24daa9a2 eefded5e
Loading
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -257,9 +257,9 @@ void Inac_switch_ematch_ivas_fx(
            {
                FOR(j = 0; j < 8; j++)
                {
                    L_tmp = L_mult(*pt_exc, ftmp);  /* Q_exc*Q0 -> Q(Q_exc+1) */
                    L_tmp = L_shl(L_tmp, add(exp, 15));  /* Q(Q_exc+1) -> Q(16+Q_exc)*/
                    *pt_exc = round_fx(L_tmp);
                    L_tmp = L_mult0(*pt_exc, ftmp);
                    L_tmp = L_shl(L_tmp, add(exp, 15));  /* Q(Q_exc) -> Q(15+Q_exc)*/
                    *pt_exc = round_fx(L_tmp);           /*Q_exc - 1*/
                    pt_exc++;
                }
            }
@@ -267,15 +267,17 @@ void Inac_switch_ematch_ivas_fx(
            {
                FOR(j = 0; j < 16; j++)
                {
                    L_tmp = L_mult(*pt_exc,ftmp);       /* Q_exc*Q0 -> Q(Q_exc+1) */
                    L_tmp = L_shl(L_tmp, add(exp,15));  /* Q(Q_exc+1) -> Q(16+Q_exc)*/
                    *pt_exc = round_fx(L_tmp);          /*Q_exc*/
                    L_tmp = L_mult0(*pt_exc,ftmp);
                    L_tmp = L_shl(L_tmp, add(exp,15));  /* Q(Q_exc) -> Q(15+Q_exc)*/
                    *pt_exc = round_fx(L_tmp);          /*Q_exc - 1*/
                    pt_exc++;
                }
            }
        }

        /* Going back to time */
        Scale_sig( dct_exc_tmp, 240, 1 ); // Q_exc
        Scale_sig( exc2, 240, 1 );        // Q_exc
        edct_16fx(dct_exc_tmp, exc2, L_frame, 5, element_mode);
    }

+3 −3
Original line number Diff line number Diff line
@@ -320,9 +320,9 @@ void gain_dec_tc_ivas_fx(
     *-----------------------------------------------------------------*/

    /* *gain_code *= gcode0;*/
    L_tmp = L_shl(L_mult(wgain_code, gcode0_fx), 1);         /* Q12*Q0+1 -> Q14 */
    *gain_code_fx= L_shl(L_tmp, add(exp_gcode0, 2));
    move32(); /* Q14 -> Q16 */
    L_tmp = L_mult(wgain_code, gcode0_fx);         /* Q12*Q0 -> Q13 */
    *gain_code_fx= L_shl(L_tmp, add(exp_gcode0, 3));
    move32(); /* Q13 -> Q16 */

    /**norm_gain_code = *gain_code / *gain_inov;*/
    expg = sub(norm_s(*gain_inov_fx),1);
+2 −2
Original line number Diff line number Diff line
@@ -4563,7 +4563,7 @@ void ivas_dirac_dec_render_sf_fx(
        IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) )
        {
            fixedToFloat_arrL32( &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx[i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, nchan_transport ) )], hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f + i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, nchan_transport ) ), q_proto_direct_buffer[slot_idx], 2 * nchan_transport * hSpatParamRendCom->num_freq_bands );
            fixedToFloat_arrL32( &proto_diffuse_buffer_f_fx[i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) )], hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ), q_proto_diffuse_buffer[slot_idx], 2 * s_min( nchan_transport, hDirACRend->num_outputs_diff ) * hSpatParamRendCom->num_freq_bands );
            fixedToFloat_arrL32( &proto_diffuse_buffer_f_fx[i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) )], hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f + i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ), q_proto_diffuse_buffer[slot_idx], 2 * hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands );
        }
        ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) )
        {
@@ -4861,7 +4861,7 @@ void ivas_dirac_dec_render_sf_fx(
                               hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx +
                                   i_mult( i_mult( slot_idx, 2 ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ),
                               hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q,
                               2 * s_min( nchan_transport, hDirACRend->num_outputs_diff ) * hSpatParamRendCom->num_freq_bands );
                               2 * hDirACRend->num_outputs_diff * hSpatParamRendCom->num_freq_bands );
        }

        floatToFixed_arrL( p_onset_filter, p_onset_filter_fx, Q30, hSpatParamRendCom->num_freq_bands );                                                                        // Q30
+18 −18
Original line number Diff line number Diff line
@@ -2703,71 +2703,71 @@ ivas_error ivas_rend_openCrend(
void ivas_rend_closeCrend(
    CREND_WRAPPER_HANDLE *pCrend )
{
    int16_t i;
    Word16 i;
    CREND_HANDLE hCrend;

    if ( pCrend == NULL || *pCrend == NULL )
    IF ( pCrend == NULL || *pCrend == NULL )
    {
        return;
    }

    if ( ( *pCrend )->hHrtfCrend != NULL )
    IF ( ( *pCrend )->hHrtfCrend != NULL )
    {
        ivas_hrtf_close( &( *pCrend )->hHrtfCrend );
    }

    {
        hCrend = ( *pCrend )->hCrend;
        if ( hCrend != NULL )
        IF ( hCrend != NULL )
        {
            for ( i = 0; i < MAX_INTERN_CHANNELS; i++ )
            FOR ( i = 0; i < MAX_INTERN_CHANNELS; i++ )
            {
                if ( hCrend->freq_buffer_re_fx[i] != NULL )
                IF ( hCrend->freq_buffer_re_fx[i] != NULL )
                {
                    free( hCrend->freq_buffer_re_fx[i] );
                    hCrend->freq_buffer_re_fx[i] = NULL;
                }
                if ( hCrend->freq_buffer_im_fx[i] != NULL )
                IF ( hCrend->freq_buffer_im_fx[i] != NULL )
                {
                    free( hCrend->freq_buffer_im_fx[i] );
                    hCrend->freq_buffer_im_fx[i] = NULL;
                }
            }

            for ( i = 0; i < BINAURAL_CHANNELS; i++ )
            FOR ( i = 0; i < BINAURAL_CHANNELS; i++ )
            {
                if ( hCrend->prev_out_buffer_fx[i] != NULL )
                IF ( hCrend->prev_out_buffer_fx[i] != NULL )
                {
                    free( hCrend->prev_out_buffer_fx[i] );
                    hCrend->prev_out_buffer_fx[i] = NULL;
                }
            }

#ifdef IVAS_FLOAT_FIXED
            if ( hCrend->lfe_delay_line_fx != NULL )
#ifdef IVAS_FLOAT_FIXED_s
            IF ( hCrend->lfe_delay_line_fx != NULL )
            {
                free( hCrend->lfe_delay_line_fx );
                hCrend->lfe_delay_line_fx = NULL;
            }
#endif

            if ( hCrend->lfe_delay_line_fx != NULL )
            IF ( hCrend->lfe_delay_line_fx != NULL )
            {
                free( hCrend->lfe_delay_line_fx);
                hCrend->lfe_delay_line_fx = NULL;
            }

            if ( hCrend->freq_buffer_re_diffuse_fx != NULL )
            IF ( hCrend->freq_buffer_re_diffuse_fx != NULL )
            {
                free( hCrend->freq_buffer_re_diffuse_fx );
                hCrend->freq_buffer_re_diffuse_fx = NULL;
            }
            if ( hCrend->freq_buffer_im_diffuse_fx != NULL )
            IF ( hCrend->freq_buffer_im_diffuse_fx != NULL )
            {
                free( hCrend->freq_buffer_im_diffuse_fx );
                hCrend->freq_buffer_im_diffuse_fx = NULL;
            }
            if ( hCrend->hTrack != NULL )
            IF ( hCrend->hTrack != NULL )
            {
                free( hCrend->hTrack );
                hCrend->hTrack = NULL;
@@ -2775,14 +2775,14 @@ void ivas_rend_closeCrend(

            ivas_reverb_close( &hCrend->hReverb );

            if ( hCrend->reflections != NULL )
            IF ( hCrend->reflections != NULL )
            {
                if ( hCrend->reflections->closest_ch_idx != NULL )
                IF ( hCrend->reflections->closest_ch_idx != NULL )
                {
                    free( hCrend->reflections->closest_ch_idx );
                    hCrend->reflections->closest_ch_idx = NULL;
                }
                if ( hCrend->reflections->circ_buffers != NULL )
                IF ( hCrend->reflections->circ_buffers != NULL )
                {
                    free( hCrend->reflections->circ_buffers );
                    hCrend->reflections->circ_buffers = NULL;
+6 −6
Original line number Diff line number Diff line
@@ -2593,16 +2593,16 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd_fx(

                    // ((p_gains_diff_q, p_proto_diff_q) >> Q1) -> (p_gains_diff_q + p_proto_diff_q - 32)
                    output_real[l * num_channels_dir + hDirACRend->sba_map_tc[ch_idx]] =
                        L_shr( L_add( output_real[l * num_channels_dir + hDirACRend->sba_map_tc[ch_idx]],
                                      Mpy_32_32( g, ( *( p_proto++ ) ) ) ),
                               Q1 );
                        L_add( output_real[l * num_channels_dir + hDirACRend->sba_map_tc[ch_idx]],
                                      L_shr( Mpy_32_32( g, ( *( p_proto++ ) ) ) ,
                                             Q1));
                    move32();

                    // ((p_gains_diff_q, p_proto_diff_q) >> Q1) -> (p_gains_diff_q + p_proto_diff_q - 32)
                    output_imag[l * num_channels_dir + hDirACRend->sba_map_tc[ch_idx]] =
                        L_shr( L_add( output_imag[l * num_channels_dir + hDirACRend->sba_map_tc[ch_idx]],
                                      Mpy_32_32( g, ( *( p_proto++ ) ) ) ),
                               Q1 );
                        L_add( output_imag[l * num_channels_dir + hDirACRend->sba_map_tc[ch_idx]],
                                      L_shr( Mpy_32_32( g, ( *( p_proto++ ) ) ),
                                             Q1));
                    move32();
                }
            }
Loading