Commit cdb14738 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'float_struct_members_buffers_cleanup' into 'main'

Float structure members and buffers cleanup

See merge request !360
parents 5d330e0c 566e7b4e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2485,13 +2485,13 @@ static ivas_error decodeVoIP(
            }
        }

        frame++;
        // frame++;
        if ( !arg.quietModeEnabled )
        {
            fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame );
        }
        vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;
        // frame++;
        frame++;
        systemTime_ms += systemTimeInc_ms;
#ifdef WMOPS
#ifndef DONT_COUNT
+12 −61
Original line number Diff line number Diff line
@@ -3489,6 +3489,7 @@ void ivas_dirac_dec_render_sf_fx(
    Word16 num_channels_dir, exp;
    Word16 q_diffuseness_vector = Q31, q_reference_power_smooth = Q31;
    Word16 proto_power_smooth_len = 0;
    Word16 tmp1;

    push_wmops( "ivas_dirac_dec_render" );

@@ -3511,46 +3512,22 @@ void ivas_dirac_dec_render_sf_fx(
    //////////////////////////////////////////////////////////////////////////// to be removed ///////////////////////////////////////////////////////////////////
    IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) )
    {
        floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) );
        IF( hDirACRend->masa_stereo_type_detect )
        {
            hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = 0;
            hDirACRend->masa_stereo_type_detect->q_subtract_power_y = Q31;
        }
    }
    ELSE IF( NE_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) )
    {
        SWITCH( nchan_transport )
        {
            case 11:
            case 8:
            case 6:
            case 4:
                floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff );
                BREAK;
            case 2:
                IF( hDirACRend->hOutSetup.is_loudspeaker_setup )
                {
                    floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 3, hSpatParamRendCom->num_freq_bands ) );
                }
                ELSE
                {
                    floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) );
                }
                BREAK;
            case 1:
                floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hSpatParamRendCom->num_freq_bands );
                BREAK;
        }
    }

    IF( L_or( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS ), EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) )
    {
        if ( hDirACRend->h_output_synthesis_psd_params.max_band_decorr != 0 )
        {
            DIRAC_OUTPUT_SYNTHESIS_STATE *state = &( hDirACRend->h_output_synthesis_psd_state );
            f2me_buf( state->proto_power_diff_smooth, state->proto_power_diff_smooth_fx, &state->proto_power_diff_smooth_q, state->proto_power_diff_smooth_len );
            state->proto_power_diff_smooth_q = 31 - state->proto_power_diff_smooth_q;
            tmp1 = L_norm_arr( state->proto_power_diff_smooth_fx, state->proto_power_diff_smooth_len );

            scale_sig32( state->proto_power_diff_smooth_fx, state->proto_power_diff_smooth_len, tmp1 );
            state->proto_power_diff_smooth_q += tmp1;
        }
    }

@@ -3674,13 +3651,15 @@ void ivas_dirac_dec_render_sf_fx(
        hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE );
        floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE );

        hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands );
        floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands );
        tmp1 = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands );
        scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands, tmp1 );
        hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q += tmp1;

        IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev != 0 )
        IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx != 0 )
        {
            hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE );
            floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE );
            tmp1 = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE );
            scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE, tmp1 );
            hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q += tmp1;
        }
    }
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -5065,7 +5044,6 @@ void ivas_dirac_dec_render_sf_fx(
    ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) )
    {
        // fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( hSpatParamRendCom->subframe_nbslots[subframe_idx], i_mult( 4, hSpatParamRendCom->num_freq_bands ) ) );
        fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) );
        fixedToFloat_arrL32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_q, i_mult( 6, hSpatParamRendCom->num_freq_bands ) );
        // fixedToFloat_arrL32( reference_power_fx, DirAC_mem.reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands );
    }
@@ -5078,7 +5056,6 @@ void ivas_dirac_dec_render_sf_fx(
            case 6:
            case 4:
                // fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( i_mult( 2, hSpatParamRendCom->subframe_nbslots[subframe_idx] ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ) );
                fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) );
                me2f_buf( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f, i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ) );
                // fixedToFloat_arrL32( reference_power_fx, DirAC_mem.reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands );
                BREAK;
