diff --git a/decoder/ixheaacd_create.c b/decoder/ixheaacd_create.c index 918d84f..4866fe1 100644 --- a/decoder/ixheaacd_create.c +++ b/decoder/ixheaacd_create.c @@ -394,7 +394,9 @@ WORD32 ixheaacd_dec_data_init(VOID *handle, &usac_data->ccfl, &usac_data->output_samples, &pstr_frame_data->str_layer.sample_rate_layer, &layer_config->samp_frequency_index); - + if (!pstr_frame_data->str_layer.sample_rate_layer) { + return -1; + } pstr_stream_config->sampling_frequency = pstr_frame_data->str_layer.sample_rate_layer; pstr_stream_config->samp_frequency_index = layer_config->samp_frequency_index; diff --git a/decoder/ixheaacd_esbr_envcal.c b/decoder/ixheaacd_esbr_envcal.c index 677c616..f5aa413 100644 --- a/decoder/ixheaacd_esbr_envcal.c +++ b/decoder/ixheaacd_esbr_envcal.c @@ -329,11 +329,13 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data, FLOAT32 c++; } - if (!int_mode) { + if (!int_mode && ui != li) { for (nrg = 0, k = c - (ui - li); k < c; k++) { nrg += nrg_est_pvc[k][t]; } nrg /= (ui - li); + } else { + nrg = 0; } c -= (ui - li); @@ -453,11 +455,13 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data, FLOAT32 c++; } - if (!int_mode) { + if (!int_mode && ui != li) { for (nrg = 0, k = c - (ui - li); k < c; k++) { nrg += nrg_est_pvc[k][t]; } nrg /= (ui - li); + } else { + nrg = 0; } c -= (ui - li); @@ -669,11 +673,13 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data, FLOAT32 rate * p_frame_info->border_vec[i]); } } - if (!int_mode) { + if (!int_mode && ui != li) { for (nrg = 0, k = c - (ui - li); k < c; k++) { nrg += nrg_est[k]; } nrg /= (ui - li); + } else { + nrg = 0; } c -= (ui - li);