aboutsummaryrefslogtreecommitdiff
path: root/decoder/ixheaacd_multichannel.c
diff options
context:
space:
mode:
Diffstat (limited to 'decoder/ixheaacd_multichannel.c')
-rw-r--r--decoder/ixheaacd_multichannel.c97
1 files changed, 52 insertions, 45 deletions
diff --git a/decoder/ixheaacd_multichannel.c b/decoder/ixheaacd_multichannel.c
index d914ad2..66c252b 100644
--- a/decoder/ixheaacd_multichannel.c
+++ b/decoder/ixheaacd_multichannel.c
@@ -43,6 +43,9 @@
#include "ixheaacd_drc_data_struct.h"
#include "ixheaacd_lt_predict.h"
+#include "ixheaacd_cnst.h"
+#include "ixheaacd_ec_defines.h"
+#include "ixheaacd_ec_struct_def.h"
#include "ixheaacd_channelinfo.h"
#include "ixheaacd_drc_dec.h"
@@ -68,8 +71,16 @@
#include "ixheaacd_latmdemux.h"
#include "ixheaacd_aacdec.h"
#include "ixheaacd_config.h"
+#include "ixheaacd_hybrid.h"
+#include "ixheaacd_ps_dec.h"
+#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_polyphase.h"
+#include "ixheaacd_mps_macro_def.h"
+#include "ixheaacd_mps_struct_def.h"
+#include "ixheaacd_mps_res_rom.h"
+#include "ixheaacd_mps_aac_struct.h"
#include "ixheaacd_mps_dec.h"
+#include "ixheaacd_mps_interface.h"
#include "ixheaacd_struct_def.h"
#include "ixheaacd_headerdecode.h"
@@ -130,7 +141,7 @@ WORD cblock_decode_huff_symbol(UWORD8 *ptr_read_next, WORD32 bit_pos,
}
IA_ERRORCODE ixheaacd_dec_coupling_channel_element(
- ia_handle_bit_buf_struct bs, ia_aac_decoder_struct *aac_handle,
+ ia_bit_buf_struct *it_bit_buf, ia_aac_decoder_struct *aac_handle,
WORD32 samp_rate_idx, ia_aac_dec_tables_struct *ptr_aac_tables,
ixheaacd_misc_tables *common_tables_ptr, WORD *element_index_order,
ia_enhaacplus_dec_ind_cc *ind_channel_info, WORD32 total_channels,
@@ -142,8 +153,6 @@ IA_ERRORCODE ixheaacd_dec_coupling_channel_element(
WORD ind_sw_cce_flag, num_coupled_elements;
WORD num_gain_element_lists = 0;
- WORD cc_domain;
- WORD gain_element_sign;
WORD gain_element_scale;
const UWORD16 *hcod_sf =
@@ -154,11 +163,11 @@ IA_ERRORCODE ixheaacd_dec_coupling_channel_element(
IA_ERRORCODE error_status = IA_NO_ERROR;
- element_instance_tag = ixheaacd_read_bits_buf(bs, 4);
+ element_instance_tag = ixheaacd_read_bits_buf(it_bit_buf, 4);
element_index_order[0] = element_instance_tag;
- ind_sw_cce_flag = ixheaacd_read_bits_buf(bs, 1);
- num_coupled_elements = ixheaacd_read_bits_buf(bs, 3);
+ ind_sw_cce_flag = ixheaacd_read_bits_buf(it_bit_buf, 1);
+ num_coupled_elements = ixheaacd_read_bits_buf(it_bit_buf, 3);
for (c = 0; c < MAX_BS_ELEMENT; c++)
ind_channel_info->elements_coupled[c] = -1;
@@ -168,11 +177,11 @@ IA_ERRORCODE ixheaacd_dec_coupling_channel_element(
for (c = 0; c < (num_coupled_elements + 1); c++) {
num_gain_element_lists++;
- ind_channel_info->cc_target_is_cpe[c] = ixheaacd_read_bits_buf(bs, 1);
- ind_channel_info->cc_target_tag_select[c] = ixheaacd_read_bits_buf(bs, 4);
+ ind_channel_info->cc_target_is_cpe[c] = ixheaacd_read_bits_buf(it_bit_buf, 1);
+ ind_channel_info->cc_target_tag_select[c] = ixheaacd_read_bits_buf(it_bit_buf, 4);
if (ind_channel_info->cc_target_is_cpe[c]) {
- ind_channel_info->cc_l[c] = ixheaacd_read_bits_buf(bs, 1);
- ind_channel_info->cc_r[c] = ixheaacd_read_bits_buf(bs, 1);
+ ind_channel_info->cc_l[c] = ixheaacd_read_bits_buf(it_bit_buf, 1);
+ ind_channel_info->cc_r[c] = ixheaacd_read_bits_buf(it_bit_buf, 1);
if (ind_channel_info->cc_l[c] && ind_channel_info->cc_r[c])
num_gain_element_lists++;
ind_channel_info->elements_coupled[c] = 1;
@@ -182,9 +191,9 @@ IA_ERRORCODE ixheaacd_dec_coupling_channel_element(
if ((ind_sw_cce_flag == 0) && (num_gain_element_lists > MAX_BS_ELEMENT)) {
return IA_FATAL_ERROR;
}
- cc_domain = ixheaacd_read_bits_buf(bs, 1);
- gain_element_sign = ixheaacd_read_bits_buf(bs, 1);
- gain_element_scale = ixheaacd_read_bits_buf(bs, 2);
+ ixheaacd_read_bits_buf(it_bit_buf, 1);/*cc_domain*/
+ ixheaacd_read_bits_buf(it_bit_buf, 1);/*gain_element_sign*/
+ gain_element_scale = ixheaacd_read_bits_buf(it_bit_buf, 2);
aac_handle->pstr_aac_dec_ch_info[0]->str_ics_info.num_swb_window = 0;
aac_handle->pstr_aac_dec_ch_info[0]->str_ics_info.sampling_rate_index =
@@ -193,7 +202,7 @@ IA_ERRORCODE ixheaacd_dec_coupling_channel_element(
aac_handle->pstr_aac_dec_ch_info[0]->common_window = 0;
error_status = ixheaacd_individual_ch_stream(
- bs, aac_handle, 1, frame_size, total_channels, audio_object_type,
+ it_bit_buf, aac_handle, 1, frame_size, total_channels, audio_object_type,
eld_specific_config, ele_type);
if (error_status) return error_status;
@@ -207,15 +216,15 @@ IA_ERRORCODE ixheaacd_dec_coupling_channel_element(
if (ind_sw_cce_flag)
cge = 1;
else {
- common_gain_element_present[c] = ixheaacd_read_bits_buf(bs, 1);
+ common_gain_element_present[c] = ixheaacd_read_bits_buf(it_bit_buf, 1);
cge = common_gain_element_present[c];
- return IA_ENHAACPLUS_DEC_EXE_FATAL_UNIMPLEMENTED_CCE;
+ return IA_XHEAAC_DEC_EXE_FATAL_UNIMPLEMENTED_CCE;
}
if (cge) {
- UWORD8 *ptr_read_next = bs->ptr_read_next;
- WORD32 bit_pos = 7 - bs->bit_pos;
+ UWORD8 *ptr_read_next = it_bit_buf->ptr_read_next;
+ WORD32 bit_pos = 7 - it_bit_buf->bit_pos;
WORD32 read_word =
- ixheaacd_aac_showbits_32(bs->ptr_read_next, bs->cnt_bits, NULL);
+ ixheaacd_aac_showbits_32(it_bit_buf->ptr_read_next, it_bit_buf->cnt_bits, NULL);
UWORD32 read_word1;
read_word1 = read_word << bit_pos;
@@ -227,9 +236,9 @@ IA_ERRORCODE ixheaacd_dec_coupling_channel_element(
while (bit_pos > 8)
ixheaacd_aac_read_byte(&ptr_read_next, &bit_pos, &read_word);
- bs->ptr_read_next = ptr_read_next;
- bs->bit_pos = 7 - bit_pos;
- bs->cnt_bits -= length;
+ it_bit_buf->ptr_read_next = ptr_read_next;
+ it_bit_buf->bit_pos = 7 - bit_pos;
+ it_bit_buf->cnt_bits -= length;
norm_value = index - 60;
if (norm_value == -1)
@@ -246,47 +255,45 @@ IA_ERRORCODE ixheaacd_dec_coupling_channel_element(
}
}
} else {
- return IA_ENHAACPLUS_DEC_EXE_FATAL_UNIMPLEMENTED_CCE;
+ return IA_XHEAAC_DEC_EXE_FATAL_UNIMPLEMENTED_CCE;
}
}
- if (bs->cnt_bits < 0) {
- return IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES;
+ if (it_bit_buf->cnt_bits < 0) {
+ return IA_XHEAAC_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES;
}
return error_status;
}
-void ixheaacd_dec_couple_channel(WORD16 *p_time_data, WORD16 *out_samp_cc,
+void ixheaacd_dec_couple_channel(WORD32 *p_time_data, WORD32 *out_samp_cc,
WORD16 frame_size, WORD total_channels,
- WORD32 gain_cc)
+ WORD16 gain_cc)
{
WORD i;
- WORD16 out_cc;
- WORD16 *ptr_out_samp = &out_samp_cc[0];
+ WORD32 out_cc;
+ WORD32 *ptr_out_samp = &out_samp_cc[0];
for (i = frame_size - 1; i >= 0; i--) {
- out_cc = ixheaacd_round16(ixheaacd_shl32_sat(
- ixheaacd_mult32x16in32(gain_cc, *ptr_out_samp++), 3));
- *p_time_data = ixheaacd_add16_sat(out_cc, *p_time_data);
+ out_cc = (ixheaacd_shl32_sat(
+ ixheaacd_mult32x16in32(*ptr_out_samp++, gain_cc), 3));
+ *p_time_data = ixheaacd_add32_sat(out_cc, *p_time_data);
p_time_data += total_channels;
}
}
void ixheaacd_dec_ind_coupling(
- ia_exhaacplus_dec_api_struct *p_obj_exhaacplus_dec, WORD16 *coup_ch_output,
- WORD16 frame_size, WORD total_channels, WORD16 *ptr_time_data)
+ ia_exhaacplus_dec_api_struct *p_obj_exhaacplus_dec, WORD32 *coup_ch_output,
+ WORD16 frame_size, WORD total_channels, VOID *ptr_time_data_tmp)
{
WORD c, j, k;
WORD l;
- WORD coupling_channel;
-
- WORD16 *out_samp_cc;
+ WORD32 *out_samp_cc;
ia_enhaacplus_dec_ind_cc *ind_channel_info;
- {
- coupling_channel = p_obj_exhaacplus_dec->aac_config.ui_coupling_channel;
+ WORD32 *ptr_time_data = (WORD32 *)ptr_time_data_tmp;
+ {
ind_channel_info = &p_obj_exhaacplus_dec->p_state_aac->ind_cc_info;
out_samp_cc = coup_ch_output;
@@ -308,18 +315,18 @@ void ixheaacd_dec_ind_coupling(
k = p_obj_exhaacplus_dec->aac_config.slot_element[l];
if (ind_channel_info->cc_target_is_cpe[c] == 0) {
- WORD16 *p_time_data = &ptr_time_data[k];
+ WORD32 *p_time_data = &ptr_time_data[k];
- WORD32 gain_cc = ind_channel_info->cc_gain[j];
+ WORD16 gain_cc = ixheaacd_round16(ind_channel_info->cc_gain[j]);
ixheaacd_dec_couple_channel(p_time_data, out_samp_cc, frame_size,
total_channels, gain_cc);
}
if (ind_channel_info->cc_target_is_cpe[c] == 1) {
if (ind_channel_info->cc_l[c] == 1) {
- WORD16 *p_time_data = &ptr_time_data[k];
+ WORD32 *p_time_data = &ptr_time_data[k];
- WORD32 gain_cc = ind_channel_info->cc_gain[j];
+ WORD16 gain_cc = ixheaacd_round16(ind_channel_info->cc_gain[j]);
ixheaacd_dec_couple_channel(p_time_data, out_samp_cc, frame_size,
total_channels, gain_cc);
@@ -328,8 +335,8 @@ void ixheaacd_dec_ind_coupling(
k = p_obj_exhaacplus_dec->aac_config.slot_element[l];
if (ind_channel_info->cc_r[c] == 1) {
- WORD16 *p_time_data = &ptr_time_data[k + 1];
- WORD32 gain_cc = ind_channel_info->cc_gain[j + 1];
+ WORD32 *p_time_data = &ptr_time_data[k + 1];
+ WORD16 gain_cc = ixheaacd_round16(ind_channel_info->cc_gain[j + 1]);
ixheaacd_dec_couple_channel(p_time_data, out_samp_cc, frame_size,
total_channels, gain_cc);