@@ -5086,19 +5063,16 @@ void ivas_dirac_dec_render_sf_fx(
                IF( hDirACRend->hOutSetup.is_loudspeaker_setup )
                {
                    // fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( hSpatParamRendCom->subframe_nbslots[subframe_idx], i_mult( 6, hSpatParamRendCom->num_freq_bands ) ) );
                    fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 3, hSpatParamRendCom->num_freq_bands ) );
                }
                ELSE
                {
                    // fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( hSpatParamRendCom->subframe_nbslots[subframe_idx], i_mult( 4, hSpatParamRendCom->num_freq_bands ) ) );
                    fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) );
                }
                me2f_buf( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f, i_mult( 6, hSpatParamRendCom->num_freq_bands ) );
                // fixedToFloat_arrL32( reference_power_fx, DirAC_mem.reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands );
                BREAK;
            case 1:
                // fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( hSpatParamRendCom->subframe_nbslots[subframe_idx], i_mult( 2, hSpatParamRendCom->num_freq_bands ) ) );
                fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hSpatParamRendCom->num_freq_bands );
                me2f_buf( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f, i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_diff ) ) );
                // fixedToFloat_arrL32( reference_power_fx, DirAC_mem.reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands );
                BREAK;
@@ -5127,21 +5101,6 @@ void ivas_dirac_dec_render_sf_fx(
            hDirACRend->proto_frame_dec_f = hDirACRend->proto_frame_f;
        }
    }
    IF( L_or( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS ), EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) )
    {
        if ( hDirACRend->h_output_synthesis_psd_params.max_band_decorr != 0 )
        {
            DIRAC_OUTPUT_SYNTHESIS_STATE *state = &( hDirACRend->h_output_synthesis_psd_state );
            me2f_buf( state->proto_power_diff_smooth_fx,
                      31 - state->proto_power_diff_smooth_q,
                      state->proto_power_diff_smooth,
                      state->proto_power_diff_smooth_len );
            /* me2f_buf( state->proto_diffuse_buffer_f_fx,
                       31 - state->proto_diffuse_buffer_f_q,
                       state->proto_diffuse_buffer_f,
                       state->proto_diffuse_buffer_f_len );*/
        }
    }

    if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac_flag )
    {
@@ -5215,14 +5174,6 @@ void ivas_dirac_dec_render_sf_fx(

        fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, size );
        fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE );

        fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands );
        fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands );
        fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE );
        IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev != 0 )
        {
            fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE );
        }
    }

    if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
