Commit 46aa6bce authored by emerit's avatar emerit
Browse files

Fix test malloc of lr_energy_and_iac_dyn and add missing #ifdef

parent b1b64606
Loading
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -1398,10 +1398,7 @@ ivas_error ivas_rend_openCrend(
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                if ( hCrend->freq_buffer_re_diffuse != NULL )
                {
                set_zero_l( hCrend->freq_buffer_re_diffuse, max_total_ir_len );
                }
#else
                set_zero( hCrend->freq_buffer_re_diffuse, max_total_ir_len );
#endif
@@ -1411,10 +1408,7 @@ ivas_error ivas_rend_openCrend(
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                if ( hCrend->freq_buffer_im_diffuse != NULL )
                {
                set_zero_l( hCrend->freq_buffer_im_diffuse, max_total_ir_len );
                }
#else
                set_zero( hCrend->freq_buffer_im_diffuse, max_total_ir_len );
#endif
+22 −1
Original line number Diff line number Diff line
@@ -450,6 +450,10 @@ static ivas_error LoadBSplineBinary(
    for ( i = 0; i < 3; i++ )
    {
        HrFiltSet_p->lr_energy_and_iac_dyn[i] = (float *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( float ) );
        if ( HrFiltSet_p->lr_energy_and_iac_dyn[i] == NULL )
        {
            return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" );
        }
        fread( HrFiltSet_p->lr_energy_and_iac_dyn[i], sizeof( const float ), LR_IAC_LENGTH_NR_FC, f_hrtf );
        HrFiltSet_p->lr_energy_and_iac[i] = (const float *) HrFiltSet_p->lr_energy_and_iac_dyn[i];
    }
@@ -483,6 +487,12 @@ static ivas_error set_default_reverb_iac_energy(
        for ( i = 0; i < 3; i++ )
        {
            HrFiltSet_p->lr_energy_and_iac_dyn[i] = (float *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( float ) );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
            if ( HrFiltSet_p->lr_energy_and_iac_dyn[i] == NULL )
            {
                return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" );
            }
#endif
        }
        switch ( HrFiltSet_p->SampleRate )
        {
@@ -528,6 +538,7 @@ static ivas_error set_default_reverb_iac_energy(
    return error;
}

#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES

/*-------------------------------------------------------------------*
 * load_reverb_from_binary()
@@ -603,6 +614,12 @@ static ivas_error load_reverb_from_binary(
        for ( i = 0; i < 3; i++ )
        {
            HrFiltSet_p->lr_energy_and_iac_dyn[i] = (float *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( float ) );
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
            if ( HrFiltSet_p->lr_energy_and_iac_dyn[i] == NULL )
            {
                return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" );
            }
#endif
            fread( HrFiltSet_p->lr_energy_and_iac_dyn[i], sizeof( const float ), LR_IAC_LENGTH_NR_FC, f_hrtf );
            HrFiltSet_p->lr_energy_and_iac[i] = (const float *) HrFiltSet_p->lr_energy_and_iac_dyn[i];
        }
@@ -610,12 +627,16 @@ static ivas_error load_reverb_from_binary(
    else
    {
        set_default_reverb_iac_energy( HrFiltSet_p );
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
        return IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA;
#else
        return IVAS_ERR_FAILED_FILE_READ;
#endif
    }

    return IVAS_ERR_OK;
}

#endif

/*---------------------------------------------------------------------*
 * load_reverb_binary()