Commit c141724e authored by TYAGIRIS's avatar TYAGIRIS
Browse files

remove unnecessary memory allocation

parent 9d18c11e
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@
#define NONBE_FIX_871_ACELP_CRASH_IN_OSBA                     /* FhG: isse 871: crash in ACELP core encoder with OSBA */
#define NONBE_FIX_225_MASA_EXT_REND                           /* Nokia: Resolve #225: Complete MASA external renderer implementation */
#define NONBE_FIX_897_USAN_WITH_MASA_RENDERING                /* Nokia: issue #897: USAN null pointer in MASA external renderer to Ambisonics */
//#define NONBE_FIX_862_UBSAN_SPAR_DEC_BR_SW_PLC                /* DLB: issue 862 : UBSAN: out-of-bound error in SPAR for OSBA bitrate switching with PLC*/
#define NONBE_FIX_862_UBSAN_SPAR_DEC_BR_SW_PLC                /* DLB: issue 862 : UBSAN: out-of-bound error in SPAR for OSBA bitrate switching with PLC*/
/* ##################### End NON-BE switches ########################### */

/* ################## End DEVELOPMENT switches ######################### */
+0 −22
Original line number Diff line number Diff line
@@ -108,12 +108,6 @@ ivas_error ivas_spar_md_dec_matrix_open(
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for band_coeffs in SPAR MD" );
    }
#ifdef NONBE_FIX_862_UBSAN_SPAR_DEC_BR_SW_PLC
    if ( ( hMdDec->band_coeffs_prev = (ivas_band_coeffs_t *) malloc( IVAS_MAX_NUM_BANDS * sizeof( ivas_band_coeffs_t ) ) ) == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for band_coeffs in SPAR MD" );
    }
#endif
    if ( ( hMdDec->mixer_mat = (float ***) malloc( num_channels * sizeof( float ** ) ) ) == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" );
@@ -376,13 +370,6 @@ void ivas_spar_md_dec_matrix_close(
        free( hMdDecoder->spar_md.band_coeffs );
        hMdDecoder->spar_md.band_coeffs = NULL;
    }
#ifdef NONBE_FIX_862_UBSAN_SPAR_DEC_BR_SW_PLC
    if ( hMdDecoder->band_coeffs_prev != NULL )
    {
        free( hMdDecoder->band_coeffs_prev );
        hMdDecoder->band_coeffs_prev = NULL;
    }
#endif

    if ( hMdDecoder->mixer_mat != NULL )
    {
@@ -561,17 +548,11 @@ ivas_error ivas_spar_md_dec_init(
    /* initialize PLC state */
    set_s( hMdDec->valid_bands, 0, IVAS_MAX_NUM_BANDS );
    set_s( hMdDec->base_band_age, 0, IVAS_MAX_NUM_BANDS );
#ifdef NONBE_FIX_862_UBSAN_SPAR_DEC_BR_SW_PLC
    set_s( hMdDec->base_band_coeffs_age, 0, IVAS_MAX_NUM_BANDS );
#endif
    hMdDec->spar_plc_num_lost_frames = 0;
    hMdDec->spar_plc_enable_fadeout_flag = 1;
    hMdDec->dtx_md_smoothing_cntr = 1;

    ivas_clear_band_coeffs( hMdDec->spar_md.band_coeffs, IVAS_MAX_NUM_BANDS );
#ifdef NONBE_FIX_862_UBSAN_SPAR_DEC_BR_SW_PLC
    ivas_clear_band_coeffs( hMdDec->band_coeffs_prev, IVAS_MAX_NUM_BANDS );
#endif
    ivas_clear_band_coeff_idx( hMdDec->spar_md.band_coeffs_idx, IVAS_MAX_NUM_BANDS );
    ivas_clear_band_coeff_idx( hMdDec->spar_md_prev.band_coeffs_idx, IVAS_MAX_NUM_BANDS );
    ivas_clear_band_coeff_idx( hMdDec->spar_md_prev.band_coeffs_idx_mapped, IVAS_MAX_NUM_BANDS );
@@ -595,9 +576,6 @@ ivas_error ivas_spar_md_dec_init(
            set_zero( hMdDec->mixer_mat_prev2[i][j], IVAS_MAX_NUM_BANDS );
        }
    }
#ifdef NONBE_FIX_862_UBSAN_SPAR_DEC_BR_SW_PLC
    hMdDec->first_valid_frame = 0;
#endif

    return IVAS_ERR_OK;
}
+0 −5
Original line number Diff line number Diff line
@@ -603,11 +603,6 @@ typedef struct ivas_spar_md_dec_state_t
    float smooth_buf[IVAS_MAX_NUM_BANDS][2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1];
    float smooth_fac[IVAS_MAX_NUM_BANDS];
    float mixer_mat_prev2[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS];
#ifdef NONBE_FIX_862_UBSAN_SPAR_DEC_BR_SW_PLC
    int16_t first_valid_frame;
    ivas_band_coeffs_t *band_coeffs_prev;
    int16_t base_band_coeffs_age[IVAS_MAX_NUM_BANDS];
#endif
} ivas_spar_md_dec_state_t;