+11 −53
Original line number Diff line number Diff line
@@ -120,6 +120,7 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx(
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n" ) );
        }
        set_zero_fx( h_dirac_output_synthesis_state->mixing_matrix_fx[idx], nchan_out * nchan_in );
        h_dirac_output_synthesis_state->mixing_matrix_len = i_mult( nchan_out, nchan_in );
    }
    for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ )
    {
@@ -142,6 +143,7 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx(
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n" ) );
        }
        set_zero_fx( h_dirac_output_synthesis_state->mixing_matrix_res_fx[idx], nchan_out * nchan_out );
        h_dirac_output_synthesis_state->mixing_matrix_res_len = i_mult( nchan_out, nchan_out );
    }
    for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ )
    {
@@ -205,34 +207,6 @@ 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" ) );
    }

    /* cov buffers */
    for ( idx = 0; idx < num_param_bands; idx++ )
    {

        if ( ( h_dirac_output_synthesis_state->mixing_matrix[idx] = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n" ) );
        }
        set_zero( h_dirac_output_synthesis_state->mixing_matrix[idx], nchan_out * nchan_in );
    }
    for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ )
    {
        h_dirac_output_synthesis_state->mixing_matrix[idx] = NULL;
    }

    for ( idx = 0; idx < num_param_bands_residual; idx++ )
    {
        if ( ( h_dirac_output_synthesis_state->mixing_matrix_res[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n" ) );
        }
        set_zero( h_dirac_output_synthesis_state->mixing_matrix_res[idx], nchan_out * nchan_out );
    }
    for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ )
    {
        h_dirac_output_synthesis_state->mixing_matrix_res[idx] = NULL;
    }
#endif
    return IVAS_ERR_OK;
}
@@ -440,15 +414,15 @@ void ivas_dirac_dec_output_synthesis_cov_init_fx(
    set16_fx( h_dirac_output_synthesis_state->mixing_matrix_res_old_exp, 0, CLDFB_NO_CHANNELS_MAX );
    set16_fx( h_dirac_output_synthesis_state->mixing_matrix_res_exp, 0, CLDFB_NO_CHANNELS_MAX );
#if 1 /*TODO: To be removed :Floating point initializations*/
    FOR( idx = 0; idx < n_param_bands; idx++ )
    {
        set_zero( h_dirac_output_synthesis_state->mixing_matrix[idx], nchan_out * nchan_in );
    }

    FOR( idx = 0; idx < n_param_bands_res; idx++ )
    {
        set_zero( h_dirac_output_synthesis_state->mixing_matrix_res[idx], nchan_out * nchan_out );
    }
    // FOR ( idx = 0; idx < n_param_bands; idx++ )
    //{
    //     set_zero( h_dirac_output_synthesis_state->mixing_matrix[idx], nchan_out * nchan_in );
    // }

    // FOR ( idx = 0; idx < n_param_bands_res; idx++ )
    //{
    //     set_zero( h_dirac_output_synthesis_state->mixing_matrix_res[idx], nchan_out * nchan_out );
    // }
#endif

    return;
@@ -606,22 +580,6 @@ void ivas_dirac_dec_output_synthesis_cov_close_fx(
        free( h_dirac_output_synthesis_params->proto_matrix );
        h_dirac_output_synthesis_params->proto_matrix = NULL;
    }

    /* free cov buffers */
    FOR( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ )
    {
        IF( h_dirac_output_synthesis_state->mixing_matrix[idx] != NULL )
        {
            free( h_dirac_output_synthesis_state->mixing_matrix[idx] );
            h_dirac_output_synthesis_state->mixing_matrix[idx] = NULL;
        }

        IF( h_dirac_output_synthesis_state->mixing_matrix_res[idx] != NULL )
        {
            free( h_dirac_output_synthesis_state->mixing_matrix_res[idx] );
            h_dirac_output_synthesis_state->mixing_matrix_res[idx] = NULL;
        }
    }
#endif
    return;
}
+13 −47

File changed.

Preview size limit exceeded, changes collapsed.

+41 −66
Original line number Diff line number Diff line
@@ -550,19 +550,6 @@ ivas_error ivas_param_mc_dec_open_fx(

        hParamMC->sz = n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands;

#if 1 /*TODO: To be removed later(floating point malloc)*/
        if ( ( hParamMC->Cldfb_RealBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) );
        }
        set_zero( hParamMC->Cldfb_RealBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands );
        if ( ( hParamMC->Cldfb_ImagBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) );
        }
        set_zero( hParamMC->Cldfb_ImagBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands );
