From d880b2f9eef8d151275d8666885c44cd78c9734d Mon Sep 17 00:00:00 2001 From: ShashankPathmudi <146080254+ShashankPathmudi@users.noreply.github.com> Date: Fri, 29 Mar 2024 09:49:01 +0530 Subject: Decoder Enhancements (#82) Significance: ======== [x] Aligned buffer access for scratch memory and scratch memory optimization. Testing: ===== [x] MSVS Conformance and CTS are passing. [x] All previous fuzzer crashes are tested. No crash observed. [x] For platforms, Conformance tested with different combinations. [x] Tested Conformance with gcc builds for x86, x86_64, armv7 and armv8. [x] Tested Conformance with clang builds with address and memory sanitizer flags for x86_64 and armv8. --- common/ixheaac_constants.h | 2 + decoder/ixheaacd_aacdecoder.c | 10 +- decoder/ixheaacd_api.c | 210 +++++++++++------------------ decoder/ixheaacd_channelinfo.h | 3 +- decoder/ixheaacd_mps_apply_m1.c | 9 +- decoder/ixheaacd_mps_apply_m2.c | 3 +- decoder/ixheaacd_mps_bitdec.c | 52 ++++--- decoder/ixheaacd_mps_blind.c | 16 ++- decoder/ixheaacd_mps_calc_m1m2_emm.c | 20 +-- decoder/ixheaacd_mps_calc_m1m2_tree_515x.c | 202 +++++++++++++++++---------- decoder/ixheaacd_mps_calc_m1m2_tree_51sx.c | 44 +++--- decoder/ixheaacd_mps_calc_m1m2_tree_52xx.c | 81 +++++++---- decoder/ixheaacd_mps_calc_m1m2_tree_727x.c | 204 ++++++++++++++++++---------- decoder/ixheaacd_mps_calc_m1m2_tree_757x.c | 88 +++++++----- decoder/ixheaacd_mps_dec.h | 4 +- decoder/ixheaacd_mps_decorr.c | 9 +- decoder/ixheaacd_mps_initfuncs.c | 115 ++++++++++++---- decoder/ixheaacd_mps_mdct_2_qmf.c | 28 ++-- decoder/ixheaacd_mps_reshape_bb_env.c | 12 +- decoder/ixheaacd_mps_smoothing.c | 7 +- decoder/ixheaacd_mps_temp_process.c | 35 +++-- decoder/ixheaacd_mps_tonality.c | 22 +-- decoder/ixheaacd_process.c | 18 +-- decoder/ixheaacd_sbrdecoder.h | 2 - 24 files changed, 729 insertions(+), 467 deletions(-) diff --git a/common/ixheaac_constants.h b/common/ixheaac_constants.h index 361b8ba..905ad75 100644 --- a/common/ixheaac_constants.h +++ b/common/ixheaac_constants.h @@ -85,5 +85,7 @@ #define BYTE_ALIGN_8 (8) #define IXHEAAC_GET_SIZE_ALIGNED(size, alignment) ((size + (alignment - 1)) & ~(alignment - 1)) +#define IXHEAAC_GET_SIZE_ALIGNED_TYPE(num_ele, ele_size, alignment) \ + ((((num_ele * ele_size) + (alignment - 1)) & ~(alignment - 1)) / ele_size) #endif /* IXHEAAC_CONSTANTS_H */ diff --git a/decoder/ixheaacd_aacdecoder.c b/decoder/ixheaacd_aacdecoder.c index 449c984..5dcfd7d 100644 --- a/decoder/ixheaacd_aacdecoder.c +++ b/decoder/ixheaacd_aacdecoder.c @@ -277,13 +277,15 @@ WORD32 ixheaacd_aacdec_decodeframe( } if ((object_type == AOT_ER_AAC_LD) || (object_type == AOT_AAC_LTP)) { if (aac_dec_handle->samples_per_frame <= 512) { + aac_dec_handle->pstr_aac_dec_ch_info[ch]->str_ics_info.ltp2.lag = + aac_dec_handle->ptr_aac_dec_static_channel_info[ch]->ltp_lag_1; aac_dec_handle->pstr_aac_dec_ch_info[ch]->str_ics_info.ltp.lag = - aac_dec_handle->ptr_aac_dec_static_channel_info[ch]->ltp_lag; + aac_dec_handle->ptr_aac_dec_static_channel_info[ch]->ltp_lag_2; } aac_dec_handle->pstr_aac_dec_ch_info[ch]->ltp_buf = aac_dec_handle->ptr_aac_dec_static_channel_info[ch]->ltp_buf; aac_dec_handle->pstr_aac_dec_ch_info[ch]->ltp_lag = - aac_dec_handle->ptr_aac_dec_static_channel_info[ch]->ltp_lag; + aac_dec_handle->ptr_aac_dec_static_channel_info[ch]->ltp_lag_1; } aac_dec_handle->pstr_aac_dec_ch_info[ch]->scratch_buf_ptr = work_buffer_2; @@ -897,7 +899,9 @@ WORD32 ixheaacd_aacdec_decodeframe( if (object_type == AOT_ER_AAC_LD) { for (ch = 0; ch < channel; ch++) { - aac_dec_handle->ptr_aac_dec_static_channel_info[ch]->ltp_lag = + aac_dec_handle->ptr_aac_dec_static_channel_info[ch]->ltp_lag_1 = + aac_dec_handle->pstr_aac_dec_ch_info[ch]->str_ics_info.ltp2.lag; + aac_dec_handle->ptr_aac_dec_static_channel_info[ch]->ltp_lag_2 = aac_dec_handle->pstr_aac_dec_ch_info[ch]->str_ics_info.ltp.lag; } } diff --git a/decoder/ixheaacd_api.c b/decoder/ixheaacd_api.c index b707df0..739d1e3 100644 --- a/decoder/ixheaacd_api.c +++ b/decoder/ixheaacd_api.c @@ -122,11 +122,50 @@ #define NUM_AAC_TABLES 8 -#define IXHEAACD_CCE_DEC_INFO_MEM_SIZE (610) -#define IXHEAACD_CCE_DEC_INFO_MEM_SIZE_8 (IXHEAACD_CCE_DEC_INFO_MEM_SIZE + 8) - #define LD_OBJ -2 +#define SCR_BASE_SCR_8K_SIZE \ + (IXHEAAC_GET_SIZE_ALIGNED((2 * CHANNELS * MAX_BINS_LONG * sizeof(WORD32)), BYTE_ALIGN_8)) +#define SCR_EXTRA_SCR_4K_0_SIZE \ + (2 * IXHEAAC_GET_SIZE_ALIGNED(sizeof(ia_aac_dec_channel_info_struct), sizeof(WORD32)) + \ + 2 * IXHEAAC_GET_SIZE_ALIGNED(sizeof(ia_aac_sfb_code_book_struct), sizeof(WORD32)) + \ + IXHEAAC_GET_SIZE_ALIGNED(sizeof(ia_pns_stereo_data_struct), sizeof(WORD32))) +#define SCR_EXTRA_SCR_4K_2_SIZE \ + (IXHEAAC_GET_SIZE_ALIGNED((IA_ENHAACPLUS_DEC_SAMPLES_PER_FRAME * sizeof(WORD32)), BYTE_ALIGN_8)) +#define SCR_EXTRA_SCR_4K_3_SIZE \ + (IXHEAAC_GET_SIZE_ALIGNED((IA_ENHAACPLUS_DEC_SAMPLES_PER_FRAME * sizeof(WORD32)), BYTE_ALIGN_8)) +#define SCR_OUT_DATA_SIZE \ + (IXHEAAC_GET_SIZE_ALIGNED((IA_ENHAACPLUS_DEC_SAMPLES_PER_FRAME * sizeof(WORD32)), BYTE_ALIGN_8)) +#define SCR_IN_DATA_SIZE \ + (2 * IXHEAAC_GET_SIZE_ALIGNED((IA_ENHAACPLUS_DEC_SAMPLES_PER_FRAME * sizeof(WORD32)), \ + BYTE_ALIGN_8)) +#define SCR_INTER_SCR_SIZE \ + (MAX_CHANNEL_COUNT * \ + IXHEAAC_GET_SIZE_ALIGNED((IA_ENHAACPLUS_DEC_SAMPLES_PER_FRAME * sizeof(WORD16)), \ + BYTE_ALIGN_8)) +#define SCR_COUP_CH_OUT_SIZE \ + (MAX_CHANNEL_COUNT * \ + IXHEAAC_GET_SIZE_ALIGNED((IA_ENHAACPLUS_DEC_SAMPLES_PER_FRAME * sizeof(WORD16)), \ + BYTE_ALIGN_8)) + +#define P_IND_CH_INFO_OFFSET \ + (SCR_BASE_SCR_8K_SIZE + SCR_EXTRA_SCR_4K_0_SIZE + SCR_EXTRA_SCR_4K_2_SIZE) + +#define HEAACV2_MAX_SIZE \ + (max(SCR_BASE_SCR_8K_SIZE + SCR_EXTRA_SCR_4K_0_SIZE + SCR_EXTRA_SCR_4K_2_SIZE + \ + SCR_INTER_SCR_SIZE + SCR_COUP_CH_OUT_SIZE, \ + MPS_SCRATCH_MEM_SIZE)) +#define ELDV2_MAX_SIZE \ + (max(SCR_BASE_SCR_8K_SIZE + SCR_EXTRA_SCR_4K_0_SIZE + SCR_EXTRA_SCR_4K_2_SIZE + \ + SCR_EXTRA_SCR_4K_3_SIZE + SCR_INTER_SCR_SIZE + SCR_COUP_CH_OUT_SIZE, \ + MPS_SCRATCH_MEM_SIZE)) +#define LD_MAX_SIZE \ + (max(SCR_BASE_SCR_8K_SIZE + SCR_EXTRA_SCR_4K_0_SIZE + SCR_EXTRA_SCR_4K_2_SIZE + \ + SCR_OUT_DATA_SIZE + SCR_IN_DATA_SIZE + SCR_INTER_SCR_SIZE + SCR_COUP_CH_OUT_SIZE, \ + MPS_SCRATCH_MEM_SIZE)) + +#define MAX_SCR_SIZE (max(max(HEAACV2_MAX_SIZE, ELDV2_MAX_SIZE), LD_MAX_SIZE)) + IA_ERRORCODE ixheaacd_dec_mem_api(ia_exhaacplus_dec_api_struct *p_obj_exhaacplus_dec, WORD32 i_cmd, WORD32 i_idx, VOID *pv_value) { pUWORD32 pui_value = pv_value; @@ -256,63 +295,50 @@ static VOID ixheaacd_allocate_aac_scr( ia_aac_dec_scratch_struct *aac_scratch_struct, VOID *base_scratch_ptr, VOID *output_ptr, WORD channel, WORD max_channel, WORD32 audio_object_type) { + WORD32 scratch_used = 0; aac_scratch_struct->base_scr_8k = base_scratch_ptr; aac_scratch_struct->extra_scr_4k[1] = (WORD8 *)base_scratch_ptr; + scratch_used += SCR_BASE_SCR_8K_SIZE; if (channel == 1) { - aac_scratch_struct->extra_scr_4k[0] = - (WORD8 *)base_scratch_ptr + (IXHEAACD_CCE_DEC_INFO_MEM_SIZE_8 * 1024) + - (4 * 1024); + aac_scratch_struct->extra_scr_4k[0] = (WORD8 *)base_scratch_ptr + scratch_used; + scratch_used += SCR_EXTRA_SCR_4K_0_SIZE; + aac_scratch_struct->extra_scr_4k[2] = (WORD8 *)base_scratch_ptr + scratch_used; + scratch_used += SCR_EXTRA_SCR_4K_2_SIZE; } else { aac_scratch_struct->extra_scr_4k[0] = output_ptr; if (max_channel > 2) { - aac_scratch_struct->extra_scr_4k[0] = - (WORD8 *)base_scratch_ptr + - (IXHEAACD_CCE_DEC_INFO_MEM_SIZE_8 * 1024) + (8 * 1024); + aac_scratch_struct->extra_scr_4k[0] = (WORD8 *)base_scratch_ptr + scratch_used; + scratch_used += SCR_EXTRA_SCR_4K_0_SIZE; } + aac_scratch_struct->extra_scr_4k[2] = (WORD8 *)base_scratch_ptr + scratch_used; + scratch_used += SCR_EXTRA_SCR_4K_2_SIZE; } - aac_scratch_struct->extra_scr_4k[2] = - (WORD8 *)base_scratch_ptr + (IXHEAACD_CCE_DEC_INFO_MEM_SIZE_8 * 1024) + - (46 * 1024); + if (audio_object_type == AOT_ER_AAC_ELD || audio_object_type == AOT_ER_AAC_LD) { + aac_scratch_struct->extra_scr_4k[0] = (WORD8 *)base_scratch_ptr + scratch_used; + scratch_used += SCR_EXTRA_SCR_4K_0_SIZE; - if (audio_object_type == AOT_ER_AAC_ELD || - audio_object_type == AOT_ER_AAC_LD) { - aac_scratch_struct->extra_scr_4k[0] = - (WORD8 *)base_scratch_ptr + (IXHEAACD_CCE_DEC_INFO_MEM_SIZE_8 * 1024) + - (4 * 1024); + aac_scratch_struct->extra_scr_4k[2] = (WORD8 *)base_scratch_ptr + scratch_used; + scratch_used += SCR_EXTRA_SCR_4K_2_SIZE; - aac_scratch_struct->extra_scr_4k[2] = - (WORD8 *)base_scratch_ptr + (IXHEAACD_CCE_DEC_INFO_MEM_SIZE_8 * 1024) + - (46 * 1024); - - aac_scratch_struct->extra_scr_4k[3] = - (WORD8 *)base_scratch_ptr + (IXHEAACD_CCE_DEC_INFO_MEM_SIZE_8 * 1024) + - (54 * 1024); + aac_scratch_struct->extra_scr_4k[3] = (WORD8 *)base_scratch_ptr + scratch_used; + scratch_used += SCR_EXTRA_SCR_4K_3_SIZE; } - if ((audio_object_type == AOT_ER_AAC_LD) || - (audio_object_type == AOT_AAC_LTP)) { - aac_scratch_struct->in_data = - (WORD32 *)((WORD8 *)base_scratch_ptr + - (IXHEAACD_CCE_DEC_INFO_MEM_SIZE_8 * 1024) + (62 * 1024) + - (4 * 16)); - aac_scratch_struct->out_data = - (WORD32 *)((WORD8 *)base_scratch_ptr + - (IXHEAACD_CCE_DEC_INFO_MEM_SIZE_8 * 1024) + (56 * 1024) + - (4 * 16)); + if ((audio_object_type == AOT_ER_AAC_LD) || (audio_object_type == AOT_AAC_LTP)) { + aac_scratch_struct->out_data = (WORD32 *)((WORD8 *)base_scratch_ptr + scratch_used); + scratch_used += SCR_OUT_DATA_SIZE; + + aac_scratch_struct->in_data = (WORD32 *)((WORD8 *)base_scratch_ptr + scratch_used); + scratch_used += SCR_IN_DATA_SIZE; } } -VOID ixheaacd_allocate_sbr_scr(ia_sbr_scr_struct *sbr_scratch_struct, - VOID *base_scratch_ptr, VOID *output_ptr, - WORD total_elements, WORD ch_fac, - WORD32 audio_object_type, WORD32 total_channels, - WORD8 *p_qshift_arr, UWORD8 slot_pos, - UWORD8 num_ch) { - WORD32 temp = 0; +VOID ixheaacd_allocate_sbr_scr(ia_sbr_scr_struct *sbr_scratch_struct, VOID *base_scratch_ptr, + VOID *output_ptr, WORD32 total_channels, WORD8 *p_qshift_arr, + UWORD8 slot_pos, UWORD8 num_ch) { WORD32 j, i; sbr_scratch_struct->ptr_work_buf_core = base_scratch_ptr; - sbr_scratch_struct->ptr_work_buf = (WORD8 *)base_scratch_ptr + (18 * 1024); if (p_qshift_arr != NULL && *p_qshift_arr != LD_OBJ) { WORD32 *tmp_buf = (WORD32 *)output_ptr; @@ -341,34 +367,6 @@ VOID ixheaacd_allocate_sbr_scr(ia_sbr_scr_struct *sbr_scratch_struct, } } } - if (total_elements > 1) { - sbr_scratch_struct->extra_scr_1k[0] = - (WORD8 *)base_scratch_ptr + (18 * 1024); - - sbr_scratch_struct->extra_scr_1k[1] = - (WORD8 *)base_scratch_ptr + (19 * 1024); - } - - else { - if (ch_fac == 1) { - temp = 2; - } else { - temp = 4; - } - - if (audio_object_type != AOT_ER_AAC_ELD) { - sbr_scratch_struct->extra_scr_1k[0] = (WORD8 *)output_ptr + (temp * 1024); - - sbr_scratch_struct->extra_scr_1k[1] = - (WORD8 *)base_scratch_ptr + (18 * 1024); - } else { - sbr_scratch_struct->extra_scr_1k[0] = - (WORD8 *)base_scratch_ptr + (18 * 1024); - - sbr_scratch_struct->extra_scr_1k[1] = - (WORD8 *)base_scratch_ptr + (19 * 1024); - } - } } VOID ixheaacd_get_lib_id_strings(pVOID pv_output) { @@ -1338,49 +1336,8 @@ VOID ixheaacd_fill_aac_mem_tables( p_mem_info_aac = &p_obj_exhaacplus_dec->p_mem_info_aac[IA_ENHAACPLUS_DEC_SCRATCH_IDX]; - { - if (num_channels > 2) { - WORD32 other_scr1; - WORD32 other_scr2 = 0; - - p_mem_info_aac->ui_size = - 2 * sizeof(WORD32) * IA_ENHAACPLUS_DEC_SAMPLES_PER_FRAME; - - other_scr2 = 2 * sizeof(WORD32) * IA_ENHAACPLUS_DEC_SAMPLES_PER_FRAME; - - other_scr1 = (4 * 1024); - - if (MAX_CC_CHANNEL_NUM > 0) { - other_scr1 += - sizeof(WORD16) * IA_ENHAACPLUS_DEC_SAMPLES_PER_FRAME * 2; - other_scr1 += (4 * 1024); - - other_scr1 += 4 * 12; - } - - p_mem_info_aac->ui_size += max(other_scr1, other_scr2); - - } else { - p_mem_info_aac->ui_size = - 2 * sizeof(WORD32) * IA_ENHAACPLUS_DEC_SAMPLES_PER_FRAME; - - p_mem_info_aac->ui_size += - 2 * sizeof(WORD32) * IA_ENHAACPLUS_DEC_SAMPLES_PER_FRAME; - - p_mem_info_aac->ui_size += - sizeof(WORD32) * IA_ENHAACPLUS_DEC_SAMPLES_PER_FRAME; - p_mem_info_aac->ui_size += 4 * 12; - - p_mem_info_aac->ui_size += - ((IA_ENHAACPLUS_DEC_SAMPLES_PER_FRAME << 1) * sizeof(WORD32)); - p_mem_info_aac->ui_size += - ((IA_ENHAACPLUS_DEC_SAMPLES_PER_FRAME << 1) * sizeof(WORD32)); - p_mem_info_aac->ui_size += - 2 * (sizeof(ia_sbr_frame_info_data_struct) + 232); - } - } + p_mem_info_aac->ui_size = MAX_SCR_SIZE; - p_mem_info_aac->ui_size += 2200000 + 2048 + MPS_SCRATCH_MEM_SIZE; p_mem_info_aac->ui_alignment = 8; p_mem_info_aac->ui_type = IA_MEMTYPE_SCRATCH; } @@ -2196,10 +2153,8 @@ IA_ERRORCODE ixheaacd_dec_init( p_state_enhaacplus_dec->pstr_stream_sbr[0][0].no_elements) { ia_sbr_scr_struct sbr_scratch_struct; WORD16 num_channels_1_t = num_channels_1; - ixheaacd_allocate_sbr_scr( - &sbr_scratch_struct, p_state_enhaacplus_dec->aac_scratch_mem_v, - time_data, 1, 1, p_state_enhaacplus_dec->audio_object_type, 0, NULL, - 0, 0); + ixheaacd_allocate_sbr_scr(&sbr_scratch_struct, p_state_enhaacplus_dec->aac_scratch_mem_v, + time_data, 0, NULL, 0, 0); { WORD32 audio_object_type = p_state_enhaacplus_dec->audio_object_type; @@ -2794,7 +2749,7 @@ IA_ERRORCODE ixheaacd_dec_execute( if (p_obj_exhaacplus_dec->aac_config.ui_max_channels > 2) { WORD32 scratch_pointer; - scratch_pointer = 12 * 1024; + scratch_pointer = (MAX_SCR_SIZE - SCR_INTER_SCR_SIZE); p_state_enhaacplus_dec->coup_ch_output = (WORD32 *)((WORD8 *) @@ -3054,9 +3009,8 @@ IA_ERRORCODE ixheaacd_dec_execute( } } - WORD16 *intermediate_scr = - (WORD16 *)(WORD8 *)p_state_enhaacplus_dec->aac_scratch_mem_v + - (128 * 1024); + WORD16 *intermediate_scr = (WORD16 *)(WORD8 *)p_state_enhaacplus_dec->aac_scratch_mem_v + + (MAX_SCR_SIZE - SCR_INTER_SCR_SIZE - SCR_COUP_CH_OUT_SIZE); for (ch_idx1 = 0; ch_idx1 < total_elements; ch_idx1++) { WORD32 skip_full_decode = 0; @@ -3174,9 +3128,8 @@ IA_ERRORCODE ixheaacd_dec_execute( &p_state_enhaacplus_dec->ind_cc_info; if (p_obj_exhaacplus_dec->aac_config.element_instance_order[ch_idx] != p_obj_exhaacplus_dec->aac_config.ui_coupling_channel) { - WORD32 pers_used = 0; skip_full_decode = 1; - pers_used = ixheaacd_set_aac_persistent_buffers( + ixheaacd_set_aac_persistent_buffers( p_state_enhaacplus_dec->pers_mem_ptr, channel); { @@ -3212,8 +3165,7 @@ IA_ERRORCODE ixheaacd_dec_execute( } } p_state_enhaacplus_dec->pstr_aac_dec_info[ch_idx]->p_ind_channel_info = - (WORD8 *)p_state_enhaacplus_dec->aac_scratch_mem_v + (8 * 1024) + - pers_used; + (WORD8 *)p_state_enhaacplus_dec->aac_scratch_mem_v + (P_IND_CH_INFO_OFFSET); } if (p_obj_exhaacplus_dec->aac_config.element_type[1] < 3 && p_obj_exhaacplus_dec->aac_config.element_type[1] > 0 && @@ -3366,12 +3318,10 @@ IA_ERRORCODE ixheaacd_dec_execute( if (p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx] && p_state_enhaacplus_dec->pstr_stream_sbr[0][0].no_elements) { ia_sbr_scr_struct sbr_scratch_struct; - ixheaacd_allocate_sbr_scr( - &sbr_scratch_struct, p_state_enhaacplus_dec->aac_scratch_mem_v, - time_data, total_elements, ch_fac, - p_state_enhaacplus_dec->audio_object_type, total_channels, - p_obj_exhaacplus_dec->p_state_aac->qshift_adj, - p_state_enhaacplus_dec->slot_pos, channel); + ixheaacd_allocate_sbr_scr(&sbr_scratch_struct, p_state_enhaacplus_dec->aac_scratch_mem_v, + time_data, total_channels, + p_obj_exhaacplus_dec->p_state_aac->qshift_adj, + p_state_enhaacplus_dec->slot_pos, channel); p_state_enhaacplus_dec->sbr_present = 1; p_state_enhaacplus_dec->peak_lim_init = 0; diff --git a/decoder/ixheaacd_channelinfo.h b/decoder/ixheaacd_channelinfo.h index f17d26a..8334b37 100644 --- a/decoder/ixheaacd_channelinfo.h +++ b/decoder/ixheaacd_channelinfo.h @@ -292,7 +292,8 @@ typedef struct { ia_aac_dec_ola_data overlap_add_data; WORD16 *ltp_buf; - UWORD16 ltp_lag; + UWORD16 ltp_lag_1; + UWORD16 ltp_lag_2; ia_ec_state_str str_ec_state; } ia_aac_dec_channel_info; diff --git a/decoder/ixheaacd_mps_apply_m1.c b/decoder/ixheaacd_mps_apply_m1.c index c0bdfb1..983a44b 100644 --- a/decoder/ixheaacd_mps_apply_m1.c +++ b/decoder/ixheaacd_mps_apply_m1.c @@ -72,9 +72,12 @@ VOID ixheaacd_mps_apply_m1(ia_heaac_mps_state_struct *pstr_mps_state) { params[3] = hybrid_bands; rout_real_ptr = pstr_mps_state->mps_scratch_mem_v; - rout_kernel_real_ptr = rout_real_ptr + TSXHB; - rout_imag_ptr = rout_kernel_real_ptr + TSXHB; - rout_kernel_imag_ptr = rout_imag_ptr + TSXHB; + rout_kernel_real_ptr = rout_real_ptr + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + TSXHB, sizeof(*rout_kernel_real_ptr), BYTE_ALIGN_8); + rout_imag_ptr = rout_kernel_real_ptr + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(TSXHB, sizeof(*rout_imag_ptr), BYTE_ALIGN_8); + rout_kernel_imag_ptr = rout_imag_ptr + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + TSXHB, sizeof(*rout_kernel_imag_ptr), BYTE_ALIGN_8); p_buffer_real = p_array_struct->buf_real; p_buffer_imag = p_array_struct->buf_imag; diff --git a/decoder/ixheaacd_mps_apply_m2.c b/decoder/ixheaacd_mps_apply_m2.c index ce109ba..3237380 100644 --- a/decoder/ixheaacd_mps_apply_m2.c +++ b/decoder/ixheaacd_mps_apply_m2.c @@ -89,7 +89,8 @@ VOID ixheaacd_apply_m2(ia_heaac_mps_state_struct *pstr_mps_state) { params[3] = hybrid_bands; rout_ptr = pstr_mps_state->mps_scratch_mem_v; - rout_kernel_ptr = rout_ptr + TSXHB; + rout_kernel_ptr = + rout_ptr + IXHEAAC_GET_SIZE_ALIGNED_TYPE(TSXHB, sizeof(*rout_kernel_ptr), BYTE_ALIGN_8); p_hyb_out_dry_real = p_array_struct->hyb_output_real_dry; p_hyb_out_dry_imag = p_array_struct->hyb_output_imag_dry; diff --git a/decoder/ixheaacd_mps_bitdec.c b/decoder/ixheaacd_mps_bitdec.c index 76d2e32..10c9fbd 100644 --- a/decoder/ixheaacd_mps_bitdec.c +++ b/decoder/ixheaacd_mps_bitdec.c @@ -699,17 +699,21 @@ static IA_ERRORCODE ixheaacd_parse_extension_frame(ia_heaac_mps_state_struct *ps for (ch = 0; ch < 2; ch++) { pstr_mps_state->p_aac_decoder_channel_info[ch] = free_scratch; - free_scratch = (WORD8 *)free_scratch + sizeof(ia_mps_dec_residual_channel_info_struct); + free_scratch = + (WORD8 *)free_scratch + + IXHEAAC_GET_SIZE_ALIGNED(sizeof(ia_mps_dec_residual_channel_info_struct), BYTE_ALIGN_8); pstr_mps_state->p_aac_decoder_dynamic_data_init[ch] = free_scratch; - free_scratch = (WORD8 *)free_scratch + sizeof(ia_mps_dec_residual_dynamic_data_struct); + free_scratch = + (WORD8 *)free_scratch + + IXHEAAC_GET_SIZE_ALIGNED(sizeof(ia_mps_dec_residual_dynamic_data_struct), BYTE_ALIGN_8); pstr_mps_state->p_aac_decoder_channel_info[ch]->p_scale_factor = pstr_mps_state->p_aac_decoder_dynamic_data_init[ch]->a_scale_factor; pstr_mps_state->p_aac_decoder_channel_info[ch]->p_code_book = pstr_mps_state->p_aac_decoder_dynamic_data_init[ch]->a_code_book; pstr_mps_state->p_aac_decoder_channel_info[ch]->p_spectral_coefficient = free_scratch; - free_scratch = (WORD8 *)free_scratch + 4096; + free_scratch = (WORD8 *)free_scratch + IXHEAAC_GET_SIZE_ALIGNED(4096, BYTE_ALIGN_8); pstr_mps_state->p_aac_decoder_channel_info[ch]->p_tns_scratch = free_scratch; - free_scratch = (WORD8 *)free_scratch + 4096; + free_scratch = (WORD8 *)free_scratch + IXHEAAC_GET_SIZE_ALIGNED(4096, BYTE_ALIGN_8); pstr_mps_state->p_aac_decoder_channel_info[ch]->ics_info.frame_length = AAC_FRAME_LENGTH; pstr_mps_state->p_aac_decoder_channel_info[ch]->common_window = 0; } @@ -1473,9 +1477,12 @@ static IA_ERRORCODE ixheaacd_map_index_data( db_1 = ott_vs_tot_db_1; db_2 = ott_vs_tot_db_2; a_param_slots = scratch; - a_interpolate = a_param_slots + MAX_PARAMETER_SETS; - a_map = a_interpolate + MAX_PARAMETER_SETS; - free_scratch = a_map + MAX_PARAMETER_BANDS_PLUS_1; + a_interpolate = a_param_slots + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + MAX_PARAMETER_SETS, sizeof(*a_interpolate), BYTE_ALIGN_8); + a_map = a_interpolate + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_SETS, sizeof(*a_map), BYTE_ALIGN_8); + free_scratch = a_map + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS_PLUS_1, sizeof(*a_map), + BYTE_ALIGN_8); data_sets = 0; for (i = 0; i < num_parameter_sets; i++) { @@ -1736,16 +1743,23 @@ static IA_ERRORCODE ixheaacd_decode_and_map_frame_ott(ia_heaac_mps_state_struct WORD32 quant_mode = curr_state->quant_mode; tot_db = pstr_mps_state->mps_scratch_mem_v; - ott_vs_tot_db_fc = tot_db + MAX_PSXPB; - ott_vs_tot_db_s = ott_vs_tot_db_fc + MAX_PSXPB; - ott_vs_tot_db_f = ott_vs_tot_db_s + MAX_PSXPB; - ott_vs_tot_db_c = ott_vs_tot_db_f + MAX_PSXPB; - ott_vs_tot_db_lr = ott_vs_tot_db_c + MAX_PSXPB; - ott_vs_tot_db_l = ott_vs_tot_db_lr + MAX_PSXPB; - ott_vs_tot_db_r = ott_vs_tot_db_l + MAX_PSXPB; - tmp1 = ott_vs_tot_db_r + MAX_PSXPB; - tmp2 = tmp1 + MAX_PSXPB; - free_scratch = tmp2 + MAX_PSXPB; + ott_vs_tot_db_fc = + tot_db + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PSXPB, sizeof(*ott_vs_tot_db_fc), BYTE_ALIGN_8); + ott_vs_tot_db_s = ott_vs_tot_db_fc + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + MAX_PSXPB, sizeof(*ott_vs_tot_db_s), BYTE_ALIGN_8); + ott_vs_tot_db_f = ott_vs_tot_db_s + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + MAX_PSXPB, sizeof(*ott_vs_tot_db_f), BYTE_ALIGN_8); + ott_vs_tot_db_c = ott_vs_tot_db_f + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + MAX_PSXPB, sizeof(*ott_vs_tot_db_c), BYTE_ALIGN_8); + ott_vs_tot_db_lr = ott_vs_tot_db_c + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + MAX_PSXPB, sizeof(*ott_vs_tot_db_lr), BYTE_ALIGN_8); + ott_vs_tot_db_l = ott_vs_tot_db_lr + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + MAX_PSXPB, sizeof(*ott_vs_tot_db_l), BYTE_ALIGN_8); + ott_vs_tot_db_r = ott_vs_tot_db_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + MAX_PSXPB, sizeof(*ott_vs_tot_db_r), BYTE_ALIGN_8); + tmp1 = ott_vs_tot_db_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PSXPB, sizeof(*tmp1), BYTE_ALIGN_8); + tmp2 = tmp1 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PSXPB, sizeof(*tmp2), BYTE_ALIGN_8); + free_scratch = tmp2 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PSXPB, sizeof(*tmp2), BYTE_ALIGN_8); p_cur_bs = pstr_mps_state->bs_frame; num_ott_boxes = curr_state->num_ott_boxes; @@ -2026,7 +2040,9 @@ static VOID ixheaacd_decode_and_map_frame_smg(ia_heaac_mps_state_struct *pstr_mp ia_mps_dec_spatial_bs_frame_struct *frame = pstr_mps_state->bs_frame; pstr_mps_state->smooth_control = frame->bs_smooth_control; a_group_to_band = pstr_mps_state->mps_scratch_mem_v; - free_scratch = a_group_to_band + MAX_PARAMETER_BANDS_PLUS_1; + free_scratch = + a_group_to_band + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS_PLUS_1, + sizeof(*a_group_to_band), BYTE_ALIGN_8); if (pstr_mps_state->smooth_control) { for (ps = 0; ps < pstr_mps_state->num_parameter_sets; ps++) { diff --git a/decoder/ixheaacd_mps_blind.c b/decoder/ixheaacd_mps_blind.c index ab4860a..41aa698 100644 --- a/decoder/ixheaacd_mps_blind.c +++ b/decoder/ixheaacd_mps_blind.c @@ -301,11 +301,17 @@ static VOID ixheaacd_update_down_mix_state(ia_heaac_mps_state_struct *pstr_mps_s WORD32 num_parameter_bands = pstr_mps_state->num_parameter_bands; WORD32 hybrid_bands = pstr_mps_state->hybrid_bands; excitation_0 = pstr_mps_state->mps_scratch_mem_v; - q_excitation_0 = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + PARAMETER_BANDSX2; - excitation_1 = excitation_0 + PARAMETER_BANDSX1_5; - q_excitation_1 = q_excitation_0 + PARAMETER_BANDSX3; - excitation_2 = excitation_1 + PARAMETER_BANDSX1_5; - q_excitation_2 = q_excitation_1 + PARAMETER_BANDSX3; + q_excitation_0 = + (WORD16 *)pstr_mps_state->mps_scratch_mem_v + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(PARAMETER_BANDSX2, sizeof(*q_excitation_0), BYTE_ALIGN_8); + excitation_1 = excitation_0 + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + PARAMETER_BANDSX1_5, sizeof(*excitation_1), BYTE_ALIGN_8); + q_excitation_1 = q_excitation_0 + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + PARAMETER_BANDSX3, sizeof(*q_excitation_1), BYTE_ALIGN_8); + excitation_2 = excitation_1 + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + PARAMETER_BANDSX1_5, sizeof(*excitation_2), BYTE_ALIGN_8); + q_excitation_2 = q_excitation_1 + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + PARAMETER_BANDSX3, sizeof(*q_excitation_2), BYTE_ALIGN_8); p_x_real = &pstr_mps_state->array_struct->x_real[offset * MAX_HYBRID_BANDS]; p_x_imag = &pstr_mps_state->array_struct->x_imag[offset * MAX_HYBRID_BANDS]; diff --git a/decoder/ixheaacd_mps_calc_m1m2_emm.c b/decoder/ixheaacd_mps_calc_m1m2_emm.c index fa8b0de..9a696fe 100644 --- a/decoder/ixheaacd_mps_calc_m1m2_emm.c +++ b/decoder/ixheaacd_mps_calc_m1m2_emm.c @@ -56,14 +56,18 @@ VOID ixheaacd_calc_m1m2_emm(ia_heaac_mps_state_struct *pstr_mps_state) { WORD16 *dummy3, *dummy4; h11 = pstr_mps_state->mps_scratch_mem_v; - h12 = h11 + MAX_PARAMETER_BANDS; - h21 = h12 + MAX_PARAMETER_BANDS; - h22 = h21 + MAX_PARAMETER_BANDS; - dummy1 = h22 + MAX_PARAMETER_BANDS; - dummy2 = dummy1 + MAX_PARAMETER_BANDS; - - dummy3 = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + PARAMETER_BANDSX12; - dummy4 = dummy3 + MAX_PARAMETER_BANDS; + h12 = h11 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12), BYTE_ALIGN_8); + h21 = h12 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21), BYTE_ALIGN_8); + h22 = h21 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22), BYTE_ALIGN_8); + dummy1 = + h22 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*dummy1), BYTE_ALIGN_8); + dummy2 = + dummy1 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*dummy2), BYTE_ALIGN_8); + + dummy3 = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(PARAMETER_BANDSX12, sizeof(*dummy3), BYTE_ALIGN_8); + dummy4 = + dummy3 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*dummy4), BYTE_ALIGN_8); for (ps = 0; ps < pstr_mps_state->num_parameter_sets; ps++) { ixheaacd_param_2_umx_ps(pstr_mps_state, h11, h12, h21, h22, dummy1, dummy2, dummy3, dummy4, 0, diff --git a/decoder/ixheaacd_mps_calc_m1m2_tree_515x.c b/decoder/ixheaacd_mps_calc_m1m2_tree_515x.c index 8144951..634782e 100644 --- a/decoder/ixheaacd_mps_calc_m1m2_tree_515x.c +++ b/decoder/ixheaacd_mps_calc_m1m2_tree_515x.c @@ -74,40 +74,73 @@ VOID ixheaacd_calc_m1m2_5151(ia_heaac_mps_state_struct *pstr_mps_state) { WORD32 *res_bands = pstr_mps_state->res_bands; h11_fs = pstr_mps_state->mps_scratch_mem_v; - h11_c = h11_fs + MAX_PARAMETER_BANDS; - h12_fs = h11_c + MAX_PARAMETER_BANDS; - h12_c = h12_fs + MAX_PARAMETER_BANDS; - h21_fs = h12_c + MAX_PARAMETER_BANDS; - h21_c = h21_fs + MAX_PARAMETER_BANDS; - h22_fs = h21_c + MAX_PARAMETER_BANDS; - h22_c = h22_fs + MAX_PARAMETER_BANDS; - h12_res_fs = h22_c + MAX_PARAMETER_BANDS; - h12_res_c = h12_res_fs + MAX_PARAMETER_BANDS; - h22_res_fs = h12_res_c + MAX_PARAMETER_BANDS; - h22_res_c = h22_res_fs + MAX_PARAMETER_BANDS; - h11_f = h22_res_c + MAX_PARAMETER_BANDS; - h11_s = h11_f + MAX_PARAMETER_BANDS; - h12_f = h11_s + MAX_PARAMETER_BANDS; - h12_s = h12_f + MAX_PARAMETER_BANDS; - h21_f = h12_s + MAX_PARAMETER_BANDS; - h21_s = h21_f + MAX_PARAMETER_BANDS; - h22_f = h21_s + MAX_PARAMETER_BANDS; - h22_s = h22_f + MAX_PARAMETER_BANDS; - h12_res_f = h22_s + MAX_PARAMETER_BANDS; - h12_res_s = h12_res_f + MAX_PARAMETER_BANDS; - h22_res_f = h12_res_s + MAX_PARAMETER_BANDS; - h22_res_s = h22_res_f + MAX_PARAMETER_BANDS; - c_r_clfe = h22_res_s + MAX_PARAMETER_BANDS; - c_l_clfe = c_r_clfe + MAX_PARAMETER_BANDS; - - c_l_fs = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + PARAMETER_BANDSX52; - c_l_c = c_l_fs + MAX_PARAMETER_BANDS; - c_r_fs = c_l_c + MAX_PARAMETER_BANDS; - c_r_c = c_r_fs + MAX_PARAMETER_BANDS; - c_l_f = c_r_c + MAX_PARAMETER_BANDS; - c_l_s = c_l_f + MAX_PARAMETER_BANDS; - c_r_f = c_l_s + MAX_PARAMETER_BANDS; - c_r_s = c_r_f + MAX_PARAMETER_BANDS; + h11_c = + h11_fs + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11_c), BYTE_ALIGN_8); + h12_fs = + h11_c + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_fs), BYTE_ALIGN_8); + h12_c = + h12_fs + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_c), BYTE_ALIGN_8); + h21_fs = + h12_c + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_fs), BYTE_ALIGN_8); + h21_c = + h21_fs + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_c), BYTE_ALIGN_8); + h22_fs = + h21_c + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_fs), BYTE_ALIGN_8); + h22_c = + h22_fs + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_c), BYTE_ALIGN_8); + h12_res_fs = h22_c + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_fs), + BYTE_ALIGN_8); + h12_res_c = h12_res_fs + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_c), + BYTE_ALIGN_8); + h22_res_fs = h12_res_c + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_fs), + BYTE_ALIGN_8); + h22_res_c = h22_res_fs + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_c), + BYTE_ALIGN_8); + h11_f = h22_res_c + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11_f), BYTE_ALIGN_8); + h11_s = + h11_f + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11_s), BYTE_ALIGN_8); + h12_f = + h11_s + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_f), BYTE_ALIGN_8); + h12_s = + h12_f + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_s), BYTE_ALIGN_8); + h21_f = + h12_s + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_f), BYTE_ALIGN_8); + h21_s = + h21_f + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_s), BYTE_ALIGN_8); + h22_f = + h21_s + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_f), BYTE_ALIGN_8); + h22_s = + h22_f + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_s), BYTE_ALIGN_8); + h12_res_f = h22_s + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_f), + BYTE_ALIGN_8); + h12_res_s = h12_res_f + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_s), + BYTE_ALIGN_8); + h22_res_f = h12_res_s + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_f), + BYTE_ALIGN_8); + h22_res_s = h22_res_f + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_s), + BYTE_ALIGN_8); + c_r_clfe = h22_res_s + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_r_clfe), BYTE_ALIGN_8); + c_l_clfe = c_r_clfe + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_l_clfe), BYTE_ALIGN_8); + + c_l_fs = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(PARAMETER_BANDSX52, sizeof(*c_l_fs), BYTE_ALIGN_8); + c_l_c = + c_l_fs + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_l_c), BYTE_ALIGN_8); + c_r_fs = + c_l_c + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_r_fs), BYTE_ALIGN_8); + c_r_c = + c_r_fs + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_r_c), BYTE_ALIGN_8); + c_l_f = + c_r_c + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_l_f), BYTE_ALIGN_8); + c_l_s = + c_l_f + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_l_s), BYTE_ALIGN_8); + c_r_f = + c_l_s + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_r_f), BYTE_ALIGN_8); + c_r_s = + c_r_f + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_r_s), BYTE_ALIGN_8); for (ps = 0; ps < num_parameter_sets; ps++) { ixheaacd_param_2_umx_ps(pstr_mps_state, h11_fs, h12_fs, h21_fs, h22_fs, h12_res_fs, @@ -277,40 +310,73 @@ VOID ixheaacd_calc_m1m2_5152(ia_heaac_mps_state_struct *pstr_mps_state) { WORD32 *res_bands = pstr_mps_state->res_bands; h11_lr = pstr_mps_state->mps_scratch_mem_v; - h11_c = h11_lr + MAX_PARAMETER_BANDS; - h12_lr = h11_c + MAX_PARAMETER_BANDS; - h12_c = h12_lr + MAX_PARAMETER_BANDS; - h21_lr = h12_c + MAX_PARAMETER_BANDS; - h21_c = h21_lr + MAX_PARAMETER_BANDS; - h22_lr = h21_c + MAX_PARAMETER_BANDS; - h22_c = h22_lr + MAX_PARAMETER_BANDS; - h12_res_lr = h22_c + MAX_PARAMETER_BANDS; - h12_res_c = h12_res_lr + MAX_PARAMETER_BANDS; - h22_res_lr = h12_res_c + MAX_PARAMETER_BANDS; - h22_res_c = h22_res_lr + MAX_PARAMETER_BANDS; - h11_l = h22_res_c + MAX_PARAMETER_BANDS; - h11_r = h11_l + MAX_PARAMETER_BANDS; - h12_l = h11_r + MAX_PARAMETER_BANDS; - h12_r = h12_l + MAX_PARAMETER_BANDS; - h21_l = h12_r + MAX_PARAMETER_BANDS; - h21_r = h21_l + MAX_PARAMETER_BANDS; - h22_l = h21_r + MAX_PARAMETER_BANDS; - h22_r = h22_l + MAX_PARAMETER_BANDS; - h12_res_l = h22_r + MAX_PARAMETER_BANDS; - h12_res_r = h12_res_l + MAX_PARAMETER_BANDS; - h22_res_l = h12_res_r + MAX_PARAMETER_BANDS; - h22_res_r = h22_res_l + MAX_PARAMETER_BANDS; - c_r_clfe = h22_res_r + MAX_PARAMETER_BANDS; - c_l_clfe = c_r_clfe + MAX_PARAMETER_BANDS; - - c_l_lr = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + PARAMETER_BANDSX52; - c_l_c = c_l_lr + MAX_PARAMETER_BANDS; - c_r_lr = c_l_c + MAX_PARAMETER_BANDS; - c_r_c = c_r_lr + MAX_PARAMETER_BANDS; - c_l_l = c_r_c + MAX_PARAMETER_BANDS; - c_l_r = c_l_l + MAX_PARAMETER_BANDS; - c_r_l = c_l_r + MAX_PARAMETER_BANDS; - c_r_r = c_r_l + MAX_PARAMETER_BANDS; + h11_c = + h11_lr + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11_c), BYTE_ALIGN_8); + h12_lr = + h11_c + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_lr), BYTE_ALIGN_8); + h12_c = + h12_lr + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_c), BYTE_ALIGN_8); + h21_lr = + h12_c + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_lr), BYTE_ALIGN_8); + h21_c = + h21_lr + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_c), BYTE_ALIGN_8); + h22_lr = + h21_c + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_lr), BYTE_ALIGN_8); + h22_c = + h22_lr + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_c), BYTE_ALIGN_8); + h12_res_lr = h22_c + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_lr), + BYTE_ALIGN_8); + h12_res_c = h12_res_lr + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_c), + BYTE_ALIGN_8); + h22_res_lr = h12_res_c + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_lr), + BYTE_ALIGN_8); + h22_res_c = h22_res_lr + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_c), + BYTE_ALIGN_8); + h11_l = h22_res_c + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11_l), BYTE_ALIGN_8); + h11_r = + h11_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11_r), BYTE_ALIGN_8); + h12_l = + h11_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_l), BYTE_ALIGN_8); + h12_r = + h12_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_r), BYTE_ALIGN_8); + h21_l = + h12_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_l), BYTE_ALIGN_8); + h21_r = + h21_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_r), BYTE_ALIGN_8); + h22_l = + h21_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_l), BYTE_ALIGN_8); + h22_r = + h22_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_r), BYTE_ALIGN_8); + h12_res_l = h22_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_l), + BYTE_ALIGN_8); + h12_res_r = h12_res_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_r), + BYTE_ALIGN_8); + h22_res_l = h12_res_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_l), + BYTE_ALIGN_8); + h22_res_r = h22_res_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_r), + BYTE_ALIGN_8); + c_r_clfe = h22_res_r + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_r_clfe), BYTE_ALIGN_8); + c_l_clfe = c_r_clfe + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_l_clfe), BYTE_ALIGN_8); + + c_l_lr = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(PARAMETER_BANDSX52, sizeof(*c_l_lr), BYTE_ALIGN_8); + c_l_c = + c_l_lr + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_l_c), BYTE_ALIGN_8); + c_r_lr = + c_l_c + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_r_lr), BYTE_ALIGN_8); + c_r_c = + c_r_lr + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_r_c), BYTE_ALIGN_8); + c_l_l = + c_r_c + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_l_l), BYTE_ALIGN_8); + c_l_r = + c_l_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_l_r), BYTE_ALIGN_8); + c_r_l = + c_l_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_r_l), BYTE_ALIGN_8); + c_r_r = + c_r_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_r_r), BYTE_ALIGN_8); for (ps = 0; ps < num_parameter_sets; ps++) { ixheaacd_param_2_umx_ps(pstr_mps_state, h11_c, h12_c, h21_c, h22_c, h12_res_c, h22_res_c, diff --git a/decoder/ixheaacd_mps_calc_m1m2_tree_51sx.c b/decoder/ixheaacd_mps_calc_m1m2_tree_51sx.c index a2a7d58..2ce148e 100644 --- a/decoder/ixheaacd_mps_calc_m1m2_tree_51sx.c +++ b/decoder/ixheaacd_mps_calc_m1m2_tree_51sx.c @@ -67,15 +67,18 @@ VOID ixheaacd_calc_m1m2_51s1(ia_heaac_mps_state_struct *pstr_mps_state) { WORD32 num_parameter_sets = pstr_mps_state->num_parameter_sets; WORD32 num_parameter_bands = pstr_mps_state->num_parameter_bands; iid = pstr_mps_state->mps_scratch_mem_v; - icc = iid + MAX_PARAMETER_BANDS; - h11 = icc + MAX_PARAMETER_BANDS; - h12 = h11 + MAX_PARAMETER_BANDS; - h21 = h12 + MAX_PARAMETER_BANDS; - h22 = h21 + MAX_PARAMETER_BANDS; - h12_res = h22 + MAX_PARAMETER_BANDS; - h22_res = h12_res + MAX_PARAMETER_BANDS; - c_l = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + PARAMETER_BANDSX16; - c_r = c_l + MAX_PARAMETER_BANDS; + icc = iid + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*icc), BYTE_ALIGN_8); + h11 = icc + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11), BYTE_ALIGN_8); + h12 = h11 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12), BYTE_ALIGN_8); + h21 = h12 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21), BYTE_ALIGN_8); + h22 = h21 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22), BYTE_ALIGN_8); + h12_res = + h22 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res), BYTE_ALIGN_8); + h22_res = h12_res + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res), BYTE_ALIGN_8); + c_l = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(PARAMETER_BANDSX16, sizeof(*c_l), BYTE_ALIGN_8); + c_r = c_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_r), BYTE_ALIGN_8); for (ps = 0; ps < num_parameter_sets; ps++) { for (pb = 0; pb < num_parameter_bands; pb++) { @@ -200,16 +203,19 @@ VOID ixheaacd_calc_m1m2_51s2(ia_heaac_mps_state_struct *pstr_mps_state) { WORD32 num_parameter_bands = pstr_mps_state->num_parameter_bands; iid = pstr_mps_state->mps_scratch_mem_v; - icc = iid + MAX_PARAMETER_BANDS; - h11 = icc + MAX_PARAMETER_BANDS; - h12 = h11 + MAX_PARAMETER_BANDS; - h21 = h12 + MAX_PARAMETER_BANDS; - h22 = h21 + MAX_PARAMETER_BANDS; - h12_res = h22 + MAX_PARAMETER_BANDS; - h22_res = h12_res + MAX_PARAMETER_BANDS; - g_s = h22_res + MAX_PARAMETER_BANDS; - c_l = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + PARAMETER_BANDSX18; - c_r = c_l + MAX_PARAMETER_BANDS; + icc = iid + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*icc), BYTE_ALIGN_8); + h11 = icc + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11), BYTE_ALIGN_8); + h12 = h11 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12), BYTE_ALIGN_8); + h21 = h12 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21), BYTE_ALIGN_8); + h22 = h21 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22), BYTE_ALIGN_8); + h12_res = + h22 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res), BYTE_ALIGN_8); + h22_res = h12_res + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res), BYTE_ALIGN_8); + g_s = h22_res + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*g_s), BYTE_ALIGN_8); + c_l = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(PARAMETER_BANDSX18, sizeof(*c_l), BYTE_ALIGN_8); + c_r = c_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_r), BYTE_ALIGN_8); for (ps = 0; ps < num_parameter_sets; ps++) { for (pb = 0; pb < num_parameter_bands; pb++) { diff --git a/decoder/ixheaacd_mps_calc_m1m2_tree_52xx.c b/decoder/ixheaacd_mps_calc_m1m2_tree_52xx.c index 90341e3..3a066a4 100644 --- a/decoder/ixheaacd_mps_calc_m1m2_tree_52xx.c +++ b/decoder/ixheaacd_mps_calc_m1m2_tree_52xx.c @@ -70,15 +70,20 @@ VOID ixheaacd_calc_m1m2_5227(ia_heaac_mps_state_struct *pstr_mps_state) { const WORD32 *cld_tab_1 = pstr_mps_state->ia_mps_dec_mps_table.m1_m2_table_ptr->cld_tab_1; lf = pstr_mps_state->mps_scratch_mem_v; - ls = lf + MAX_PARAMETER_BANDS; - rf = ls + MAX_PARAMETER_BANDS; - rs = rf + MAX_PARAMETER_BANDS; - a_c1 = rs + MAX_PARAMETER_BANDS; - a_c2 = a_c1 + MAX_PARAMETER_BANDS; - a_icc_c = a_c2 + MAX_PARAMETER_BANDS; - a_prediction_mode = a_icc_c + MAX_PARAMETER_BANDS; - m_real = a_prediction_mode + MAX_PARAMETER_BANDS; - m_imag = m_real + PARAMETER_BANDSX15; + ls = lf + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*ls), BYTE_ALIGN_8); + rf = ls + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*rf), BYTE_ALIGN_8); + rs = rf + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*rs), BYTE_ALIGN_8); + a_c1 = rs + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*a_c1), BYTE_ALIGN_8); + a_c2 = a_c1 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*a_c2), BYTE_ALIGN_8); + a_icc_c = + a_c2 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*a_icc_c), BYTE_ALIGN_8); + a_prediction_mode = + a_icc_c + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*a_prediction_mode), + BYTE_ALIGN_8); + m_real = a_prediction_mode + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*m_real), BYTE_ALIGN_8); + m_imag = + m_real + IXHEAAC_GET_SIZE_ALIGNED_TYPE(PARAMETER_BANDSX15, sizeof(*m_imag), BYTE_ALIGN_8); for (i = 0; i < PARAMETER_BANDSX15; i++) { m_real[i] = 0; @@ -295,26 +300,44 @@ VOID ixheaacd_calc_m1m2_5251(ia_heaac_mps_state_struct *pstr_mps_state) { WORD64 acc; h11_l = pstr_mps_state->mps_scratch_mem_v; - h11_r = h11_l + MAX_PARAMETER_BANDS; - h12_l = h11_r + MAX_PARAMETER_BANDS; - h12_r = h12_l + MAX_PARAMETER_BANDS; - h21_l = h12_r + MAX_PARAMETER_BANDS; - h21_r = h21_l + MAX_PARAMETER_BANDS; - h22_l = h21_r + MAX_PARAMETER_BANDS; - h22_r = h22_l + MAX_PARAMETER_BANDS; - h12_res_l = h22_r + MAX_PARAMETER_BANDS; - h12_res_r = h12_res_l + MAX_PARAMETER_BANDS; - h22_res_l = h12_res_r + MAX_PARAMETER_BANDS; - h22_res_r = h22_res_l + MAX_PARAMETER_BANDS; - c_l_clfe = h22_res_r + MAX_PARAMETER_BANDS; - c_r_clfe = c_l_clfe + MAX_PARAMETER_BANDS; - kappa = c_r_clfe + MAX_PARAMETER_BANDS; - g_dd = kappa + MAX_PARAMETER_BANDS; - - c_f_l = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + PARAMETER_BANDSX32; - c_f_r = c_f_l + MAX_PARAMETER_BANDS; - dummy1 = c_f_r + MAX_PARAMETER_BANDS; - dummy2 = dummy1 + MAX_PARAMETER_BANDS; + h11_r = + h11_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11_r), BYTE_ALIGN_8); + h12_l = + h11_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_l), BYTE_ALIGN_8); + h12_r = + h12_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_r), BYTE_ALIGN_8); + h21_l = + h12_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_l), BYTE_ALIGN_8); + h21_r = + h21_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_r), BYTE_ALIGN_8); + h22_l = + h21_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_l), BYTE_ALIGN_8); + h22_r = + h22_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_r), BYTE_ALIGN_8); + h12_res_l = h22_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_l), + BYTE_ALIGN_8); + h12_res_r = h12_res_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_r), + BYTE_ALIGN_8); + h22_res_l = h12_res_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_l), + BYTE_ALIGN_8); + h22_res_r = h22_res_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_r), + BYTE_ALIGN_8); + c_l_clfe = h22_res_r + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_l_clfe), BYTE_ALIGN_8); + c_r_clfe = c_l_clfe + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_r_clfe), BYTE_ALIGN_8); + kappa = + c_r_clfe + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*kappa), BYTE_ALIGN_8); + g_dd = kappa + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*g_dd), BYTE_ALIGN_8); + + c_f_l = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(PARAMETER_BANDSX32, sizeof(*c_f_l), BYTE_ALIGN_8); + c_f_r = + c_f_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_f_r), BYTE_ALIGN_8); + dummy1 = + c_f_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*dummy1), BYTE_ALIGN_8); + dummy2 = + dummy1 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*dummy2), BYTE_ALIGN_8); if (enable_additionals) { if (mode_1 == 0 && diff --git a/decoder/ixheaacd_mps_calc_m1m2_tree_727x.c b/decoder/ixheaacd_mps_calc_m1m2_tree_727x.c index cb35749..5dbb846 100644 --- a/decoder/ixheaacd_mps_calc_m1m2_tree_727x.c +++ b/decoder/ixheaacd_mps_calc_m1m2_tree_727x.c @@ -81,40 +81,71 @@ VOID ixheaacd_calc_m1m2_7271(ia_heaac_mps_state_struct *pstr_mps_state) { WORD32 pos_resid[5] = {0}; h11_l = pstr_mps_state->mps_scratch_mem_v; - h11_r = h11_l + MAX_PARAMETER_BANDS; - h12_l = h11_r + MAX_PARAMETER_BANDS; - h12_r = h12_l + MAX_PARAMETER_BANDS; - h21_l = h12_r + MAX_PARAMETER_BANDS; - h21_r = h21_l + MAX_PARAMETER_BANDS; - h22_l = h21_r + MAX_PARAMETER_BANDS; - h22_r = h22_l + MAX_PARAMETER_BANDS; - h12_res_l = h22_r + MAX_PARAMETER_BANDS; - h12_res_r = h12_res_l + MAX_PARAMETER_BANDS; - h22_res_l = h12_res_r + MAX_PARAMETER_BANDS; - h22_res_r = h22_res_l + MAX_PARAMETER_BANDS; - c_l_clfe = h22_res_r + MAX_PARAMETER_BANDS; - c_r_clfe = c_l_clfe + MAX_PARAMETER_BANDS; - kappa = c_r_clfe + MAX_PARAMETER_BANDS; - g_dd = kappa + MAX_PARAMETER_BANDS; - - h11_lc = g_dd + MAX_PARAMETER_BANDS; - h11_rc = h11_lc + MAX_PARAMETER_BANDS; - h12_lc = h11_rc + MAX_PARAMETER_BANDS; - h12_rc = h12_lc + MAX_PARAMETER_BANDS; - h21_lc = h12_rc + MAX_PARAMETER_BANDS; - h21_rc = h21_lc + MAX_PARAMETER_BANDS; - h22_lc = h21_rc + MAX_PARAMETER_BANDS; - h22_rc = h22_lc + MAX_PARAMETER_BANDS; - h12_res_lc = h22_rc + MAX_PARAMETER_BANDS; - h12_res_rc = h12_res_lc + MAX_PARAMETER_BANDS; - h22_res_lc = h12_res_rc + MAX_PARAMETER_BANDS; - h22_res_rc = h22_res_lc + MAX_PARAMETER_BANDS; - - c_f_l = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + PARAMETER_BANDSX56; - c_f_r = c_f_l + MAX_PARAMETER_BANDS; - dummy = c_f_r + MAX_PARAMETER_BANDS; - c_f_lc = dummy + MAX_PARAMETER_BANDS; - c_f_rc = c_f_lc + MAX_PARAMETER_BANDS; + h11_r = + h11_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11_r), BYTE_ALIGN_8); + h12_l = + h11_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_l), BYTE_ALIGN_8); + h12_r = + h12_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_r), BYTE_ALIGN_8); + h21_l = + h12_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_l), BYTE_ALIGN_8); + h21_r = + h21_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_r), BYTE_ALIGN_8); + h22_l = + h21_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_l), BYTE_ALIGN_8); + h22_r = + h22_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_r), BYTE_ALIGN_8); + h12_res_l = h22_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_l), + BYTE_ALIGN_8); + h12_res_r = h12_res_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_r), + BYTE_ALIGN_8); + h22_res_l = h12_res_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_l), + BYTE_ALIGN_8); + h22_res_r = h22_res_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_r), + BYTE_ALIGN_8); + c_l_clfe = h22_res_r + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_l_clfe), BYTE_ALIGN_8); + c_r_clfe = c_l_clfe + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_r_clfe), BYTE_ALIGN_8); + kappa = + c_r_clfe + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*kappa), BYTE_ALIGN_8); + g_dd = kappa + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*g_dd), BYTE_ALIGN_8); + + h11_lc = + g_dd + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11_lc), BYTE_ALIGN_8); + h11_rc = + h11_lc + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11_rc), BYTE_ALIGN_8); + h12_lc = + h11_rc + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_lc), BYTE_ALIGN_8); + h12_rc = + h12_lc + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_rc), BYTE_ALIGN_8); + h21_lc = + h12_rc + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_lc), BYTE_ALIGN_8); + h21_rc = + h21_lc + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_rc), BYTE_ALIGN_8); + h22_lc = + h21_rc + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_lc), BYTE_ALIGN_8); + h22_rc = + h22_lc + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_rc), BYTE_ALIGN_8); + h12_res_lc = h22_rc + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_lc), + BYTE_ALIGN_8); + h12_res_rc = h12_res_lc + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, + sizeof(*h12_res_rc), BYTE_ALIGN_8); + h22_res_lc = h12_res_rc + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, + sizeof(*h22_res_lc), BYTE_ALIGN_8); + h22_res_rc = h22_res_lc + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, + sizeof(*h22_res_rc), BYTE_ALIGN_8); + + c_f_l = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(PARAMETER_BANDSX56, sizeof(*c_f_l), BYTE_ALIGN_8); + c_f_r = + c_f_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_f_r), BYTE_ALIGN_8); + dummy = + c_f_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*dummy), BYTE_ALIGN_8); + c_f_lc = + dummy + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_f_lc), BYTE_ALIGN_8); + c_f_rc = + c_f_lc + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_f_rc), BYTE_ALIGN_8); if (enable_additionals) { if (mode_1 == 0 && @@ -487,42 +518,75 @@ VOID ixheaacd_calc_m1m2_7272(ia_heaac_mps_state_struct *pstr_mps_state) { WORD32 residual_coding = pstr_mps_state->residual_coding; h11_l = pstr_mps_state->mps_scratch_mem_v; - h11_r = h11_l + MAX_PARAMETER_BANDS; - h12_l = h11_r + MAX_PARAMETER_BANDS; - h12_r = h12_l + MAX_PARAMETER_BANDS; - h21_l = h12_r + MAX_PARAMETER_BANDS; - h21_r = h21_l + MAX_PARAMETER_BANDS; - h22_l = h21_r + MAX_PARAMETER_BANDS; - h22_r = h22_l + MAX_PARAMETER_BANDS; - h12_res_l = h22_r + MAX_PARAMETER_BANDS; - h12_res_r = h12_res_l + MAX_PARAMETER_BANDS; - h22_res_l = h12_res_r + MAX_PARAMETER_BANDS; - h22_res_r = h22_res_l + MAX_PARAMETER_BANDS; - c_l_clfe = h22_res_r + MAX_PARAMETER_BANDS; - c_r_clfe = c_l_clfe + MAX_PARAMETER_BANDS; - kappa = c_r_clfe + MAX_PARAMETER_BANDS; - g_dd = kappa + MAX_PARAMETER_BANDS; - - h11_ls = g_dd + MAX_PARAMETER_BANDS; - h11_rs = h11_ls + MAX_PARAMETER_BANDS; - h12_ls = h11_rs + MAX_PARAMETER_BANDS; - h12_rs = h12_ls + MAX_PARAMETER_BANDS; - h21_ls = h12_rs + MAX_PARAMETER_BANDS; - h21_rs = h21_ls + MAX_PARAMETER_BANDS; - h22_ls = h21_rs + MAX_PARAMETER_BANDS; - h22_rs = h22_ls + MAX_PARAMETER_BANDS; - h12_res_ls = h22_rs + MAX_PARAMETER_BANDS; - h12_res_rs = h12_res_ls + MAX_PARAMETER_BANDS; - h22_res_ls = h12_res_rs + MAX_PARAMETER_BANDS; - h22_res_rs = h22_res_ls + MAX_PARAMETER_BANDS; - - c_1_L = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + PARAMETER_BANDSX56; - c_1_R = c_1_L + MAX_PARAMETER_BANDS; - c_2_L = c_1_R + MAX_PARAMETER_BANDS; - c_2_R = c_2_L + MAX_PARAMETER_BANDS; - c_f_ls = c_2_R + MAX_PARAMETER_BANDS; - c_f_rs = c_f_ls + MAX_PARAMETER_BANDS; - dummy = c_f_rs + MAX_PARAMETER_BANDS; + h11_r = + h11_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11_r), BYTE_ALIGN_8); + h12_l = + h11_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_l), BYTE_ALIGN_8); + h12_r = + h12_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_r), BYTE_ALIGN_8); + h21_l = + h12_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_l), BYTE_ALIGN_8); + h21_r = + h21_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_r), BYTE_ALIGN_8); + h22_l = + h21_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_l), BYTE_ALIGN_8); + h22_r = + h22_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_r), BYTE_ALIGN_8); + h12_res_l = h22_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_l), + BYTE_ALIGN_8); + h12_res_r = h12_res_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_r), + BYTE_ALIGN_8); + h22_res_l = h12_res_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_l), + BYTE_ALIGN_8); + h22_res_r = h22_res_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_r), + BYTE_ALIGN_8); + c_l_clfe = h22_res_r + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_l_clfe), BYTE_ALIGN_8); + c_r_clfe = c_l_clfe + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_r_clfe), BYTE_ALIGN_8); + kappa = + c_r_clfe + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*kappa), BYTE_ALIGN_8); + g_dd = kappa + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*g_dd), BYTE_ALIGN_8); + + h11_ls = + g_dd + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11_ls), BYTE_ALIGN_8); + h11_rs = + h11_ls + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11_rs), BYTE_ALIGN_8); + h12_ls = + h11_rs + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_ls), BYTE_ALIGN_8); + h12_rs = + h12_ls + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_rs), BYTE_ALIGN_8); + h21_ls = + h12_rs + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_ls), BYTE_ALIGN_8); + h21_rs = + h21_ls + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_rs), BYTE_ALIGN_8); + h22_ls = + h21_rs + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_ls), BYTE_ALIGN_8); + h22_rs = + h22_ls + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_rs), BYTE_ALIGN_8); + h12_res_ls = h22_rs + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_ls), + BYTE_ALIGN_8); + h12_res_rs = h12_res_ls + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, + sizeof(*h12_res_rs), BYTE_ALIGN_8); + h22_res_ls = h12_res_rs + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, + sizeof(*h22_res_ls), BYTE_ALIGN_8); + h22_res_rs = h22_res_ls + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, + sizeof(*h22_res_rs), BYTE_ALIGN_8); + + c_1_L = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(PARAMETER_BANDSX56, sizeof(*c_1_L), BYTE_ALIGN_8); + c_1_R = + c_1_L + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_1_R), BYTE_ALIGN_8); + c_2_L = + c_1_R + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_2_L), BYTE_ALIGN_8); + c_2_R = + c_2_L + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_2_R), BYTE_ALIGN_8); + c_f_ls = + c_2_R + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_f_ls), BYTE_ALIGN_8); + c_f_rs = + c_f_ls + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_f_rs), BYTE_ALIGN_8); + dummy = + c_f_rs + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*dummy), BYTE_ALIGN_8); if (enable_additionals) { if (mode_1 == 0 && diff --git a/decoder/ixheaacd_mps_calc_m1m2_tree_757x.c b/decoder/ixheaacd_mps_calc_m1m2_tree_757x.c index 70de156..36f05ac 100644 --- a/decoder/ixheaacd_mps_calc_m1m2_tree_757x.c +++ b/decoder/ixheaacd_mps_calc_m1m2_tree_757x.c @@ -58,21 +58,35 @@ VOID ixheaacd_calc_m1m2_7571(ia_heaac_mps_state_struct *pstr_mps_state) { WORD32 num_parameter_bands = pstr_mps_state->num_parameter_bands; h11_l = pstr_mps_state->mps_scratch_mem_v; - h11_r = h11_l + MAX_PARAMETER_BANDS; - h12_l = h11_r + MAX_PARAMETER_BANDS; - h12_r = h12_l + MAX_PARAMETER_BANDS; - h21_l = h12_r + MAX_PARAMETER_BANDS; - h21_r = h21_l + MAX_PARAMETER_BANDS; - h22_l = h21_r + MAX_PARAMETER_BANDS; - h22_r = h22_l + MAX_PARAMETER_BANDS; - h12_res_l = h22_r + MAX_PARAMETER_BANDS; - h12_res_r = h12_res_l + MAX_PARAMETER_BANDS; - h22_res_l = h12_res_r + MAX_PARAMETER_BANDS; - h22_res_r = h22_res_l + MAX_PARAMETER_BANDS; - - c_f_l = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + PARAMETER_BANDSX24; - c_f_r = c_f_l + MAX_PARAMETER_BANDS; - dummy = c_f_r + MAX_PARAMETER_BANDS; + h11_r = + h11_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11_r), BYTE_ALIGN_8); + h12_l = + h11_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_l), BYTE_ALIGN_8); + h12_r = + h12_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_r), BYTE_ALIGN_8); + h21_l = + h12_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_l), BYTE_ALIGN_8); + h21_r = + h21_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_r), BYTE_ALIGN_8); + h22_l = + h21_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_l), BYTE_ALIGN_8); + h22_r = + h22_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_r), BYTE_ALIGN_8); + h12_res_l = h22_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_l), + BYTE_ALIGN_8); + h12_res_r = h12_res_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_r), + BYTE_ALIGN_8); + h22_res_l = h12_res_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_l), + BYTE_ALIGN_8); + h22_res_r = h22_res_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_r), + BYTE_ALIGN_8); + + c_f_l = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(PARAMETER_BANDSX24, sizeof(*c_f_l), BYTE_ALIGN_8); + c_f_r = + c_f_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_f_r), BYTE_ALIGN_8); + dummy = + c_f_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*dummy), BYTE_ALIGN_8); for (ps = 0; ps < num_parameter_sets; ps++) { ixheaacd_param_2_umx_ps(pstr_mps_state, h11_l, h12_l, h21_l, h22_l, h12_res_l, h22_res_l, @@ -142,21 +156,35 @@ VOID ixheaacd_calc_m1m2_7572(ia_heaac_mps_state_struct *pstr_mps_state) { WORD32 num_parameter_bands = pstr_mps_state->num_parameter_bands; h11_l = pstr_mps_state->mps_scratch_mem_v; - h11_r = h11_l + MAX_PARAMETER_BANDS; - h12_l = h11_r + MAX_PARAMETER_BANDS; - h12_r = h12_l + MAX_PARAMETER_BANDS; - h21_l = h12_r + MAX_PARAMETER_BANDS; - h21_r = h21_l + MAX_PARAMETER_BANDS; - h22_l = h21_r + MAX_PARAMETER_BANDS; - h22_r = h22_l + MAX_PARAMETER_BANDS; - h12_res_l = h22_r + MAX_PARAMETER_BANDS; - h12_res_r = h12_res_l + MAX_PARAMETER_BANDS; - h22_res_l = h12_res_r + MAX_PARAMETER_BANDS; - h22_res_r = h22_res_l + MAX_PARAMETER_BANDS; - - c_f_l = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + PARAMETER_BANDSX24; - c_f_r = c_f_l + MAX_PARAMETER_BANDS; - dummy = c_f_r + MAX_PARAMETER_BANDS; + h11_r = + h11_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h11_r), BYTE_ALIGN_8); + h12_l = + h11_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_l), BYTE_ALIGN_8); + h12_r = + h12_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_r), BYTE_ALIGN_8); + h21_l = + h12_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_l), BYTE_ALIGN_8); + h21_r = + h21_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h21_r), BYTE_ALIGN_8); + h22_l = + h21_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_l), BYTE_ALIGN_8); + h22_r = + h22_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_r), BYTE_ALIGN_8); + h12_res_l = h22_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_l), + BYTE_ALIGN_8); + h12_res_r = h12_res_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h12_res_r), + BYTE_ALIGN_8); + h22_res_l = h12_res_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_l), + BYTE_ALIGN_8); + h22_res_r = h22_res_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*h22_res_r), + BYTE_ALIGN_8); + + c_f_l = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(PARAMETER_BANDSX24, sizeof(*c_f_l), BYTE_ALIGN_8); + c_f_r = + c_f_l + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*c_f_r), BYTE_ALIGN_8); + dummy = + c_f_r + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*dummy), BYTE_ALIGN_8); for (ps = 0; ps < num_parameter_sets; ps++) { ixheaacd_param_2_umx_ps(pstr_mps_state, h11_l, h12_l, h21_l, h22_l, h12_res_l, h22_res_l, diff --git a/decoder/ixheaacd_mps_dec.h b/decoder/ixheaacd_mps_dec.h index d60c436..efcea30 100644 --- a/decoder/ixheaacd_mps_dec.h +++ b/decoder/ixheaacd_mps_dec.h @@ -93,7 +93,7 @@ #define BP_SIZE 25 -#define MPS_SCRATCH_MEM_SIZE (235168) +#define MPS_SCRATCH_MEM_SIZE (194048) typedef struct { FLOAT32 re; @@ -1016,6 +1016,8 @@ VOID ixheaacd_set_mps_persistent_buffers(ia_heaac_mps_state_struct *pstr_mps_sta WORD32 num_channel, VOID *persistent_mem); +WORD32 ixheaacd_scratch_buffer_sizes(); + VOID ixheaacd_set_scratch_buffers(ia_heaac_mps_state_struct *pstr_mps_state, VOID *scratch_mem); diff --git a/decoder/ixheaacd_mps_decorr.c b/decoder/ixheaacd_mps_decorr.c index 910f03a..d2bb221 100644 --- a/decoder/ixheaacd_mps_decorr.c +++ b/decoder/ixheaacd_mps_decorr.c @@ -623,7 +623,8 @@ static VOID ixheaacd_ducker_apply_71( WORD16 one_by_5 = ONE_BY_FIVE_Q16; duck_gain = scratch; - q_duck_gain = (WORD16 *)scratch + PARAMETER_BANDSX2; + q_duck_gain = (WORD16 *)scratch + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + PARAMETER_BANDSX2, sizeof(*q_duck_gain), BYTE_ALIGN_8); p_input_real = input_real; p_input_imag = input_imag; @@ -792,7 +793,8 @@ static VOID ixheaacd_ducker_apply( WORD16 one_by_5 = ONE_BY_FIVE_Q16; duck_gain = scratch; - q_duck_gain = (WORD16 *)scratch + PARAMETER_BANDSX2; + q_duck_gain = (WORD16 *)scratch + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + PARAMETER_BANDSX2, sizeof(*q_duck_gain), BYTE_ALIGN_8); p_input_real = input_real; p_input_imag = input_imag; @@ -1012,7 +1014,8 @@ VOID ixheaacd_decorr_apply(ia_heaac_mps_state_struct *pstr_mps_state, WORD32 len WORD32 length1; VOID *free_scratch; - free_scratch = (WORD32 *)pstr_mps_state->mps_scratch_mem_v + MAX_TIMESLOTSX2; + free_scratch = (WORD32 *)pstr_mps_state->mps_scratch_mem_v + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_TIMESLOTSX2, sizeof(WORD32), BYTE_ALIGN_8); if (decorr_ptr != NULL) { p_input_real = input_real; diff --git a/decoder/ixheaacd_mps_initfuncs.c b/decoder/ixheaacd_mps_initfuncs.c index 535d672..80d8171 100644 --- a/decoder/ixheaacd_mps_initfuncs.c +++ b/decoder/ixheaacd_mps_initfuncs.c @@ -157,6 +157,26 @@ WORD32 ixheaacd_mps_persistent_buffer_sizes() { buffer_size += IXHEAAC_GET_SIZE_ALIGNED(ARRAY_STRUCT_SIZE, BYTE_ALIGN_8); + // Add buffer sizes for pstr_mps_state->array_struct + // res_mdct + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(MDCT_RES_BUF_SIZE, BYTE_ALIGN_8); + // qmf_residual_real + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(QMF_RES_BUF_SIZE, BYTE_ALIGN_8); + // qmf_residual_imag + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(QMF_RES_BUF_SIZE, BYTE_ALIGN_8); + // m_qmf_real + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(QMF_BUF_SIZE, BYTE_ALIGN_8); + // m_qmf_imag + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(QMF_BUF_SIZE, BYTE_ALIGN_8); + // buf_real + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(BUF_SIZE, BYTE_ALIGN_8); + // buf_imag + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(BUF_SIZE, BYTE_ALIGN_8); + // aux_struct + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(sizeof(ia_mps_dec_auxilary_struct), BYTE_ALIGN_8); + // aux_struct->m2_param + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(sizeof(ia_mps_dec_m2_param_struct), BYTE_ALIGN_8); + return buffer_size; } @@ -292,34 +312,32 @@ VOID ixheaacd_set_mps_persistent_buffers(ia_heaac_mps_state_struct *pstr_mps_sta IXHEAAC_GET_SIZE_ALIGNED(ARRAY_STRUCT_SIZE, BYTE_ALIGN_8)); used_persistent += IXHEAAC_GET_SIZE_ALIGNED(ARRAY_STRUCT_SIZE, BYTE_ALIGN_8); - *persistent_used = used_persistent; -} - -VOID ixheaacd_set_scratch_buffers(ia_heaac_mps_state_struct *pstr_mps_state, VOID *scratch_mem) { - WORD32 scratch_used; + // Set buffers pointers of pstr_mps_state->array_struct ia_mps_dec_reuse_array_struct *p_array_struct = pstr_mps_state->array_struct; - p_array_struct->res_mdct = scratch_mem; - scratch_used = MDCT_RES_BUF_SIZE; + p_array_struct->res_mdct = (WORD32 *)((WORD8 *)persistent_mem + used_persistent); + used_persistent += IXHEAAC_GET_SIZE_ALIGNED(MDCT_RES_BUF_SIZE, BYTE_ALIGN_8); - p_array_struct->qmf_residual_real = (WORD32 *)((WORD8 *)scratch_mem + scratch_used); - scratch_used += QMF_RES_BUF_SIZE; - p_array_struct->qmf_residual_imag = (WORD32 *)((WORD8 *)scratch_mem + scratch_used); - scratch_used += QMF_RES_BUF_SIZE; + p_array_struct->qmf_residual_real = (WORD32 *)((WORD8 *)persistent_mem + used_persistent); + used_persistent += IXHEAAC_GET_SIZE_ALIGNED(QMF_RES_BUF_SIZE, BYTE_ALIGN_8); + p_array_struct->qmf_residual_imag = (WORD32 *)((WORD8 *)persistent_mem + used_persistent); + used_persistent += IXHEAAC_GET_SIZE_ALIGNED(QMF_RES_BUF_SIZE, BYTE_ALIGN_8); - p_array_struct->m_qmf_real = (WORD32 *)((WORD8 *)scratch_mem + scratch_used); - scratch_used += QMF_BUF_SIZE; - p_array_struct->m_qmf_imag = (WORD32 *)((WORD8 *)scratch_mem + scratch_used); - scratch_used += QMF_BUF_SIZE; + p_array_struct->m_qmf_real = (WORD32 *)((WORD8 *)persistent_mem + used_persistent); + used_persistent += IXHEAAC_GET_SIZE_ALIGNED(QMF_BUF_SIZE, BYTE_ALIGN_8); + p_array_struct->m_qmf_imag = (WORD32 *)((WORD8 *)persistent_mem + used_persistent); + used_persistent += IXHEAAC_GET_SIZE_ALIGNED(QMF_BUF_SIZE, BYTE_ALIGN_8); - p_array_struct->buf_real = (WORD32 *)((WORD8 *)scratch_mem + scratch_used); - scratch_used += BUF_SIZE; - p_array_struct->buf_imag = (WORD32 *)((WORD8 *)scratch_mem + scratch_used); - scratch_used += BUF_SIZE; + p_array_struct->buf_real = (WORD32 *)((WORD8 *)persistent_mem + used_persistent); + used_persistent += IXHEAAC_GET_SIZE_ALIGNED(BUF_SIZE, BYTE_ALIGN_8); + p_array_struct->buf_imag = (WORD32 *)((WORD8 *)persistent_mem + used_persistent); + used_persistent += IXHEAAC_GET_SIZE_ALIGNED(BUF_SIZE, BYTE_ALIGN_8); p_array_struct->hyb_output_real_dry = p_array_struct->res_mdct; p_array_struct->hyb_output_imag_dry = - p_array_struct->res_mdct + MAX_OUTPUT_CHANNELS_AT_MPS * TSXHB; + p_array_struct->res_mdct + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_OUTPUT_CHANNELS_AT_MPS * TSXHB, + sizeof(*p_array_struct->hyb_output_imag_dry), BYTE_ALIGN_8); p_array_struct->x_real = p_array_struct->hyb_output_real_dry; p_array_struct->x_imag = p_array_struct->hyb_output_imag_dry; @@ -329,14 +347,25 @@ VOID ixheaacd_set_scratch_buffers(ia_heaac_mps_state_struct *pstr_mps_state, VOI p_array_struct->w_dry_real = p_array_struct->m_qmf_real; p_array_struct->w_dry_imag = p_array_struct->m_qmf_imag; - p_array_struct->env_dmx_0 = p_array_struct->m_qmf_real + TSXHBX5; - p_array_struct->env_dmx_1 = p_array_struct->env_dmx_0 + MAX_TIME_SLOTS; + p_array_struct->env_dmx_0 = + p_array_struct->m_qmf_real + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(TSXHBX5, sizeof(*p_array_struct->env_dmx_0), BYTE_ALIGN_8); + p_array_struct->env_dmx_1 = + p_array_struct->env_dmx_0 + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_TIME_SLOTS, sizeof(*p_array_struct->env_dmx_1), + BYTE_ALIGN_8); p_array_struct->qmf_residual_real_pre = p_array_struct->qmf_residual_real; - p_array_struct->qmf_residual_real_post = p_array_struct->qmf_residual_real + RES_CHXQMFXTS; + p_array_struct->qmf_residual_real_post = + p_array_struct->qmf_residual_real + + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + RES_CHXQMFXTS, sizeof(*p_array_struct->qmf_residual_real_post), BYTE_ALIGN_8); p_array_struct->qmf_residual_imag_pre = p_array_struct->qmf_residual_imag; - p_array_struct->qmf_residual_imag_post = p_array_struct->qmf_residual_imag + RES_CHXQMFXTS; + p_array_struct->qmf_residual_imag_post = + p_array_struct->qmf_residual_imag + + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + RES_CHXQMFXTS, sizeof(*p_array_struct->qmf_residual_imag_post), BYTE_ALIGN_8); p_array_struct->buffer_real = p_array_struct->qmf_residual_real_post; p_array_struct->buffer_imag = p_array_struct->qmf_residual_imag_post; @@ -344,12 +373,42 @@ VOID ixheaacd_set_scratch_buffers(ia_heaac_mps_state_struct *pstr_mps_state, VOI p_array_struct->m1_param = (ia_mps_dec_m1_param_struct *)p_array_struct->buffer_real; pstr_mps_state->aux_struct = - (ia_mps_dec_auxilary_struct *)((WORD8 *)scratch_mem + scratch_used); - scratch_used += sizeof(ia_mps_dec_auxilary_struct); + (ia_mps_dec_auxilary_struct *)((WORD8 *)persistent_mem + used_persistent); + used_persistent += IXHEAAC_GET_SIZE_ALIGNED(sizeof(ia_mps_dec_auxilary_struct), BYTE_ALIGN_8); pstr_mps_state->aux_struct->m2_param = - (ia_mps_dec_m2_param_struct *)((WORD8 *)scratch_mem + scratch_used); - scratch_used += sizeof(ia_mps_dec_m2_param_struct); + (ia_mps_dec_m2_param_struct *)((WORD8 *)persistent_mem + used_persistent); + used_persistent += IXHEAAC_GET_SIZE_ALIGNED(sizeof(ia_mps_dec_m2_param_struct), BYTE_ALIGN_8); + + *persistent_used = used_persistent; +} + +WORD32 ixheaacd_scratch_buffer_sizes() { + WORD32 buffer_size; + + buffer_size = IXHEAAC_GET_SIZE_ALIGNED(MDCT_RES_BUF_SIZE, BYTE_ALIGN_8); + + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(QMF_RES_BUF_SIZE, BYTE_ALIGN_8); + + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(QMF_RES_BUF_SIZE, BYTE_ALIGN_8); + + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(QMF_BUF_SIZE, BYTE_ALIGN_8); + + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(QMF_BUF_SIZE, BYTE_ALIGN_8); + + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(BUF_SIZE, BYTE_ALIGN_8); + + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(BUF_SIZE, BYTE_ALIGN_8); + + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(sizeof(ia_mps_dec_auxilary_struct), BYTE_ALIGN_8); + + buffer_size += IXHEAAC_GET_SIZE_ALIGNED(sizeof(ia_mps_dec_m2_param_struct), BYTE_ALIGN_8); + + return buffer_size; +} + +VOID ixheaacd_set_scratch_buffers(ia_heaac_mps_state_struct *pstr_mps_state, VOID *scratch_mem) { + WORD32 scratch_used = 0; pstr_mps_state->mps_scratch_mem_v = (VOID *)((WORD8 *)scratch_mem + scratch_used); } diff --git a/decoder/ixheaacd_mps_mdct_2_qmf.c b/decoder/ixheaacd_mps_mdct_2_qmf.c index b341209..e188e74 100644 --- a/decoder/ixheaacd_mps_mdct_2_qmf.c +++ b/decoder/ixheaacd_mps_mdct_2_qmf.c @@ -874,7 +874,8 @@ static VOID ixheaacd_local_imdet( WORD32 l; WORD32 *p_sum = scratch; - WORD32 *p_diff = (WORD32 *)scratch + SUM_SIZE; + WORD32 *p_diff = + (WORD32 *)scratch + IXHEAAC_GET_SIZE_ALIGNED_TYPE(SUM_SIZE, sizeof(*p_diff), BYTE_ALIGN_8); z_real_2 = z_real + lw; z_imag_2 = z_imag + lw; @@ -1526,16 +1527,21 @@ VOID ixheaacd_mdct2qmf_process(WORD32 upd_qmf, WORD32 *const mdct_in, WORD32 *qm WORD32 *wp; wf = scratch; - wt = wf + MAX_TIMESLOTSX2; - v1 = wt + MAX_TIMESLOTSX2; - v2 = v1 + MDCT_LENGTH_HI; - twipost_real = v2 + MDCT_LENGTH_HI; - twipost_imag = twipost_real + MAX_NUM_QMF_BANDS; - mdct_sf = twipost_imag + MAX_NUM_QMF_BANDS; - z1_real = mdct_sf + MDCT_LENGTH_SF; - z1_imag = z1_real + QBXTSX2; - a = z1_imag + QBXTSX2; - free_scratch = (VOID *)((WORD32 *)a + MAX_NUM_QMF_BANDS); + wt = wf + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_TIMESLOTSX2, sizeof(*wt), BYTE_ALIGN_8); + v1 = wt + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_TIMESLOTSX2, sizeof(*v1), BYTE_ALIGN_8); + v2 = v1 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MDCT_LENGTH_HI, sizeof(*v2), BYTE_ALIGN_8); + twipost_real = + v2 + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MDCT_LENGTH_HI, sizeof(*twipost_real), BYTE_ALIGN_8); + twipost_imag = twipost_real + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + MAX_NUM_QMF_BANDS, sizeof(*twipost_imag), BYTE_ALIGN_8); + mdct_sf = twipost_imag + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_NUM_QMF_BANDS, sizeof(*mdct_sf), BYTE_ALIGN_8); + z1_real = + mdct_sf + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MDCT_LENGTH_SF, sizeof(*z1_real), BYTE_ALIGN_8); + z1_imag = z1_real + IXHEAAC_GET_SIZE_ALIGNED_TYPE(QBXTSX2, sizeof(*z1_imag), BYTE_ALIGN_8); + a = z1_imag + IXHEAAC_GET_SIZE_ALIGNED_TYPE(QBXTSX2, sizeof(*a), BYTE_ALIGN_8); + free_scratch = (VOID *)((WORD32 *)a + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_NUM_QMF_BANDS, + sizeof(*a), BYTE_ALIGN_8)); scale = a; diff --git a/decoder/ixheaacd_mps_reshape_bb_env.c b/decoder/ixheaacd_mps_reshape_bb_env.c index e432343..4d29881 100644 --- a/decoder/ixheaacd_mps_reshape_bb_env.c +++ b/decoder/ixheaacd_mps_reshape_bb_env.c @@ -103,8 +103,10 @@ static VOID ixheaacd_extract_bb_env(ia_heaac_mps_state_struct *pstr_mps_state, W pstr_mps_state->ia_mps_dec_mps_table.bitdec_table_ptr->kernel_table.bb_env_kernels; q_slot_nrg_fix = (WORD16 *)scratch; - n_slot_nrg = (WORD32 *)((WORD8 *)scratch + RESHAPE_OFFSET_1); - slot_nrg_fix = (WORD64 *)ALIGN_SIZE64((SIZE_T)((WORD8 *)scratch + RESHAPE_OFFSET_2)); + n_slot_nrg = + (WORD32 *)((WORD8 *)scratch + IXHEAAC_GET_SIZE_ALIGNED(RESHAPE_OFFSET_1, BYTE_ALIGN_8)); + slot_nrg_fix = + (WORD64 *)((WORD8 *)scratch + IXHEAAC_GET_SIZE_ALIGNED(RESHAPE_OFFSET_2, BYTE_ALIGN_8)); switch (inp) { WORD32 frame_nrg_prev; WORD16 q_frame_nrg_prev; @@ -401,8 +403,10 @@ VOID ixheaacd_reshape_bb_env(ia_heaac_mps_state_struct *pstr_mps_state) { env_dry = free_scratch; env_dmx_0 = pstr_mps_state->array_struct->env_dmx_0; env_dmx_1 = pstr_mps_state->array_struct->env_dmx_1; - inter = (WORD64 *)((WORD8 *)free_scratch + MAX_TIME_SLOTSX12); - free_scratch = inter + MAX_TIME_SLOTS; + inter = (WORD64 *)((WORD8 *)free_scratch + + IXHEAAC_GET_SIZE_ALIGNED(MAX_TIME_SLOTSX12, BYTE_ALIGN_8)); + free_scratch = + inter + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_TIME_SLOTS, sizeof(*inter), BYTE_ALIGN_8); p_buffer_real = pstr_mps_state->array_struct->buf_real + start_hsb; p_buffer_imag = pstr_mps_state->array_struct->buf_imag + start_hsb; diff --git a/decoder/ixheaacd_mps_smoothing.c b/decoder/ixheaacd_mps_smoothing.c index f4f5628..5b8c4b1 100644 --- a/decoder/ixheaacd_mps_smoothing.c +++ b/decoder/ixheaacd_mps_smoothing.c @@ -290,8 +290,11 @@ VOID ixheaacd_smooth_m1m2(ia_heaac_mps_state_struct *pstr_mps_state) { WORD32 *m1_param_imag_prev = persistent_mem->m1_param_imag_prev; ton = pstr_mps_state->mps_scratch_mem_v; - delta = delta_ptr = ton + MAX_PARAMETER_BANDS; - one_minus_delta = one_minus_delta_ptr = delta + MAX_PARAMETER_SETS; + delta = delta_ptr = + ton + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_BANDS, sizeof(*delta), BYTE_ALIGN_8); + one_minus_delta = one_minus_delta_ptr = + delta + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(MAX_PARAMETER_SETS, sizeof(*one_minus_delta), BYTE_ALIGN_8); param_r = curr_state->res_bands; if (curr_state->residual_coding) { diff --git a/decoder/ixheaacd_mps_temp_process.c b/decoder/ixheaacd_mps_temp_process.c index 3d676bd..b1d3339 100644 --- a/decoder/ixheaacd_mps_temp_process.c +++ b/decoder/ixheaacd_mps_temp_process.c @@ -360,24 +360,37 @@ static VOID ixheaacd_subband_tp(ia_heaac_mps_state_struct *pstr_mps_state, WORD3 WORD32 tree_config = pstr_mps_state->tree_config; dry_ener = pstr_mps_state->mps_scratch_mem_v; - q_dry_ener = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + INPUT_CHX2; + q_dry_ener = (WORD16 *)pstr_mps_state->mps_scratch_mem_v + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(INPUT_CHX2, sizeof(*q_dry_ener), BYTE_ALIGN_8); - wet_ener = dry_ener + INPUT_CHX1_5; - q_wet_ener = q_dry_ener + IN_CH_2XOUT_CH; + wet_ener = + dry_ener + IXHEAAC_GET_SIZE_ALIGNED_TYPE(INPUT_CHX1_5, sizeof(*wet_ener), BYTE_ALIGN_8); + q_wet_ener = q_dry_ener + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(IN_CH_2XOUT_CH, sizeof(*q_wet_ener), BYTE_ALIGN_8); - scale = wet_ener + OUTPUT_CHX1_5; - q_scale = q_wet_ener + OUTPUT_CHX3; + scale = wet_ener + IXHEAAC_GET_SIZE_ALIGNED_TYPE(OUTPUT_CHX1_5, sizeof(*scale), BYTE_ALIGN_8); + q_scale = + q_wet_ener + IXHEAAC_GET_SIZE_ALIGNED_TYPE(OUTPUT_CHX3, sizeof(*q_scale), BYTE_ALIGN_8); - dmx_real = scale + OUTPUT_CHX1_5; - dmx_imag = dmx_real + IN_CHXBP_SIZE; + dmx_real = + scale + IXHEAAC_GET_SIZE_ALIGNED_TYPE(OUTPUT_CHX1_5, sizeof(*dmx_real), BYTE_ALIGN_8); + dmx_imag = + dmx_real + IXHEAAC_GET_SIZE_ALIGNED_TYPE(IN_CHXBP_SIZE, sizeof(*dmx_imag), BYTE_ALIGN_8); - qmf_output_real_dry = dmx_imag + IN_CHXBP_SIZE; + qmf_output_real_dry = dmx_imag + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + IN_CHXBP_SIZE, sizeof(*qmf_output_real_dry), BYTE_ALIGN_8); - qmf_output_imag_dry = qmf_output_real_dry + OUT_CHXQB; + qmf_output_imag_dry = + qmf_output_real_dry + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(OUT_CHXQB, sizeof(*qmf_output_imag_dry), BYTE_ALIGN_8); - qmf_output_real_wet = qmf_output_imag_dry + OUT_CHXQB; + qmf_output_real_wet = + qmf_output_imag_dry + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(OUT_CHXQB, sizeof(*qmf_output_real_wet), BYTE_ALIGN_8); - qmf_output_imag_wet = qmf_output_real_wet + OUT_CHXQB; + qmf_output_imag_wet = + qmf_output_real_wet + + IXHEAAC_GET_SIZE_ALIGNED_TYPE(OUT_CHXQB, sizeof(*qmf_output_imag_wet), BYTE_ALIGN_8); if (sub_band_tp->update_old_ener == STP_UPDATE_ENERGY_RATE) { sub_band_tp->update_old_ener = 1; diff --git a/decoder/ixheaacd_mps_tonality.c b/decoder/ixheaacd_mps_tonality.c index 325b474..0b81ef0 100644 --- a/decoder/ixheaacd_mps_tonality.c +++ b/decoder/ixheaacd_mps_tonality.c @@ -212,15 +212,19 @@ VOID ixheaacd_measure_tonality(ia_heaac_mps_state_struct *pstr_mps_state, WORD32 WORD32 temp_1, temp; WORD16 qtemp1, qtemp2; - spec_zoom_real = - (WORD32 *)((WORD8 *)pstr_mps_state->mps_scratch_mem_v + SCRATCH_OFFSET_SMOOTHING); - spec_zoom_imag = spec_zoom_real + QMF_BANDSX8; - p_max = spec_zoom_imag + QMF_BANDSX8; - coh_spec = p_max + QMF_BANDSX8; - pow_spec = coh_spec + QMF_BANDSX8; - - qmf_real = pow_spec + QMF_BANDSX8; - qmf_imag = qmf_real + QBXTS; + spec_zoom_real = (WORD32 *)((WORD8 *)pstr_mps_state->mps_scratch_mem_v + + IXHEAAC_GET_SIZE_ALIGNED(SCRATCH_OFFSET_SMOOTHING, BYTE_ALIGN_8)); + spec_zoom_imag = spec_zoom_real + IXHEAAC_GET_SIZE_ALIGNED_TYPE( + QMF_BANDSX8, sizeof(*spec_zoom_imag), BYTE_ALIGN_8); + p_max = + spec_zoom_imag + IXHEAAC_GET_SIZE_ALIGNED_TYPE(QMF_BANDSX8, sizeof(*p_max), BYTE_ALIGN_8); + coh_spec = p_max + IXHEAAC_GET_SIZE_ALIGNED_TYPE(QMF_BANDSX8, sizeof(*coh_spec), BYTE_ALIGN_8); + pow_spec = + coh_spec + IXHEAAC_GET_SIZE_ALIGNED_TYPE(QMF_BANDSX8, sizeof(*pow_spec), BYTE_ALIGN_8); + + qmf_real = + pow_spec + IXHEAAC_GET_SIZE_ALIGNED_TYPE(QMF_BANDSX8, sizeof(*qmf_real), BYTE_ALIGN_8); + qmf_imag = qmf_real + IXHEAAC_GET_SIZE_ALIGNED_TYPE(QBXTS, sizeof(*qmf_imag), BYTE_ALIGN_8); switch (num_parameter_bands) { case PARAMETER_BANDS_4: diff --git a/decoder/ixheaacd_process.c b/decoder/ixheaacd_process.c index 6b3acf6..4089d98 100644 --- a/decoder/ixheaacd_process.c +++ b/decoder/ixheaacd_process.c @@ -103,12 +103,9 @@ #define MAXNRSBRELEMENTS 6 -VOID ixheaacd_allocate_sbr_scr(ia_sbr_scr_struct *sbr_scratch_struct, - VOID *base_scratch_ptr, VOID *output_ptr, - WORD total_elements, WORD ch_fac, - WORD32 object_type, WORD32 total_channels, - WORD8 *p_qshift_arr, UWORD8 slot_element, - WORD32 channel); +VOID ixheaacd_allocate_sbr_scr(ia_sbr_scr_struct *sbr_scratch_struct, VOID *base_scratch_ptr, + VOID *output_ptr, WORD32 total_channels, WORD8 *p_qshift_arr, + UWORD8 slot_element, WORD32 channel); IA_ERRORCODE ixheaacd_esbr_process(ia_usac_data_struct *usac_data, ia_bit_buf_struct *it_bit_buff, @@ -122,9 +119,8 @@ IA_ERRORCODE ixheaacd_esbr_process(ia_usac_data_struct *usac_data, ia_handle_sbr_dec_inst_struct self = usac_data->pstr_esbr_dec; ia_sbr_scr_struct sbr_scratch_struct; - ixheaacd_allocate_sbr_scr(&sbr_scratch_struct, - usac_data->sbr_scratch_mem_base, NULL, 2, 1, - audio_object_type, 0, NULL, 0, 0); + ixheaacd_allocate_sbr_scr(&sbr_scratch_struct, usac_data->sbr_scratch_mem_base, NULL, 0, NULL, + 0, 0); self->usac_independency_flag = usac_data->usac_independency_flg; @@ -169,8 +165,8 @@ IA_ERRORCODE ixheaacd_esbr_parse(ia_usac_data_struct *usac_data, ia_bit_buf_stru ia_sbr_scr_struct sbr_scratch_struct; jmp_buf local; - ixheaacd_allocate_sbr_scr(&sbr_scratch_struct, usac_data->sbr_scratch_mem_base, NULL, 2, 1, - audio_object_type, 0, NULL, 0, 0); + ixheaacd_allocate_sbr_scr(&sbr_scratch_struct, usac_data->sbr_scratch_mem_base, NULL, 0, NULL, + 0, 0); self->usac_independency_flag = usac_data->usac_independency_flg; diff --git a/decoder/ixheaacd_sbrdecoder.h b/decoder/ixheaacd_sbrdecoder.h index 846fc02..ab299cf 100644 --- a/decoder/ixheaacd_sbrdecoder.h +++ b/decoder/ixheaacd_sbrdecoder.h @@ -69,8 +69,6 @@ typedef struct ia_sbr_dec_inst_struct *ia_handle_sbr_dec_inst_struct; typedef struct { VOID *ptr_work_buf_core; - VOID *ptr_work_buf; - VOID *extra_scr_1k[2]; } ia_sbr_scr_struct; IA_ERRORCODE ixheaacd_applysbr( -- cgit v1.2.3