aboutsummaryrefslogtreecommitdiff
path: root/decoder
diff options
context:
space:
mode:
Diffstat (limited to 'decoder')
-rw-r--r--decoder/ixheaacd_aacdecoder.c6
-rw-r--r--decoder/ixheaacd_api.c7
-rw-r--r--decoder/ixheaacd_headerdecode.c5
-rw-r--r--decoder/ixheaacd_init_config.c3
-rw-r--r--decoder/ixheaacd_mps_bitdec.c20
-rw-r--r--decoder/ixheaacd_mps_parse.c18
6 files changed, 48 insertions, 11 deletions
diff --git a/decoder/ixheaacd_aacdecoder.c b/decoder/ixheaacd_aacdecoder.c
index a5b958f..449c984 100644
--- a/decoder/ixheaacd_aacdecoder.c
+++ b/decoder/ixheaacd_aacdecoder.c
@@ -1120,8 +1120,10 @@ WORD32 ixheaacd_extension_payload(ia_bit_buf_struct *it_bit_buff, WORD32 *cnt,
ixheaacd_read_bits_buf(it_bit_buff, 2);/*anc_type*/
ixheaacd_read_bits_buf(it_bit_buff, 2);/*anc_start_stop*/
- err = ixheaacd_ld_mps_frame_parsing(self, it_bit_buff);
- if (err) return err;
+ if (self->ldmps_config.ldmps_present_flag == 1) {
+ err = ixheaacd_ld_mps_frame_parsing(self, it_bit_buff);
+ if (err) return err;
+ }
*cnt = it_bit_buff->cnt_bits;
break;
diff --git a/decoder/ixheaacd_api.c b/decoder/ixheaacd_api.c
index 9f60ef7..066bf9d 100644
--- a/decoder/ixheaacd_api.c
+++ b/decoder/ixheaacd_api.c
@@ -2452,11 +2452,8 @@ IA_ERRORCODE ixheaacd_dec_init(
(p_obj_exhaacplus_dec->p_state_aac->audio_object_type ==
AOT_ER_AAC_ELD)))
p_obj_exhaacplus_dec->aac_config.flag_to_stereo = 1;
- if (p_state_enhaacplus_dec->mps_dec_handle.ldmps_config
- .ldmps_present_flag == 1) {
- copy_qmf_to_ldmps(&p_obj_exhaacplus_dec->p_state_aac->mps_dec_handle,
- p_state_enhaacplus_dec->sbr_persistent_mem_v);
- }
+ copy_qmf_to_ldmps(&p_obj_exhaacplus_dec->p_state_aac->mps_dec_handle,
+ p_state_enhaacplus_dec->sbr_persistent_mem_v);
if (p_state_enhaacplus_dec->audio_object_type == AOT_AAC_LC &&
p_state_enhaacplus_dec->ui_mps_out_bytes != 0) {
p_state_enhaacplus_dec->heaac_mps_handle.heaac_mps_present = 1;
diff --git a/decoder/ixheaacd_headerdecode.c b/decoder/ixheaacd_headerdecode.c
index 41c4594..03fb067 100644
--- a/decoder/ixheaacd_headerdecode.c
+++ b/decoder/ixheaacd_headerdecode.c
@@ -535,6 +535,11 @@ WORD32 ixheaacd_ga_hdr_dec(ia_aac_dec_state_struct *aac_state_struct,
aac_state_struct->ch_config = ixheaacd_read_bits_buf(it_bit_buff, 4);
+ if (aac_state_struct->audio_object_type == AOT_USAC &&
+ ((aac_state_struct->ch_config >= 3) && (aac_state_struct->ch_config != 8))) {
+ return IA_XHEAAC_DEC_INIT_FATAL_DEC_INIT_FAIL;
+ }
+
pstr_audio_specific_config->channel_configuration =
aac_state_struct->ch_config;
diff --git a/decoder/ixheaacd_init_config.c b/decoder/ixheaacd_init_config.c
index d5373a8..f58b72e 100644
--- a/decoder/ixheaacd_init_config.c
+++ b/decoder/ixheaacd_init_config.c
@@ -644,6 +644,9 @@ WORD32 ixheaacd_config(ia_bit_buf_struct *it_bit_buff, ia_usac_config_struct *ps
if (BS_MAX_NUM_OUT_CHANNELS < pstr_usac_conf->num_out_channels) {
return IA_XHEAAC_DEC_INIT_FATAL_STREAM_CHAN_GT_MAX;
}
+ if (pstr_usac_conf->num_out_channels < 1) {
+ return IA_XHEAAC_DEC_INIT_FATAL_DEC_INIT_FAIL;
+ }
for (i = 0; i < pstr_usac_conf->num_out_channels; i++)
pstr_usac_conf->output_channel_pos[i] =
ixheaacd_read_bits_buf(it_bit_buff, 5);
diff --git a/decoder/ixheaacd_mps_bitdec.c b/decoder/ixheaacd_mps_bitdec.c
index d8a10e4..76d2e32 100644
--- a/decoder/ixheaacd_mps_bitdec.c
+++ b/decoder/ixheaacd_mps_bitdec.c
@@ -511,6 +511,26 @@ static IA_ERRORCODE ixheaacd_ec_data_dec(ia_heaac_mps_state_struct *pstr_mps_sta
(!frame->bs_independency_flag || (set_idx > 0)), 0, 1, pstr_mps_state->ec_flag);
if (error_code != IA_NO_ERROR) return error_code;
+ if (datatype == CLD) {
+ WORD32 band;
+ for (i = 0; i < pstr_mps_state->num_parameter_sets; i++) {
+ for (band = start_band; band < stop_band; band++) {
+ if (data[box_idx][i][band] > 15 || data[box_idx][i][band] < -15) {
+ return IA_FATAL_ERROR;
+ }
+ }
+ }
+ } else if (datatype == ICC) {
+ WORD32 band;
+ for (i = 0; i < pstr_mps_state->num_parameter_sets; i++) {
+ for (band = start_band; band < stop_band; band++) {
+ if (data[box_idx][i][band] > 7 || data[box_idx][i][band] < 0) {
+ return IA_FATAL_ERROR;
+ }
+ }
+ }
+ }
+
for (pb = 0; pb < data_bands; pb++) {
for (i = a_strides[pb]; i < a_strides[pb + 1]; i++) {
lastdata[box_idx][i] = data[box_idx][set_idx + bs_data_pair][start_band + pb];
diff --git a/decoder/ixheaacd_mps_parse.c b/decoder/ixheaacd_mps_parse.c
index 83ffdf3..19b7212 100644
--- a/decoder/ixheaacd_mps_parse.c
+++ b/decoder/ixheaacd_mps_parse.c
@@ -825,12 +825,21 @@ IA_ERRORCODE ixheaacd_ld_mps_frame_parsing(
bits_param_slot = 4;
if (bs_frame_type) {
+ WORD32 prev_param_slot = -1;
for (i = 0; i < self->num_parameter_sets; i++) {
- self->param_slots[i] =
- ixheaacd_read_bits_buf(it_bit_buff, bits_param_slot);
+ self->param_slots[i] = ixheaacd_read_bits_buf(it_bit_buff, bits_param_slot);
+
+ if (prev_param_slot >= self->param_slots[i] || self->param_slots[i] >= self->time_slots) {
+ return IA_FATAL_ERROR;
+ }
+ prev_param_slot = self->param_slots[i];
}
} else {
- self->param_slots[0] = self->time_slots - 1;
+ for (i = 0; i < self->num_parameter_sets; i++) {
+ self->param_slots[i] = (((self->time_slots * (i + 1)) + self->num_parameter_sets - 1) /
+ self->num_parameter_sets) -
+ 1;
+ }
}
frame->independency_flag = ixheaacd_read_bits_buf(it_bit_buff, 1);
@@ -1304,7 +1313,8 @@ IA_ERRORCODE ixheaacd_mps_frame_decode(ia_mps_dec_state_struct *self) {
(WORD32)floor(self->inv_param_slot_diff[0] * 1073741824 + 0.5);
for (i = 1; i < self->num_parameter_sets; i++) {
self->param_slot_diff[i] = self->param_slots[i] - self->param_slots[i - 1];
- if (MAX_TIME_SLOTS < (self->param_slot_diff[0] + self->param_slot_diff[i])) {
+ if ((MAX_TIME_SLOTS < (self->param_slot_diff[0] + self->param_slot_diff[i])) ||
+ (self->param_slot_diff[i] == 0)) {
if (self->ec_flag == 0) {
return -1;
} else {