#endif

        IF( st_ivas->hTcBuffer == NULL )
        {
            IF( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK )
@@ -575,10 +562,6 @@ ivas_error ivas_param_mc_dec_open_fx(
    {
        hParamMC->Cldfb_RealBuffer_tc_fx = NULL;
        hParamMC->Cldfb_ImagBuffer_tc_fx = NULL;
#if 1 /*TODO: To be removed later*/
        hParamMC->Cldfb_RealBuffer_tc = NULL;
        hParamMC->Cldfb_ImagBuffer_tc = NULL;
#endif
    }

    hParamMC->subframes_rendered = 0;
@@ -1539,18 +1522,6 @@ ivas_error ivas_param_mc_dec_reconfig_fx(
        IF( NE_16( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) )
        {
            Word16 n_cldfb_slots;
#if 1 /*TODO: To be removed later*/
            IF( hParamMC->Cldfb_RealBuffer_tc != NULL )
            {
                free( hParamMC->Cldfb_RealBuffer_tc );
                hParamMC->Cldfb_RealBuffer_tc = NULL;
            }
            IF( hParamMC->Cldfb_ImagBuffer_tc != NULL )
            {
                free( hParamMC->Cldfb_ImagBuffer_tc );
                hParamMC->Cldfb_ImagBuffer_tc = NULL;
            }
#endif
            IF( hParamMC->Cldfb_RealBuffer_tc_fx != NULL )
            {
                free( hParamMC->Cldfb_RealBuffer_tc_fx );
@@ -1567,19 +1538,6 @@ ivas_error ivas_param_mc_dec_reconfig_fx(
            {
                n_cldfb_slots = MAX_JBM_CLDFB_TIMESLOTS;
            }
#if 1 /*TODO: To be removed later*/
            IF( ( hParamMC->Cldfb_RealBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL )
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) );
            }
            set_zero( hParamMC->Cldfb_RealBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands );

            IF( ( hParamMC->Cldfb_ImagBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL )
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) );
            }
            set_zero( hParamMC->Cldfb_ImagBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands );
#endif
            IF( ( hParamMC->Cldfb_RealBuffer_tc_fx = (Word32 *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL )
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) );
@@ -1594,18 +1552,6 @@ ivas_error ivas_param_mc_dec_reconfig_fx(
        }
        ELSE
        {
#if 1 /*TODO:To be removed later(floating point memory dealloc)*/
            IF( hParamMC->Cldfb_RealBuffer_tc != NULL )
            {
                free( hParamMC->Cldfb_RealBuffer_tc );
                hParamMC->Cldfb_RealBuffer_tc = NULL;
            }
            IF( hParamMC->Cldfb_ImagBuffer_tc != NULL )
            {
                free( hParamMC->Cldfb_ImagBuffer_tc );
                hParamMC->Cldfb_ImagBuffer_tc = NULL;
            }
#endif
            IF( hParamMC->Cldfb_RealBuffer_tc_fx != NULL )
            {
                free( hParamMC->Cldfb_RealBuffer_tc_fx );
@@ -2306,16 +2252,6 @@ void ivas_param_mc_dec_close_fx(
        free( hParamMC->hoa_encoder );
        hParamMC->hoa_encoder = NULL;
    }
    IF( hParamMC->Cldfb_RealBuffer_tc != NULL )
    {
        free( hParamMC->Cldfb_RealBuffer_tc );
        hParamMC->Cldfb_RealBuffer_tc = NULL;
    }
    IF( hParamMC->Cldfb_ImagBuffer_tc != NULL )
    {
        free( hParamMC->Cldfb_ImagBuffer_tc );
        hParamMC->Cldfb_ImagBuffer_tc = NULL;
    }
#endif /***********************************ends here************************************************/

    free( *hParamMC_out );
@@ -3022,9 +2958,9 @@ void ivas_param_mc_dec_digest_tc_fx(
        IF( slot_idx >= 2 * hParamMC->hMetadataPMC->attackIndex )
        {
            ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( &hParamMC->Cldfb_RealBuffer_tc_fx[slot_idx * hParamMC->num_freq_bands * nchan_transport],
                                                                          hParamMC->Cldfb_RealBuffer_tc_e,
                                                                          /*hParamMC->Cldfb_RealBuffer_tc_e*/ Q31 - Q6,
                                                                          &hParamMC->Cldfb_ImagBuffer_tc_fx[slot_idx * hParamMC->num_freq_bands * nchan_transport],
                                                                          hParamMC->Cldfb_ImagBuffer_tc_e,
                                                                          /*hParamMC->Cldfb_ImagBuffer_tc_e*/ Q31 - Q6,
                                                                          cx_fx,
                                                                          &cx_e,
                                                                          cx_imag_fx,
@@ -3488,6 +3424,45 @@ void ivas_param_mc_dec_render_fx(
    slot_idx_start = hParamMC->slots_rendered;
    slot_idx_start_cldfb_synth = 0;

    Flag is_zero = 1;
    move16();
    FOR( j = 0; j < st_ivas->hParamMC->hMetadataPMC->nbands_coded; j++ )
    {
        is_zero = 1;
        move16();
        FOR( i = 0; i < hParamMC->h_output_synthesis_cov_state.mixing_matrix_len; i++ )
        {
            IF( NE_32( hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[j][i], 0 ) )
            {
                is_zero = 0;
                move16();
            }
        }
        IF( is_zero )
        {
            hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[j] = 0;
            move16();
        }
        is_zero = 1;
        move16();
        IF( st_ivas->hParamMC->band_grouping[j] < st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr )
        {
            FOR( i = 0; i < hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_len; i++ )
            {
                IF( NE_32( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[j][i], 0 ) )
                {
                    is_zero = 0;
                    move16();
                }
            }
        }

        IF( is_zero )
        {
            hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[j] = 0;
            move16();
        }
    }
    FOR( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ )
    {
        FOR( slot_idx = 0; slot_idx < hParamMC->subframe_nbslots[subframe_idx]; ( slot_idx++, hParamMC->slots_rendered++ ) )
Loading