Cleanup memory allocation for DRC buffers
This fixes un intialized data access in loudness equalizer selection Memory allocation and distribution inside DRC module was cleaned up. Memory clean-up changes were done inside the library and in test bench. Similar changes were done in OMX and C2 plug-in as well. Bug: 115509210 Test: vendor+poc Change-Id: I6a2bf5fe6eeecc5d0fec395af020aef8221a5f93
This commit is contained in:
parent
4d7d9daad6
commit
fe1d70bf7e
6 changed files with 161 additions and 73 deletions
|
|
@ -64,8 +64,41 @@ IA_ERRORCODE impd_drc_set_default_config(ia_drc_api_struct *p_obj_drc);
|
|||
IA_ERRORCODE impd_drc_set_struct_pointer(ia_drc_api_struct *p_obj_drc);
|
||||
IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc);
|
||||
|
||||
#define SUBBAND_BUF_SIZE \
|
||||
NUM_ELE_IN_CPLX_NUM *MAX_CHANNEL_COUNT * sizeof(FLOAT32 *) + \
|
||||
(MAX_SUBBAND_DELAY + MAX_DRC_FRAME_SIZE) * MAX_CHANNEL_COUNT * \
|
||||
sizeof(FLOAT32) * NUM_ELE_IN_CPLX_NUM
|
||||
|
||||
#define NUM_DRC_TABLES 4
|
||||
#define SCRATCH_MEM_SIZE 1024 * 256 * 64
|
||||
#define SCRATCH_MEM_SIZE \
|
||||
(AUDIO_CODEC_FRAME_SIZE_MAX * MAX_CHANNEL_COUNT * sizeof(FLOAT32) * \
|
||||
NUM_ELE_IN_CPLX_NUM)
|
||||
|
||||
#define PERSIST_MEM_SIZE \
|
||||
(sizeof(ia_drc_state_struct) + sizeof(ia_drc_bits_dec_struct) + \
|
||||
sizeof(ia_drc_gain_dec_struct) * 2 + \
|
||||
sizeof(ia_drc_loudness_info_set_struct) + sizeof(ia_drc_gain_struct) + \
|
||||
sizeof(ia_drc_interface_struct) + sizeof(ia_drc_config) + \
|
||||
sizeof(ia_drc_sel_pro_struct) + sizeof(ia_drc_sel_proc_params_struct) + \
|
||||
sizeof(ia_drc_sel_proc_output_struct) + \
|
||||
sizeof(ia_drc_peak_limiter_struct) + sizeof(ia_drc_peak_limiter_struct) + \
|
||||
sizeof(ia_drc_qmf_filt_struct) + ANALY_BUF_SIZE + SYNTH_BUF_SIZE + \
|
||||
PEAK_LIM_BUF_SIZE + MAX_BS_BUF_SIZE + /*DRC Config Bitstream*/ \
|
||||
MAX_DRC_CONFG_BUF_SIZE + /*DRC loudness info Bitstream*/ \
|
||||
MAX_LOUD_INFO_BUF_SIZE + /*DRC interface Bitstream*/ \
|
||||
MAX_INTERFACE_BUF_SIZE + \
|
||||
NUM_GAIN_DEC_INSTANCES * \
|
||||
(SEL_DRC_COUNT * sizeof(ia_interp_buf_struct) * MAX_GAIN_ELE_COUNT + \
|
||||
sizeof(ia_eq_set_struct) + /*non_interleaved_audio*/ \
|
||||
MAX_CHANNEL_COUNT * sizeof(FLOAT32 *) + \
|
||||
MAX_DRC_FRAME_SIZE * sizeof(FLOAT32) * \
|
||||
MAX_CHANNEL_COUNT + /*audio_in_out_buf ptr*/ \
|
||||
MAX_CHANNEL_COUNT * sizeof(FLOAT32 *) + /*audio_io_buffer_delayed*/ \
|
||||
MAX_CHANNEL_COUNT * sizeof(FLOAT32 *) + \
|
||||
MAX_DRC_FRAME_SIZE * sizeof(FLOAT32) * \
|
||||
MAX_CHANNEL_COUNT + /*subband band buffer ptr*/ \
|
||||
NUM_ELE_IN_CPLX_NUM * MAX_CHANNEL_COUNT * sizeof(FLOAT32 *) + \
|
||||
SUBBAND_BUF_SIZE + (PARAM_DRC_MAX_BUF_SZ * MAX_CHANNEL_COUNT)))
|
||||
|
||||
IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
|
||||
pVOID pv_value) {
|
||||
|
|
@ -111,8 +144,7 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
|
|||
break;
|
||||
}
|
||||
case IA_API_CMD_GET_API_SIZE: {
|
||||
*pui_value = sizeof(ia_drc_api_struct) +
|
||||
(sizeof(ia_drc_state_struct) + 8) + 8080 * 1024;
|
||||
*pui_value = sizeof(ia_drc_api_struct);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -120,7 +152,8 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
|
|||
switch (i_idx) {
|
||||
case IA_CMD_TYPE_INIT_SET_BUFF_PTR: {
|
||||
p_obj_drc->p_state->persistant_ptr =
|
||||
p_obj_drc->pp_mem[IA_DRC_PERSIST_IDX];
|
||||
(UWORD8 *)p_obj_drc->pp_mem[IA_DRC_PERSIST_IDX] +
|
||||
sizeof(ia_drc_state_struct);
|
||||
impd_drc_set_struct_pointer(p_obj_drc);
|
||||
|
||||
break;
|
||||
|
|
@ -130,11 +163,6 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
|
|||
break;
|
||||
}
|
||||
case IA_CMD_TYPE_INIT_API_POST_CONFIG_PARAMS: {
|
||||
p_obj_drc->p_state =
|
||||
(ia_drc_state_struct *)((SIZE_T)p_obj_drc + 8000 * 1024);
|
||||
p_obj_drc->p_mem_info =
|
||||
(ia_mem_info_struct *)((SIZE_T)p_obj_drc + 8002 * 1024);
|
||||
p_obj_drc->pp_mem = (pVOID)((SIZE_T)p_obj_drc + 8006 * 1024);
|
||||
impd_drc_fill_mem_tables(p_obj_drc);
|
||||
break;
|
||||
}
|
||||
|
|
@ -402,9 +430,15 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
|
|||
break;
|
||||
}
|
||||
case IA_API_CMD_GET_MEMTABS_SIZE: {
|
||||
*pui_value =
|
||||
(sizeof(ia_mem_info_struct) + sizeof(pVOID *)) * (NUM_DRC_TABLES);
|
||||
break;
|
||||
}
|
||||
case IA_API_CMD_SET_MEMTABS_PTR: {
|
||||
p_obj_drc->p_mem_info = (ia_mem_info_struct *)(ps_value);
|
||||
p_obj_drc->pp_mem =
|
||||
(pVOID)((SIZE_T)p_obj_drc->p_mem_info +
|
||||
(NUM_DRC_TABLES * sizeof(*(p_obj_drc->p_mem_info))));
|
||||
break;
|
||||
}
|
||||
case IA_API_CMD_GET_N_MEMTABS: {
|
||||
|
|
@ -535,8 +569,11 @@ IA_ERRORCODE impd_drc_mem_api(ia_drc_api_struct *p_obj_drc, WORD32 i_cmd,
|
|||
p_obj_drc->pp_mem[i_idx] = pv_value;
|
||||
pbtemp = p_obj_drc->pp_mem[i_idx];
|
||||
sz = p_obj_drc->p_mem_info[i_idx].ui_size;
|
||||
|
||||
if (IA_MEMTYPE_PERSIST == i_idx) {
|
||||
p_obj_drc->p_state = pv_value;
|
||||
}
|
||||
memset(pbtemp, 0, sz);
|
||||
break;
|
||||
}
|
||||
case IA_API_CMD_SET_MEM_PLACEMENT: {
|
||||
}
|
||||
|
|
@ -548,7 +585,8 @@ IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc) {
|
|||
ia_mem_info_struct *p_mem_info;
|
||||
{
|
||||
p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_PERSIST_IDX];
|
||||
p_mem_info->ui_size = 64 * 1024 * 1024;
|
||||
memset(p_mem_info, 0, sizeof(*p_mem_info));
|
||||
p_mem_info->ui_size = PERSIST_MEM_SIZE;
|
||||
p_mem_info->ui_alignment = 8;
|
||||
p_mem_info->ui_type = IA_MEMTYPE_PERSIST;
|
||||
p_mem_info->ui_placement[0] = 0;
|
||||
|
|
@ -559,6 +597,7 @@ IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc) {
|
|||
}
|
||||
{
|
||||
p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_INPUT_IDX];
|
||||
memset(p_mem_info, 0, sizeof(*p_mem_info));
|
||||
p_mem_info->ui_size = p_obj_drc->str_config.frame_size *
|
||||
(p_obj_drc->str_config.pcm_size >> 3) *
|
||||
p_obj_drc->str_config.num_ch_in;
|
||||
|
|
@ -572,6 +611,7 @@ IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc) {
|
|||
}
|
||||
{
|
||||
p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_OUTPUT_IDX];
|
||||
memset(p_mem_info, 0, sizeof(*p_mem_info));
|
||||
p_mem_info->ui_size = p_obj_drc->str_config.frame_size *
|
||||
(p_obj_drc->str_config.pcm_size >> 3) *
|
||||
p_obj_drc->str_config.num_ch_in;
|
||||
|
|
@ -585,6 +625,7 @@ IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc) {
|
|||
}
|
||||
{
|
||||
p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_SCRATCH_IDX];
|
||||
memset(p_mem_info, 0, sizeof(*p_mem_info));
|
||||
p_mem_info->ui_size = SCRATCH_MEM_SIZE;
|
||||
p_mem_info->ui_alignment = 8;
|
||||
p_mem_info->ui_type = IA_MEMTYPE_SCRATCH;
|
||||
|
|
|
|||
|
|
@ -30,9 +30,10 @@ extern "C" {
|
|||
|
||||
#define ENABLE_ADDITIONAL_TESTS 1
|
||||
|
||||
#define SPEAKER_POS_COUNT_MAX 128
|
||||
#define SPEAKER_POS_COUNT_MAX (8) // 128
|
||||
#define DOWNMIX_COEFF_COUNT_MAX 32 * 32
|
||||
#define MAX_CHANNEL_COUNT 128
|
||||
#define MAX_CHANNEL_COUNT (8) // 128
|
||||
#define MAX_SUBBAND_CHANNEL_COUNT (128)
|
||||
#define BAND_COUNT_MAX 8
|
||||
#define SEQUENCE_COUNT_MAX 24
|
||||
#define GAIN_SET_COUNT_MAX SEQUENCE_COUNT_MAX
|
||||
|
|
@ -50,6 +51,42 @@ extern "C" {
|
|||
#define DOWNMIX_ID_COUNT_MAX 8
|
||||
#define MAX_SIGNAL_DELAY 4500
|
||||
|
||||
#define NUM_ELE_IN_CPLX_NUM 2
|
||||
#define MAX_BS_BUF_SIZE 768
|
||||
#define MAX_DRC_CONFG_BUF_SIZE MAX_BS_BUF_SIZE
|
||||
#define MAX_LOUD_INFO_BUF_SIZE MAX_BS_BUF_SIZE
|
||||
#define MAX_INTERFACE_BUF_SIZE MAX_BS_BUF_SIZE
|
||||
#define MAX_GAIN_ELE_COUNT 15 /*MAX 4-bit Value*/
|
||||
|
||||
#define NUM_GAIN_DEC_INSTANCES 2
|
||||
|
||||
#define MAX_DRC_FRAME_SIZE AUDIO_CODEC_FRAME_SIZE_MAX
|
||||
#define ANALY_BUF_SIZE \
|
||||
(AUDIO_CODEC_FRAME_SIZE_MAX * MAX_CHANNEL_COUNT * sizeof(FLOAT32) * \
|
||||
NUM_ELE_IN_CPLX_NUM)
|
||||
#define SYNTH_BUF_SIZE \
|
||||
(AUDIO_CODEC_FRAME_SIZE_MAX * MAX_CHANNEL_COUNT * sizeof(FLOAT32) * \
|
||||
NUM_ELE_IN_CPLX_NUM)
|
||||
#define PEAK_LIM_BUF_SIZE \
|
||||
(AUDIO_CODEC_FRAME_SIZE_MAX * MAX_CHANNEL_COUNT * sizeof(FLOAT32) * \
|
||||
NUM_ELE_IN_CPLX_NUM)
|
||||
|
||||
/*7 bits read from the bitstream*/
|
||||
#define MAX_PARAM_DRC_LOOK_AHEAD_VAL 127
|
||||
|
||||
#define MAX_PARAM_DRC_LIM_ATTACK_VAL MAX_PARAM_DRC_LOOK_AHEAD_VAL
|
||||
#define MAX_SAMP_FREQ_IN_KHZ 96
|
||||
#define MAX_ATTACK_VAL (MAX_PARAM_DRC_LOOK_AHEAD_VAL * MAX_SAMP_FREQ_IN_KHZ)
|
||||
|
||||
/*int(sqrt(MAX_ATTACK_VAL + 1))*/
|
||||
#define MAX_SEC_LEN 110
|
||||
#define MAX_NUMBUF_SEC_VAL (MAX_ATTACK_VAL / MAX_SEC_LEN)
|
||||
|
||||
/*(MAX_NUMBUF_SEC_VAL * MAX_SEC_LEN)*/
|
||||
#define PARAM_DRC_MAX_BUF_SZ 110
|
||||
|
||||
#define MAX_SUBBAND_DELAY (MAX_SIGNAL_DELAY / AUDIO_CODEC_SUBBAND_COUNT_QMF64)
|
||||
|
||||
#define DRC_BAND_COUNT_MAX BAND_COUNT_MAX
|
||||
#define SPLIT_CHARACTERISTIC_COUNT_MAX 8
|
||||
#define GAIN_SET_COUNT_MAX SEQUENCE_COUNT_MAX
|
||||
|
|
@ -150,6 +187,7 @@ extern "C" {
|
|||
#define PARAM_DRC_TYPE_LIM_THRESHOLD_DEFAULT (-1.f)
|
||||
#define PARAM_DRC_TYPE_LIM_ATTACK_DEFAULT 5
|
||||
#define PARAM_DRC_TYPE_LIM_RELEASE_DEFAULT 50
|
||||
#define MAX_LOUDNESS_INFO_COUNT (16)
|
||||
|
||||
#define MAX_LOUDNESS_INFO_COUNT (16)
|
||||
|
||||
|
|
@ -200,7 +238,7 @@ typedef struct ia_drc_sel_proc_output_struct {
|
|||
WORD32 target_channel_count;
|
||||
WORD32 target_layout;
|
||||
WORD32 downmix_matrix_present;
|
||||
FLOAT32 downmix_matrix[MAX_CHANNEL_COUNT][MAX_CHANNEL_COUNT];
|
||||
FLOAT32 downmix_matrix[MAX_SUBBAND_CHANNEL_COUNT][MAX_SUBBAND_CHANNEL_COUNT];
|
||||
|
||||
FLOAT32 boost;
|
||||
FLOAT32 compress;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#endif
|
||||
|
||||
#define EQ_CHANNEL_COUNT_MAX 8
|
||||
#define EQ_AUDIO_DELAY_MAX 1024
|
||||
#define EQ_FIR_FILTER_SIZE_MAX 128
|
||||
#define EQ_SUBBAND_COUNT_MAX 256
|
||||
#define EQ_INTERMEDIATE_2ND_ORDER_PARAMS_COUNT_MAX 32
|
||||
|
|
@ -38,6 +37,10 @@
|
|||
#define EQ_FILTER_DOMAIN_TIME (1 << 0)
|
||||
#define EQ_FILTER_DOMAIN_SUBBAND (1 << 1)
|
||||
|
||||
#define EQ_REAL_ZERO_CNT 63 /*Max Value of a 6 bit number*/
|
||||
#define EQ_GENERIC_ZERO_CNT 63 /*Max Value of a 6 bit number*/
|
||||
#define EQ_AUDIO_DELAY_MAX (EQ_REAL_ZERO_CNT + (EQ_GENERIC_ZERO_CNT * 2))
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ IA_ERRORCODE impd_init_drc_decode_post_config(
|
|||
}
|
||||
|
||||
p_drc_gain_dec_structs->eq_set = (ia_eq_set_struct*)*mem_ptr;
|
||||
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr + sizeof(ia_eq_set_struct) + 32);
|
||||
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr + sizeof(ia_eq_set_struct));
|
||||
|
||||
if (err_code) return (err_code);
|
||||
|
||||
|
|
@ -217,14 +217,13 @@ IA_ERRORCODE impd_init_drc_decode_post_config(
|
|||
|
||||
p_drc_gain_dec_structs->audio_band_buffer.non_interleaved_audio = *mem_ptr;
|
||||
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
|
||||
(maxMultibandAudioSignalCount * sizeof(FLOAT32*)) + 32);
|
||||
(maxMultibandAudioSignalCount * sizeof(FLOAT32*)));
|
||||
|
||||
for (i = 0; i < maxMultibandAudioSignalCount; i++) {
|
||||
p_drc_gain_dec_structs->audio_band_buffer.non_interleaved_audio[i] =
|
||||
*mem_ptr;
|
||||
*mem_ptr =
|
||||
(pVOID)((SIZE_T)*mem_ptr +
|
||||
(p_drc_params_struct->drc_frame_size * sizeof(FLOAT32)) + 32);
|
||||
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
|
||||
(p_drc_params_struct->drc_frame_size * sizeof(FLOAT32)));
|
||||
}
|
||||
p_drc_gain_dec_structs->audio_band_buffer.multiband_audio_sig_count =
|
||||
maxMultibandAudioSignalCount;
|
||||
|
|
@ -235,21 +234,18 @@ IA_ERRORCODE impd_init_drc_decode_post_config(
|
|||
if (p_drc_params_struct->sub_band_domain_mode == SUBBAND_DOMAIN_MODE_OFF &&
|
||||
p_audio_in_out_buf->audio_delay_samples) {
|
||||
p_audio_in_out_buf->audio_io_buffer_delayed = *mem_ptr;
|
||||
*mem_ptr =
|
||||
(pVOID)((SIZE_T)*mem_ptr +
|
||||
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)) + 32);
|
||||
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
|
||||
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)));
|
||||
p_audio_in_out_buf->audio_in_out_buf = *mem_ptr;
|
||||
*mem_ptr =
|
||||
(pVOID)((SIZE_T)*mem_ptr +
|
||||
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)) + 32);
|
||||
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
|
||||
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)));
|
||||
|
||||
for (i = 0; i < p_audio_in_out_buf->audio_num_chan; i++) {
|
||||
p_audio_in_out_buf->audio_io_buffer_delayed[i] = *mem_ptr;
|
||||
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
|
||||
((p_audio_in_out_buf->frame_size +
|
||||
p_audio_in_out_buf->audio_delay_samples) *
|
||||
sizeof(FLOAT32*)) +
|
||||
32);
|
||||
sizeof(FLOAT32*)));
|
||||
p_audio_in_out_buf->audio_in_out_buf[i] =
|
||||
&p_audio_in_out_buf->audio_io_buffer_delayed
|
||||
[i][p_audio_in_out_buf->audio_delay_samples];
|
||||
|
|
@ -258,35 +254,29 @@ IA_ERRORCODE impd_init_drc_decode_post_config(
|
|||
if (p_drc_params_struct->sub_band_domain_mode != SUBBAND_DOMAIN_MODE_OFF &&
|
||||
p_audio_in_out_buf->audio_delay_sub_band_samples) {
|
||||
p_audio_in_out_buf->audio_buffer_delayed_real = *mem_ptr;
|
||||
*mem_ptr =
|
||||
(pVOID)((SIZE_T)*mem_ptr +
|
||||
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)) + 32);
|
||||
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
|
||||
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)));
|
||||
p_audio_in_out_buf->audio_buffer_delayed_imag = *mem_ptr;
|
||||
*mem_ptr =
|
||||
(pVOID)((SIZE_T)*mem_ptr +
|
||||
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)) + 32);
|
||||
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
|
||||
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)));
|
||||
p_audio_in_out_buf->audio_real_buff = *mem_ptr;
|
||||
*mem_ptr =
|
||||
(pVOID)((SIZE_T)*mem_ptr +
|
||||
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)) + 32);
|
||||
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
|
||||
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)));
|
||||
p_audio_in_out_buf->audio_imag_buff = *mem_ptr;
|
||||
*mem_ptr =
|
||||
(pVOID)((SIZE_T)*mem_ptr +
|
||||
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)) + 32);
|
||||
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
|
||||
(p_audio_in_out_buf->audio_num_chan * sizeof(FLOAT32*)));
|
||||
|
||||
for (i = 0; i < p_audio_in_out_buf->audio_num_chan; i++) {
|
||||
p_audio_in_out_buf->audio_buffer_delayed_real[i] = *mem_ptr;
|
||||
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
|
||||
((p_audio_in_out_buf->audio_sub_band_frame_size +
|
||||
p_audio_in_out_buf->audio_delay_sub_band_samples) *
|
||||
sizeof(FLOAT32*)) +
|
||||
32);
|
||||
sizeof(FLOAT32*)));
|
||||
p_audio_in_out_buf->audio_buffer_delayed_imag[i] = *mem_ptr;
|
||||
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
|
||||
((p_audio_in_out_buf->audio_sub_band_frame_size +
|
||||
p_audio_in_out_buf->audio_delay_sub_band_samples) *
|
||||
sizeof(FLOAT32*)) +
|
||||
32);
|
||||
sizeof(FLOAT32*)));
|
||||
|
||||
p_audio_in_out_buf->audio_real_buff[i] =
|
||||
&p_audio_in_out_buf->audio_buffer_delayed_real
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include <string.h>
|
||||
#include "impd_type_def.h"
|
||||
#include "impd_error_standards.h"
|
||||
|
||||
#include <string.h>
|
||||
#include "impd_drc_extr_delta_coded_info.h"
|
||||
#include "impd_drc_common.h"
|
||||
#include "impd_drc_struct.h"
|
||||
|
|
@ -62,8 +62,6 @@ impd_drc_dec_interface_add_effect_type(
|
|||
ia_drc_interface_struct *pstr_drc_interface, WORD32 drc_effect_type,
|
||||
WORD32 target_loudness, WORD32 loud_norm);
|
||||
|
||||
#define NUM_GAIN_DEC_INSTANCES 2
|
||||
|
||||
#define BITSTREAM_FILE_FORMAT_SPLIT 1
|
||||
#define LIM_DEFAULT_THRESHOLD (0.89125094f)
|
||||
|
||||
|
|
@ -279,79 +277,73 @@ IA_ERRORCODE impd_drc_set_struct_pointer(ia_drc_api_struct *p_obj_drc) {
|
|||
|
||||
p_obj_drc->str_payload.pstr_bitstream_dec =
|
||||
(ia_drc_bits_dec_struct *)persistant_ptr;
|
||||
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_bits_dec_struct) + 32;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_bits_dec_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_gain_dec[0] =
|
||||
(ia_drc_gain_dec_struct *)persistant_ptr;
|
||||
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_gain_dec_struct) + 32;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_gain_dec_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_gain_dec[1] =
|
||||
(ia_drc_gain_dec_struct *)persistant_ptr;
|
||||
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_gain_dec_struct) + 32;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_gain_dec_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_loudness_info =
|
||||
(ia_drc_loudness_info_set_struct *)persistant_ptr;
|
||||
persistant_ptr =
|
||||
(SIZE_T)persistant_ptr + sizeof(ia_drc_loudness_info_set_struct) + 32;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_loudness_info_set_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_drc_gain = (ia_drc_gain_struct *)persistant_ptr;
|
||||
;
|
||||
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_gain_struct) + 32;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_gain_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_drc_interface =
|
||||
(ia_drc_interface_struct *)persistant_ptr;
|
||||
persistant_ptr =
|
||||
(SIZE_T)persistant_ptr + sizeof(ia_drc_interface_struct) + 32;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_interface_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_drc_config = (ia_drc_config *)persistant_ptr;
|
||||
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_config) + 32;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_config);
|
||||
|
||||
p_obj_drc->str_payload.pstr_selection_proc =
|
||||
(ia_drc_sel_pro_struct *)persistant_ptr;
|
||||
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_sel_pro_struct) + 32;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_sel_pro_struct);
|
||||
|
||||
p_obj_drc->str_bit_handler.it_bit_buf = (UWORD8 *)persistant_ptr;
|
||||
persistant_ptr = (SIZE_T)persistant_ptr + 32 * 1024; /*varify the sizelater*/
|
||||
persistant_ptr = persistant_ptr + MAX_BS_BUF_SIZE;
|
||||
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_params =
|
||||
(ia_drc_sel_proc_params_struct *)persistant_ptr;
|
||||
persistant_ptr =
|
||||
(SIZE_T)persistant_ptr + sizeof(ia_drc_sel_proc_params_struct);
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_sel_proc_params_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output =
|
||||
(ia_drc_sel_proc_output_struct *)persistant_ptr;
|
||||
persistant_ptr = (SIZE_T)persistant_ptr +
|
||||
sizeof(ia_drc_sel_proc_output_struct) + 16 * 1024;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_sel_proc_output_struct);
|
||||
|
||||
p_obj_drc->str_bit_handler.bitstream_drc_config = (UWORD8 *)persistant_ptr;
|
||||
persistant_ptr = (SIZE_T)persistant_ptr + 8 * 1024;
|
||||
persistant_ptr = persistant_ptr + MAX_BS_BUF_SIZE;
|
||||
|
||||
p_obj_drc->str_bit_handler.bitstream_loudness_info = (UWORD8 *)persistant_ptr;
|
||||
persistant_ptr = (SIZE_T)persistant_ptr + 8 * 1024;
|
||||
persistant_ptr = persistant_ptr + MAX_BS_BUF_SIZE;
|
||||
|
||||
p_obj_drc->str_bit_handler.bitstream_unidrc_interface =
|
||||
(UWORD8 *)persistant_ptr;
|
||||
persistant_ptr = (SIZE_T)persistant_ptr + 8 * 1024;
|
||||
persistant_ptr = persistant_ptr + MAX_BS_BUF_SIZE;
|
||||
|
||||
p_obj_drc->str_payload.pstr_peak_limiter =
|
||||
(ia_drc_peak_limiter_struct *)persistant_ptr;
|
||||
persistant_ptr =
|
||||
(SIZE_T)persistant_ptr + sizeof(ia_drc_peak_limiter_struct) + 32;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_peak_limiter_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_peak_limiter->buffer =
|
||||
(FLOAT32 *)((SIZE_T)p_obj_drc->str_payload.pstr_peak_limiter +
|
||||
sizeof(ia_drc_peak_limiter_struct) + 32);
|
||||
persistant_ptr = (SIZE_T)persistant_ptr + 16 * 1024;
|
||||
sizeof(ia_drc_peak_limiter_struct));
|
||||
persistant_ptr = persistant_ptr + PEAK_LIM_BUF_SIZE;
|
||||
|
||||
p_obj_drc->str_payload.pstr_qmf_filter =
|
||||
(ia_drc_qmf_filt_struct *)persistant_ptr;
|
||||
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_qmf_filt_struct) + 32;
|
||||
persistant_ptr = persistant_ptr + sizeof(ia_drc_qmf_filt_struct);
|
||||
|
||||
p_obj_drc->str_payload.pstr_qmf_filter->ana_buff = (FLOAT64 *)persistant_ptr;
|
||||
persistant_ptr = (SIZE_T)persistant_ptr + 16 * 1024;
|
||||
persistant_ptr = persistant_ptr + ANALY_BUF_SIZE;
|
||||
|
||||
p_obj_drc->str_payload.pstr_qmf_filter->syn_buff = (FLOAT64 *)persistant_ptr;
|
||||
persistant_ptr = (SIZE_T)persistant_ptr + 16 * 1024;
|
||||
persistant_ptr = persistant_ptr + SYNTH_BUF_SIZE;
|
||||
|
||||
p_obj_drc->p_state->persistant_ptr = (pVOID)persistant_ptr;
|
||||
return IA_NO_ERROR;
|
||||
|
|
@ -464,6 +456,7 @@ IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc) {
|
|||
p_obj_drc->str_bit_handler.num_bytes_bs_drc_config);
|
||||
|
||||
if (err_code == 1) {
|
||||
memset(p_obj_drc->str_payload.pstr_drc_config, 0, sizeof(ia_drc_config));
|
||||
err_code = impd_drc_set_default_bitstream_config(
|
||||
p_obj_drc->str_payload.pstr_drc_config);
|
||||
p_obj_drc->str_payload.pstr_drc_config->channel_layout
|
||||
|
|
|
|||
|
|
@ -1332,6 +1332,29 @@ int ixheaacd_main_process(WORD32 argc, pWORD8 argv[]) {
|
|||
_IA_HANDLE_ERROR(p_proc_err_info, (pWORD8) "", err_code);
|
||||
}
|
||||
|
||||
/* Get memory info tables size */
|
||||
err_code =
|
||||
ia_drc_dec_api(pv_ia_drc_process_api_obj, IA_API_CMD_GET_MEMTABS_SIZE,
|
||||
0, &ui_proc_mem_tabs_size);
|
||||
_IA_HANDLE_ERROR(p_proc_err_info, (pWORD8) "", err_code);
|
||||
|
||||
g_pv_arr_alloc_memory[g_w_malloc_count] = malloc(ui_proc_mem_tabs_size);
|
||||
|
||||
if (g_pv_arr_alloc_memory[g_w_malloc_count] == NULL) {
|
||||
err_code = IA_TESTBENCH_MFMAN_FATAL_MEM_ALLOC_FAILED;
|
||||
_IA_HANDLE_ERROR(&ixheaacd_ia_testbench_error_info,
|
||||
(pWORD8) "Mem tables alloc", err_code);
|
||||
}
|
||||
|
||||
/* Set pointer for process memory tables */
|
||||
err_code = ia_drc_dec_api(
|
||||
pv_ia_drc_process_api_obj, IA_API_CMD_SET_MEMTABS_PTR, 0,
|
||||
(pVOID)((WORD8 *)g_pv_arr_alloc_memory[g_w_malloc_count]));
|
||||
|
||||
_IA_HANDLE_ERROR(p_proc_err_info, (pWORD8) "", err_code);
|
||||
|
||||
g_w_malloc_count++;
|
||||
|
||||
err_code = ia_drc_dec_api(pv_ia_drc_process_api_obj, IA_API_CMD_INIT,
|
||||
IA_CMD_TYPE_INIT_API_POST_CONFIG_PARAMS, NULL);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue