Formatting changes
am: b3226ce6f8
Change-Id: I6c76e505a44f1dba20bc8ae06e4cbece1c4efae2
This commit is contained in:
commit
dfdabaf9eb
152 changed files with 20984 additions and 21999 deletions
|
|
@ -134,7 +134,8 @@ VOID(*ixheaacd_harm_idx_zerotwolp)
|
||||||
|
|
||||||
VOID(*ixheaacd_tns_ar_filter_fixed)
|
VOID(*ixheaacd_tns_ar_filter_fixed)
|
||||||
(WORD32 *spectrum, WORD32 size, WORD32 inc, WORD32 *lpc, WORD32 order,
|
(WORD32 *spectrum, WORD32 size, WORD32 inc, WORD32 *lpc, WORD32 order,
|
||||||
WORD32 shift_value, WORD scale_spec) = &ixheaacd_tns_ar_filter_fixed_non_neon_armv7;
|
WORD32 shift_value,
|
||||||
|
WORD scale_spec) = &ixheaacd_tns_ar_filter_fixed_non_neon_armv7;
|
||||||
|
|
||||||
VOID(*ixheaacd_tns_ar_filter)
|
VOID(*ixheaacd_tns_ar_filter)
|
||||||
(WORD32 *spectrum, WORD32 size, WORD32 inc, WORD16 *lpc, WORD32 order,
|
(WORD32 *spectrum, WORD32 size, WORD32 inc, WORD16 *lpc, WORD32 order,
|
||||||
|
|
|
||||||
|
|
@ -249,8 +249,8 @@ VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states,
|
||||||
filter_states[3 * M] = 0;
|
filter_states[3 * M] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID ixheaacd_inv_emodulation(
|
VOID ixheaacd_inv_emodulation(WORD32 *qmf_real,
|
||||||
WORD32 *qmf_real, ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
||||||
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
||||||
ixheaacd_cos_sin_mod(qmf_real, syn_qmf, (WORD16 *)qmf_dec_tables_ptr->w1024,
|
ixheaacd_cos_sin_mod(qmf_real, syn_qmf, (WORD16 *)qmf_dec_tables_ptr->w1024,
|
||||||
(WORD32 *)qmf_dec_tables_ptr->dig_rev_table2_128);
|
(WORD32 *)qmf_dec_tables_ptr->dig_rev_table2_128);
|
||||||
|
|
@ -352,4 +352,3 @@ VOID ixheaacd_esbr_cos_sin_mod(WORD32 *subband,
|
||||||
p_sin = qmf_bank->esbr_alt_sin_twiddle;
|
p_sin = qmf_bank->esbr_alt_sin_twiddle;
|
||||||
ixheaacd_esbr_cos_sin_mod_loop2(subband, p_sin, M);
|
ixheaacd_esbr_cos_sin_mod_loop2(subband, p_sin, M);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -490,8 +490,8 @@ VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states,
|
||||||
filter_states[3 * M] = 0;
|
filter_states[3 * M] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID ixheaacd_inv_emodulation(
|
VOID ixheaacd_inv_emodulation(WORD32 *qmf_real,
|
||||||
WORD32 *qmf_real, ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
||||||
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
||||||
ixheaacd_cos_sin_mod(qmf_real, syn_qmf, (WORD16 *)qmf_dec_tables_ptr->w1024,
|
ixheaacd_cos_sin_mod(qmf_real, syn_qmf, (WORD16 *)qmf_dec_tables_ptr->w1024,
|
||||||
(WORD32 *)qmf_dec_tables_ptr->dig_rev_table2_128);
|
(WORD32 *)qmf_dec_tables_ptr->dig_rev_table2_128);
|
||||||
|
|
@ -1103,7 +1103,6 @@ VOID ixheaacd_esbr_cos_sin_mod(WORD32 *subband,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID ixheaacd_esbr_fwd_modulation(
|
VOID ixheaacd_esbr_fwd_modulation(
|
||||||
const WORD32 *time_sample_buf, WORD32 *real_subband, WORD32 *imag_subband,
|
const WORD32 *time_sample_buf, WORD32 *real_subband, WORD32 *imag_subband,
|
||||||
ia_sbr_qmf_filter_bank_struct *qmf_bank,
|
ia_sbr_qmf_filter_bank_struct *qmf_bank,
|
||||||
|
|
@ -1344,6 +1343,3 @@ VOID ixheaacd_radix4bfly(const WORD16 *w, WORD32 *x, WORD32 index1,
|
||||||
w_ptr = w_ptr - fft_jmp;
|
w_ptr = w_ptr - fft_jmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@
|
||||||
#define IA_API_CMD_GET_OUTPUT_BYTES 0x000D
|
#define IA_API_CMD_GET_OUTPUT_BYTES 0x000D
|
||||||
#define IA_API_CMD_INPUT_OVER 0x000E
|
#define IA_API_CMD_INPUT_OVER 0x000E
|
||||||
|
|
||||||
|
|
||||||
#define IA_API_CMD_RESET 0x0010
|
#define IA_API_CMD_RESET 0x0010
|
||||||
|
|
||||||
#define IA_API_CMD_GET_MEM_INFO_SIZE 0x0011
|
#define IA_API_CMD_GET_MEM_INFO_SIZE 0x0011
|
||||||
|
|
@ -63,7 +62,6 @@
|
||||||
#define IA_API_CMD_SET_TABLE_PTR 0x001D
|
#define IA_API_CMD_SET_TABLE_PTR 0x001D
|
||||||
#define IA_API_CMD_GET_TABLE_PTR 0x001E
|
#define IA_API_CMD_GET_TABLE_PTR 0x001E
|
||||||
|
|
||||||
|
|
||||||
#define IA_API_CMD_INPUT_OVER_BS 0x0021
|
#define IA_API_CMD_INPUT_OVER_BS 0x0021
|
||||||
#define IA_API_CMD_INPUT_OVER_IC_BS 0x0022
|
#define IA_API_CMD_INPUT_OVER_IC_BS 0x0022
|
||||||
#define IA_API_CMD_INPUT_OVER_IG_BS 0x0023
|
#define IA_API_CMD_INPUT_OVER_IG_BS 0x0023
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
#include "impd_apicmd_standards.h"
|
#include "impd_apicmd_standards.h"
|
||||||
#include "impd_memory_standards.h"
|
#include "impd_memory_standards.h"
|
||||||
|
|
||||||
|
|
||||||
#include "impd_drc_bitbuffer.h"
|
#include "impd_drc_bitbuffer.h"
|
||||||
#include "impd_drc_extr_delta_coded_info.h"
|
#include "impd_drc_extr_delta_coded_info.h"
|
||||||
#include "impd_drc_common.h"
|
#include "impd_drc_common.h"
|
||||||
|
|
@ -52,16 +51,13 @@ WORD32 impd_init_process_audio_main_qmf(ia_drc_api_struct *p_obj_drc);
|
||||||
WORD32 impd_init_process_audio_main_stft(ia_drc_api_struct *p_obj_drc);
|
WORD32 impd_init_process_audio_main_stft(ia_drc_api_struct *p_obj_drc);
|
||||||
WORD32 impd_init_process_audio_main_td_qmf(ia_drc_api_struct *p_obj_drc);
|
WORD32 impd_init_process_audio_main_td_qmf(ia_drc_api_struct *p_obj_drc);
|
||||||
|
|
||||||
IA_ERRORCODE impd_drc_mem_api(ia_drc_api_struct *p_obj_drc,
|
IA_ERRORCODE impd_drc_mem_api(ia_drc_api_struct *p_obj_drc, WORD32 i_cmd,
|
||||||
WORD32 i_cmd, WORD32 i_idx, pVOID pv_value);
|
WORD32 i_idx, pVOID pv_value);
|
||||||
|
|
||||||
IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc);
|
IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VOID impd_drc_set_default_config_params(ia_drc_config_struct *ptr_config);
|
VOID impd_drc_set_default_config_params(ia_drc_config_struct *ptr_config);
|
||||||
|
|
||||||
|
|
||||||
IA_ERRORCODE impd_drc_process_frame(ia_drc_api_struct *p_obj_drc);
|
IA_ERRORCODE impd_drc_process_frame(ia_drc_api_struct *p_obj_drc);
|
||||||
IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc);
|
IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc);
|
||||||
IA_ERRORCODE impd_drc_set_default_config(ia_drc_api_struct *p_obj_drc);
|
IA_ERRORCODE impd_drc_set_default_config(ia_drc_api_struct *p_obj_drc);
|
||||||
|
|
@ -71,13 +67,8 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc);
|
||||||
#define NUM_DRC_TABLES 4
|
#define NUM_DRC_TABLES 4
|
||||||
#define SCRATCH_MEM_SIZE 1024 * 256 * 64
|
#define SCRATCH_MEM_SIZE 1024 * 256 * 64
|
||||||
|
|
||||||
|
IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
|
||||||
|
pVOID pv_value) {
|
||||||
IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj,
|
|
||||||
WORD32 i_cmd,
|
|
||||||
WORD32 i_idx,
|
|
||||||
pVOID pv_value)
|
|
||||||
{
|
|
||||||
ia_drc_api_struct *p_obj_drc = p_ia_drc_dec_obj;
|
ia_drc_api_struct *p_obj_drc = p_ia_drc_dec_obj;
|
||||||
IA_ERRORCODE error_code = IA_NO_ERROR;
|
IA_ERRORCODE error_code = IA_NO_ERROR;
|
||||||
LOOPIDX i;
|
LOOPIDX i;
|
||||||
|
|
@ -87,567 +78,458 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj,
|
||||||
pWORD8 pb_value = pv_value;
|
pWORD8 pb_value = pv_value;
|
||||||
SIZE_T *ps_value = pv_value;
|
SIZE_T *ps_value = pv_value;
|
||||||
|
|
||||||
switch(i_cmd)
|
switch (i_cmd) {
|
||||||
{
|
|
||||||
case IA_API_CMD_GET_MEM_INFO_SIZE:
|
case IA_API_CMD_GET_MEM_INFO_SIZE:
|
||||||
case IA_API_CMD_GET_MEM_INFO_ALIGNMENT:
|
case IA_API_CMD_GET_MEM_INFO_ALIGNMENT:
|
||||||
case IA_API_CMD_GET_MEM_INFO_TYPE:
|
case IA_API_CMD_GET_MEM_INFO_TYPE:
|
||||||
case IA_API_CMD_GET_MEM_INFO_PLACEMENT:
|
case IA_API_CMD_GET_MEM_INFO_PLACEMENT:
|
||||||
case IA_API_CMD_GET_MEM_INFO_PRIORITY:
|
case IA_API_CMD_GET_MEM_INFO_PRIORITY:
|
||||||
case IA_API_CMD_SET_MEM_PTR:
|
case IA_API_CMD_SET_MEM_PTR:
|
||||||
case IA_API_CMD_SET_MEM_PLACEMENT:
|
case IA_API_CMD_SET_MEM_PLACEMENT: {
|
||||||
{
|
|
||||||
return impd_drc_mem_api(p_ia_drc_dec_obj, i_cmd, i_idx, pv_value);
|
return impd_drc_mem_api(p_ia_drc_dec_obj, i_cmd, i_idx, pv_value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
switch(i_cmd)
|
switch (i_cmd) {
|
||||||
{
|
case IA_API_CMD_GET_LIB_ID_STRINGS: {
|
||||||
case IA_API_CMD_GET_LIB_ID_STRINGS:
|
switch (i_idx) {
|
||||||
{
|
case IA_CMD_TYPE_LIB_NAME: {
|
||||||
switch(i_idx)
|
|
||||||
{
|
|
||||||
case IA_CMD_TYPE_LIB_NAME:
|
|
||||||
{
|
|
||||||
WORD8 lib_name[] = LIBNAME;
|
WORD8 lib_name[] = LIBNAME;
|
||||||
for(i = 0; i < IA_API_STR_LEN && lib_name[i -1] != 0; i++)
|
for (i = 0; i < IA_API_STR_LEN && lib_name[i - 1] != 0; i++) {
|
||||||
{
|
|
||||||
pb_value[i] = lib_name[i];
|
pb_value[i] = lib_name[i];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_CMD_TYPE_LIB_VERSION:
|
case IA_CMD_TYPE_LIB_VERSION: {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IA_CMD_TYPE_API_VERSION:
|
case IA_CMD_TYPE_API_VERSION: {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
default: { return -1; }
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_GET_API_SIZE:
|
case IA_API_CMD_GET_API_SIZE: {
|
||||||
{
|
*pui_value = sizeof(ia_drc_api_struct) +
|
||||||
*pui_value = sizeof(ia_drc_api_struct)+(sizeof(ia_drc_state_struct)+8)+8080*1024;
|
(sizeof(ia_drc_state_struct) + 8) + 8080 * 1024;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_INIT:
|
case IA_API_CMD_INIT: {
|
||||||
{
|
switch (i_idx) {
|
||||||
switch(i_idx)
|
case IA_CMD_TYPE_INIT_SET_BUFF_PTR: {
|
||||||
{
|
p_obj_drc->p_state->persistant_ptr =
|
||||||
case IA_CMD_TYPE_INIT_SET_BUFF_PTR:
|
p_obj_drc->pp_mem[IA_DRC_PERSIST_IDX];
|
||||||
{
|
|
||||||
p_obj_drc->p_state->persistant_ptr=p_obj_drc->pp_mem[IA_DRC_PERSIST_IDX];
|
|
||||||
impd_drc_set_struct_pointer(p_obj_drc);
|
impd_drc_set_struct_pointer(p_obj_drc);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_CMD_TYPE_INIT_API_PRE_CONFIG_PARAMS:
|
case IA_CMD_TYPE_INIT_API_PRE_CONFIG_PARAMS: {
|
||||||
{
|
|
||||||
impd_drc_set_default_config(p_obj_drc);
|
impd_drc_set_default_config(p_obj_drc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_CMD_TYPE_INIT_API_POST_CONFIG_PARAMS:
|
case IA_CMD_TYPE_INIT_API_POST_CONFIG_PARAMS: {
|
||||||
{
|
p_obj_drc->p_state =
|
||||||
p_obj_drc->p_state=(ia_drc_state_struct *)((SIZE_T)p_obj_drc+8000*1024);
|
(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->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);
|
p_obj_drc->pp_mem = (pVOID)((SIZE_T)p_obj_drc + 8006 * 1024);
|
||||||
impd_drc_fill_mem_tables(p_obj_drc);
|
impd_drc_fill_mem_tables(p_obj_drc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_CMD_TYPE_INIT_PROCESS:
|
case IA_CMD_TYPE_INIT_PROCESS: {
|
||||||
{
|
|
||||||
IA_ERRORCODE Error = 0;
|
IA_ERRORCODE Error = 0;
|
||||||
|
|
||||||
if(p_obj_drc->pp_mem[IA_DRC_PERSIST_IDX] == 0)
|
if (p_obj_drc->pp_mem[IA_DRC_PERSIST_IDX] == 0) {
|
||||||
{
|
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Error = impd_drc_init(p_obj_drc);
|
Error = impd_drc_init(p_obj_drc);
|
||||||
if(Error)
|
if (Error) return Error;
|
||||||
return Error;
|
|
||||||
p_obj_drc->p_state->ui_init_done = 1;
|
p_obj_drc->p_state->ui_init_done = 1;
|
||||||
return Error;
|
return Error;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_CMD_TYPE_INIT_DONE_QUERY:
|
case IA_CMD_TYPE_INIT_DONE_QUERY: {
|
||||||
{
|
if (p_obj_drc->p_state->ui_init_done == 1) {
|
||||||
|
|
||||||
if(p_obj_drc->p_state->ui_init_done == 1)
|
|
||||||
{
|
|
||||||
*pui_value = 1;
|
*pui_value = 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
*pui_value = 0;
|
*pui_value = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IA_CMD_TYPE_INIT_CPY_BSF_BUFF_OVER_QUERY:
|
case IA_CMD_TYPE_INIT_CPY_BSF_BUFF_OVER_QUERY: {
|
||||||
{
|
|
||||||
*pui_value = p_obj_drc->str_bit_handler.cpy_over;
|
*pui_value = p_obj_drc->str_bit_handler.cpy_over;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_CMD_TYPE_INIT_CPY_IC_BSF_BUFF_OVER_QUERY:
|
case IA_CMD_TYPE_INIT_CPY_IC_BSF_BUFF_OVER_QUERY: {
|
||||||
{
|
|
||||||
*pui_value = p_obj_drc->str_bit_handler.cpy_over_ic;
|
*pui_value = p_obj_drc->str_bit_handler.cpy_over_ic;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IA_CMD_TYPE_INIT_CPY_IL_BSF_BUFF_OVER_QUERY:
|
case IA_CMD_TYPE_INIT_CPY_IL_BSF_BUFF_OVER_QUERY: {
|
||||||
{
|
|
||||||
*pui_value = p_obj_drc->str_bit_handler.cpy_over_il;
|
*pui_value = p_obj_drc->str_bit_handler.cpy_over_il;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_CMD_TYPE_INIT_CPY_IN_BSF_BUFF_OVER_QUERY:
|
case IA_CMD_TYPE_INIT_CPY_IN_BSF_BUFF_OVER_QUERY: {
|
||||||
{
|
|
||||||
*pui_value = p_obj_drc->str_bit_handler.cpy_over_in;
|
*pui_value = p_obj_drc->str_bit_handler.cpy_over_in;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_CMD_TYPE_INIT_CPY_BSF_BUFF:
|
case IA_CMD_TYPE_INIT_CPY_BSF_BUFF: {
|
||||||
{
|
memcpy(p_obj_drc->str_bit_handler.it_bit_buf +
|
||||||
memcpy(p_obj_drc->str_bit_handler.it_bit_buf+p_obj_drc->str_bit_handler.num_bytes_bs, p_obj_drc->pp_mem[2],p_obj_drc->str_bit_handler.num_byts_cur);
|
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs=p_obj_drc->str_bit_handler.num_bytes_bs+p_obj_drc->str_bit_handler.num_byts_cur;
|
p_obj_drc->pp_mem[2], p_obj_drc->str_bit_handler.num_byts_cur);
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs =
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs +
|
||||||
|
p_obj_drc->str_bit_handler.num_byts_cur;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
case IA_CMD_TYPE_INIT_CPY_IC_BSF_BUFF:
|
case IA_CMD_TYPE_INIT_CPY_IC_BSF_BUFF: {
|
||||||
{
|
memcpy(p_obj_drc->str_bit_handler.bitstream_drc_config +
|
||||||
memcpy(p_obj_drc->str_bit_handler.bitstream_drc_config+p_obj_drc->str_bit_handler.num_bytes_bs_drc_config, p_obj_drc->pp_mem[2],p_obj_drc->str_bit_handler.num_byts_cur_ic);
|
p_obj_drc->str_bit_handler.num_bytes_bs_drc_config,
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs_drc_config=p_obj_drc->str_bit_handler.num_bytes_bs_drc_config+p_obj_drc->str_bit_handler.num_byts_cur_ic;
|
p_obj_drc->pp_mem[2],
|
||||||
|
p_obj_drc->str_bit_handler.num_byts_cur_ic);
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs_drc_config =
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs_drc_config +
|
||||||
|
p_obj_drc->str_bit_handler.num_byts_cur_ic;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
case IA_CMD_TYPE_INIT_CPY_IL_BSF_BUFF:
|
case IA_CMD_TYPE_INIT_CPY_IL_BSF_BUFF: {
|
||||||
{
|
memcpy(p_obj_drc->str_bit_handler.bitstream_loudness_info +
|
||||||
memcpy(p_obj_drc->str_bit_handler.bitstream_loudness_info+p_obj_drc->str_bit_handler.num_bytes_bs_loudness_info, p_obj_drc->pp_mem[2],p_obj_drc->str_bit_handler.num_byts_cur_il);
|
p_obj_drc->str_bit_handler.num_bytes_bs_loudness_info,
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs_loudness_info=p_obj_drc->str_bit_handler.num_bytes_bs_loudness_info+p_obj_drc->str_bit_handler.num_byts_cur_il;
|
p_obj_drc->pp_mem[2],
|
||||||
|
p_obj_drc->str_bit_handler.num_byts_cur_il);
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs_loudness_info =
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs_loudness_info +
|
||||||
|
p_obj_drc->str_bit_handler.num_byts_cur_il;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
case IA_CMD_TYPE_INIT_CPY_IN_BSF_BUFF:
|
case IA_CMD_TYPE_INIT_CPY_IN_BSF_BUFF: {
|
||||||
{
|
memcpy(p_obj_drc->str_bit_handler.bitstream_unidrc_interface +
|
||||||
memcpy(p_obj_drc->str_bit_handler.bitstream_unidrc_interface+p_obj_drc->str_bit_handler.num_bytes_bs_unidrc_interface, p_obj_drc->pp_mem[2],p_obj_drc->str_bit_handler.num_byts_cur_in);
|
p_obj_drc->str_bit_handler.num_bytes_bs_unidrc_interface,
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs_unidrc_interface=p_obj_drc->str_bit_handler.num_bytes_bs_unidrc_interface+p_obj_drc->str_bit_handler.num_byts_cur_in;
|
p_obj_drc->pp_mem[2],
|
||||||
|
p_obj_drc->str_bit_handler.num_byts_cur_in);
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs_unidrc_interface =
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs_unidrc_interface +
|
||||||
|
p_obj_drc->str_bit_handler.num_byts_cur_in;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
default: { return -1; }
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_GET_CONFIG_PARAM:
|
case IA_API_CMD_GET_CONFIG_PARAM: {
|
||||||
{
|
switch (i_idx) {
|
||||||
switch(i_idx)
|
case IA_DRC_DEC_CONFIG_PARAM_SAMP_FREQ: {
|
||||||
{
|
|
||||||
|
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_SAMP_FREQ:
|
|
||||||
{
|
|
||||||
|
|
||||||
*pus_value = p_obj_drc->str_config.sampling_rate;
|
*pus_value = p_obj_drc->str_config.sampling_rate;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_NUM_CHANNELS:
|
case IA_DRC_DEC_CONFIG_PARAM_NUM_CHANNELS: {
|
||||||
{
|
|
||||||
|
|
||||||
*pus_value = p_obj_drc->str_config.num_ch_out;
|
*pus_value = p_obj_drc->str_config.num_ch_out;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_DRC_DEC_CONFIG_PROC_OUT_PTR:
|
case IA_DRC_DEC_CONFIG_PROC_OUT_PTR: {
|
||||||
{
|
|
||||||
|
|
||||||
*ps_value = (SIZE_T)p_obj_drc->str_payload.pstr_drc_sel_proc_output;
|
*ps_value = (SIZE_T)p_obj_drc->str_payload.pstr_drc_sel_proc_output;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_SET_CONFIG_PARAM:
|
case IA_API_CMD_SET_CONFIG_PARAM: {
|
||||||
{
|
switch (i_idx) {
|
||||||
switch(i_idx)
|
case IA_DRC_DEC_CONFIG_PARAM_DEC_TYPE: {
|
||||||
{
|
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_DEC_TYPE:
|
|
||||||
{
|
|
||||||
if (*pus_value == 1) {
|
if (*pus_value == 1) {
|
||||||
p_obj_drc->str_config.dec_type = DEC_TYPE_TD_QMF64;
|
p_obj_drc->str_config.dec_type = DEC_TYPE_TD_QMF64;
|
||||||
p_obj_drc->str_config.sub_band_domain_mode = SUBBAND_DOMAIN_MODE_QMF64;
|
p_obj_drc->str_config.sub_band_domain_mode =
|
||||||
p_obj_drc->str_config.sub_band_down_sampling_factor = AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64;
|
SUBBAND_DOMAIN_MODE_QMF64;
|
||||||
p_obj_drc->str_config.sub_band_count = AUDIO_CODEC_SUBBAND_COUNT_QMF64;
|
p_obj_drc->str_config.sub_band_down_sampling_factor =
|
||||||
}
|
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64;
|
||||||
else if(*pus_value==2){
|
p_obj_drc->str_config.sub_band_count =
|
||||||
|
AUDIO_CODEC_SUBBAND_COUNT_QMF64;
|
||||||
|
} else if (*pus_value == 2) {
|
||||||
p_obj_drc->str_config.dec_type = DEC_TYPE_QMF64;
|
p_obj_drc->str_config.dec_type = DEC_TYPE_QMF64;
|
||||||
p_obj_drc->str_config.sub_band_domain_mode = SUBBAND_DOMAIN_MODE_QMF64;
|
p_obj_drc->str_config.sub_band_domain_mode =
|
||||||
p_obj_drc->str_config.sub_band_down_sampling_factor = AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64;
|
SUBBAND_DOMAIN_MODE_QMF64;
|
||||||
p_obj_drc->str_config.sub_band_count = AUDIO_CODEC_SUBBAND_COUNT_QMF64;
|
p_obj_drc->str_config.sub_band_down_sampling_factor =
|
||||||
}
|
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64;
|
||||||
else if(*pus_value==3){
|
p_obj_drc->str_config.sub_band_count =
|
||||||
|
AUDIO_CODEC_SUBBAND_COUNT_QMF64;
|
||||||
|
} else if (*pus_value == 3) {
|
||||||
p_obj_drc->str_config.dec_type = DEC_TYPE_STFT256;
|
p_obj_drc->str_config.dec_type = DEC_TYPE_STFT256;
|
||||||
p_obj_drc->str_config.sub_band_domain_mode = SUBBAND_DOMAIN_MODE_STFT256;
|
p_obj_drc->str_config.sub_band_domain_mode =
|
||||||
p_obj_drc->str_config.sub_band_down_sampling_factor = AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_STFT256;
|
SUBBAND_DOMAIN_MODE_STFT256;
|
||||||
p_obj_drc->str_config.sub_band_count = AUDIO_CODEC_SUBBAND_COUNT_STFT256;
|
p_obj_drc->str_config.sub_band_down_sampling_factor =
|
||||||
}
|
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_STFT256;
|
||||||
else{
|
p_obj_drc->str_config.sub_band_count =
|
||||||
|
AUDIO_CODEC_SUBBAND_COUNT_STFT256;
|
||||||
|
} else {
|
||||||
p_obj_drc->str_config.dec_type = DEC_TYPE_TD;
|
p_obj_drc->str_config.dec_type = DEC_TYPE_TD;
|
||||||
p_obj_drc->str_config.sub_band_domain_mode = SUBBAND_DOMAIN_MODE_OFF;
|
p_obj_drc->str_config.sub_band_domain_mode =
|
||||||
|
SUBBAND_DOMAIN_MODE_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(*pus_value<0 || *pus_value >3)
|
if (*pus_value < 0 || *pus_value > 3) {
|
||||||
{
|
|
||||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_DECODE_TYPE;
|
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_DECODE_TYPE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_CTRL_PARAM:
|
case IA_DRC_DEC_CONFIG_PARAM_CTRL_PARAM: {
|
||||||
{
|
if (*pus_value < 1 || *pus_value > 39) {
|
||||||
if(*pus_value<1 || *pus_value>39)
|
|
||||||
{
|
|
||||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_CTRL_PARAM_IDX;
|
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_CTRL_PARAM_IDX;
|
||||||
}
|
}
|
||||||
p_obj_drc->str_config.control_parameter_index = *pus_value;
|
p_obj_drc->str_config.control_parameter_index = *pus_value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_PEAK_LIMITER:
|
case IA_DRC_DEC_CONFIG_PARAM_PEAK_LIMITER: {
|
||||||
{
|
if (*pus_value < 0 || *pus_value > 1) {
|
||||||
if(*pus_value<0 || *pus_value>1)
|
|
||||||
{
|
|
||||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_PEAK_LIM_FLAG;
|
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_PEAK_LIM_FLAG;
|
||||||
}
|
}
|
||||||
p_obj_drc->str_config.peak_limiter = *pus_value;
|
p_obj_drc->str_config.peak_limiter = *pus_value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_VER_MODE:
|
case IA_DRC_DEC_CONFIG_PARAM_VER_MODE: {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_SAMP_FREQ:
|
case IA_DRC_DEC_CONFIG_PARAM_SAMP_FREQ: {
|
||||||
{
|
if (*pus_value < 8000 || *pus_value > 96000) {
|
||||||
if(*pus_value<8000 || *pus_value>96000)
|
|
||||||
{
|
|
||||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_SAMP_FREQ;
|
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_SAMP_FREQ;
|
||||||
}
|
}
|
||||||
p_obj_drc->str_config.sampling_rate = *pus_value;
|
p_obj_drc->str_config.sampling_rate = *pus_value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_NUM_CHANNELS:
|
case IA_DRC_DEC_CONFIG_PARAM_NUM_CHANNELS: {
|
||||||
{
|
|
||||||
p_obj_drc->str_config.num_ch_in = *pus_value;
|
p_obj_drc->str_config.num_ch_in = *pus_value;
|
||||||
if(*pus_value < 1 || *pus_value > MAX_CHANNEL_COUNT)
|
if (*pus_value < 1 || *pus_value > MAX_CHANNEL_COUNT) {
|
||||||
{
|
|
||||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_NUM_OF_CHANNELS;
|
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_NUM_OF_CHANNELS;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_PCM_WDSZ:
|
case IA_DRC_DEC_CONFIG_PARAM_PCM_WDSZ: {
|
||||||
{
|
if ((*pus_value != 16) && (*pus_value != 32)) {
|
||||||
if((*pus_value!=16) && (*pus_value!=32))
|
|
||||||
{
|
|
||||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_PCM_SIZE;
|
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_PCM_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
p_obj_drc->str_config.pcm_size = *pus_value;
|
p_obj_drc->str_config.pcm_size = *pus_value;
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_BITS_FORMAT:
|
case IA_DRC_DEC_CONFIG_PARAM_BITS_FORMAT: {
|
||||||
{
|
if ((*pus_value != 1) && (*pus_value != 0)) {
|
||||||
if((*pus_value!=1)&&(*pus_value!=0))
|
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
p_obj_drc->str_config.bitstream_file_format = *pus_value;
|
p_obj_drc->str_config.bitstream_file_format = *pus_value;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_INT_PRESENT:
|
case IA_DRC_DEC_CONFIG_PARAM_INT_PRESENT: {
|
||||||
{
|
if ((*pus_value != 1) && (*pus_value != 0)) {
|
||||||
if((*pus_value!=1)&&(*pus_value!=0))
|
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
p_obj_drc->str_config.interface_bitstream_present = *pus_value;
|
p_obj_drc->str_config.interface_bitstream_present = *pus_value;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_DELAY_MODE:
|
case IA_DRC_DEC_CONFIG_PARAM_DELAY_MODE: {
|
||||||
{
|
if ((*pus_value != 1) && (*pus_value != 0)) {
|
||||||
if((*pus_value!=1)&&(*pus_value!=0))
|
|
||||||
{
|
|
||||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_DELAY_MODE;
|
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_DELAY_MODE;
|
||||||
}
|
}
|
||||||
p_obj_drc->str_config.delay_mode = *pus_value;
|
p_obj_drc->str_config.delay_mode = *pus_value;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_GAIN_DELAY:
|
case IA_DRC_DEC_CONFIG_PARAM_GAIN_DELAY: {
|
||||||
{
|
if ((*pus_value > MAX_SIGNAL_DELAY) || (*pus_value < 0)) {
|
||||||
if ((*pus_value > MAX_SIGNAL_DELAY) || (*pus_value < 0))
|
|
||||||
{
|
|
||||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_GAIN_DELAY;
|
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_GAIN_DELAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
p_obj_drc->str_config.gain_delay_samples = *pus_value;
|
p_obj_drc->str_config.gain_delay_samples = *pus_value;
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Sujith: introduce error*/
|
/*Sujith: introduce error*/
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_AUDIO_DELAY:
|
case IA_DRC_DEC_CONFIG_PARAM_AUDIO_DELAY: {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_CON_DELAY_MODE:
|
case IA_DRC_DEC_CONFIG_PARAM_CON_DELAY_MODE: {
|
||||||
{
|
if (*pus_value < 0 || *pus_value > 1) {
|
||||||
if(*pus_value<0 || *pus_value>1)
|
|
||||||
{
|
|
||||||
return IA_DRC_DEC_CONFIG_PARAM_CON_DELAY_MODE;
|
return IA_DRC_DEC_CONFIG_PARAM_CON_DELAY_MODE;
|
||||||
}
|
}
|
||||||
p_obj_drc->str_config.constant_delay_on = *pus_value;
|
p_obj_drc->str_config.constant_delay_on = *pus_value;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_ABSO_DELAY_OFF:
|
case IA_DRC_DEC_CONFIG_PARAM_ABSO_DELAY_OFF: {
|
||||||
{
|
|
||||||
p_obj_drc->str_config.absorb_delay_on = *pus_value;
|
p_obj_drc->str_config.absorb_delay_on = *pus_value;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_DRC_DEC_CONFIG_PARAM_FRAME_SIZE:
|
case IA_DRC_DEC_CONFIG_PARAM_FRAME_SIZE: {
|
||||||
{
|
if (*pus_value < 1 || *pus_value > 4096) {
|
||||||
if(*pus_value<1 || *pus_value>4096)
|
|
||||||
{
|
|
||||||
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_FRAME_SIZE;
|
return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_FRAME_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
p_obj_drc->str_config.frame_size = *pus_value;
|
p_obj_drc->str_config.frame_size = *pus_value;
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_DRC_DEC_CONFIG_GAIN_STREAM_FLAG:
|
case IA_DRC_DEC_CONFIG_GAIN_STREAM_FLAG: {
|
||||||
{
|
|
||||||
p_obj_drc->str_bit_handler.gain_stream_flag = *pus_value;
|
p_obj_drc->str_bit_handler.gain_stream_flag = *pus_value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IA_DRC_DEC_CONFIG_DRC_EFFECT_TYPE:
|
case IA_DRC_DEC_CONFIG_DRC_EFFECT_TYPE: {
|
||||||
{
|
|
||||||
p_obj_drc->str_config.effect_type = *pus_value;
|
p_obj_drc->str_config.effect_type = *pus_value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_DRC_DEC_CONFIG_DRC_TARGET_LOUDNESS:
|
case IA_DRC_DEC_CONFIG_DRC_TARGET_LOUDNESS: {
|
||||||
{
|
|
||||||
p_obj_drc->str_config.target_loudness = *pus_value;
|
p_obj_drc->str_config.target_loudness = *pus_value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_DRC_DEC_CONFIG_DRC_LOUD_NORM:
|
case IA_DRC_DEC_CONFIG_DRC_LOUD_NORM: {
|
||||||
{
|
|
||||||
p_obj_drc->str_config.loud_norm_flag = *pus_value;
|
p_obj_drc->str_config.loud_norm_flag = *pus_value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default: { return -1; }
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_GET_MEMTABS_SIZE:
|
case IA_API_CMD_GET_MEMTABS_SIZE: {
|
||||||
{
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_SET_MEMTABS_PTR:
|
case IA_API_CMD_SET_MEMTABS_PTR: {
|
||||||
{
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_GET_N_MEMTABS:
|
case IA_API_CMD_GET_N_MEMTABS: {
|
||||||
{
|
|
||||||
|
|
||||||
*pui_value = NUM_DRC_TABLES;
|
*pui_value = NUM_DRC_TABLES;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_GET_N_TABLES:
|
case IA_API_CMD_GET_N_TABLES: {
|
||||||
{
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IA_API_CMD_EXECUTE:
|
case IA_API_CMD_EXECUTE: {
|
||||||
{
|
switch (i_idx) {
|
||||||
switch(i_idx)
|
case IA_CMD_TYPE_DO_EXECUTE: {
|
||||||
{
|
|
||||||
case IA_CMD_TYPE_DO_EXECUTE:
|
|
||||||
{
|
|
||||||
if (p_obj_drc->str_config.dec_type == DEC_TYPE_TD) {
|
if (p_obj_drc->str_config.dec_type == DEC_TYPE_TD) {
|
||||||
error_code=impd_process_time_domain(p_obj_drc);}
|
error_code = impd_process_time_domain(p_obj_drc);
|
||||||
else if(p_obj_drc->str_config.dec_type==DEC_TYPE_QMF64){
|
} else if (p_obj_drc->str_config.dec_type == DEC_TYPE_QMF64) {
|
||||||
error_code = impd_init_process_audio_main_qmf(p_obj_drc);
|
error_code = impd_init_process_audio_main_qmf(p_obj_drc);
|
||||||
}
|
} else if (p_obj_drc->str_config.dec_type == DEC_TYPE_STFT256) {
|
||||||
else if(p_obj_drc->str_config.dec_type==DEC_TYPE_STFT256){
|
|
||||||
error_code = impd_init_process_audio_main_stft(p_obj_drc);
|
error_code = impd_init_process_audio_main_stft(p_obj_drc);
|
||||||
}
|
} else if (p_obj_drc->str_config.dec_type == DEC_TYPE_TD_QMF64) {
|
||||||
else if(p_obj_drc->str_config.dec_type==DEC_TYPE_TD_QMF64){
|
|
||||||
error_code = impd_init_process_audio_main_td_qmf(p_obj_drc);
|
error_code = impd_init_process_audio_main_td_qmf(p_obj_drc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_CMD_TYPE_DONE_QUERY:
|
case IA_CMD_TYPE_DONE_QUERY: {
|
||||||
{
|
|
||||||
|
|
||||||
*pui_value = p_obj_drc->p_state->ui_exe_done;
|
*pui_value = p_obj_drc->p_state->ui_exe_done;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: { return -1; }
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_PUT_INPUT_QUERY:
|
case IA_API_CMD_PUT_INPUT_QUERY: {
|
||||||
{
|
|
||||||
*pui_value = 1;
|
*pui_value = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_GET_CURIDX_INPUT_BUF:
|
case IA_API_CMD_GET_CURIDX_INPUT_BUF: {
|
||||||
{
|
UWORD32 ui_in_buf_size = p_obj_drc->p_mem_info[IA_DRC_INPUT_IDX].ui_size;
|
||||||
UWORD32 ui_in_buf_size =
|
|
||||||
p_obj_drc->p_mem_info[IA_DRC_INPUT_IDX].ui_size;
|
|
||||||
UWORD32 ui_in_bytes = p_obj_drc->p_state->ui_in_bytes;
|
UWORD32 ui_in_bytes = p_obj_drc->p_state->ui_in_bytes;
|
||||||
*pui_value = ui_in_buf_size > ui_in_bytes ? ui_in_bytes : ui_in_buf_size;
|
*pui_value = ui_in_buf_size > ui_in_bytes ? ui_in_bytes : ui_in_buf_size;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_SET_INPUT_BYTES:
|
case IA_API_CMD_SET_INPUT_BYTES: {
|
||||||
{
|
|
||||||
p_obj_drc->p_state->ui_in_bytes = *pui_value;
|
p_obj_drc->p_state->ui_in_bytes = *pui_value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IA_API_CMD_GET_OUTPUT_BYTES:
|
case IA_API_CMD_GET_OUTPUT_BYTES: {
|
||||||
{
|
|
||||||
*pui_value = p_obj_drc->p_state->ui_out_bytes;
|
*pui_value = p_obj_drc->p_state->ui_out_bytes;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_INPUT_OVER:
|
case IA_API_CMD_INPUT_OVER: {
|
||||||
{
|
|
||||||
p_obj_drc->p_state->ui_exe_done = 1;
|
p_obj_drc->p_state->ui_exe_done = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_INPUT_OVER_BS:
|
case IA_API_CMD_INPUT_OVER_BS: {
|
||||||
{
|
|
||||||
p_obj_drc->str_bit_handler.cpy_over = 1;
|
p_obj_drc->str_bit_handler.cpy_over = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_INPUT_OVER_IC_BS:
|
case IA_API_CMD_INPUT_OVER_IC_BS: {
|
||||||
{
|
|
||||||
p_obj_drc->str_bit_handler.cpy_over_ic = 1;
|
p_obj_drc->str_bit_handler.cpy_over_ic = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_INPUT_OVER_IL_BS:
|
case IA_API_CMD_INPUT_OVER_IL_BS: {
|
||||||
{
|
|
||||||
p_obj_drc->str_bit_handler.cpy_over_il = 1;
|
p_obj_drc->str_bit_handler.cpy_over_il = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_INPUT_OVER_IN_BS:
|
case IA_API_CMD_INPUT_OVER_IN_BS: {
|
||||||
{
|
|
||||||
p_obj_drc->str_bit_handler.cpy_over_in = 1;
|
p_obj_drc->str_bit_handler.cpy_over_in = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_SET_INPUT_BYTES_BS:
|
case IA_API_CMD_SET_INPUT_BYTES_BS: {
|
||||||
{
|
|
||||||
p_obj_drc->str_bit_handler.num_byts_cur = *pus_value;
|
p_obj_drc->str_bit_handler.num_byts_cur = *pus_value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_SET_INPUT_BYTES_IC_BS:
|
case IA_API_CMD_SET_INPUT_BYTES_IC_BS: {
|
||||||
{
|
|
||||||
p_obj_drc->str_bit_handler.num_byts_cur_ic = *pus_value;
|
p_obj_drc->str_bit_handler.num_byts_cur_ic = *pus_value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_SET_INPUT_BYTES_IL_BS:
|
case IA_API_CMD_SET_INPUT_BYTES_IL_BS: {
|
||||||
{
|
|
||||||
p_obj_drc->str_bit_handler.num_byts_cur_il = *pus_value;
|
p_obj_drc->str_bit_handler.num_byts_cur_il = *pus_value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_SET_INPUT_BYTES_IN_BS:
|
case IA_API_CMD_SET_INPUT_BYTES_IN_BS: {
|
||||||
{
|
|
||||||
p_obj_drc->str_bit_handler.num_byts_cur_in = *pus_value;
|
p_obj_drc->str_bit_handler.num_byts_cur_in = *pus_value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: { return -1; }
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
return error_code;
|
return error_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IA_ERRORCODE impd_drc_mem_api(ia_drc_api_struct *p_obj_drc, WORD32 i_cmd,
|
||||||
IA_ERRORCODE impd_drc_mem_api(ia_drc_api_struct *p_obj_drc,
|
WORD32 i_idx, pVOID pv_value) {
|
||||||
WORD32 i_cmd, WORD32 i_idx, pVOID pv_value)
|
|
||||||
{
|
|
||||||
pUWORD32 pui_value = pv_value;
|
pUWORD32 pui_value = pv_value;
|
||||||
|
|
||||||
switch(i_cmd)
|
switch (i_cmd) {
|
||||||
{
|
case IA_API_CMD_GET_MEM_INFO_SIZE: {
|
||||||
case IA_API_CMD_GET_MEM_INFO_SIZE:
|
|
||||||
{
|
|
||||||
*pui_value = p_obj_drc->p_mem_info[i_idx].ui_size;
|
*pui_value = p_obj_drc->p_mem_info[i_idx].ui_size;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_GET_MEM_INFO_ALIGNMENT:
|
case IA_API_CMD_GET_MEM_INFO_ALIGNMENT: {
|
||||||
{
|
|
||||||
*pui_value = p_obj_drc->p_mem_info[i_idx].ui_alignment;
|
*pui_value = p_obj_drc->p_mem_info[i_idx].ui_alignment;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_GET_MEM_INFO_TYPE:
|
case IA_API_CMD_GET_MEM_INFO_TYPE: {
|
||||||
{
|
|
||||||
*pui_value = p_obj_drc->p_mem_info[i_idx].ui_type;
|
*pui_value = p_obj_drc->p_mem_info[i_idx].ui_type;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_GET_MEM_INFO_PLACEMENT:
|
case IA_API_CMD_GET_MEM_INFO_PLACEMENT: {
|
||||||
{
|
|
||||||
*pui_value = p_obj_drc->p_mem_info[i_idx].ui_placement[0];
|
*pui_value = p_obj_drc->p_mem_info[i_idx].ui_placement[0];
|
||||||
*(pui_value + 1) = p_obj_drc->p_mem_info[i_idx].ui_placement[1];
|
*(pui_value + 1) = p_obj_drc->p_mem_info[i_idx].ui_placement[1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_GET_MEM_INFO_PRIORITY:
|
case IA_API_CMD_GET_MEM_INFO_PRIORITY: {
|
||||||
{
|
|
||||||
*pui_value = p_obj_drc->p_mem_info[i_idx].ui_priority;
|
*pui_value = p_obj_drc->p_mem_info[i_idx].ui_priority;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_API_CMD_SET_MEM_PTR:
|
case IA_API_CMD_SET_MEM_PTR: {
|
||||||
{
|
|
||||||
|
|
||||||
pWORD8 pbtemp;
|
pWORD8 pbtemp;
|
||||||
UWORD32 sz;
|
UWORD32 sz;
|
||||||
if(pv_value == 0)
|
if (pv_value == 0) {
|
||||||
{
|
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if(((SIZE_T)pv_value % p_obj_drc->p_mem_info[i_idx].ui_alignment) != 0)
|
if (((SIZE_T)pv_value % p_obj_drc->p_mem_info[i_idx].ui_alignment) != 0) {
|
||||||
{
|
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
p_obj_drc->pp_mem[i_idx] = pv_value;
|
p_obj_drc->pp_mem[i_idx] = pv_value;
|
||||||
|
|
@ -656,16 +538,13 @@ IA_ERRORCODE impd_drc_mem_api(ia_drc_api_struct *p_obj_drc,
|
||||||
|
|
||||||
memset(pbtemp, 0, sz);
|
memset(pbtemp, 0, sz);
|
||||||
}
|
}
|
||||||
case IA_API_CMD_SET_MEM_PLACEMENT:
|
case IA_API_CMD_SET_MEM_PLACEMENT: {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return IA_NO_ERROR;
|
return IA_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc)
|
IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc) {
|
||||||
{
|
|
||||||
ia_mem_info_struct *p_mem_info;
|
ia_mem_info_struct *p_mem_info;
|
||||||
{
|
{
|
||||||
p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_PERSIST_IDX];
|
p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_PERSIST_IDX];
|
||||||
|
|
@ -680,7 +559,9 @@ 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];
|
p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_INPUT_IDX];
|
||||||
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;
|
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;
|
||||||
p_mem_info->ui_alignment = 4;
|
p_mem_info->ui_alignment = 4;
|
||||||
p_mem_info->ui_type = IA_MEMTYPE_INPUT;
|
p_mem_info->ui_type = IA_MEMTYPE_INPUT;
|
||||||
p_mem_info->ui_placement[0] = 0;
|
p_mem_info->ui_placement[0] = 0;
|
||||||
|
|
@ -691,7 +572,9 @@ 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];
|
p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_OUTPUT_IDX];
|
||||||
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;
|
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;
|
||||||
p_mem_info->ui_alignment = 4;
|
p_mem_info->ui_alignment = 4;
|
||||||
p_mem_info->ui_type = IA_MEMTYPE_OUTPUT;
|
p_mem_info->ui_type = IA_MEMTYPE_OUTPUT;
|
||||||
p_mem_info->ui_placement[0] = 0;
|
p_mem_info->ui_placement[0] = 0;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef IMPD_API_DEFS_H
|
#ifndef IMPD_API_DEFS_H
|
||||||
#define IMPD_API_DEFS_H
|
#define IMPD_API_DEFS_H
|
||||||
|
|
||||||
|
|
@ -40,12 +39,11 @@
|
||||||
|
|
||||||
#define IA_STR(str) #str
|
#define IA_STR(str) #str
|
||||||
#define IA_MAKE_VERSION_STR(maj, min) IA_STR(maj) "." IA_STR(min)
|
#define IA_MAKE_VERSION_STR(maj, min) IA_STR(maj) "." IA_STR(min)
|
||||||
#define IA_APIVERSION IA_MAKE_VERSION_STR(\
|
#define IA_APIVERSION \
|
||||||
IA_APIVERSION_MAJOR, \
|
IA_MAKE_VERSION_STR(IA_APIVERSION_MAJOR, IA_APIVERSION_MINOR)
|
||||||
IA_APIVERSION_MINOR)
|
|
||||||
|
|
||||||
#define IA_LAST_COMP_APIVERSION IA_MAKE_VERSION_STR(\
|
#define IA_LAST_COMP_APIVERSION \
|
||||||
IA_LASTCOMP_APIVERSION_MAJOR, \
|
IA_MAKE_VERSION_STR(IA_LASTCOMP_APIVERSION_MAJOR, \
|
||||||
IA_LASTCOMP_APIVERSION_MINOR)
|
IA_LASTCOMP_APIVERSION_MINOR)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,7 @@
|
||||||
/* structure definitions */
|
/* structure definitions */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* DRC Configuration */
|
/* DRC Configuration */
|
||||||
typedef struct ia_drc_config_struct
|
typedef struct ia_drc_config_struct {
|
||||||
{
|
|
||||||
WORD32 bitstream_file_format;
|
WORD32 bitstream_file_format;
|
||||||
WORD32 dec_type;
|
WORD32 dec_type;
|
||||||
WORD32 sub_band_domain_mode;
|
WORD32 sub_band_domain_mode;
|
||||||
|
|
@ -60,8 +59,7 @@ typedef struct ia_drc_config_struct
|
||||||
} ia_drc_config_struct;
|
} ia_drc_config_struct;
|
||||||
|
|
||||||
/* DRC bitsteam handler */
|
/* DRC bitsteam handler */
|
||||||
typedef struct bits_handler
|
typedef struct bits_handler {
|
||||||
{
|
|
||||||
UWORD8 *bitstream_drc_config;
|
UWORD8 *bitstream_drc_config;
|
||||||
UWORD8 *bitstream_loudness_info;
|
UWORD8 *bitstream_loudness_info;
|
||||||
UWORD8 *bitstream_unidrc_interface;
|
UWORD8 *bitstream_unidrc_interface;
|
||||||
|
|
@ -86,8 +84,7 @@ typedef struct bits_handler
|
||||||
WORD32 gain_stream_flag;
|
WORD32 gain_stream_flag;
|
||||||
} ia_drc_bits_handler_struct;
|
} ia_drc_bits_handler_struct;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
ia_drc_bits_dec_struct *pstr_bitstream_dec;
|
ia_drc_bits_dec_struct *pstr_bitstream_dec;
|
||||||
ia_drc_gain_dec_struct *pstr_gain_dec[2];
|
ia_drc_gain_dec_struct *pstr_gain_dec[2];
|
||||||
ia_drc_sel_pro_struct *pstr_selection_proc;
|
ia_drc_sel_pro_struct *pstr_selection_proc;
|
||||||
|
|
@ -103,8 +100,7 @@ typedef struct
|
||||||
|
|
||||||
} ia_drc_payload_struct;
|
} ia_drc_payload_struct;
|
||||||
|
|
||||||
typedef struct ia_drc_state_struct
|
typedef struct ia_drc_state_struct {
|
||||||
{
|
|
||||||
UWORD32 ui_out_bytes;
|
UWORD32 ui_out_bytes;
|
||||||
UWORD32 ui_in_bytes;
|
UWORD32 ui_in_bytes;
|
||||||
UWORD32 ui_ir_bytes;
|
UWORD32 ui_ir_bytes;
|
||||||
|
|
@ -119,8 +115,7 @@ typedef struct ia_drc_state_struct
|
||||||
pVOID persistant_ptr;
|
pVOID persistant_ptr;
|
||||||
} ia_drc_state_struct;
|
} ia_drc_state_struct;
|
||||||
|
|
||||||
typedef struct IA_PSM_API_Struct
|
typedef struct IA_PSM_API_Struct {
|
||||||
{
|
|
||||||
ia_drc_state_struct *p_state;
|
ia_drc_state_struct *p_state;
|
||||||
ia_drc_config_struct str_config;
|
ia_drc_config_struct str_config;
|
||||||
ia_drc_payload_struct str_payload;
|
ia_drc_payload_struct str_payload;
|
||||||
|
|
|
||||||
|
|
@ -30,18 +30,13 @@
|
||||||
#include "impd_drc_struct.h"
|
#include "impd_drc_struct.h"
|
||||||
#include "impd_drc_parser.h"
|
#include "impd_drc_parser.h"
|
||||||
|
|
||||||
|
WORD32 impd_read_bits_buf(ia_bit_buf_struct* it_bit_buff, WORD no_of_bits) {
|
||||||
WORD32 impd_read_bits_buf(ia_bit_buf_struct* it_bit_buff,
|
|
||||||
WORD no_of_bits)
|
|
||||||
{
|
|
||||||
|
|
||||||
UWORD32 ret_val;
|
UWORD32 ret_val;
|
||||||
UWORD8* ptr_read_next = it_bit_buff->ptr_read_next;
|
UWORD8* ptr_read_next = it_bit_buff->ptr_read_next;
|
||||||
WORD bit_pos = it_bit_buff->bit_pos;
|
WORD bit_pos = it_bit_buff->bit_pos;
|
||||||
it_bit_buff->error = 0;
|
it_bit_buff->error = 0;
|
||||||
|
|
||||||
if(it_bit_buff->cnt_bits <= 0)
|
if (it_bit_buff->cnt_bits <= 0) {
|
||||||
{
|
|
||||||
it_bit_buff->error = 1;
|
it_bit_buff->error = 1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -75,9 +70,7 @@ WORD32 impd_read_bits_buf(ia_bit_buf_struct* it_bit_buff,
|
||||||
|
|
||||||
ia_bit_buf_struct* impd_create_bit_buf(ia_bit_buf_struct* it_bit_buff,
|
ia_bit_buf_struct* impd_create_bit_buf(ia_bit_buf_struct* it_bit_buff,
|
||||||
UWORD8* ptr_bit_buf_base,
|
UWORD8* ptr_bit_buf_base,
|
||||||
WORD32 bit_buf_size)
|
WORD32 bit_buf_size) {
|
||||||
{
|
|
||||||
|
|
||||||
it_bit_buff->ptr_bit_buf_base = ptr_bit_buf_base;
|
it_bit_buff->ptr_bit_buf_base = ptr_bit_buf_base;
|
||||||
it_bit_buff->ptr_bit_buf_end = ptr_bit_buf_base + bit_buf_size - 1;
|
it_bit_buff->ptr_bit_buf_end = ptr_bit_buf_base + bit_buf_size - 1;
|
||||||
|
|
||||||
|
|
@ -92,122 +85,103 @@ ia_bit_buf_struct* impd_create_bit_buf(ia_bit_buf_struct* it_bit_buff,
|
||||||
|
|
||||||
ia_bit_buf_struct* impd_create_init_bit_buf(ia_bit_buf_struct* it_bit_buff,
|
ia_bit_buf_struct* impd_create_init_bit_buf(ia_bit_buf_struct* it_bit_buff,
|
||||||
UWORD8* ptr_bit_buf_base,
|
UWORD8* ptr_bit_buf_base,
|
||||||
WORD32 bit_buf_size)
|
WORD32 bit_buf_size) {
|
||||||
{
|
|
||||||
impd_create_bit_buf(it_bit_buff, ptr_bit_buf_base, bit_buf_size);
|
impd_create_bit_buf(it_bit_buff, ptr_bit_buf_base, bit_buf_size);
|
||||||
it_bit_buff->cnt_bits = (bit_buf_size << 3);
|
it_bit_buff->cnt_bits = (bit_buf_size << 3);
|
||||||
return (it_bit_buff);
|
return (it_bit_buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32 impd_init_drc_bitstream_dec(ia_drc_bits_dec_struct* p_drc_bs_dec_struct,
|
WORD32 impd_init_drc_bitstream_dec(ia_drc_bits_dec_struct* p_drc_bs_dec_struct,
|
||||||
WORD32 sample_rate,
|
WORD32 sample_rate, WORD32 frame_size,
|
||||||
WORD32 frame_size,
|
|
||||||
WORD32 delay_mode,
|
WORD32 delay_mode,
|
||||||
WORD32 lfe_channel_map_count,
|
WORD32 lfe_channel_map_count,
|
||||||
WORD32* lfe_channel_map)
|
WORD32* lfe_channel_map) {
|
||||||
{
|
|
||||||
WORD32 i, err_code = 0;
|
WORD32 i, err_code = 0;
|
||||||
|
|
||||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct = &p_drc_bs_dec_struct->ia_drc_params_struct;
|
ia_drc_params_bs_dec_struct* ia_drc_params_struct =
|
||||||
|
&p_drc_bs_dec_struct->ia_drc_params_struct;
|
||||||
ia_drc_params_struct->drc_frame_size = frame_size;
|
ia_drc_params_struct->drc_frame_size = frame_size;
|
||||||
ia_drc_params_struct->delta_tmin_default = impd_get_delta_tmin(sample_rate);
|
ia_drc_params_struct->delta_tmin_default = impd_get_delta_tmin(sample_rate);
|
||||||
ia_drc_params_struct->num_gain_values_max_default = ia_drc_params_struct->drc_frame_size / ia_drc_params_struct->delta_tmin_default;
|
ia_drc_params_struct->num_gain_values_max_default =
|
||||||
|
ia_drc_params_struct->drc_frame_size /
|
||||||
|
ia_drc_params_struct->delta_tmin_default;
|
||||||
ia_drc_params_struct->delay_mode = delay_mode;
|
ia_drc_params_struct->delay_mode = delay_mode;
|
||||||
|
|
||||||
if ((frame_size < 1)||(frame_size > AUDIO_CODEC_FRAME_SIZE_MAX)||(ia_drc_params_struct->drc_frame_size < 0.001f * sample_rate))
|
if ((frame_size < 1) || (frame_size > AUDIO_CODEC_FRAME_SIZE_MAX) ||
|
||||||
{
|
(ia_drc_params_struct->drc_frame_size < 0.001f * sample_rate)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (sample_rate < 1000)
|
if (sample_rate < 1000) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ia_drc_params_struct->delta_tmin_default > ia_drc_params_struct->drc_frame_size)
|
if (ia_drc_params_struct->delta_tmin_default >
|
||||||
{
|
ia_drc_params_struct->drc_frame_size) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lfe_channel_map_count >= 0)
|
if (lfe_channel_map_count >= 0) {
|
||||||
{
|
if ((lfe_channel_map == NULL) ||
|
||||||
if ((lfe_channel_map == NULL) || (lfe_channel_map_count > MAX_CHANNEL_COUNT))
|
(lfe_channel_map_count > MAX_CHANNEL_COUNT)) {
|
||||||
{
|
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ia_drc_params_struct->lfe_channel_map_count = lfe_channel_map_count;
|
ia_drc_params_struct->lfe_channel_map_count = lfe_channel_map_count;
|
||||||
|
|
||||||
for (i=0; i<lfe_channel_map_count; i++)
|
for (i = 0; i < lfe_channel_map_count; i++) {
|
||||||
{
|
|
||||||
ia_drc_params_struct->lfe_channel_map[i] = lfe_channel_map[i];
|
ia_drc_params_struct->lfe_channel_map[i] = lfe_channel_map[i];
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ia_drc_params_struct->lfe_channel_map_count = -1;
|
ia_drc_params_struct->lfe_channel_map_count = -1;
|
||||||
|
|
||||||
for (i=0; i<MAX_CHANNEL_COUNT; i++)
|
for (i = 0; i < MAX_CHANNEL_COUNT; i++) {
|
||||||
{
|
|
||||||
ia_drc_params_struct->lfe_channel_map[i] = 0;
|
ia_drc_params_struct->lfe_channel_map[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err_code = impd_init_tbls(ia_drc_params_struct->num_gain_values_max_default, &p_drc_bs_dec_struct->tables_default);
|
err_code = impd_init_tbls(ia_drc_params_struct->num_gain_values_max_default,
|
||||||
|
&p_drc_bs_dec_struct->tables_default);
|
||||||
|
|
||||||
return err_code;
|
return err_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WORD32 impd_process_drc_bitstream_dec(
|
||||||
WORD32 impd_process_drc_bitstream_dec(ia_drc_bits_dec_struct* p_drc_bs_dec_struct,
|
ia_drc_bits_dec_struct* p_drc_bs_dec_struct, ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
UWORD8* bitstream_config,
|
UWORD8* bitstream_config, WORD32 num_bytes, WORD32 num_bits_offset,
|
||||||
WORD32 num_bytes,
|
WORD32* num_bits_read) {
|
||||||
WORD32 num_bits_offset,
|
|
||||||
WORD32* num_bits_read)
|
|
||||||
{
|
|
||||||
WORD32 err_code = 0;
|
WORD32 err_code = 0;
|
||||||
|
|
||||||
WORD32 loudness_info_set_present, drc_config_present, dummy;
|
WORD32 loudness_info_set_present, drc_config_present, dummy;
|
||||||
|
|
||||||
|
if (bitstream_config == NULL) {
|
||||||
if (bitstream_config == NULL)
|
|
||||||
{
|
|
||||||
*num_bits_read = 0;
|
*num_bits_read = 0;
|
||||||
}
|
} else {
|
||||||
else
|
it_bit_buff =
|
||||||
{
|
impd_create_init_bit_buf(it_bit_buff, bitstream_config, num_bytes);
|
||||||
|
|
||||||
it_bit_buff = impd_create_init_bit_buf(it_bit_buff, bitstream_config, num_bytes);
|
|
||||||
|
|
||||||
dummy = impd_read_bits_buf(it_bit_buff, num_bits_offset);
|
dummy = impd_read_bits_buf(it_bit_buff, num_bits_offset);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
|
|
||||||
loudness_info_set_present = impd_read_bits_buf(it_bit_buff, 1);
|
loudness_info_set_present = impd_read_bits_buf(it_bit_buff, 1);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
|
|
||||||
if (loudness_info_set_present)
|
if (loudness_info_set_present) {
|
||||||
{
|
|
||||||
drc_config_present = impd_read_bits_buf(it_bit_buff, 1);
|
drc_config_present = impd_read_bits_buf(it_bit_buff, 1);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
|
|
||||||
if (drc_config_present)
|
if (drc_config_present) {
|
||||||
{
|
err_code = impd_parse_drc_config(
|
||||||
err_code = impd_parse_drc_config(it_bit_buff, &p_drc_bs_dec_struct->ia_drc_params_struct, pstr_drc_config);
|
it_bit_buff, &p_drc_bs_dec_struct->ia_drc_params_struct,
|
||||||
|
pstr_drc_config);
|
||||||
if (err_code)
|
|
||||||
return (err_code);
|
|
||||||
|
|
||||||
|
if (err_code) return (err_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
err_code = impd_parse_loudness_info_set(it_bit_buff, pstr_loudness_info);
|
err_code = impd_parse_loudness_info_set(it_bit_buff, pstr_loudness_info);
|
||||||
|
|
||||||
if (err_code)
|
if (err_code) return (err_code);
|
||||||
return (err_code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*num_bits_read = it_bit_buff->size - it_bit_buff->cnt_bits;
|
*num_bits_read = it_bit_buff->size - it_bit_buff->cnt_bits;
|
||||||
|
|
@ -216,76 +190,62 @@ WORD32 impd_process_drc_bitstream_dec(ia_drc_bits_dec_struct* p_drc_bs_dec_struc
|
||||||
return err_code;
|
return err_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WORD32 impd_process_drc_bitstream_dec_config(
|
||||||
WORD32 impd_process_drc_bitstream_dec_config(ia_drc_bits_dec_struct* p_drc_bs_dec_struct,
|
ia_drc_bits_dec_struct* p_drc_bs_dec_struct, ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
ia_drc_config* pstr_drc_config, UWORD8* bitstream_config,
|
||||||
ia_drc_config *pstr_drc_config,
|
WORD32 num_bytes) {
|
||||||
UWORD8* bitstream_config,
|
|
||||||
WORD32 num_bytes)
|
|
||||||
{
|
|
||||||
WORD32 err_code = 0;
|
WORD32 err_code = 0;
|
||||||
|
|
||||||
it_bit_buff = impd_create_init_bit_buf(it_bit_buff, bitstream_config, num_bytes);
|
it_bit_buff =
|
||||||
|
impd_create_init_bit_buf(it_bit_buff, bitstream_config, num_bytes);
|
||||||
|
|
||||||
err_code = impd_parse_drc_config( it_bit_buff, &p_drc_bs_dec_struct->ia_drc_params_struct, pstr_drc_config);
|
err_code = impd_parse_drc_config(
|
||||||
|
it_bit_buff, &p_drc_bs_dec_struct->ia_drc_params_struct, pstr_drc_config);
|
||||||
if (err_code) return (err_code);
|
if (err_code) return (err_code);
|
||||||
|
|
||||||
return err_code;
|
return err_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WORD32 impd_process_drc_bitstream_dec_gain(
|
||||||
WORD32 impd_process_drc_bitstream_dec_gain(ia_drc_bits_dec_struct* p_drc_bs_dec_struct,
|
ia_drc_bits_dec_struct* p_drc_bs_dec_struct, ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
ia_drc_config* pstr_drc_config, ia_drc_gain_struct* pstr_drc_gain,
|
||||||
ia_drc_config *pstr_drc_config,
|
UWORD8* bitstream_gain, WORD32 num_bytes, WORD32 num_bits_offset,
|
||||||
ia_drc_gain_struct *pstr_drc_gain,
|
WORD32* num_bits_read) {
|
||||||
UWORD8* bitstream_gain,
|
|
||||||
WORD32 num_bytes,
|
|
||||||
WORD32 num_bits_offset,
|
|
||||||
WORD32* num_bits_read)
|
|
||||||
{
|
|
||||||
WORD32 err_code = 0;
|
WORD32 err_code = 0;
|
||||||
|
|
||||||
WORD32 dummy;
|
WORD32 dummy;
|
||||||
|
|
||||||
it_bit_buff = impd_create_init_bit_buf(it_bit_buff, bitstream_gain, num_bytes);
|
it_bit_buff =
|
||||||
|
impd_create_init_bit_buf(it_bit_buff, bitstream_gain, num_bytes);
|
||||||
|
|
||||||
dummy = impd_read_bits_buf(it_bit_buff, num_bits_offset);
|
dummy = impd_read_bits_buf(it_bit_buff, num_bits_offset);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
|
|
||||||
err_code = impd_drc_uni_gain_read(
|
err_code = impd_drc_uni_gain_read(it_bit_buff, p_drc_bs_dec_struct,
|
||||||
it_bit_buff,
|
pstr_drc_config, pstr_drc_gain);
|
||||||
p_drc_bs_dec_struct,
|
|
||||||
pstr_drc_config,
|
|
||||||
pstr_drc_gain);
|
|
||||||
|
|
||||||
if (err_code > PROC_COMPLETE)
|
if (err_code > PROC_COMPLETE) return (err_code);
|
||||||
return (err_code);
|
|
||||||
|
|
||||||
*num_bits_read = (it_bit_buff->size) - it_bit_buff->cnt_bits;
|
*num_bits_read = (it_bit_buff->size) - it_bit_buff->cnt_bits;
|
||||||
|
|
||||||
if (err_code == PROC_COMPLETE)
|
if (err_code == PROC_COMPLETE) {
|
||||||
{
|
|
||||||
return err_code;
|
return err_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WORD32 impd_process_drc_bitstream_dec_loudness_info_set(
|
||||||
WORD32 impd_process_drc_bitstream_dec_loudness_info_set(ia_bit_buf_struct* it_bit_buff,
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
UWORD8* bit_stream_loudness,
|
UWORD8* bit_stream_loudness, WORD32 num_bytes_loudness) {
|
||||||
WORD32 num_bytes_loudness)
|
|
||||||
{
|
|
||||||
WORD32 err_code = 0;
|
WORD32 err_code = 0;
|
||||||
|
|
||||||
it_bit_buff = impd_create_init_bit_buf(it_bit_buff, bit_stream_loudness, num_bytes_loudness);
|
it_bit_buff = impd_create_init_bit_buf(it_bit_buff, bit_stream_loudness,
|
||||||
|
num_bytes_loudness);
|
||||||
|
|
||||||
err_code = impd_parse_loudness_info_set(it_bit_buff, pstr_loudness_info);
|
err_code = impd_parse_loudness_info_set(it_bit_buff, pstr_loudness_info);
|
||||||
if (err_code)
|
if (err_code) return (err_code);
|
||||||
return(err_code);
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,7 @@
|
||||||
#ifndef IMPD_DRC_BITBUFFER_H
|
#ifndef IMPD_DRC_BITBUFFER_H
|
||||||
#define IMPD_DRC_BITBUFFER_H
|
#define IMPD_DRC_BITBUFFER_H
|
||||||
|
|
||||||
|
typedef struct ia_bit_buf_struct {
|
||||||
typedef struct ia_bit_buf_struct
|
|
||||||
{
|
|
||||||
UWORD8 *ptr_bit_buf_base;
|
UWORD8 *ptr_bit_buf_base;
|
||||||
UWORD8 *ptr_bit_buf_end;
|
UWORD8 *ptr_bit_buf_end;
|
||||||
|
|
||||||
|
|
@ -34,10 +32,8 @@ typedef struct ia_bit_buf_struct
|
||||||
WORD32 size;
|
WORD32 size;
|
||||||
WORD32 error;
|
WORD32 error;
|
||||||
|
|
||||||
|
|
||||||
} ia_bit_buf_struct;
|
} ia_bit_buf_struct;
|
||||||
|
|
||||||
|
|
||||||
ia_bit_buf_struct *impd_create_bit_buf(ia_bit_buf_struct *it_bit_buff,
|
ia_bit_buf_struct *impd_create_bit_buf(ia_bit_buf_struct *it_bit_buff,
|
||||||
UWORD8 *ptr_bit_buf_base,
|
UWORD8 *ptr_bit_buf_base,
|
||||||
WORD32 bit_buf_size);
|
WORD32 bit_buf_size);
|
||||||
|
|
@ -46,8 +42,6 @@ ia_bit_buf_struct * impd_create_init_bit_buf(ia_bit_buf_struct* it_bit_buff,
|
||||||
UWORD8 *ptr_bit_buf_base,
|
UWORD8 *ptr_bit_buf_base,
|
||||||
WORD32 bit_buf_size);
|
WORD32 bit_buf_size);
|
||||||
|
|
||||||
WORD32 impd_read_bits_buf(ia_bit_buf_struct* it_bit_buff,
|
WORD32 impd_read_bits_buf(ia_bit_buf_struct *it_bit_buff, WORD no_of_bits);
|
||||||
WORD no_of_bits);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -20,44 +20,31 @@
|
||||||
#ifndef IMPD_DRC_BITSTREAM_DEC_API_H
|
#ifndef IMPD_DRC_BITSTREAM_DEC_API_H
|
||||||
#define IMPD_DRC_BITSTREAM_DEC_API_H
|
#define IMPD_DRC_BITSTREAM_DEC_API_H
|
||||||
|
|
||||||
|
WORD32 impd_init_drc_bitstream_dec(
|
||||||
WORD32 impd_init_drc_bitstream_dec(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct, WORD32 sample_rate,
|
||||||
WORD32 sample_rate,
|
WORD32 frame_size, WORD32 delay_mode, WORD32 lfe_channel_map_count,
|
||||||
WORD32 frame_size,
|
|
||||||
WORD32 delay_mode,
|
|
||||||
WORD32 lfe_channel_map_count,
|
|
||||||
WORD32* lfe_channel_map);
|
WORD32* lfe_channel_map);
|
||||||
|
|
||||||
WORD32 impd_process_drc_bitstream_dec(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
WORD32 impd_process_drc_bitstream_dec(
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_bit_buf_struct* it_bit_buff, ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
UWORD8* bitstream_config,
|
UWORD8* bitstream_config, WORD32 num_bytes, WORD32 num_bits_offset,
|
||||||
WORD32 num_bytes,
|
|
||||||
WORD32 num_bits_offset,
|
|
||||||
WORD32* num_bits_read);
|
WORD32* num_bits_read);
|
||||||
|
|
||||||
WORD32 impd_process_drc_bitstream_dec_config(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
WORD32 impd_process_drc_bitstream_dec_config(
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_bit_buf_struct* it_bit_buff, ia_drc_config* pstr_drc_config,
|
||||||
UWORD8* bitstream_config,
|
UWORD8* bitstream_config, WORD32 num_bytes);
|
||||||
WORD32 num_bytes);
|
|
||||||
|
|
||||||
WORD32 impd_process_drc_bitstream_dec_gain(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
WORD32 impd_process_drc_bitstream_dec_gain(
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_bit_buf_struct* it_bit_buff, ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_gain_struct* pstr_drc_gain,
|
ia_drc_gain_struct* pstr_drc_gain, UWORD8* bitstream_gain, WORD32 num_bytes,
|
||||||
UWORD8* bitstream_gain,
|
WORD32 num_bits_offset, WORD32* num_bits_read);
|
||||||
WORD32 num_bytes,
|
|
||||||
WORD32 num_bits_offset,
|
|
||||||
WORD32* num_bits_read);
|
|
||||||
|
|
||||||
WORD32 impd_process_drc_bitstream_dec_loudness_info_set(ia_bit_buf_struct* it_bit_buff,
|
WORD32 impd_process_drc_bitstream_dec_loudness_info_set(
|
||||||
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
UWORD8* bitstream_loudness,
|
UWORD8* bitstream_loudness, WORD32 num_bytes_loudness);
|
||||||
WORD32 num_bytes_loudness
|
|
||||||
);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,9 @@
|
||||||
#define IMPD_DRC_COMMON_H
|
#define IMPD_DRC_COMMON_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define EQ_IS_SUPPORTED 1
|
#define EQ_IS_SUPPORTED 1
|
||||||
|
|
||||||
#define MEASURE_AVERAGE_BITRATE 0
|
#define MEASURE_AVERAGE_BITRATE 0
|
||||||
|
|
@ -137,7 +135,6 @@ extern "C"
|
||||||
#define UNIDRCCONFEXT_TERM 0x0
|
#define UNIDRCCONFEXT_TERM 0x0
|
||||||
#define UNIDRCINTERFACEEXT_TERM 0x0
|
#define UNIDRCINTERFACEEXT_TERM 0x0
|
||||||
|
|
||||||
|
|
||||||
#define UNIDRCCONFEXT_PARAM_DRC 0x1
|
#define UNIDRCCONFEXT_PARAM_DRC 0x1
|
||||||
|
|
||||||
#define PARAM_DRC_INSTRUCTIONS_COUNT_MAX 8
|
#define PARAM_DRC_INSTRUCTIONS_COUNT_MAX 8
|
||||||
|
|
@ -152,7 +149,6 @@ extern "C"
|
||||||
#define PARAM_DRC_TYPE_LIM_ATTACK_DEFAULT 5
|
#define PARAM_DRC_TYPE_LIM_ATTACK_DEFAULT 5
|
||||||
#define PARAM_DRC_TYPE_LIM_RELEASE_DEFAULT 50
|
#define PARAM_DRC_TYPE_LIM_RELEASE_DEFAULT 50
|
||||||
|
|
||||||
|
|
||||||
#define UNIDRCCONFEXT_V1 0x2
|
#define UNIDRCCONFEXT_V1 0x2
|
||||||
#define UNIDRCLOUDEXT_EQ 0x1
|
#define UNIDRCLOUDEXT_EQ 0x1
|
||||||
#define UNIDRCINTERFACEEXT_EQ 0x1
|
#define UNIDRCINTERFACEEXT_EQ 0x1
|
||||||
|
|
@ -171,8 +167,6 @@ extern "C"
|
||||||
#define EQ_PURPOSE_HEADPHONES (1 << 5)
|
#define EQ_PURPOSE_HEADPHONES (1 << 5)
|
||||||
#define EQ_PURPOSE_LATE_NIGHT (1 << 6)
|
#define EQ_PURPOSE_LATE_NIGHT (1 << 6)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define MAXPACKETLOSSTIME 2.5f
|
#define MAXPACKETLOSSTIME 2.5f
|
||||||
|
|
||||||
#define SLOPE_FACTOR_DB_TO_LINEAR 0.1151f
|
#define SLOPE_FACTOR_DB_TO_LINEAR 0.1151f
|
||||||
|
|
@ -188,8 +182,7 @@ extern "C"
|
||||||
#define bool WORD32
|
#define bool WORD32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct ia_drc_sel_proc_output_struct
|
typedef struct ia_drc_sel_proc_output_struct {
|
||||||
{
|
|
||||||
FLOAT32 output_peak_level_db;
|
FLOAT32 output_peak_level_db;
|
||||||
FLOAT32 loudness_normalization_gain_db;
|
FLOAT32 loudness_normalization_gain_db;
|
||||||
FLOAT32 output_loudness;
|
FLOAT32 output_loudness;
|
||||||
|
|
@ -209,7 +202,6 @@ typedef struct ia_drc_sel_proc_output_struct
|
||||||
FLOAT32 compress;
|
FLOAT32 compress;
|
||||||
WORD32 drc_characteristic_target;
|
WORD32 drc_characteristic_target;
|
||||||
|
|
||||||
|
|
||||||
FLOAT32 mixing_level;
|
FLOAT32 mixing_level;
|
||||||
WORD32 sel_eq_set_ids[SELECTED_EQ_SET_COUNT_MAX];
|
WORD32 sel_eq_set_ids[SELECTED_EQ_SET_COUNT_MAX];
|
||||||
WORD32 sel_loud_eq_id;
|
WORD32 sel_loud_eq_id;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
#ifndef IMPD_DRC_CONFIG_PARAMS_H
|
#ifndef IMPD_DRC_CONFIG_PARAMS_H
|
||||||
#define IMPD_DRC_CONFIG_PARAMS_H
|
#define IMPD_DRC_CONFIG_PARAMS_H
|
||||||
|
|
||||||
|
|
||||||
#define IA_DRC_DEC_CONFIG_PARAM_PCM_WDSZ 0x0000
|
#define IA_DRC_DEC_CONFIG_PARAM_PCM_WDSZ 0x0000
|
||||||
#define IA_DRC_DEC_CONFIG_PARAM_SAMP_FREQ 0x0001
|
#define IA_DRC_DEC_CONFIG_PARAM_SAMP_FREQ 0x0001
|
||||||
#define IA_DRC_DEC_CONFIG_PARAM_NUM_CHANNELS 0x0002
|
#define IA_DRC_DEC_CONFIG_PARAM_NUM_CHANNELS 0x0002
|
||||||
|
|
|
||||||
|
|
@ -27,29 +27,22 @@
|
||||||
#include "impd_drc_filter_bank.h"
|
#include "impd_drc_filter_bank.h"
|
||||||
#include "impd_drc_multi_band.h"
|
#include "impd_drc_multi_band.h"
|
||||||
|
|
||||||
|
WORD32 impd_init_drc_params(WORD32 frame_size, WORD32 sample_rate,
|
||||||
WORD32 impd_init_drc_params(WORD32 frame_size,
|
WORD32 gain_delay_samples, WORD32 delay_mode,
|
||||||
WORD32 sample_rate,
|
|
||||||
WORD32 gain_delay_samples,
|
|
||||||
WORD32 delay_mode,
|
|
||||||
WORD32 sub_band_domain_mode,
|
WORD32 sub_band_domain_mode,
|
||||||
ia_drc_params_struct* ia_drc_params_struct)
|
ia_drc_params_struct* ia_drc_params_struct) {
|
||||||
{
|
|
||||||
WORD32 k;
|
WORD32 k;
|
||||||
if (frame_size < 1|| frame_size > AUDIO_CODEC_FRAME_SIZE_MAX)
|
if (frame_size < 1 || frame_size > AUDIO_CODEC_FRAME_SIZE_MAX) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sample_rate < 1000)
|
if (sample_rate < 1000) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ia_drc_params_struct->drc_frame_size = frame_size;
|
ia_drc_params_struct->drc_frame_size = frame_size;
|
||||||
|
|
||||||
if (ia_drc_params_struct->drc_frame_size < 0.001f * sample_rate)
|
if (ia_drc_params_struct->drc_frame_size < 0.001f * sample_rate) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,13 +50,13 @@ WORD32 impd_init_drc_params(WORD32 frame_size,
|
||||||
|
|
||||||
ia_drc_params_struct->delta_tmin_default = impd_get_delta_tmin(sample_rate);
|
ia_drc_params_struct->delta_tmin_default = impd_get_delta_tmin(sample_rate);
|
||||||
|
|
||||||
if (ia_drc_params_struct->delta_tmin_default > ia_drc_params_struct->drc_frame_size)
|
if (ia_drc_params_struct->delta_tmin_default >
|
||||||
{
|
ia_drc_params_struct->drc_frame_size) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((delay_mode != DELAY_MODE_REGULAR_DELAY) && (delay_mode != DELAY_MODE_LOW_DELAY))
|
if ((delay_mode != DELAY_MODE_REGULAR_DELAY) &&
|
||||||
{
|
(delay_mode != DELAY_MODE_LOW_DELAY)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,24 +65,19 @@ WORD32 impd_init_drc_params(WORD32 frame_size,
|
||||||
ia_drc_params_struct->drc_set_counter = 0;
|
ia_drc_params_struct->drc_set_counter = 0;
|
||||||
ia_drc_params_struct->multiband_sel_drc_idx = -1;
|
ia_drc_params_struct->multiband_sel_drc_idx = -1;
|
||||||
|
|
||||||
for (k = 0; k < SEL_DRC_COUNT; k++)
|
for (k = 0; k < SEL_DRC_COUNT; k++) {
|
||||||
{
|
|
||||||
ia_drc_params_struct->sel_drc_array[k].drc_instructions_index = -1;
|
ia_drc_params_struct->sel_drc_array[k].drc_instructions_index = -1;
|
||||||
ia_drc_params_struct->sel_drc_array[k].dwnmix_instructions_index = -1;
|
ia_drc_params_struct->sel_drc_array[k].dwnmix_instructions_index = -1;
|
||||||
ia_drc_params_struct->sel_drc_array[k].drc_coeff_idx = -1;
|
ia_drc_params_struct->sel_drc_array[k].drc_coeff_idx = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gain_delay_samples > MAX_SIGNAL_DELAY) || (gain_delay_samples < 0))
|
if ((gain_delay_samples > MAX_SIGNAL_DELAY) || (gain_delay_samples < 0)) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ia_drc_params_struct->gain_delay_samples = gain_delay_samples;
|
ia_drc_params_struct->gain_delay_samples = gain_delay_samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (sub_band_domain_mode)
|
switch (sub_band_domain_mode) {
|
||||||
{
|
|
||||||
case SUBBAND_DOMAIN_MODE_OFF:
|
case SUBBAND_DOMAIN_MODE_OFF:
|
||||||
case SUBBAND_DOMAIN_MODE_QMF64:
|
case SUBBAND_DOMAIN_MODE_QMF64:
|
||||||
case SUBBAND_DOMAIN_MODE_QMF71:
|
case SUBBAND_DOMAIN_MODE_QMF71:
|
||||||
|
|
@ -107,59 +95,46 @@ WORD32 impd_init_drc_params(WORD32 frame_size,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WORD32 impd_select_drc_coefficients(
|
||||||
WORD32 impd_select_drc_coefficients(ia_drc_config* drc_config,
|
ia_drc_config* drc_config, ia_uni_drc_coeffs_struct** drc_coefficients_drc,
|
||||||
ia_uni_drc_coeffs_struct** drc_coefficients_drc,
|
WORD32* drc_coefficients_selected) {
|
||||||
WORD32* drc_coefficients_selected)
|
|
||||||
{
|
|
||||||
WORD32 i;
|
WORD32 i;
|
||||||
WORD32 cof1 = -1;
|
WORD32 cof1 = -1;
|
||||||
WORD32 cof0 = -1;
|
WORD32 cof0 = -1;
|
||||||
for(i=0; i<drc_config->drc_coefficients_drc_count; i++)
|
for (i = 0; i < drc_config->drc_coefficients_drc_count; i++) {
|
||||||
{
|
if (drc_config->str_p_loc_drc_coefficients_uni_drc[i].drc_location == 1) {
|
||||||
if (drc_config->str_p_loc_drc_coefficients_uni_drc[i].drc_location == 1)
|
if (drc_config->str_p_loc_drc_coefficients_uni_drc[i].version == 0) {
|
||||||
{
|
|
||||||
if (drc_config->str_p_loc_drc_coefficients_uni_drc[i].version == 0)
|
|
||||||
{
|
|
||||||
cof0 = i;
|
cof0 = i;
|
||||||
*drc_coefficients_selected = cof0;
|
*drc_coefficients_selected = cof0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
cof1 = i;
|
cof1 = i;
|
||||||
*drc_coefficients_selected = cof1;
|
*drc_coefficients_selected = cof1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (cof1 >= 0) {
|
if (cof1 >= 0) {
|
||||||
*drc_coefficients_drc = &(drc_config->str_p_loc_drc_coefficients_uni_drc[cof1]);
|
*drc_coefficients_drc =
|
||||||
}
|
&(drc_config->str_p_loc_drc_coefficients_uni_drc[cof1]);
|
||||||
else if (cof0 >= 0) {
|
} else if (cof0 >= 0) {
|
||||||
*drc_coefficients_drc = &(drc_config->str_p_loc_drc_coefficients_uni_drc[cof0]);
|
*drc_coefficients_drc =
|
||||||
}
|
&(drc_config->str_p_loc_drc_coefficients_uni_drc[cof0]);
|
||||||
else {
|
} else {
|
||||||
*drc_coefficients_drc = NULL;
|
*drc_coefficients_drc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WORD32 impd_init_selected_drc_set(
|
||||||
WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
|
ia_drc_config* drc_config, ia_drc_params_struct* ia_drc_params_struct,
|
||||||
ia_drc_params_struct* ia_drc_params_struct,
|
|
||||||
ia_parametric_drc_params_struct* p_parametric_drc_params,
|
ia_parametric_drc_params_struct* p_parametric_drc_params,
|
||||||
WORD32 audio_num_chan,
|
WORD32 audio_num_chan, WORD32 drc_set_id_selected,
|
||||||
WORD32 drc_set_id_selected,
|
WORD32 downmix_id_selected, ia_filter_banks_struct* ia_filter_banks_struct,
|
||||||
WORD32 downmix_id_selected,
|
|
||||||
ia_filter_banks_struct* ia_filter_banks_struct,
|
|
||||||
ia_overlap_params_struct* pstr_overlap_params
|
ia_overlap_params_struct* pstr_overlap_params
|
||||||
|
|
||||||
, shape_filter_block* shape_filter_block
|
,
|
||||||
)
|
shape_filter_block* shape_filter_block) {
|
||||||
{
|
|
||||||
WORD32 g, n, c, err = 0;
|
WORD32 g, n, c, err = 0;
|
||||||
WORD32 channel_count = 0;
|
WORD32 channel_count = 0;
|
||||||
WORD32 i;
|
WORD32 i;
|
||||||
|
|
@ -172,44 +147,36 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
|
||||||
WORD32 drc_coefficients_selected = -1;
|
WORD32 drc_coefficients_selected = -1;
|
||||||
p_parametric_drc_params->parametric_drc_instance_count = 0;
|
p_parametric_drc_params->parametric_drc_instance_count = 0;
|
||||||
|
|
||||||
if (drc_config->drc_coefficients_drc_count && drc_config->str_p_loc_drc_coefficients_uni_drc->drc_frame_size_present)
|
if (drc_config->drc_coefficients_drc_count &&
|
||||||
{
|
drc_config->str_p_loc_drc_coefficients_uni_drc->drc_frame_size_present) {
|
||||||
if (drc_config->str_p_loc_drc_coefficients_uni_drc->drc_frame_size != ia_drc_params_struct->drc_frame_size)
|
if (drc_config->str_p_loc_drc_coefficients_uni_drc->drc_frame_size !=
|
||||||
{
|
ia_drc_params_struct->drc_frame_size) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (n = 0; n < drc_config->drc_instructions_count_plus; n++) {
|
||||||
for(n=0; n<drc_config->drc_instructions_count_plus; n++)
|
if (drc_config->str_drc_instruction_str[n].drc_set_id ==
|
||||||
{
|
drc_set_id_selected)
|
||||||
if (drc_config->str_drc_instruction_str[n].drc_set_id == drc_set_id_selected)
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (n == drc_config->drc_instructions_count_plus)
|
if (n == drc_config->drc_instructions_count_plus) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
drc_instructions_selected = n;
|
drc_instructions_selected = n;
|
||||||
drc_instructions_uni_drc = &(drc_config->str_drc_instruction_str[drc_instructions_selected]);
|
drc_instructions_uni_drc =
|
||||||
|
&(drc_config->str_drc_instruction_str[drc_instructions_selected]);
|
||||||
|
|
||||||
if (downmix_id_selected == ID_FOR_BASE_LAYOUT)
|
if (downmix_id_selected == ID_FOR_BASE_LAYOUT) {
|
||||||
{
|
|
||||||
channel_count = drc_config->channel_layout.base_channel_count;
|
channel_count = drc_config->channel_layout.base_channel_count;
|
||||||
}
|
} else if (downmix_id_selected == ID_FOR_ANY_DOWNMIX) {
|
||||||
else if (downmix_id_selected == ID_FOR_ANY_DOWNMIX)
|
|
||||||
{
|
|
||||||
channel_count = audio_num_chan;
|
channel_count = audio_num_chan;
|
||||||
}
|
} else {
|
||||||
else
|
for (n = 0; n < drc_config->dwnmix_instructions_count; n++) {
|
||||||
{
|
|
||||||
for(n=0; n<drc_config->dwnmix_instructions_count; n++)
|
|
||||||
{
|
|
||||||
if (drc_config->dwnmix_instructions[n].downmix_id == downmix_id_selected)
|
if (drc_config->dwnmix_instructions[n].downmix_id == downmix_id_selected)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (n == drc_config->dwnmix_instructions_count)
|
if (n == drc_config->dwnmix_instructions_count) {
|
||||||
{
|
|
||||||
return (UNEXPECTED_ERROR);
|
return (UNEXPECTED_ERROR);
|
||||||
}
|
}
|
||||||
channel_count = drc_config->dwnmix_instructions[n].target_channel_count;
|
channel_count = drc_config->dwnmix_instructions[n].target_channel_count;
|
||||||
|
|
@ -218,24 +185,24 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
|
||||||
}
|
}
|
||||||
drc_instructions_uni_drc->audio_num_chan = channel_count;
|
drc_instructions_uni_drc->audio_num_chan = channel_count;
|
||||||
|
|
||||||
if (drc_instructions_uni_drc->drc_set_id <= 0)
|
if (drc_instructions_uni_drc->drc_set_id <= 0) {
|
||||||
{
|
|
||||||
drc_coefficients_selected = 0;
|
drc_coefficients_selected = 0;
|
||||||
}
|
} else {
|
||||||
else
|
err = impd_select_drc_coefficients(drc_config, &drc_coefficients_uni_drc,
|
||||||
{
|
&drc_coefficients_selected);
|
||||||
err = impd_select_drc_coefficients(drc_config, &drc_coefficients_uni_drc, &drc_coefficients_selected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ia_drc_params_struct->sel_drc_array[ia_drc_params_struct->drc_set_counter].drc_instructions_index = drc_instructions_selected;
|
ia_drc_params_struct->sel_drc_array[ia_drc_params_struct->drc_set_counter]
|
||||||
ia_drc_params_struct->sel_drc_array[ia_drc_params_struct->drc_set_counter].dwnmix_instructions_index = downmix_instructions_selected;
|
.drc_instructions_index = drc_instructions_selected;
|
||||||
ia_drc_params_struct->sel_drc_array[ia_drc_params_struct->drc_set_counter].drc_coeff_idx = drc_coefficients_selected;
|
ia_drc_params_struct->sel_drc_array[ia_drc_params_struct->drc_set_counter]
|
||||||
|
.dwnmix_instructions_index = downmix_instructions_selected;
|
||||||
|
ia_drc_params_struct->sel_drc_array[ia_drc_params_struct->drc_set_counter]
|
||||||
|
.drc_coeff_idx = drc_coefficients_selected;
|
||||||
|
|
||||||
if ((drc_instructions_uni_drc->downmix_id[0] == ID_FOR_ANY_DOWNMIX) || (drc_instructions_uni_drc->dwnmix_id_count > 1))
|
if ((drc_instructions_uni_drc->downmix_id[0] == ID_FOR_ANY_DOWNMIX) ||
|
||||||
{
|
(drc_instructions_uni_drc->dwnmix_id_count > 1)) {
|
||||||
WORD32 idx = drc_instructions_uni_drc->gain_set_index[0];
|
WORD32 idx = drc_instructions_uni_drc->gain_set_index[0];
|
||||||
for (c=0; c<drc_instructions_uni_drc->audio_num_chan; c++)
|
for (c = 0; c < drc_instructions_uni_drc->audio_num_chan; c++) {
|
||||||
{
|
|
||||||
drc_instructions_uni_drc->channel_group_of_ch[c] = (idx >= 0) ? 0 : -1;
|
drc_instructions_uni_drc->channel_group_of_ch[c] = (idx >= 0) ? 0 : -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -249,8 +216,10 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drc_instructions_uni_drc->drc_set_effect & (EFFECT_BIT_DUCK_OTHER | EFFECT_BIT_DUCK_SELF)) {
|
if (drc_instructions_uni_drc->drc_set_effect &
|
||||||
drc_instructions_uni_drc->multiband_audio_sig_count = drc_instructions_uni_drc->audio_num_chan;
|
(EFFECT_BIT_DUCK_OTHER | EFFECT_BIT_DUCK_SELF)) {
|
||||||
|
drc_instructions_uni_drc->multiband_audio_sig_count =
|
||||||
|
drc_instructions_uni_drc->audio_num_chan;
|
||||||
} else {
|
} else {
|
||||||
drc_instructions_uni_drc->multiband_audio_sig_count = 0;
|
drc_instructions_uni_drc->multiband_audio_sig_count = 0;
|
||||||
for (c = 0; c < drc_instructions_uni_drc->audio_num_chan; c++) {
|
for (c = 0; c < drc_instructions_uni_drc->audio_num_chan; c++) {
|
||||||
|
|
@ -258,115 +227,135 @@ WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
|
||||||
if (g < 0) {
|
if (g < 0) {
|
||||||
drc_instructions_uni_drc->multiband_audio_sig_count++;
|
drc_instructions_uni_drc->multiband_audio_sig_count++;
|
||||||
} else {
|
} else {
|
||||||
drc_instructions_uni_drc->multiband_audio_sig_count += drc_instructions_uni_drc->band_count_of_ch_group[g];
|
drc_instructions_uni_drc->multiband_audio_sig_count +=
|
||||||
|
drc_instructions_uni_drc->band_count_of_ch_group[g];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (g=0; g<drc_instructions_uni_drc->num_drc_ch_groups; g++)
|
for (g = 0; g < drc_instructions_uni_drc->num_drc_ch_groups; g++) {
|
||||||
{
|
|
||||||
if (g == 0) {
|
if (g == 0) {
|
||||||
drc_instructions_uni_drc->parametric_drc_look_ahead_samples_max = 0;
|
drc_instructions_uni_drc->parametric_drc_look_ahead_samples_max = 0;
|
||||||
}
|
}
|
||||||
if (drc_instructions_uni_drc->ch_group_parametric_drc_flag[g] == 0) {
|
if (drc_instructions_uni_drc->ch_group_parametric_drc_flag[g] == 0) {
|
||||||
if (drc_instructions_uni_drc->band_count_of_ch_group[g] > 1)
|
if (drc_instructions_uni_drc->band_count_of_ch_group[g] > 1) {
|
||||||
{
|
if (ia_drc_params_struct->multiband_sel_drc_idx != -1) {
|
||||||
if (ia_drc_params_struct->multiband_sel_drc_idx != -1)
|
|
||||||
{
|
|
||||||
return (UNEXPECTED_ERROR);
|
return (UNEXPECTED_ERROR);
|
||||||
}
|
}
|
||||||
selected_drc_is_multiband = 1;
|
selected_drc_is_multiband = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
WORD32 gain_set_index = drc_instructions_uni_drc->gain_set_idx_of_ch_group_parametric_drc[g];
|
WORD32 gain_set_index =
|
||||||
WORD32 parametric_drc_id = drc_config->str_drc_config_ext.str_drc_coeff_param_drc.str_parametric_drc_gain_set_params[gain_set_index].parametric_drc_id;
|
drc_instructions_uni_drc->gain_set_idx_of_ch_group_parametric_drc[g];
|
||||||
|
WORD32 parametric_drc_id =
|
||||||
|
drc_config->str_drc_config_ext.str_drc_coeff_param_drc
|
||||||
|
.str_parametric_drc_gain_set_params[gain_set_index]
|
||||||
|
.parametric_drc_id;
|
||||||
WORD32 parametric_drc_look_ahead_samples = 0;
|
WORD32 parametric_drc_look_ahead_samples = 0;
|
||||||
ia_parametric_drc_instructions_struct* str_parametric_drc_instructions;
|
ia_parametric_drc_instructions_struct* str_parametric_drc_instructions;
|
||||||
|
|
||||||
for(i=0; i<drc_config->str_drc_config_ext.parametric_drc_instructions_count; i++)
|
for (i = 0;
|
||||||
{
|
i < drc_config->str_drc_config_ext.parametric_drc_instructions_count;
|
||||||
if (parametric_drc_id == drc_config->str_drc_config_ext.str_parametric_drc_instructions[i].parametric_drc_id) break;
|
i++) {
|
||||||
|
if (parametric_drc_id ==
|
||||||
|
drc_config->str_drc_config_ext.str_parametric_drc_instructions[i]
|
||||||
|
.parametric_drc_id)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (i == drc_config->str_drc_config_ext.parametric_drc_instructions_count)
|
if (i ==
|
||||||
{
|
drc_config->str_drc_config_ext.parametric_drc_instructions_count) {
|
||||||
return (UNEXPECTED_ERROR);
|
return (UNEXPECTED_ERROR);
|
||||||
}
|
}
|
||||||
str_parametric_drc_instructions = &drc_config->str_drc_config_ext.str_parametric_drc_instructions[i];
|
str_parametric_drc_instructions =
|
||||||
|
&drc_config->str_drc_config_ext.str_parametric_drc_instructions[i];
|
||||||
|
|
||||||
p_parametric_drc_params->parametric_drc_idx[p_parametric_drc_params->parametric_drc_instance_count] = i;
|
p_parametric_drc_params->parametric_drc_idx
|
||||||
p_parametric_drc_params->gain_set_index[p_parametric_drc_params->parametric_drc_instance_count] = gain_set_index;
|
[p_parametric_drc_params->parametric_drc_instance_count] = i;
|
||||||
|
p_parametric_drc_params->gain_set_index
|
||||||
|
[p_parametric_drc_params->parametric_drc_instance_count] =
|
||||||
|
gain_set_index;
|
||||||
if (drc_instructions_uni_drc->drc_apply_to_dwnmix == 0) {
|
if (drc_instructions_uni_drc->drc_apply_to_dwnmix == 0) {
|
||||||
p_parametric_drc_params->dwnmix_id_from_drc_instructions[p_parametric_drc_params->parametric_drc_instance_count] = ID_FOR_BASE_LAYOUT;
|
p_parametric_drc_params->dwnmix_id_from_drc_instructions
|
||||||
|
[p_parametric_drc_params->parametric_drc_instance_count] =
|
||||||
|
ID_FOR_BASE_LAYOUT;
|
||||||
} else {
|
} else {
|
||||||
if (drc_instructions_uni_drc->dwnmix_id_count > 1) {
|
if (drc_instructions_uni_drc->dwnmix_id_count > 1) {
|
||||||
p_parametric_drc_params->dwnmix_id_from_drc_instructions[p_parametric_drc_params->parametric_drc_instance_count] = ID_FOR_ANY_DOWNMIX;
|
p_parametric_drc_params->dwnmix_id_from_drc_instructions
|
||||||
|
[p_parametric_drc_params->parametric_drc_instance_count] =
|
||||||
|
ID_FOR_ANY_DOWNMIX;
|
||||||
} else {
|
} else {
|
||||||
p_parametric_drc_params->dwnmix_id_from_drc_instructions[p_parametric_drc_params->parametric_drc_instance_count] = drc_instructions_uni_drc->downmix_id[0];
|
p_parametric_drc_params->dwnmix_id_from_drc_instructions
|
||||||
|
[p_parametric_drc_params->parametric_drc_instance_count] =
|
||||||
|
drc_instructions_uni_drc->downmix_id[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p_parametric_drc_params->audio_num_chan = channel_count;
|
p_parametric_drc_params->audio_num_chan = channel_count;
|
||||||
for (i = 0; i < p_parametric_drc_params->audio_num_chan; i++) {
|
for (i = 0; i < p_parametric_drc_params->audio_num_chan; i++) {
|
||||||
if (drc_instructions_uni_drc->channel_group_of_ch[i] == g) {
|
if (drc_instructions_uni_drc->channel_group_of_ch[i] == g) {
|
||||||
p_parametric_drc_params->channel_map[p_parametric_drc_params->parametric_drc_instance_count][i] = 1;
|
p_parametric_drc_params->channel_map
|
||||||
|
[p_parametric_drc_params->parametric_drc_instance_count][i] = 1;
|
||||||
} else {
|
} else {
|
||||||
p_parametric_drc_params->channel_map[p_parametric_drc_params->parametric_drc_instance_count][i] = 0;
|
p_parametric_drc_params->channel_map
|
||||||
|
[p_parametric_drc_params->parametric_drc_instance_count][i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drc_instructions_uni_drc->parametric_drc_look_ahead_samples[g] = 0;
|
drc_instructions_uni_drc->parametric_drc_look_ahead_samples[g] = 0;
|
||||||
if (str_parametric_drc_instructions->parametric_drc_look_ahead_flag) {
|
if (str_parametric_drc_instructions->parametric_drc_look_ahead_flag) {
|
||||||
parametric_drc_look_ahead_samples = (WORD32)((FLOAT32)str_parametric_drc_instructions->parametric_drc_look_ahead*(FLOAT32)p_parametric_drc_params->sampling_rate*0.001f);
|
parametric_drc_look_ahead_samples = (WORD32)(
|
||||||
|
(FLOAT32)
|
||||||
|
str_parametric_drc_instructions->parametric_drc_look_ahead *
|
||||||
|
(FLOAT32)p_parametric_drc_params->sampling_rate * 0.001f);
|
||||||
|
} else {
|
||||||
|
if (str_parametric_drc_instructions->parametric_drc_type ==
|
||||||
|
PARAM_DRC_TYPE_FF) {
|
||||||
|
parametric_drc_look_ahead_samples = (WORD32)(
|
||||||
|
10.0f * (FLOAT32)p_parametric_drc_params->sampling_rate * 0.001f);
|
||||||
|
} else if (str_parametric_drc_instructions->parametric_drc_type ==
|
||||||
|
PARAM_DRC_TYPE_LIM) {
|
||||||
|
parametric_drc_look_ahead_samples = (WORD32)(
|
||||||
|
5.0f * (FLOAT32)p_parametric_drc_params->sampling_rate * 0.001f);
|
||||||
} else {
|
} else {
|
||||||
if (str_parametric_drc_instructions->parametric_drc_type == PARAM_DRC_TYPE_FF)
|
|
||||||
{
|
|
||||||
parametric_drc_look_ahead_samples = (WORD32)(10.0f*(FLOAT32)p_parametric_drc_params->sampling_rate*0.001f);
|
|
||||||
}
|
|
||||||
else if (str_parametric_drc_instructions->parametric_drc_type == PARAM_DRC_TYPE_LIM)
|
|
||||||
{
|
|
||||||
parametric_drc_look_ahead_samples = (WORD32)(5.0f*(FLOAT32)p_parametric_drc_params->sampling_rate*0.001f);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
return (UNEXPECTED_ERROR);
|
return (UNEXPECTED_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drc_instructions_uni_drc->parametric_drc_look_ahead_samples[g] = parametric_drc_look_ahead_samples;
|
drc_instructions_uni_drc->parametric_drc_look_ahead_samples[g] =
|
||||||
if (drc_instructions_uni_drc->parametric_drc_look_ahead_samples_max < drc_instructions_uni_drc->parametric_drc_look_ahead_samples[g])
|
parametric_drc_look_ahead_samples;
|
||||||
{
|
if (drc_instructions_uni_drc->parametric_drc_look_ahead_samples_max <
|
||||||
drc_instructions_uni_drc->parametric_drc_look_ahead_samples_max = drc_instructions_uni_drc->parametric_drc_look_ahead_samples[g];
|
drc_instructions_uni_drc->parametric_drc_look_ahead_samples[g]) {
|
||||||
|
drc_instructions_uni_drc->parametric_drc_look_ahead_samples_max =
|
||||||
|
drc_instructions_uni_drc->parametric_drc_look_ahead_samples[g];
|
||||||
}
|
}
|
||||||
p_parametric_drc_params->parametric_drc_instance_count += 1;
|
p_parametric_drc_params->parametric_drc_instance_count += 1;
|
||||||
selected_drc_is_multiband = 0;
|
selected_drc_is_multiband = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ia_drc_params_struct->parametric_drc_delay += drc_instructions_uni_drc->parametric_drc_look_ahead_samples_max;
|
ia_drc_params_struct->parametric_drc_delay +=
|
||||||
|
drc_instructions_uni_drc->parametric_drc_look_ahead_samples_max;
|
||||||
|
|
||||||
if (selected_drc_is_multiband == 1)
|
if (selected_drc_is_multiband == 1) {
|
||||||
{
|
ia_drc_params_struct->multiband_sel_drc_idx =
|
||||||
ia_drc_params_struct->multiband_sel_drc_idx = ia_drc_params_struct->drc_set_counter;
|
ia_drc_params_struct->drc_set_counter;
|
||||||
err = impd_init_all_filter_banks(drc_coefficients_uni_drc,
|
err = impd_init_all_filter_banks(
|
||||||
|
drc_coefficients_uni_drc,
|
||||||
&(drc_config->str_drc_instruction_str[drc_instructions_selected]),
|
&(drc_config->str_drc_instruction_str[drc_instructions_selected]),
|
||||||
ia_filter_banks_struct);
|
ia_filter_banks_struct);
|
||||||
if (err)
|
if (err) return (err);
|
||||||
return (err);
|
|
||||||
|
|
||||||
err = impd_init_overlap_weight (drc_coefficients_uni_drc,
|
err = impd_init_overlap_weight(
|
||||||
|
drc_coefficients_uni_drc,
|
||||||
&(drc_config->str_drc_instruction_str[drc_instructions_selected]),
|
&(drc_config->str_drc_instruction_str[drc_instructions_selected]),
|
||||||
ia_drc_params_struct->sub_band_domain_mode,
|
ia_drc_params_struct->sub_band_domain_mode, pstr_overlap_params);
|
||||||
pstr_overlap_params);
|
if (err) return (err);
|
||||||
if (err)
|
} else {
|
||||||
return (err);
|
ia_gain_modifiers_struct* gain_modifiers =
|
||||||
}
|
drc_config->str_drc_instruction_str->str_gain_modifiers_of_ch_group;
|
||||||
else
|
for (g = 0; g < drc_instructions_uni_drc->num_drc_ch_groups; g++) {
|
||||||
{
|
if (gain_modifiers[g].shape_filter_flag == 1) {
|
||||||
ia_gain_modifiers_struct* gain_modifiers = drc_config->str_drc_instruction_str->str_gain_modifiers_of_ch_group;
|
impd_shape_filt_block_init(
|
||||||
for (g=0; g<drc_instructions_uni_drc->num_drc_ch_groups; g++)
|
&drc_coefficients_uni_drc->str_shape_filter_block_params
|
||||||
{
|
[gain_modifiers[g].shape_filter_idx],
|
||||||
if (gain_modifiers[g].shape_filter_flag == 1)
|
|
||||||
{
|
|
||||||
impd_shape_filt_block_init(&drc_coefficients_uni_drc->str_shape_filter_block_params[gain_modifiers[g].shape_filter_idx],
|
|
||||||
&shape_filter_block[g]);
|
&shape_filter_block[g]);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
shape_filter_block[g].shape_flter_block_flag = 0;
|
shape_filter_block[g].shape_flter_block_flag = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,35 +20,28 @@
|
||||||
#ifndef IMPD_DRC_DEC_H
|
#ifndef IMPD_DRC_DEC_H
|
||||||
#define IMPD_DRC_DEC_H
|
#define IMPD_DRC_DEC_H
|
||||||
|
|
||||||
WORD32 impd_init_drc_params(WORD32 frame_size,
|
WORD32 impd_init_drc_params(WORD32 frame_size, WORD32 sample_rate,
|
||||||
WORD32 sample_rate,
|
WORD32 gain_delay_samples, WORD32 delay_mode,
|
||||||
WORD32 gain_delay_samples,
|
|
||||||
WORD32 delay_mode,
|
|
||||||
WORD32 sub_band_domain_mode,
|
WORD32 sub_band_domain_mode,
|
||||||
ia_drc_params_struct* ia_drc_params_struct);
|
ia_drc_params_struct* ia_drc_params_struct);
|
||||||
|
|
||||||
|
WORD32 impd_init_selected_drc_set(
|
||||||
WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
|
ia_drc_config* drc_config, ia_drc_params_struct* ia_drc_params_struct,
|
||||||
ia_drc_params_struct* ia_drc_params_struct,
|
|
||||||
ia_parametric_drc_params_struct* p_parametricdrc_params,
|
ia_parametric_drc_params_struct* p_parametricdrc_params,
|
||||||
WORD32 audio_num_chan,
|
WORD32 audio_num_chan, WORD32 drc_set_id_selected,
|
||||||
WORD32 drc_set_id_selected,
|
WORD32 downmix_id_selected, ia_filter_banks_struct* ia_filter_banks_struct,
|
||||||
WORD32 downmix_id_selected,
|
|
||||||
ia_filter_banks_struct* ia_filter_banks_struct,
|
|
||||||
ia_overlap_params_struct* pstr_overlap_params
|
ia_overlap_params_struct* pstr_overlap_params
|
||||||
|
|
||||||
, shape_filter_block* shape_filter_block
|
,
|
||||||
);
|
shape_filter_block* shape_filter_block);
|
||||||
|
|
||||||
WORD32 impd_apply_gains_and_add(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
WORD32 impd_apply_gains_and_add(
|
||||||
|
ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||||
const WORD32 drc_instructions_index,
|
const WORD32 drc_instructions_index,
|
||||||
ia_drc_params_struct* ia_drc_params_struct,
|
ia_drc_params_struct* ia_drc_params_struct,
|
||||||
ia_gain_buffer_struct* pstr_gain_buf,
|
ia_gain_buffer_struct* pstr_gain_buf,
|
||||||
shape_filter_block shape_filter_block[],
|
shape_filter_block shape_filter_block[], FLOAT32* deinterleaved_audio[],
|
||||||
FLOAT32* deinterleaved_audio[],
|
|
||||||
|
|
||||||
FLOAT32* channel_audio[],
|
|
||||||
WORD32 impd_apply_gains);
|
|
||||||
|
|
||||||
|
FLOAT32* channel_audio[], WORD32 impd_apply_gains);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,12 @@
|
||||||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef IMPD_DRC_DEFINITIONS_H
|
#ifndef IMPD_DRC_DEFINITIONS_H
|
||||||
#define IMPD_DRC_DEFINITIONS_H
|
#define IMPD_DRC_DEFINITIONS_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define LIBNAME "IA_DRC"
|
#define LIBNAME "IA_DRC"
|
||||||
#define LIB_APIVERSION 1
|
#define LIB_APIVERSION 1
|
||||||
|
|
||||||
|
|
||||||
#define IA_DRC_PERSIST_IDX (0)
|
#define IA_DRC_PERSIST_IDX (0)
|
||||||
#define IA_DRC_SCRATCH_IDX (1)
|
#define IA_DRC_SCRATCH_IDX (1)
|
||||||
#define IA_DRC_INPUT_IDX (2)
|
#define IA_DRC_INPUT_IDX (2)
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -39,12 +39,9 @@
|
||||||
#define EQ_FILTER_DOMAIN_SUBBAND (1 << 1)
|
#define EQ_FILTER_DOMAIN_SUBBAND (1 << 1)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WORD32 delay;
|
WORD32 delay;
|
||||||
FLOAT32 state[EQ_CHANNEL_COUNT_MAX][EQ_AUDIO_DELAY_MAX];
|
FLOAT32 state[EQ_CHANNEL_COUNT_MAX][EQ_AUDIO_DELAY_MAX];
|
||||||
|
|
@ -70,16 +67,19 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WORD32 filter_format;
|
WORD32 filter_format;
|
||||||
WORD32 filter_param_count_of_zeros;
|
WORD32 filter_param_count_of_zeros;
|
||||||
ia_2nd_order_filt_params_struct ord_2_filt_params_of_zeros[EQ_INTERMEDIATE_2ND_ORDER_PARAMS_COUNT_MAX];
|
ia_2nd_order_filt_params_struct
|
||||||
|
ord_2_filt_params_of_zeros[EQ_INTERMEDIATE_2ND_ORDER_PARAMS_COUNT_MAX];
|
||||||
WORD32 filter_param_count_of_poles;
|
WORD32 filter_param_count_of_poles;
|
||||||
ia_2nd_order_filt_params_struct ord_2_filt_params_of_poles[EQ_INTERMEDIATE_2ND_ORDER_PARAMS_COUNT_MAX];
|
ia_2nd_order_filt_params_struct
|
||||||
|
ord_2_filt_params_of_poles[EQ_INTERMEDIATE_2ND_ORDER_PARAMS_COUNT_MAX];
|
||||||
WORD32 filter_param_count_of_fir;
|
WORD32 filter_param_count_of_fir;
|
||||||
ia_fir_filter_struct fir_filter;
|
ia_fir_filter_struct fir_filter;
|
||||||
} ia_interm_filt_params_struct;
|
} ia_interm_filt_params_struct;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WORD32 interm_filt_param_count;
|
WORD32 interm_filt_param_count;
|
||||||
ia_interm_filt_params_struct interm_filt_params[EQ_INTERMEDIATE_PARAMETER_COUNT_MAX];
|
ia_interm_filt_params_struct
|
||||||
|
interm_filt_params[EQ_INTERMEDIATE_PARAMETER_COUNT_MAX];
|
||||||
} IntermediateParams;
|
} IntermediateParams;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -148,7 +148,8 @@ typedef struct {
|
||||||
WORD32 block_count;
|
WORD32 block_count;
|
||||||
ia_eq_filt_block_struct pstr_eq_filt_block[EQ_FILTER_BLOCK_COUNT_MAX];
|
ia_eq_filt_block_struct pstr_eq_filt_block[EQ_FILTER_BLOCK_COUNT_MAX];
|
||||||
WORD32 num_ph_align_filt;
|
WORD32 num_ph_align_filt;
|
||||||
ia_ph_alignment_filt_struct ph_alignment_filt[EQ_FILTER_BLOCK_COUNT_MAX * EQ_FILTER_BLOCK_COUNT_MAX];
|
ia_ph_alignment_filt_struct
|
||||||
|
ph_alignment_filt[EQ_FILTER_BLOCK_COUNT_MAX * EQ_FILTER_BLOCK_COUNT_MAX];
|
||||||
} ia_filt_cascade_td_struct;
|
} ia_filt_cascade_td_struct;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -160,36 +161,25 @@ typedef struct {
|
||||||
ia_subband_filt_struct subband_filt[EQ_CHANNEL_GROUP_COUNT_MAX];
|
ia_subband_filt_struct subband_filt[EQ_CHANNEL_GROUP_COUNT_MAX];
|
||||||
} ia_eq_set_struct;
|
} ia_eq_set_struct;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_derive_eq_set(ia_eq_coeff_struct* str_eq_coeff,
|
impd_derive_eq_set(ia_eq_coeff_struct* str_eq_coeff,
|
||||||
ia_eq_instructions_struct* str_eq_instructions,
|
ia_eq_instructions_struct* str_eq_instructions,
|
||||||
FLOAT32 sample_rate,
|
FLOAT32 sample_rate, WORD32 drc_frame_size,
|
||||||
WORD32 drc_frame_size,
|
WORD32 sub_band_domain_mode, ia_eq_set_struct* eq_set);
|
||||||
WORD32 sub_band_domain_mode,
|
|
||||||
ia_eq_set_struct* eq_set);
|
|
||||||
|
|
||||||
VOID impd_get_eq_set_delay (ia_eq_set_struct* eq_set,
|
VOID impd_get_eq_set_delay(ia_eq_set_struct* eq_set, WORD32* cascade_delay);
|
||||||
WORD32* cascade_delay);
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_process_eq_set_td(ia_eq_set_struct* eq_set,
|
impd_process_eq_set_td(ia_eq_set_struct* eq_set, WORD32 channel,
|
||||||
WORD32 channel,
|
FLOAT32 audio_in, FLOAT32* audio_out);
|
||||||
FLOAT32 audio_in,
|
|
||||||
FLOAT32* audio_out);
|
|
||||||
|
|
||||||
WORD32 impd_process_eq_set_time_domain(ia_eq_set_struct* eq_set,
|
WORD32 impd_process_eq_set_time_domain(ia_eq_set_struct* eq_set, WORD32 channel,
|
||||||
WORD32 channel,
|
FLOAT32* audio_in, FLOAT32* audio_out,
|
||||||
FLOAT32 *audio_in,
|
|
||||||
FLOAT32 *audio_out,
|
|
||||||
WORD32 frame_size);
|
WORD32 frame_size);
|
||||||
WORD32
|
WORD32
|
||||||
impd_process_eq_set_subband_domain(ia_eq_set_struct* eq_set,
|
impd_process_eq_set_subband_domain(ia_eq_set_struct* eq_set, WORD32 channel,
|
||||||
WORD32 channel,
|
|
||||||
FLOAT32* subbandSampleIn,
|
FLOAT32* subbandSampleIn,
|
||||||
FLOAT32* subbandSampleOut);
|
FLOAT32* subbandSampleOut);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef IMPD_DRC_ERROR_CODES_H
|
#ifndef IMPD_DRC_ERROR_CODES_H
|
||||||
#define IMPD_DRC_ERROR_CODES_H
|
#define IMPD_DRC_ERROR_CODES_H
|
||||||
|
|
||||||
|
|
@ -30,7 +29,6 @@
|
||||||
#define IA_DRC_DEC_API_NONFATAL_CMD_NOT_SUPPORTED 0x00000001
|
#define IA_DRC_DEC_API_NONFATAL_CMD_NOT_SUPPORTED 0x00000001
|
||||||
#define IA_DRC_DEC_API_NONFATAL_CMD_TYPE_NOT_SUPPORTED 0x00000002
|
#define IA_DRC_DEC_API_NONFATAL_CMD_TYPE_NOT_SUPPORTED 0x00000002
|
||||||
|
|
||||||
|
|
||||||
/*API Fatal Errors */
|
/*API Fatal Errors */
|
||||||
#define IA_DRC_DEC_API_FATAL_INVALID_MEMTAB_INDEX 0xFFFF8000
|
#define IA_DRC_DEC_API_FATAL_INVALID_MEMTAB_INDEX 0xFFFF8000
|
||||||
#define IA_DRC_DEC_API_FATAL_INVALID_LIB_ID_STRINGS_IDX 0xFFFF8001
|
#define IA_DRC_DEC_API_FATAL_INVALID_LIB_ID_STRINGS_IDX 0xFFFF8001
|
||||||
|
|
@ -43,7 +41,6 @@
|
||||||
/* Class 1: Configuration Errors */
|
/* Class 1: Configuration Errors */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/* Non Fatal Errors */
|
/* Non Fatal Errors */
|
||||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_NUM_OF_CHANNELS 0x00000800
|
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_NUM_OF_CHANNELS 0x00000800
|
||||||
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_SAMP_FREQ 0x00000801
|
#define IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_SAMP_FREQ 0x00000801
|
||||||
|
|
|
||||||
|
|
@ -28,40 +28,32 @@
|
||||||
#include "impd_drc_rom.h"
|
#include "impd_drc_rom.h"
|
||||||
|
|
||||||
WORD32 impd_init_tbls(const WORD32 num_gain_max_values,
|
WORD32 impd_init_tbls(const WORD32 num_gain_max_values,
|
||||||
ia_tables_struct* str_tables)
|
ia_tables_struct* str_tables) {
|
||||||
{
|
|
||||||
impd_gen_delta_time_code_tbl(num_gain_max_values,
|
impd_gen_delta_time_code_tbl(num_gain_max_values,
|
||||||
str_tables->delta_time_code_table);
|
str_tables->delta_time_code_table);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void impd_get_delta_gain_code_tbl(
|
||||||
void
|
const WORD32 gain_coding_profile,
|
||||||
impd_get_delta_gain_code_tbl(const WORD32 gain_coding_profile,
|
|
||||||
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
||||||
WORD32 *num_entries)
|
WORD32* num_entries) {
|
||||||
{
|
if (gain_coding_profile == GAIN_CODING_PROFILE_CLIPPING) {
|
||||||
if (gain_coding_profile==GAIN_CODING_PROFILE_CLIPPING)
|
|
||||||
{
|
|
||||||
*delta_time_code_tbl = ia_drc_gain_tbls_prof_2;
|
*delta_time_code_tbl = ia_drc_gain_tbls_prof_2;
|
||||||
*num_entries = NUM_GAIN_TBL_PROF_2_ENTRIES;
|
*num_entries = NUM_GAIN_TBL_PROF_2_ENTRIES;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
*delta_time_code_tbl = ia_drc_gain_tbls_prof_0_1;
|
*delta_time_code_tbl = ia_drc_gain_tbls_prof_0_1;
|
||||||
*num_entries = NUM_GAIN_TBL_PROF_0_1_ENTRIES;
|
*num_entries = NUM_GAIN_TBL_PROF_0_1_ENTRIES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void impd_gen_delta_time_code_tbl(
|
||||||
impd_gen_delta_time_code_tbl (const WORD32 num_gain_max_values,
|
const WORD32 num_gain_max_values,
|
||||||
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item)
|
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item) {
|
||||||
{
|
|
||||||
WORD32 n, k;
|
WORD32 n, k;
|
||||||
|
|
||||||
WORD32 Z = 1;
|
WORD32 Z = 1;
|
||||||
while((1<<Z)<2*num_gain_max_values)
|
while ((1 << Z) < 2 * num_gain_max_values) {
|
||||||
{
|
|
||||||
Z++;
|
Z++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,42 +64,32 @@ impd_gen_delta_time_code_tbl (const WORD32 num_gain_max_values,
|
||||||
delta_time_code_tbl_item[1].size = 2;
|
delta_time_code_tbl_item[1].size = 2;
|
||||||
delta_time_code_tbl_item[1].code = 0x0;
|
delta_time_code_tbl_item[1].code = 0x0;
|
||||||
delta_time_code_tbl_item[1].value = 1;
|
delta_time_code_tbl_item[1].value = 1;
|
||||||
for (n=0; n<4; n++)
|
for (n = 0; n < 4; n++) {
|
||||||
{
|
|
||||||
delta_time_code_tbl_item[n + 2].size = 4;
|
delta_time_code_tbl_item[n + 2].size = 4;
|
||||||
delta_time_code_tbl_item[n + 2].code = 0x4 + n;
|
delta_time_code_tbl_item[n + 2].code = 0x4 + n;
|
||||||
delta_time_code_tbl_item[n + 2].value = n + 2;
|
delta_time_code_tbl_item[n + 2].value = n + 2;
|
||||||
}
|
}
|
||||||
for (n=0; n<8; n++)
|
for (n = 0; n < 8; n++) {
|
||||||
{
|
|
||||||
delta_time_code_tbl_item[n + 6].size = 5;
|
delta_time_code_tbl_item[n + 6].size = 5;
|
||||||
delta_time_code_tbl_item[n + 6].code = 0x10 + n;
|
delta_time_code_tbl_item[n + 6].code = 0x10 + n;
|
||||||
delta_time_code_tbl_item[n + 6].value = n + 6;
|
delta_time_code_tbl_item[n + 6].value = n + 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
k = 2 * num_gain_max_values - 14 + 1;
|
k = 2 * num_gain_max_values - 14 + 1;
|
||||||
for (n=0; n<k; n++)
|
for (n = 0; n < k; n++) {
|
||||||
{
|
|
||||||
delta_time_code_tbl_item[n + 14].size = 2 + Z;
|
delta_time_code_tbl_item[n + 14].size = 2 + Z;
|
||||||
delta_time_code_tbl_item[n + 14].code = (0x3 << Z) + n;
|
delta_time_code_tbl_item[n + 14].code = (0x3 << Z) + n;
|
||||||
delta_time_code_tbl_item[n + 14].value = n + 14;
|
delta_time_code_tbl_item[n + 14].value = n + 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_get_delta_tmin (const WORD32 sampling_rate)
|
impd_get_delta_tmin(const WORD32 sampling_rate) {
|
||||||
{
|
|
||||||
WORD32 lowerBound = (WORD32)(0.5f + 0.0005f * sampling_rate);
|
WORD32 lowerBound = (WORD32)(0.5f + 0.0005f * sampling_rate);
|
||||||
WORD32 result = 1;
|
WORD32 result = 1;
|
||||||
if (sampling_rate < 1000)
|
if (sampling_rate < 1000) {
|
||||||
{
|
|
||||||
return (UNEXPECTED_ERROR);
|
return (UNEXPECTED_ERROR);
|
||||||
}
|
}
|
||||||
while (result <= lowerBound) result = result << 1;
|
while (result <= lowerBound) result = result << 1;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,7 @@
|
||||||
#define IMPD_DRC_TABLES_H
|
#define IMPD_DRC_TABLES_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX (512 + 14)
|
#define N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX (512 + 14)
|
||||||
|
|
@ -47,7 +46,8 @@ typedef struct {
|
||||||
} ia_delta_gain_code_table_struct;
|
} ia_delta_gain_code_table_struct;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ia_delta_time_code_table_entry_struct delta_time_code_table[N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX];
|
ia_delta_time_code_table_entry_struct
|
||||||
|
delta_time_code_table[N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX];
|
||||||
} ia_tables_struct;
|
} ia_tables_struct;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -67,15 +67,14 @@ typedef struct {
|
||||||
} ia_cicp_node_characteristic_param;
|
} ia_cicp_node_characteristic_param;
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_init_tbls(const WORD32 num_gain_max_values,
|
impd_init_tbls(const WORD32 num_gain_max_values, ia_tables_struct* str_tables);
|
||||||
ia_tables_struct* str_tables);
|
|
||||||
|
|
||||||
void
|
void impd_gen_delta_time_code_tbl(
|
||||||
impd_gen_delta_time_code_tbl (const WORD32 num_gain_max_values,
|
const WORD32 num_gain_max_values,
|
||||||
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item);
|
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item);
|
||||||
|
|
||||||
void
|
void impd_get_delta_gain_code_tbl(
|
||||||
impd_get_delta_gain_code_tbl(const WORD32 gain_coding_profile,
|
const WORD32 gain_coding_profile,
|
||||||
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
||||||
WORD32* num_entries);
|
WORD32* num_entries);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,7 @@ VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
|
||||||
ia_iir_filter_struct* pstr_lp_filt_coeff,
|
ia_iir_filter_struct* pstr_lp_filt_coeff,
|
||||||
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
||||||
ia_iir_filter_struct* pstr_ap_filt_coeff,
|
ia_iir_filter_struct* pstr_ap_filt_coeff,
|
||||||
WORD32 filter_type)
|
WORD32 filter_type) {
|
||||||
{
|
|
||||||
FLOAT32 gamma = normal_cross_freq[crossover_freq_idx].gamma;
|
FLOAT32 gamma = normal_cross_freq[crossover_freq_idx].gamma;
|
||||||
FLOAT32 delta = normal_cross_freq[crossover_freq_idx].delta;
|
FLOAT32 delta = normal_cross_freq[crossover_freq_idx].delta;
|
||||||
|
|
||||||
|
|
@ -55,8 +54,10 @@ VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
|
||||||
|
|
||||||
if (filter_type == 1 || filter_type == 2) {
|
if (filter_type == 1 || filter_type == 2) {
|
||||||
pstr_ap_filt_coeff->a0 = 1.0f;
|
pstr_ap_filt_coeff->a0 = 1.0f;
|
||||||
pstr_ap_filt_coeff->a1 = 2.0f * (gamma - delta);;
|
pstr_ap_filt_coeff->a1 = 2.0f * (gamma - delta);
|
||||||
pstr_ap_filt_coeff->a2 = 2.0f * (gamma + delta) - 1.0f;;
|
;
|
||||||
|
pstr_ap_filt_coeff->a2 = 2.0f * (gamma + delta) - 1.0f;
|
||||||
|
;
|
||||||
pstr_ap_filt_coeff->b0 = pstr_ap_filt_coeff->a2;
|
pstr_ap_filt_coeff->b0 = pstr_ap_filt_coeff->a2;
|
||||||
pstr_ap_filt_coeff->b1 = pstr_ap_filt_coeff->a1;
|
pstr_ap_filt_coeff->b1 = pstr_ap_filt_coeff->a1;
|
||||||
pstr_ap_filt_coeff->b2 = pstr_ap_filt_coeff->a0;
|
pstr_ap_filt_coeff->b2 = pstr_ap_filt_coeff->a0;
|
||||||
|
|
@ -67,38 +68,30 @@ VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
|
||||||
|
|
||||||
WORD32 impd_initialize_filt_bank(WORD32 num_sub_bands,
|
WORD32 impd_initialize_filt_bank(WORD32 num_sub_bands,
|
||||||
ia_gain_params_struct* gain_params,
|
ia_gain_params_struct* gain_params,
|
||||||
ia_drc_filter_bank_struct* drc_filter_bank)
|
ia_drc_filter_bank_struct* drc_filter_bank) {
|
||||||
{
|
|
||||||
ia_two_band_filt_struct* str_two_band_bank;
|
ia_two_band_filt_struct* str_two_band_bank;
|
||||||
ia_three_band_filt_struct* str_three_band_bank;
|
ia_three_band_filt_struct* str_three_band_bank;
|
||||||
ia_four_band_filt_struct* str_four_band_bank;
|
ia_four_band_filt_struct* str_four_band_bank;
|
||||||
drc_filter_bank->complexity = 0;
|
drc_filter_bank->complexity = 0;
|
||||||
drc_filter_bank->num_bands = num_sub_bands;
|
drc_filter_bank->num_bands = num_sub_bands;
|
||||||
|
|
||||||
|
|
||||||
if (num_sub_bands == 1) {
|
if (num_sub_bands == 1) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else if (num_sub_bands == 2) {
|
||||||
else if(num_sub_bands==2){
|
|
||||||
str_two_band_bank = &drc_filter_bank->str_two_band_bank;
|
str_two_band_bank = &drc_filter_bank->str_two_band_bank;
|
||||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||||
&(str_two_band_bank->low_pass),
|
&(str_two_band_bank->low_pass),
|
||||||
&(str_two_band_bank->high_pass),
|
&(str_two_band_bank->high_pass), NULL, 0);
|
||||||
NULL,
|
} else if (num_sub_bands == 3) {
|
||||||
0);
|
|
||||||
}
|
|
||||||
else if(num_sub_bands==3){
|
|
||||||
str_three_band_bank = &drc_filter_bank->str_three_band_bank;
|
str_three_band_bank = &drc_filter_bank->str_three_band_bank;
|
||||||
|
|
||||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||||
&(str_three_band_bank->str_low_pass_stage_2),
|
&(str_three_band_bank->str_low_pass_stage_2),
|
||||||
&(str_three_band_bank->str_high_pass_stage_2),
|
&(str_three_band_bank->str_high_pass_stage_2),
|
||||||
&(str_three_band_bank->str_all_pass_stage_2),
|
&(str_three_band_bank->str_all_pass_stage_2), 2);
|
||||||
2);
|
|
||||||
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
||||||
&(str_three_band_bank->str_low_pass_stage_1),
|
&(str_three_band_bank->str_low_pass_stage_1),
|
||||||
&(str_three_band_bank->str_high_pass_stage_1),
|
&(str_three_band_bank->str_high_pass_stage_1), NULL,
|
||||||
NULL,
|
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,82 +105,85 @@ WORD32 impd_initialize_filt_bank(WORD32 num_sub_bands,
|
||||||
2);
|
2);
|
||||||
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
||||||
&(str_four_band_bank->str_low_pass_stage_1),
|
&(str_four_band_bank->str_low_pass_stage_1),
|
||||||
&(str_four_band_bank->str_high_pass_stage_1),
|
&(str_four_band_bank->str_high_pass_stage_1), NULL,
|
||||||
NULL,
|
|
||||||
0);
|
0);
|
||||||
impd_compute_filt_coeff(gain_params[3].crossover_freq_idx,
|
impd_compute_filt_coeff(gain_params[3].crossover_freq_idx,
|
||||||
&(str_four_band_bank->str_low_pass_stage_3_high),
|
&(str_four_band_bank->str_low_pass_stage_3_high),
|
||||||
&(str_four_band_bank->str_high_pass_stage_3_high),
|
&(str_four_band_bank->str_high_pass_stage_3_high),
|
||||||
&(str_four_band_bank->str_all_pass_stage_2_low),
|
&(str_four_band_bank->str_all_pass_stage_2_low), 2);
|
||||||
2);
|
} else {
|
||||||
}
|
|
||||||
else {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
WORD32 impd_init_all_filter_banks(
|
||||||
|
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||||
ia_filter_banks_struct* ia_filter_banks_struct)
|
ia_filter_banks_struct* ia_filter_banks_struct) {
|
||||||
{
|
|
||||||
WORD32 err_code = 0;
|
WORD32 err_code = 0;
|
||||||
WORD32 b, g, i, k, m, s , crossover_freq_idx, num_ch_in_groups, num_ph_align_ch_groups;
|
WORD32 b, g, i, k, m, s, crossover_freq_idx, num_ch_in_groups,
|
||||||
|
num_ph_align_ch_groups;
|
||||||
WORD32 match_found = 0, num_filter;
|
WORD32 match_found = 0, num_filter;
|
||||||
WORD32 cascade_cross_idx[CHANNEL_GROUP_COUNT_MAX+1][CHANNEL_GROUP_COUNT_MAX * 3];
|
WORD32 cascade_cross_idx[CHANNEL_GROUP_COUNT_MAX + 1]
|
||||||
|
[CHANNEL_GROUP_COUNT_MAX * 3];
|
||||||
WORD32 count[CHANNEL_GROUP_COUNT_MAX + 1];
|
WORD32 count[CHANNEL_GROUP_COUNT_MAX + 1];
|
||||||
|
|
||||||
num_ch_in_groups = 0;
|
num_ch_in_groups = 0;
|
||||||
num_ph_align_ch_groups = str_drc_instruction_str->num_drc_ch_groups;
|
num_ph_align_ch_groups = str_drc_instruction_str->num_drc_ch_groups;
|
||||||
|
|
||||||
|
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups; g++)
|
|
||||||
{
|
|
||||||
num_ch_in_groups += str_drc_instruction_str->num_chan_per_ch_group[g];
|
num_ch_in_groups += str_drc_instruction_str->num_chan_per_ch_group[g];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_ch_in_groups < str_drc_instruction_str->audio_num_chan)
|
if (num_ch_in_groups < str_drc_instruction_str->audio_num_chan) {
|
||||||
{
|
|
||||||
num_ph_align_ch_groups++;
|
num_ph_align_ch_groups++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ia_filter_banks_struct->nfilter_banks = str_drc_instruction_str->num_drc_ch_groups;
|
ia_filter_banks_struct->nfilter_banks =
|
||||||
|
str_drc_instruction_str->num_drc_ch_groups;
|
||||||
ia_filter_banks_struct->num_ph_align_ch_groups = num_ph_align_ch_groups;
|
ia_filter_banks_struct->num_ph_align_ch_groups = num_ph_align_ch_groups;
|
||||||
|
|
||||||
if (str_p_loc_drc_coefficients_uni_drc == NULL)
|
if (str_p_loc_drc_coefficients_uni_drc == NULL) {
|
||||||
{
|
|
||||||
ia_filter_banks_struct->str_drc_filter_bank->num_bands = 1;
|
ia_filter_banks_struct->str_drc_filter_bank->num_bands = 1;
|
||||||
}
|
} else {
|
||||||
else
|
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||||
{
|
err_code = impd_initialize_filt_bank(
|
||||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups; g++)
|
str_p_loc_drc_coefficients_uni_drc
|
||||||
{
|
->gain_set_params[str_drc_instruction_str
|
||||||
err_code = impd_initialize_filt_bank(str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].band_count,
|
->gain_set_index_for_channel_group[g]]
|
||||||
str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].gain_params,
|
.band_count,
|
||||||
|
str_p_loc_drc_coefficients_uni_drc
|
||||||
|
->gain_set_params[str_drc_instruction_str
|
||||||
|
->gain_set_index_for_channel_group[g]]
|
||||||
|
.gain_params,
|
||||||
&(ia_filter_banks_struct->str_drc_filter_bank[g]));
|
&(ia_filter_banks_struct->str_drc_filter_bank[g]));
|
||||||
if (err_code!=0)
|
if (err_code != 0) return (err_code);
|
||||||
return (err_code);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (g=0; g<CHANNEL_GROUP_COUNT_MAX + 1; g++)
|
for (g = 0; g < CHANNEL_GROUP_COUNT_MAX + 1; g++) {
|
||||||
{
|
|
||||||
count[g] = 0;
|
count[g] = 0;
|
||||||
}
|
}
|
||||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups; g++)
|
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||||
{
|
for (b = 1;
|
||||||
for (b=1; b<str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].band_count; b++)
|
b < str_p_loc_drc_coefficients_uni_drc
|
||||||
{
|
->gain_set_params[str_drc_instruction_str
|
||||||
crossover_freq_idx = str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].gain_params[b].crossover_freq_idx;
|
->gain_set_index_for_channel_group[g]]
|
||||||
for (k=0; k<num_ph_align_ch_groups; k++)
|
.band_count;
|
||||||
{
|
b++) {
|
||||||
if (k!=g)
|
crossover_freq_idx =
|
||||||
{
|
str_p_loc_drc_coefficients_uni_drc
|
||||||
|
->gain_set_params[str_drc_instruction_str
|
||||||
|
->gain_set_index_for_channel_group[g]]
|
||||||
|
.gain_params[b]
|
||||||
|
.crossover_freq_idx;
|
||||||
|
for (k = 0; k < num_ph_align_ch_groups; k++) {
|
||||||
|
if (k != g) {
|
||||||
cascade_cross_idx[k][count[k]] = crossover_freq_idx;
|
cascade_cross_idx[k][count[k]] = crossover_freq_idx;
|
||||||
count[k]++;
|
count[k]++;
|
||||||
if (count[k] > CHANNEL_GROUP_COUNT_MAX * 3)
|
if (count[k] > CHANNEL_GROUP_COUNT_MAX * 3) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -196,34 +192,24 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i<count[0])
|
while (i < count[0]) {
|
||||||
{
|
|
||||||
crossover_freq_idx = cascade_cross_idx[0][i];
|
crossover_freq_idx = cascade_cross_idx[0][i];
|
||||||
match_found = 0;
|
match_found = 0;
|
||||||
for (g=1; g<num_ph_align_ch_groups; g++)
|
for (g = 1; g < num_ph_align_ch_groups; g++) {
|
||||||
{
|
|
||||||
match_found = 0;
|
match_found = 0;
|
||||||
for (k=0; k<count[g]; k++)
|
for (k = 0; k < count[g]; k++) {
|
||||||
{
|
if (cascade_cross_idx[g][k] == crossover_freq_idx) {
|
||||||
if (cascade_cross_idx[g][k] == crossover_freq_idx)
|
|
||||||
{
|
|
||||||
match_found = 1;
|
match_found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (match_found == 0)
|
if (match_found == 0) break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (match_found == 1)
|
if (match_found == 1) {
|
||||||
{
|
for (g = 0; g < num_ph_align_ch_groups; g++) {
|
||||||
for (g=0; g<num_ph_align_ch_groups; g++)
|
for (m = 0; m < count[g]; m++) {
|
||||||
{
|
if (cascade_cross_idx[g][m] == crossover_freq_idx) {
|
||||||
for (m=0; m<count[g]; m++)
|
for (s = m + 1; s < count[g]; s++) {
|
||||||
{
|
|
||||||
if (cascade_cross_idx[g][m] == crossover_freq_idx)
|
|
||||||
{
|
|
||||||
for (s=m+1; s<count[g]; s++)
|
|
||||||
{
|
|
||||||
cascade_cross_idx[g][s - 1] = cascade_cross_idx[g][s];
|
cascade_cross_idx[g][s - 1] = cascade_cross_idx[g][s];
|
||||||
}
|
}
|
||||||
count[g]--;
|
count[g]--;
|
||||||
|
|
@ -232,41 +218,35 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (g=0; g<num_ph_align_ch_groups; g++)
|
for (g = 0; g < num_ph_align_ch_groups; g++) {
|
||||||
{
|
|
||||||
num_filter = count[g];
|
num_filter = count[g];
|
||||||
if (num_filter > 0) {
|
if (num_filter > 0) {
|
||||||
for (i = 0; i < num_filter; i++) {
|
for (i = 0; i < num_filter; i++) {
|
||||||
impd_compute_filt_coeff(cascade_cross_idx[g][i],
|
impd_compute_filt_coeff(
|
||||||
NULL,
|
cascade_cross_idx[g][i], NULL, NULL,
|
||||||
NULL,
|
&(ia_filter_banks_struct->str_drc_filter_bank[g]
|
||||||
&(ia_filter_banks_struct->str_drc_filter_bank[g].str_all_pass_cascade.str_all_pass_cascade_filter[i].str_all_pass_stage),
|
.str_all_pass_cascade.str_all_pass_cascade_filter[i]
|
||||||
|
.str_all_pass_stage),
|
||||||
1);
|
1);
|
||||||
}
|
}
|
||||||
ia_filter_banks_struct->str_drc_filter_bank[g].str_all_pass_cascade.num_filter = num_filter;
|
ia_filter_banks_struct->str_drc_filter_bank[g]
|
||||||
|
.str_all_pass_cascade.num_filter = num_filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err_code!=0)
|
if (err_code != 0) return (err_code);
|
||||||
return (err_code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID impd_iir_second_order_filter_all_pass(ia_iir_filter_struct* filter,
|
VOID impd_iir_second_order_filter_all_pass(ia_iir_filter_struct* filter,
|
||||||
WORD32 chan_idx,
|
WORD32 chan_idx, WORD32 frame_len,
|
||||||
WORD32 frame_len,
|
FLOAT32* input, FLOAT32* output) {
|
||||||
FLOAT32* input,
|
|
||||||
FLOAT32* output)
|
|
||||||
{
|
|
||||||
WORD32 i;
|
WORD32 i;
|
||||||
FLOAT32 tmp;
|
FLOAT32 tmp;
|
||||||
FLOAT32 a1 = filter->a1;
|
FLOAT32 a1 = filter->a1;
|
||||||
|
|
@ -278,8 +258,7 @@ VOID impd_iir_second_order_filter_all_pass(ia_iir_filter_struct* filter,
|
||||||
FLOAT32 st1 = filter->x_p[chan_idx * 2];
|
FLOAT32 st1 = filter->x_p[chan_idx * 2];
|
||||||
FLOAT32 st2 = filter->y_p[chan_idx * 2];
|
FLOAT32 st2 = filter->y_p[chan_idx * 2];
|
||||||
|
|
||||||
for (i=0; i<frame_len; i++)
|
for (i = 0; i < frame_len; i++) {
|
||||||
{
|
|
||||||
tmp = input[i];
|
tmp = input[i];
|
||||||
output[i] = b0 * tmp + st1;
|
output[i] = b0 * tmp + st1;
|
||||||
st1 = b1 * tmp - a1 * output[i] + st2;
|
st1 = b1 * tmp - a1 * output[i] + st2;
|
||||||
|
|
@ -293,11 +272,8 @@ VOID impd_iir_second_order_filter_all_pass(ia_iir_filter_struct* filter,
|
||||||
|
|
||||||
VOID impd_apply_low_high_filter(ia_iir_filter_struct* pstr_lp_filt_coeff,
|
VOID impd_apply_low_high_filter(ia_iir_filter_struct* pstr_lp_filt_coeff,
|
||||||
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
||||||
WORD32 chan_idx,
|
WORD32 chan_idx, WORD32 frame_len,
|
||||||
WORD32 frame_len,
|
FLOAT32* input, FLOAT32* output[]) {
|
||||||
FLOAT32* input,
|
|
||||||
FLOAT32* output[])
|
|
||||||
{
|
|
||||||
WORD32 i;
|
WORD32 i;
|
||||||
FLOAT32 tmp, tmp1;
|
FLOAT32 tmp, tmp1;
|
||||||
FLOAT32 a1_l = pstr_lp_filt_coeff->a1;
|
FLOAT32 a1_l = pstr_lp_filt_coeff->a1;
|
||||||
|
|
@ -325,8 +301,7 @@ VOID impd_apply_low_high_filter(ia_iir_filter_struct* pstr_lp_filt_coeff,
|
||||||
FLOAT32* output_low = output[0];
|
FLOAT32* output_low = output[0];
|
||||||
FLOAT32* output_high = output[1];
|
FLOAT32* output_high = output[1];
|
||||||
|
|
||||||
for (i=0; i<frame_len; i++)
|
for (i = 0; i < frame_len; i++) {
|
||||||
{
|
|
||||||
tmp1 = input[i];
|
tmp1 = input[i];
|
||||||
tmp = b0_l * tmp1 + st1_l;
|
tmp = b0_l * tmp1 + st1_l;
|
||||||
st1_l = b1_l * tmp1 - a1_l * tmp + st2_l;
|
st1_l = b1_l * tmp1 - a1_l * tmp + st2_l;
|
||||||
|
|
@ -357,79 +332,54 @@ VOID impd_apply_low_high_filter(ia_iir_filter_struct* pstr_lp_filt_coeff,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VOID impd_two_band_filter_process(ia_two_band_filt_struct* str_two_band_bank,
|
VOID impd_two_band_filter_process(ia_two_band_filt_struct* str_two_band_bank,
|
||||||
WORD32 chan_idx,
|
WORD32 chan_idx, WORD32 frame_len,
|
||||||
WORD32 frame_len,
|
FLOAT32* input, FLOAT32* output[]) {
|
||||||
FLOAT32* input,
|
|
||||||
FLOAT32* output[])
|
|
||||||
{
|
|
||||||
ia_iir_filter_struct* pstr_lp_filt_coeff = &str_two_band_bank->low_pass;
|
ia_iir_filter_struct* pstr_lp_filt_coeff = &str_two_band_bank->low_pass;
|
||||||
ia_iir_filter_struct* pstr_hp_filt_coeff = &str_two_band_bank->high_pass;
|
ia_iir_filter_struct* pstr_hp_filt_coeff = &str_two_band_bank->high_pass;
|
||||||
|
|
||||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, chan_idx,
|
||||||
pstr_hp_filt_coeff,
|
frame_len, input, output);
|
||||||
chan_idx,
|
|
||||||
frame_len,
|
|
||||||
input,
|
|
||||||
output);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID impd_three_band_filter_process(
|
||||||
|
ia_three_band_filt_struct* str_three_band_bank, WORD32 c, WORD32 size,
|
||||||
VOID impd_three_band_filter_process(ia_three_band_filt_struct* str_three_band_bank,
|
FLOAT32* input, FLOAT32* output[]) {
|
||||||
WORD32 c,
|
|
||||||
WORD32 size,
|
|
||||||
FLOAT32* input,
|
|
||||||
FLOAT32* output[])
|
|
||||||
{
|
|
||||||
WORD32 err_code = 0;
|
WORD32 err_code = 0;
|
||||||
ia_iir_filter_struct* all_pass_filter;
|
ia_iir_filter_struct* all_pass_filter;
|
||||||
ia_iir_filter_struct* pstr_lp_filt_coeff=&str_three_band_bank->str_low_pass_stage_1;
|
ia_iir_filter_struct* pstr_lp_filt_coeff =
|
||||||
ia_iir_filter_struct* pstr_hp_filt_coeff=&str_three_band_bank->str_high_pass_stage_1;
|
&str_three_band_bank->str_low_pass_stage_1;
|
||||||
|
ia_iir_filter_struct* pstr_hp_filt_coeff =
|
||||||
|
&str_three_band_bank->str_high_pass_stage_1;
|
||||||
FLOAT32* output1[2];
|
FLOAT32* output1[2];
|
||||||
output1[0] = output[0];
|
output1[0] = output[0];
|
||||||
output1[1] = output[1];
|
output1[1] = output[1];
|
||||||
|
|
||||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, c, size,
|
||||||
pstr_hp_filt_coeff,
|
input, output1);
|
||||||
c,
|
|
||||||
size,
|
|
||||||
input,
|
|
||||||
output1);
|
|
||||||
|
|
||||||
all_pass_filter = &str_three_band_bank->str_all_pass_stage_2;
|
all_pass_filter = &str_three_band_bank->str_all_pass_stage_2;
|
||||||
|
|
||||||
impd_iir_second_order_filter_all_pass(all_pass_filter,
|
impd_iir_second_order_filter_all_pass(all_pass_filter, c, size, output1[1],
|
||||||
c,
|
|
||||||
size,
|
|
||||||
output1[1],
|
|
||||||
output[2]);
|
output[2]);
|
||||||
pstr_lp_filt_coeff = &str_three_band_bank->str_low_pass_stage_2;
|
pstr_lp_filt_coeff = &str_three_band_bank->str_low_pass_stage_2;
|
||||||
pstr_hp_filt_coeff = &str_three_band_bank->str_high_pass_stage_2;
|
pstr_hp_filt_coeff = &str_three_band_bank->str_high_pass_stage_2;
|
||||||
|
|
||||||
|
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, c, size,
|
||||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
output1[0], output1);
|
||||||
pstr_hp_filt_coeff,
|
|
||||||
c,
|
|
||||||
size,
|
|
||||||
output1[0],
|
|
||||||
output1);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID impd_four_band_filter_process(ia_four_band_filt_struct* str_four_band_bank,
|
VOID impd_four_band_filter_process(ia_four_band_filt_struct* str_four_band_bank,
|
||||||
WORD32 cha_idx,
|
WORD32 cha_idx, WORD32 win_size,
|
||||||
WORD32 win_size,
|
FLOAT32* input, FLOAT32* output[]) {
|
||||||
FLOAT32* input,
|
|
||||||
FLOAT32* output[])
|
|
||||||
{
|
|
||||||
WORD32 err_code = 0;
|
WORD32 err_code = 0;
|
||||||
ia_iir_filter_struct* all_pass_filter;
|
ia_iir_filter_struct* all_pass_filter;
|
||||||
ia_iir_filter_struct* pstr_lp_filt_coeff=&str_four_band_bank->str_low_pass_stage_1;
|
ia_iir_filter_struct* pstr_lp_filt_coeff =
|
||||||
ia_iir_filter_struct* pstr_hp_filt_coeff=&str_four_band_bank->str_high_pass_stage_1;
|
&str_four_band_bank->str_low_pass_stage_1;
|
||||||
|
ia_iir_filter_struct* pstr_hp_filt_coeff =
|
||||||
|
&str_four_band_bank->str_high_pass_stage_1;
|
||||||
FLOAT32* output1[2];
|
FLOAT32* output1[2];
|
||||||
FLOAT32* output2[2];
|
FLOAT32* output2[2];
|
||||||
output1[0] = output[0];
|
output1[0] = output[0];
|
||||||
|
|
@ -437,68 +387,44 @@ VOID impd_four_band_filter_process(ia_four_band_filt_struct* str_four_band_bank,
|
||||||
output2[0] = output[2];
|
output2[0] = output[2];
|
||||||
output2[1] = output[3];
|
output2[1] = output[3];
|
||||||
|
|
||||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, cha_idx,
|
||||||
pstr_hp_filt_coeff,
|
win_size, input, output1);
|
||||||
cha_idx,
|
|
||||||
win_size,
|
|
||||||
input,
|
|
||||||
output1);
|
|
||||||
|
|
||||||
all_pass_filter = &str_four_band_bank->str_all_pass_stage_2_low;
|
all_pass_filter = &str_four_band_bank->str_all_pass_stage_2_low;
|
||||||
|
|
||||||
impd_iir_second_order_filter_all_pass(all_pass_filter,
|
impd_iir_second_order_filter_all_pass(all_pass_filter, cha_idx, win_size,
|
||||||
cha_idx,
|
output1[0], output1[0]);
|
||||||
win_size,
|
|
||||||
output1[0],
|
|
||||||
output1[0]);
|
|
||||||
|
|
||||||
|
|
||||||
all_pass_filter = &str_four_band_bank->str_all_pass_stage_2_high;
|
all_pass_filter = &str_four_band_bank->str_all_pass_stage_2_high;
|
||||||
|
|
||||||
impd_iir_second_order_filter_all_pass(all_pass_filter,
|
impd_iir_second_order_filter_all_pass(all_pass_filter, cha_idx, win_size,
|
||||||
cha_idx,
|
output1[1], output2[0]);
|
||||||
win_size,
|
|
||||||
output1[1],
|
|
||||||
output2[0]);
|
|
||||||
|
|
||||||
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_low;
|
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_low;
|
||||||
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_low;
|
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_low;
|
||||||
|
|
||||||
|
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, cha_idx,
|
||||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
win_size, output1[0], output1);
|
||||||
pstr_hp_filt_coeff,
|
|
||||||
cha_idx,
|
|
||||||
win_size,
|
|
||||||
output1[0],
|
|
||||||
output1);
|
|
||||||
|
|
||||||
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_high;
|
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_high;
|
||||||
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_high;
|
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_high;
|
||||||
|
|
||||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, cha_idx,
|
||||||
pstr_hp_filt_coeff,
|
win_size, output2[0], output2);
|
||||||
cha_idx,
|
|
||||||
win_size,
|
|
||||||
output2[0],
|
|
||||||
output2);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID impd_all_pass_cascade_process(ia_all_pass_cascade_struct *str_all_pass_cascade,
|
VOID impd_all_pass_cascade_process(
|
||||||
WORD32 ch_idx,
|
ia_all_pass_cascade_struct* str_all_pass_cascade, WORD32 ch_idx,
|
||||||
WORD32 win_size,
|
WORD32 win_size, FLOAT32* input) {
|
||||||
FLOAT32* input)
|
|
||||||
{
|
|
||||||
WORD32 i;
|
WORD32 i;
|
||||||
|
|
||||||
for (i=0; i<str_all_pass_cascade->num_filter; i++)
|
for (i = 0; i < str_all_pass_cascade->num_filter; i++) {
|
||||||
{
|
impd_iir_second_order_filter_all_pass(
|
||||||
impd_iir_second_order_filter_all_pass (&(str_all_pass_cascade->str_all_pass_cascade_filter[i].str_all_pass_stage),
|
&(str_all_pass_cascade->str_all_pass_cascade_filter[i]
|
||||||
ch_idx,
|
.str_all_pass_stage),
|
||||||
win_size,
|
ch_idx, win_size, input, input);
|
||||||
input,
|
|
||||||
input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,7 @@ VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
|
||||||
ia_iir_filter_struct* pstr_lp_filt_coeff,
|
ia_iir_filter_struct* pstr_lp_filt_coeff,
|
||||||
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
||||||
ia_iir_filter_struct* pstr_ap_filt_coeff,
|
ia_iir_filter_struct* pstr_ap_filt_coeff,
|
||||||
WORD32 filter_type)
|
WORD32 filter_type) {
|
||||||
{
|
|
||||||
FLOAT32 gamma = normal_cross_freq[crossover_freq_idx].gamma;
|
FLOAT32 gamma = normal_cross_freq[crossover_freq_idx].gamma;
|
||||||
FLOAT32 delta = normal_cross_freq[crossover_freq_idx].delta;
|
FLOAT32 delta = normal_cross_freq[crossover_freq_idx].delta;
|
||||||
|
|
||||||
|
|
@ -55,8 +54,10 @@ VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
|
||||||
|
|
||||||
if (filter_type == 1 || filter_type == 2) {
|
if (filter_type == 1 || filter_type == 2) {
|
||||||
pstr_ap_filt_coeff->a0 = 1.0f;
|
pstr_ap_filt_coeff->a0 = 1.0f;
|
||||||
pstr_ap_filt_coeff->a1 = 2.0f * (gamma - delta);;
|
pstr_ap_filt_coeff->a1 = 2.0f * (gamma - delta);
|
||||||
pstr_ap_filt_coeff->a2 = 2.0f * (gamma + delta) - 1.0f;;
|
;
|
||||||
|
pstr_ap_filt_coeff->a2 = 2.0f * (gamma + delta) - 1.0f;
|
||||||
|
;
|
||||||
pstr_ap_filt_coeff->b0 = pstr_ap_filt_coeff->a2;
|
pstr_ap_filt_coeff->b0 = pstr_ap_filt_coeff->a2;
|
||||||
pstr_ap_filt_coeff->b1 = pstr_ap_filt_coeff->a1;
|
pstr_ap_filt_coeff->b1 = pstr_ap_filt_coeff->a1;
|
||||||
pstr_ap_filt_coeff->b2 = pstr_ap_filt_coeff->a0;
|
pstr_ap_filt_coeff->b2 = pstr_ap_filt_coeff->a0;
|
||||||
|
|
@ -67,38 +68,30 @@ VOID impd_compute_filt_coeff(WORD32 crossover_freq_idx,
|
||||||
|
|
||||||
WORD32 impd_initialize_filt_bank(WORD32 num_sub_bands,
|
WORD32 impd_initialize_filt_bank(WORD32 num_sub_bands,
|
||||||
ia_gain_params_struct* gain_params,
|
ia_gain_params_struct* gain_params,
|
||||||
ia_drc_filter_bank_struct* drc_filter_bank)
|
ia_drc_filter_bank_struct* drc_filter_bank) {
|
||||||
{
|
|
||||||
ia_two_band_filt_struct* str_two_band_bank;
|
ia_two_band_filt_struct* str_two_band_bank;
|
||||||
ia_three_band_filt_struct* str_three_band_bank;
|
ia_three_band_filt_struct* str_three_band_bank;
|
||||||
ia_four_band_filt_struct* str_four_band_bank;
|
ia_four_band_filt_struct* str_four_band_bank;
|
||||||
drc_filter_bank->complexity = 0;
|
drc_filter_bank->complexity = 0;
|
||||||
drc_filter_bank->num_bands = num_sub_bands;
|
drc_filter_bank->num_bands = num_sub_bands;
|
||||||
|
|
||||||
|
|
||||||
if (num_sub_bands == 1) {
|
if (num_sub_bands == 1) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else if (num_sub_bands == 2) {
|
||||||
else if(num_sub_bands==2){
|
|
||||||
str_two_band_bank = &drc_filter_bank->str_two_band_bank;
|
str_two_band_bank = &drc_filter_bank->str_two_band_bank;
|
||||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||||
&(str_two_band_bank->low_pass),
|
&(str_two_band_bank->low_pass),
|
||||||
&(str_two_band_bank->high_pass),
|
&(str_two_band_bank->high_pass), NULL, 0);
|
||||||
NULL,
|
} else if (num_sub_bands == 3) {
|
||||||
0);
|
|
||||||
}
|
|
||||||
else if(num_sub_bands==3){
|
|
||||||
str_three_band_bank = &drc_filter_bank->str_three_band_bank;
|
str_three_band_bank = &drc_filter_bank->str_three_band_bank;
|
||||||
|
|
||||||
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
impd_compute_filt_coeff(gain_params[1].crossover_freq_idx,
|
||||||
&(str_three_band_bank->str_low_pass_stage_2),
|
&(str_three_band_bank->str_low_pass_stage_2),
|
||||||
&(str_three_band_bank->str_high_pass_stage_2),
|
&(str_three_band_bank->str_high_pass_stage_2),
|
||||||
&(str_three_band_bank->str_all_pass_stage_2),
|
&(str_three_band_bank->str_all_pass_stage_2), 2);
|
||||||
2);
|
|
||||||
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
||||||
&(str_three_band_bank->str_low_pass_stage_1),
|
&(str_three_band_bank->str_low_pass_stage_1),
|
||||||
&(str_three_band_bank->str_high_pass_stage_1),
|
&(str_three_band_bank->str_high_pass_stage_1), NULL,
|
||||||
NULL,
|
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,82 +105,85 @@ WORD32 impd_initialize_filt_bank(WORD32 num_sub_bands,
|
||||||
2);
|
2);
|
||||||
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
impd_compute_filt_coeff(gain_params[2].crossover_freq_idx,
|
||||||
&(str_four_band_bank->str_low_pass_stage_1),
|
&(str_four_band_bank->str_low_pass_stage_1),
|
||||||
&(str_four_band_bank->str_high_pass_stage_1),
|
&(str_four_band_bank->str_high_pass_stage_1), NULL,
|
||||||
NULL,
|
|
||||||
0);
|
0);
|
||||||
impd_compute_filt_coeff(gain_params[3].crossover_freq_idx,
|
impd_compute_filt_coeff(gain_params[3].crossover_freq_idx,
|
||||||
&(str_four_band_bank->str_low_pass_stage_3_high),
|
&(str_four_band_bank->str_low_pass_stage_3_high),
|
||||||
&(str_four_band_bank->str_high_pass_stage_3_high),
|
&(str_four_band_bank->str_high_pass_stage_3_high),
|
||||||
&(str_four_band_bank->str_all_pass_stage_2_low),
|
&(str_four_band_bank->str_all_pass_stage_2_low), 2);
|
||||||
2);
|
} else {
|
||||||
}
|
|
||||||
else {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
WORD32 impd_init_all_filter_banks(
|
||||||
|
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||||
ia_filter_banks_struct* ia_filter_banks_struct)
|
ia_filter_banks_struct* ia_filter_banks_struct) {
|
||||||
{
|
|
||||||
WORD32 err_code = 0;
|
WORD32 err_code = 0;
|
||||||
WORD32 b, g, i, k, m, s , crossover_freq_idx, num_ch_in_groups, num_ph_align_ch_groups;
|
WORD32 b, g, i, k, m, s, crossover_freq_idx, num_ch_in_groups,
|
||||||
|
num_ph_align_ch_groups;
|
||||||
WORD32 match_found = 0, num_filter;
|
WORD32 match_found = 0, num_filter;
|
||||||
WORD32 cascade_cross_idx[CHANNEL_GROUP_COUNT_MAX+1][CHANNEL_GROUP_COUNT_MAX * 3];
|
WORD32 cascade_cross_idx[CHANNEL_GROUP_COUNT_MAX + 1]
|
||||||
|
[CHANNEL_GROUP_COUNT_MAX * 3];
|
||||||
WORD32 count[CHANNEL_GROUP_COUNT_MAX + 1];
|
WORD32 count[CHANNEL_GROUP_COUNT_MAX + 1];
|
||||||
|
|
||||||
num_ch_in_groups = 0;
|
num_ch_in_groups = 0;
|
||||||
num_ph_align_ch_groups = str_drc_instruction_str->num_drc_ch_groups;
|
num_ph_align_ch_groups = str_drc_instruction_str->num_drc_ch_groups;
|
||||||
|
|
||||||
|
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups; g++)
|
|
||||||
{
|
|
||||||
num_ch_in_groups += str_drc_instruction_str->num_chan_per_ch_group[g];
|
num_ch_in_groups += str_drc_instruction_str->num_chan_per_ch_group[g];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_ch_in_groups < str_drc_instruction_str->audio_num_chan)
|
if (num_ch_in_groups < str_drc_instruction_str->audio_num_chan) {
|
||||||
{
|
|
||||||
num_ph_align_ch_groups++;
|
num_ph_align_ch_groups++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ia_filter_banks_struct->nfilter_banks = str_drc_instruction_str->num_drc_ch_groups;
|
ia_filter_banks_struct->nfilter_banks =
|
||||||
|
str_drc_instruction_str->num_drc_ch_groups;
|
||||||
ia_filter_banks_struct->num_ph_align_ch_groups = num_ph_align_ch_groups;
|
ia_filter_banks_struct->num_ph_align_ch_groups = num_ph_align_ch_groups;
|
||||||
|
|
||||||
if (str_p_loc_drc_coefficients_uni_drc == NULL)
|
if (str_p_loc_drc_coefficients_uni_drc == NULL) {
|
||||||
{
|
|
||||||
ia_filter_banks_struct->str_drc_filter_bank->num_bands = 1;
|
ia_filter_banks_struct->str_drc_filter_bank->num_bands = 1;
|
||||||
}
|
} else {
|
||||||
else
|
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||||
{
|
err_code = impd_initialize_filt_bank(
|
||||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups; g++)
|
str_p_loc_drc_coefficients_uni_drc
|
||||||
{
|
->gain_set_params[str_drc_instruction_str
|
||||||
err_code = impd_initialize_filt_bank(str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].band_count,
|
->gain_set_index_for_channel_group[g]]
|
||||||
str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].gain_params,
|
.band_count,
|
||||||
|
str_p_loc_drc_coefficients_uni_drc
|
||||||
|
->gain_set_params[str_drc_instruction_str
|
||||||
|
->gain_set_index_for_channel_group[g]]
|
||||||
|
.gain_params,
|
||||||
&(ia_filter_banks_struct->str_drc_filter_bank[g]));
|
&(ia_filter_banks_struct->str_drc_filter_bank[g]));
|
||||||
if (err_code!=0)
|
if (err_code != 0) return (err_code);
|
||||||
return (err_code);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (g=0; g<CHANNEL_GROUP_COUNT_MAX + 1; g++)
|
for (g = 0; g < CHANNEL_GROUP_COUNT_MAX + 1; g++) {
|
||||||
{
|
|
||||||
count[g] = 0;
|
count[g] = 0;
|
||||||
}
|
}
|
||||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups; g++)
|
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||||
{
|
for (b = 1;
|
||||||
for (b=1; b<str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].band_count; b++)
|
b < str_p_loc_drc_coefficients_uni_drc
|
||||||
{
|
->gain_set_params[str_drc_instruction_str
|
||||||
crossover_freq_idx = str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].gain_params[b].crossover_freq_idx;
|
->gain_set_index_for_channel_group[g]]
|
||||||
for (k=0; k<num_ph_align_ch_groups; k++)
|
.band_count;
|
||||||
{
|
b++) {
|
||||||
if (k!=g)
|
crossover_freq_idx =
|
||||||
{
|
str_p_loc_drc_coefficients_uni_drc
|
||||||
|
->gain_set_params[str_drc_instruction_str
|
||||||
|
->gain_set_index_for_channel_group[g]]
|
||||||
|
.gain_params[b]
|
||||||
|
.crossover_freq_idx;
|
||||||
|
for (k = 0; k < num_ph_align_ch_groups; k++) {
|
||||||
|
if (k != g) {
|
||||||
cascade_cross_idx[k][count[k]] = crossover_freq_idx;
|
cascade_cross_idx[k][count[k]] = crossover_freq_idx;
|
||||||
count[k]++;
|
count[k]++;
|
||||||
if (count[k] > CHANNEL_GROUP_COUNT_MAX * 3)
|
if (count[k] > CHANNEL_GROUP_COUNT_MAX * 3) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -196,34 +192,24 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i<count[0])
|
while (i < count[0]) {
|
||||||
{
|
|
||||||
crossover_freq_idx = cascade_cross_idx[0][i];
|
crossover_freq_idx = cascade_cross_idx[0][i];
|
||||||
match_found = 0;
|
match_found = 0;
|
||||||
for (g=1; g<num_ph_align_ch_groups; g++)
|
for (g = 1; g < num_ph_align_ch_groups; g++) {
|
||||||
{
|
|
||||||
match_found = 0;
|
match_found = 0;
|
||||||
for (k=0; k<count[g]; k++)
|
for (k = 0; k < count[g]; k++) {
|
||||||
{
|
if (cascade_cross_idx[g][k] == crossover_freq_idx) {
|
||||||
if (cascade_cross_idx[g][k] == crossover_freq_idx)
|
|
||||||
{
|
|
||||||
match_found = 1;
|
match_found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (match_found == 0)
|
if (match_found == 0) break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (match_found == 1)
|
if (match_found == 1) {
|
||||||
{
|
for (g = 0; g < num_ph_align_ch_groups; g++) {
|
||||||
for (g=0; g<num_ph_align_ch_groups; g++)
|
for (m = 0; m < count[g]; m++) {
|
||||||
{
|
if (cascade_cross_idx[g][m] == crossover_freq_idx) {
|
||||||
for (m=0; m<count[g]; m++)
|
for (s = m + 1; s < count[g]; s++) {
|
||||||
{
|
|
||||||
if (cascade_cross_idx[g][m] == crossover_freq_idx)
|
|
||||||
{
|
|
||||||
for (s=m+1; s<count[g]; s++)
|
|
||||||
{
|
|
||||||
cascade_cross_idx[g][s - 1] = cascade_cross_idx[g][s];
|
cascade_cross_idx[g][s - 1] = cascade_cross_idx[g][s];
|
||||||
}
|
}
|
||||||
count[g]--;
|
count[g]--;
|
||||||
|
|
@ -232,41 +218,35 @@ WORD32 impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coeff
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (g=0; g<num_ph_align_ch_groups; g++)
|
for (g = 0; g < num_ph_align_ch_groups; g++) {
|
||||||
{
|
|
||||||
num_filter = count[g];
|
num_filter = count[g];
|
||||||
if (num_filter > 0) {
|
if (num_filter > 0) {
|
||||||
for (i = 0; i < num_filter; i++) {
|
for (i = 0; i < num_filter; i++) {
|
||||||
impd_compute_filt_coeff(cascade_cross_idx[g][i],
|
impd_compute_filt_coeff(
|
||||||
NULL,
|
cascade_cross_idx[g][i], NULL, NULL,
|
||||||
NULL,
|
&(ia_filter_banks_struct->str_drc_filter_bank[g]
|
||||||
&(ia_filter_banks_struct->str_drc_filter_bank[g].str_all_pass_cascade.str_all_pass_cascade_filter[i].str_all_pass_stage),
|
.str_all_pass_cascade.str_all_pass_cascade_filter[i]
|
||||||
|
.str_all_pass_stage),
|
||||||
1);
|
1);
|
||||||
}
|
}
|
||||||
ia_filter_banks_struct->str_drc_filter_bank[g].str_all_pass_cascade.num_filter = num_filter;
|
ia_filter_banks_struct->str_drc_filter_bank[g]
|
||||||
|
.str_all_pass_cascade.num_filter = num_filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err_code!=0)
|
if (err_code != 0) return (err_code);
|
||||||
return (err_code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID impd_iir_second_order_filter_all_pass(ia_iir_filter_struct* filter,
|
VOID impd_iir_second_order_filter_all_pass(ia_iir_filter_struct* filter,
|
||||||
WORD32 chan_idx,
|
WORD32 chan_idx, WORD32 frame_len,
|
||||||
WORD32 frame_len,
|
FLOAT32* input, FLOAT32* output) {
|
||||||
FLOAT32* input,
|
|
||||||
FLOAT32* output)
|
|
||||||
{
|
|
||||||
WORD32 i;
|
WORD32 i;
|
||||||
FLOAT32 tmp;
|
FLOAT32 tmp;
|
||||||
FLOAT32 a1 = filter->a1;
|
FLOAT32 a1 = filter->a1;
|
||||||
|
|
@ -278,8 +258,7 @@ VOID impd_iir_second_order_filter_all_pass(ia_iir_filter_struct* filter,
|
||||||
FLOAT32 st1 = filter->x_p[chan_idx * 2];
|
FLOAT32 st1 = filter->x_p[chan_idx * 2];
|
||||||
FLOAT32 st2 = filter->y_p[chan_idx * 2];
|
FLOAT32 st2 = filter->y_p[chan_idx * 2];
|
||||||
|
|
||||||
for (i=0; i<frame_len; i++)
|
for (i = 0; i < frame_len; i++) {
|
||||||
{
|
|
||||||
tmp = input[i];
|
tmp = input[i];
|
||||||
output[i] = b0 * tmp + st1;
|
output[i] = b0 * tmp + st1;
|
||||||
st1 = b1 * tmp - a1 * output[i] + st2;
|
st1 = b1 * tmp - a1 * output[i] + st2;
|
||||||
|
|
@ -293,11 +272,8 @@ VOID impd_iir_second_order_filter_all_pass(ia_iir_filter_struct* filter,
|
||||||
|
|
||||||
VOID impd_apply_low_high_filter(ia_iir_filter_struct* pstr_lp_filt_coeff,
|
VOID impd_apply_low_high_filter(ia_iir_filter_struct* pstr_lp_filt_coeff,
|
||||||
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
ia_iir_filter_struct* pstr_hp_filt_coeff,
|
||||||
WORD32 chan_idx,
|
WORD32 chan_idx, WORD32 frame_len,
|
||||||
WORD32 frame_len,
|
FLOAT32* input, FLOAT32* output[]) {
|
||||||
FLOAT32* input,
|
|
||||||
FLOAT32* output[])
|
|
||||||
{
|
|
||||||
WORD32 i;
|
WORD32 i;
|
||||||
FLOAT32 tmp, tmp1;
|
FLOAT32 tmp, tmp1;
|
||||||
FLOAT32 a1_l = pstr_lp_filt_coeff->a1;
|
FLOAT32 a1_l = pstr_lp_filt_coeff->a1;
|
||||||
|
|
@ -325,8 +301,7 @@ VOID impd_apply_low_high_filter(ia_iir_filter_struct* pstr_lp_filt_coeff,
|
||||||
FLOAT32* output_low = output[0];
|
FLOAT32* output_low = output[0];
|
||||||
FLOAT32* output_high = output[1];
|
FLOAT32* output_high = output[1];
|
||||||
|
|
||||||
for (i=0; i<frame_len; i++)
|
for (i = 0; i < frame_len; i++) {
|
||||||
{
|
|
||||||
tmp1 = input[i];
|
tmp1 = input[i];
|
||||||
tmp = b0_l * tmp1 + st1_l;
|
tmp = b0_l * tmp1 + st1_l;
|
||||||
st1_l = b1_l * tmp1 - a1_l * tmp + st2_l;
|
st1_l = b1_l * tmp1 - a1_l * tmp + st2_l;
|
||||||
|
|
@ -357,79 +332,54 @@ VOID impd_apply_low_high_filter(ia_iir_filter_struct* pstr_lp_filt_coeff,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VOID impd_two_band_filter_process(ia_two_band_filt_struct* str_two_band_bank,
|
VOID impd_two_band_filter_process(ia_two_band_filt_struct* str_two_band_bank,
|
||||||
WORD32 chan_idx,
|
WORD32 chan_idx, WORD32 frame_len,
|
||||||
WORD32 frame_len,
|
FLOAT32* input, FLOAT32* output[]) {
|
||||||
FLOAT32* input,
|
|
||||||
FLOAT32* output[])
|
|
||||||
{
|
|
||||||
ia_iir_filter_struct* pstr_lp_filt_coeff = &str_two_band_bank->low_pass;
|
ia_iir_filter_struct* pstr_lp_filt_coeff = &str_two_band_bank->low_pass;
|
||||||
ia_iir_filter_struct* pstr_hp_filt_coeff = &str_two_band_bank->high_pass;
|
ia_iir_filter_struct* pstr_hp_filt_coeff = &str_two_band_bank->high_pass;
|
||||||
|
|
||||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, chan_idx,
|
||||||
pstr_hp_filt_coeff,
|
frame_len, input, output);
|
||||||
chan_idx,
|
|
||||||
frame_len,
|
|
||||||
input,
|
|
||||||
output);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID impd_three_band_filter_process(
|
||||||
|
ia_three_band_filt_struct* str_three_band_bank, WORD32 c, WORD32 size,
|
||||||
VOID impd_three_band_filter_process(ia_three_band_filt_struct* str_three_band_bank,
|
FLOAT32* input, FLOAT32* output[]) {
|
||||||
WORD32 c,
|
|
||||||
WORD32 size,
|
|
||||||
FLOAT32* input,
|
|
||||||
FLOAT32* output[])
|
|
||||||
{
|
|
||||||
// WORD32 err_code=0;
|
// WORD32 err_code=0;
|
||||||
ia_iir_filter_struct* all_pass_filter;
|
ia_iir_filter_struct* all_pass_filter;
|
||||||
ia_iir_filter_struct* pstr_lp_filt_coeff=&str_three_band_bank->str_low_pass_stage_1;
|
ia_iir_filter_struct* pstr_lp_filt_coeff =
|
||||||
ia_iir_filter_struct* pstr_hp_filt_coeff=&str_three_band_bank->str_high_pass_stage_1;
|
&str_three_band_bank->str_low_pass_stage_1;
|
||||||
|
ia_iir_filter_struct* pstr_hp_filt_coeff =
|
||||||
|
&str_three_band_bank->str_high_pass_stage_1;
|
||||||
FLOAT32* output1[2];
|
FLOAT32* output1[2];
|
||||||
output1[0] = output[0];
|
output1[0] = output[0];
|
||||||
output1[1] = output[1];
|
output1[1] = output[1];
|
||||||
|
|
||||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, c, size,
|
||||||
pstr_hp_filt_coeff,
|
input, output1);
|
||||||
c,
|
|
||||||
size,
|
|
||||||
input,
|
|
||||||
output1);
|
|
||||||
|
|
||||||
all_pass_filter = &str_three_band_bank->str_all_pass_stage_2;
|
all_pass_filter = &str_three_band_bank->str_all_pass_stage_2;
|
||||||
|
|
||||||
impd_iir_second_order_filter_all_pass(all_pass_filter,
|
impd_iir_second_order_filter_all_pass(all_pass_filter, c, size, output1[1],
|
||||||
c,
|
|
||||||
size,
|
|
||||||
output1[1],
|
|
||||||
output[2]);
|
output[2]);
|
||||||
pstr_lp_filt_coeff = &str_three_band_bank->str_low_pass_stage_2;
|
pstr_lp_filt_coeff = &str_three_band_bank->str_low_pass_stage_2;
|
||||||
pstr_hp_filt_coeff = &str_three_band_bank->str_high_pass_stage_2;
|
pstr_hp_filt_coeff = &str_three_band_bank->str_high_pass_stage_2;
|
||||||
|
|
||||||
|
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, c, size,
|
||||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
output1[0], output1);
|
||||||
pstr_hp_filt_coeff,
|
|
||||||
c,
|
|
||||||
size,
|
|
||||||
output1[0],
|
|
||||||
output1);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID impd_four_band_filter_process(ia_four_band_filt_struct* str_four_band_bank,
|
VOID impd_four_band_filter_process(ia_four_band_filt_struct* str_four_band_bank,
|
||||||
WORD32 cha_idx,
|
WORD32 cha_idx, WORD32 win_size,
|
||||||
WORD32 win_size,
|
FLOAT32* input, FLOAT32* output[]) {
|
||||||
FLOAT32* input,
|
|
||||||
FLOAT32* output[])
|
|
||||||
{
|
|
||||||
// WORD32 err_code=0;
|
// WORD32 err_code=0;
|
||||||
ia_iir_filter_struct* all_pass_filter;
|
ia_iir_filter_struct* all_pass_filter;
|
||||||
ia_iir_filter_struct* pstr_lp_filt_coeff=&str_four_band_bank->str_low_pass_stage_1;
|
ia_iir_filter_struct* pstr_lp_filt_coeff =
|
||||||
ia_iir_filter_struct* pstr_hp_filt_coeff=&str_four_band_bank->str_high_pass_stage_1;
|
&str_four_band_bank->str_low_pass_stage_1;
|
||||||
|
ia_iir_filter_struct* pstr_hp_filt_coeff =
|
||||||
|
&str_four_band_bank->str_high_pass_stage_1;
|
||||||
FLOAT32* output1[2];
|
FLOAT32* output1[2];
|
||||||
FLOAT32* output2[2];
|
FLOAT32* output2[2];
|
||||||
output1[0] = output[0];
|
output1[0] = output[0];
|
||||||
|
|
@ -437,68 +387,44 @@ VOID impd_four_band_filter_process(ia_four_band_filt_struct* str_four_band_bank,
|
||||||
output2[0] = output[2];
|
output2[0] = output[2];
|
||||||
output2[1] = output[3];
|
output2[1] = output[3];
|
||||||
|
|
||||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, cha_idx,
|
||||||
pstr_hp_filt_coeff,
|
win_size, input, output1);
|
||||||
cha_idx,
|
|
||||||
win_size,
|
|
||||||
input,
|
|
||||||
output1);
|
|
||||||
|
|
||||||
all_pass_filter = &str_four_band_bank->str_all_pass_stage_2_low;
|
all_pass_filter = &str_four_band_bank->str_all_pass_stage_2_low;
|
||||||
|
|
||||||
impd_iir_second_order_filter_all_pass(all_pass_filter,
|
impd_iir_second_order_filter_all_pass(all_pass_filter, cha_idx, win_size,
|
||||||
cha_idx,
|
output1[0], output1[0]);
|
||||||
win_size,
|
|
||||||
output1[0],
|
|
||||||
output1[0]);
|
|
||||||
|
|
||||||
|
|
||||||
all_pass_filter = &str_four_band_bank->str_all_pass_stage_2_high;
|
all_pass_filter = &str_four_band_bank->str_all_pass_stage_2_high;
|
||||||
|
|
||||||
impd_iir_second_order_filter_all_pass(all_pass_filter,
|
impd_iir_second_order_filter_all_pass(all_pass_filter, cha_idx, win_size,
|
||||||
cha_idx,
|
output1[1], output2[0]);
|
||||||
win_size,
|
|
||||||
output1[1],
|
|
||||||
output2[0]);
|
|
||||||
|
|
||||||
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_low;
|
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_low;
|
||||||
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_low;
|
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_low;
|
||||||
|
|
||||||
|
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, cha_idx,
|
||||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
win_size, output1[0], output1);
|
||||||
pstr_hp_filt_coeff,
|
|
||||||
cha_idx,
|
|
||||||
win_size,
|
|
||||||
output1[0],
|
|
||||||
output1);
|
|
||||||
|
|
||||||
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_high;
|
pstr_lp_filt_coeff = &str_four_band_bank->str_low_pass_stage_3_high;
|
||||||
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_high;
|
pstr_hp_filt_coeff = &str_four_band_bank->str_high_pass_stage_3_high;
|
||||||
|
|
||||||
impd_apply_low_high_filter(pstr_lp_filt_coeff,
|
impd_apply_low_high_filter(pstr_lp_filt_coeff, pstr_hp_filt_coeff, cha_idx,
|
||||||
pstr_hp_filt_coeff,
|
win_size, output2[0], output2);
|
||||||
cha_idx,
|
|
||||||
win_size,
|
|
||||||
output2[0],
|
|
||||||
output2);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID impd_all_pass_cascade_process(ia_all_pass_cascade_struct *str_all_pass_cascade,
|
VOID impd_all_pass_cascade_process(
|
||||||
WORD32 ch_idx,
|
ia_all_pass_cascade_struct* str_all_pass_cascade, WORD32 ch_idx,
|
||||||
WORD32 win_size,
|
WORD32 win_size, FLOAT32* input) {
|
||||||
FLOAT32* input)
|
|
||||||
{
|
|
||||||
WORD32 i;
|
WORD32 i;
|
||||||
|
|
||||||
for (i=0; i<str_all_pass_cascade->num_filter; i++)
|
for (i = 0; i < str_all_pass_cascade->num_filter; i++) {
|
||||||
{
|
impd_iir_second_order_filter_all_pass(
|
||||||
impd_iir_second_order_filter_all_pass (&(str_all_pass_cascade->str_all_pass_cascade_filter[i].str_all_pass_stage),
|
&(str_all_pass_cascade->str_all_pass_cascade_filter[i]
|
||||||
ch_idx,
|
.str_all_pass_stage),
|
||||||
win_size,
|
ch_idx, win_size, input, input);
|
||||||
input,
|
|
||||||
input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,7 @@
|
||||||
#define QMF_NUM_FILT_BANDS 64
|
#define QMF_NUM_FILT_BANDS 64
|
||||||
#define QMF_FILT_RESOLUTION 64
|
#define QMF_FILT_RESOLUTION 64
|
||||||
|
|
||||||
|
typedef struct ia_drc_qmf_filt_struct {
|
||||||
typedef struct ia_drc_qmf_filt_struct
|
|
||||||
{
|
|
||||||
|
|
||||||
FLOAT64* ana_buff;
|
FLOAT64* ana_buff;
|
||||||
FLOAT64* syn_buff;
|
FLOAT64* syn_buff;
|
||||||
FLOAT64 ana_tab_real[QMF_NUM_FILT_BANDS][2 * QMF_NUM_FILT_BANDS];
|
FLOAT64 ana_tab_real[QMF_NUM_FILT_BANDS][2 * QMF_NUM_FILT_BANDS];
|
||||||
|
|
@ -44,7 +41,6 @@ typedef struct {
|
||||||
FLOAT32 delta;
|
FLOAT32 delta;
|
||||||
} ia_filter_bank_params_struct;
|
} ia_filter_bank_params_struct;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
FLOAT32 s00;
|
FLOAT32 s00;
|
||||||
FLOAT32 s01;
|
FLOAT32 s01;
|
||||||
|
|
@ -52,7 +48,6 @@ typedef struct {
|
||||||
FLOAT32 s11;
|
FLOAT32 s11;
|
||||||
} ia_lr_filter_state_struct;
|
} ia_lr_filter_state_struct;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
FLOAT32 s0;
|
FLOAT32 s0;
|
||||||
FLOAT32 s1;
|
FLOAT32 s1;
|
||||||
|
|
@ -97,7 +92,8 @@ typedef struct {
|
||||||
} ia_all_pass_filter_sturct;
|
} ia_all_pass_filter_sturct;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ia_all_pass_filter_sturct str_all_pass_cascade_filter[CASCADE_ALLPASS_COUNT_MAX];
|
ia_all_pass_filter_sturct
|
||||||
|
str_all_pass_cascade_filter[CASCADE_ALLPASS_COUNT_MAX];
|
||||||
WORD32 num_filter;
|
WORD32 num_filter;
|
||||||
} ia_all_pass_cascade_struct;
|
} ia_all_pass_cascade_struct;
|
||||||
|
|
||||||
|
|
@ -117,49 +113,38 @@ typedef struct {
|
||||||
ia_drc_filter_bank_struct str_drc_filter_bank[8];
|
ia_drc_filter_bank_struct str_drc_filter_bank[8];
|
||||||
} ia_filter_banks_struct;
|
} ia_filter_banks_struct;
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_init_all_filter_banks( ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
impd_init_all_filter_banks(
|
||||||
|
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||||
ia_filter_banks_struct* ia_filter_banks_struct);
|
ia_filter_banks_struct* ia_filter_banks_struct);
|
||||||
|
|
||||||
VOID impd_two_band_filter_process(ia_two_band_filt_struct* str_two_band_bank,
|
VOID impd_two_band_filter_process(ia_two_band_filt_struct* str_two_band_bank,
|
||||||
WORD32 c,
|
WORD32 c, WORD32 size, FLOAT32* audio_in,
|
||||||
WORD32 size,
|
|
||||||
FLOAT32* audio_in,
|
|
||||||
FLOAT32* audio_out[]);
|
FLOAT32* audio_out[]);
|
||||||
|
|
||||||
VOID impd_three_band_filter_process(ia_three_band_filt_struct* str_three_band_bank,
|
VOID impd_three_band_filter_process(
|
||||||
WORD32 c,
|
ia_three_band_filt_struct* str_three_band_bank, WORD32 c, WORD32 size,
|
||||||
WORD32 size,
|
FLOAT32* audio_in, FLOAT32* audio_out[]);
|
||||||
FLOAT32* audio_in,
|
|
||||||
FLOAT32* audio_out[]);
|
|
||||||
|
|
||||||
VOID impd_four_band_filter_process(ia_four_band_filt_struct* str_four_band_bank,
|
VOID impd_four_band_filter_process(ia_four_band_filt_struct* str_four_band_bank,
|
||||||
WORD32 c,
|
WORD32 c, WORD32 size, FLOAT32* audio_in,
|
||||||
WORD32 size,
|
|
||||||
FLOAT32* audio_in,
|
|
||||||
FLOAT32* audio_out[]);
|
FLOAT32* audio_out[]);
|
||||||
|
|
||||||
VOID impd_all_pass_cascade_process(ia_all_pass_cascade_struct *str_all_pass_cascade,
|
VOID impd_all_pass_cascade_process(
|
||||||
WORD32 c,
|
ia_all_pass_cascade_struct* str_all_pass_cascade, WORD32 c, WORD32 size,
|
||||||
WORD32 size,
|
|
||||||
FLOAT32* audio_in);
|
FLOAT32* audio_in);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_shape_filt_block_init(ia_shape_filter_block_params_struct* pstr_shape_filter_block_params,
|
impd_shape_filt_block_init(
|
||||||
|
ia_shape_filter_block_params_struct* pstr_shape_filter_block_params,
|
||||||
shape_filter_block* shape_filter_block);
|
shape_filter_block* shape_filter_block);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_shape_filt_block_adapt(const FLOAT32 drc_gain,
|
impd_shape_filt_block_adapt(const FLOAT32 drc_gain,
|
||||||
shape_filter_block* shape_filter_block);
|
shape_filter_block* shape_filter_block);
|
||||||
|
|
||||||
|
WORD32 impd_shape_filt_block_time_process(
|
||||||
|
shape_filter_block* shape_filter_block, FLOAT32* drc_gain,
|
||||||
WORD32 impd_shape_filt_block_time_process(shape_filter_block* shape_filter_block,
|
const WORD32 channel, FLOAT32* audio_in, WORD32 start, WORD32 end);
|
||||||
FLOAT32* drc_gain,
|
|
||||||
const WORD32 channel,
|
|
||||||
FLOAT32 *audio_in,
|
|
||||||
WORD32 start,
|
|
||||||
WORD32 end);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -34,56 +34,59 @@
|
||||||
#include "impd_drc_eq.h"
|
#include "impd_drc_eq.h"
|
||||||
#include "impd_drc_gain_decoder.h"
|
#include "impd_drc_gain_decoder.h"
|
||||||
|
|
||||||
extern ia_cicp_sigmoid_characteristic_param_struct pstr_cicp_sigmoid_characteristic_param[];
|
extern ia_cicp_sigmoid_characteristic_param_struct
|
||||||
|
pstr_cicp_sigmoid_characteristic_param[];
|
||||||
|
|
||||||
WORD32 impd_gain_db_to_lin(ia_interp_params_struct* interp_params_str,
|
WORD32 impd_gain_db_to_lin(ia_interp_params_struct* interp_params_str,
|
||||||
WORD32 drc_band,
|
WORD32 drc_band, FLOAT32 in_param_db_gain,
|
||||||
FLOAT32 in_param_db_gain,
|
|
||||||
FLOAT32 in_param_db_slope,
|
FLOAT32 in_param_db_slope,
|
||||||
FLOAT32* out_param_lin_gain,
|
FLOAT32* out_param_lin_gain,
|
||||||
FLOAT32* out_param_lin_slope)
|
FLOAT32* out_param_lin_slope) {
|
||||||
{
|
|
||||||
|
|
||||||
FLOAT32 loc_db_gain = in_param_db_gain;
|
FLOAT32 loc_db_gain = in_param_db_gain;
|
||||||
FLOAT32 gain_ratio = 1.0;
|
FLOAT32 gain_ratio = 1.0;
|
||||||
|
|
||||||
ia_gain_modifiers_struct* pstr_gain_modifiers = interp_params_str->pstr_gain_modifiers;
|
ia_gain_modifiers_struct* pstr_gain_modifiers =
|
||||||
|
interp_params_str->pstr_gain_modifiers;
|
||||||
if (interp_params_str->gain_modification_flag) {
|
if (interp_params_str->gain_modification_flag) {
|
||||||
|
if ((interp_params_str->characteristic_index > 0) &&
|
||||||
if ((interp_params_str->characteristic_index > 0) && (loc_db_gain != 0.0f)){
|
(loc_db_gain != 0.0f)) {
|
||||||
|
|
||||||
gain_ratio = 1.0f;
|
gain_ratio = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (loc_db_gain < 0.0f) {
|
if (loc_db_gain < 0.0f) {
|
||||||
gain_ratio *= interp_params_str->compress;
|
gain_ratio *= interp_params_str->compress;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
gain_ratio *= interp_params_str->boost;
|
gain_ratio *= interp_params_str->boost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pstr_gain_modifiers->gain_scaling_flag[drc_band] == 1) {
|
if (pstr_gain_modifiers->gain_scaling_flag[drc_band] == 1) {
|
||||||
if (loc_db_gain < 0.0) {
|
if (loc_db_gain < 0.0) {
|
||||||
gain_ratio *= pstr_gain_modifiers->attn_scaling[drc_band];
|
gain_ratio *= pstr_gain_modifiers->attn_scaling[drc_band];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
gain_ratio *= pstr_gain_modifiers->ampl_scaling[drc_band];
|
gain_ratio *= pstr_gain_modifiers->ampl_scaling[drc_band];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((interp_params_str->pstr_ducking_modifiers->ducking_scaling_flag == 1) && (interp_params_str->ducking_flag == 1)) {
|
if ((interp_params_str->pstr_ducking_modifiers->ducking_scaling_flag == 1) &&
|
||||||
|
(interp_params_str->ducking_flag == 1)) {
|
||||||
gain_ratio *= interp_params_str->pstr_ducking_modifiers->ducking_scaling;
|
gain_ratio *= interp_params_str->pstr_ducking_modifiers->ducking_scaling;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
*out_param_lin_gain = (FLOAT32)pow(2.0, (FLOAT64)(gain_ratio * loc_db_gain / 6.0f));
|
*out_param_lin_gain =
|
||||||
*out_param_lin_slope = SLOPE_FACTOR_DB_TO_LINEAR * gain_ratio * *out_param_lin_gain * in_param_db_slope;
|
(FLOAT32)pow(2.0, (FLOAT64)(gain_ratio * loc_db_gain / 6.0f));
|
||||||
|
*out_param_lin_slope = SLOPE_FACTOR_DB_TO_LINEAR * gain_ratio *
|
||||||
|
*out_param_lin_gain * in_param_db_slope;
|
||||||
|
|
||||||
if (pstr_gain_modifiers->gain_offset_flag[drc_band] == 1) {
|
if (pstr_gain_modifiers->gain_offset_flag[drc_band] == 1) {
|
||||||
*out_param_lin_gain *= (FLOAT32)pow(2.0, (FLOAT64)(pstr_gain_modifiers->gain_offset[drc_band]/6.0f));
|
*out_param_lin_gain *= (FLOAT32)pow(
|
||||||
|
2.0, (FLOAT64)(pstr_gain_modifiers->gain_offset[drc_band] / 6.0f));
|
||||||
}
|
}
|
||||||
if ((interp_params_str->limiter_peak_target_present == 1) && (interp_params_str->clipping_flag == 1)) {
|
if ((interp_params_str->limiter_peak_target_present == 1) &&
|
||||||
*out_param_lin_gain *= (FLOAT32)pow(2.0, max(0.0, -interp_params_str->limiter_peak_target - interp_params_str->loudness_normalization_gain_db)/6.0);
|
(interp_params_str->clipping_flag == 1)) {
|
||||||
|
*out_param_lin_gain *= (FLOAT32)pow(
|
||||||
|
2.0, max(0.0, -interp_params_str->limiter_peak_target -
|
||||||
|
interp_params_str->loudness_normalization_gain_db) /
|
||||||
|
6.0);
|
||||||
if (*out_param_lin_gain >= 1.0) {
|
if (*out_param_lin_gain >= 1.0) {
|
||||||
*out_param_lin_gain = 1.0;
|
*out_param_lin_gain = 1.0;
|
||||||
*out_param_lin_slope = 0.0;
|
*out_param_lin_slope = 0.0;
|
||||||
|
|
@ -93,17 +96,10 @@ WORD32 impd_gain_db_to_lin (ia_interp_params_struct* interp_params_str,
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_compressor_io_sigmoid(ia_split_drc_characteristic_struct* split_drc_characteristic,
|
impd_compressor_io_sigmoid(
|
||||||
FLOAT32 in_db_level,
|
ia_split_drc_characteristic_struct* split_drc_characteristic,
|
||||||
FLOAT32* out_db_gain)
|
FLOAT32 in_db_level, FLOAT32* out_db_gain) {
|
||||||
{
|
|
||||||
FLOAT32 tmp;
|
FLOAT32 tmp;
|
||||||
FLOAT32 in_out_ratio = split_drc_characteristic->in_out_ratio;
|
FLOAT32 in_out_ratio = split_drc_characteristic->in_out_ratio;
|
||||||
FLOAT32 gainDbLimit = split_drc_characteristic->gain;
|
FLOAT32 gainDbLimit = split_drc_characteristic->gain;
|
||||||
|
|
@ -112,8 +108,7 @@ impd_compressor_io_sigmoid(ia_split_drc_characteristic_struct* split_drc_charact
|
||||||
tmp = (DRC_INPUT_LOUDNESS_TARGET - in_db_level) * in_out_ratio;
|
tmp = (DRC_INPUT_LOUDNESS_TARGET - in_db_level) * in_out_ratio;
|
||||||
if (exp < 1000.0f) {
|
if (exp < 1000.0f) {
|
||||||
FLOAT32 x = tmp / gainDbLimit;
|
FLOAT32 x = tmp / gainDbLimit;
|
||||||
if (x < 0.0f)
|
if (x < 0.0f) {
|
||||||
{
|
|
||||||
return (UNEXPECTED_ERROR);
|
return (UNEXPECTED_ERROR);
|
||||||
}
|
}
|
||||||
*out_db_gain = (FLOAT32)(tmp / pow(1.0f + pow(x, exp), 1.0f / exp));
|
*out_db_gain = (FLOAT32)(tmp / pow(1.0f + pow(x, exp), 1.0f / exp));
|
||||||
|
|
@ -127,10 +122,9 @@ impd_compressor_io_sigmoid(ia_split_drc_characteristic_struct* split_drc_charact
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_compressor_io_sigmoid_inv(ia_split_drc_characteristic_struct* split_drc_characteristic,
|
impd_compressor_io_sigmoid_inv(
|
||||||
FLOAT32 loc_db_gain,
|
ia_split_drc_characteristic_struct* split_drc_characteristic,
|
||||||
FLOAT32* in_level)
|
FLOAT32 loc_db_gain, FLOAT32* in_level) {
|
||||||
{
|
|
||||||
FLOAT32 in_out_ratio = split_drc_characteristic->in_out_ratio;
|
FLOAT32 in_out_ratio = split_drc_characteristic->in_out_ratio;
|
||||||
FLOAT32 gainDbLimit = split_drc_characteristic->gain;
|
FLOAT32 gainDbLimit = split_drc_characteristic->gain;
|
||||||
FLOAT32 exp = split_drc_characteristic->exp;
|
FLOAT32 exp = split_drc_characteristic->exp;
|
||||||
|
|
@ -141,8 +135,7 @@ impd_compressor_io_sigmoid_inv(ia_split_drc_characteristic_struct* split_drc_cha
|
||||||
}
|
}
|
||||||
if (exp < 1000.0f) {
|
if (exp < 1000.0f) {
|
||||||
FLOAT32 x = tmp / gainDbLimit;
|
FLOAT32 x = tmp / gainDbLimit;
|
||||||
if (x < 0.0f)
|
if (x < 0.0f) {
|
||||||
{
|
|
||||||
return (UNEXPECTED_ERROR);
|
return (UNEXPECTED_ERROR);
|
||||||
}
|
}
|
||||||
tmp = (FLOAT32)(tmp / pow(1.0f - pow(x, exp), 1.0f / exp));
|
tmp = (FLOAT32)(tmp / pow(1.0f - pow(x, exp), 1.0f / exp));
|
||||||
|
|
@ -153,17 +146,15 @@ impd_compressor_io_sigmoid_inv(ia_split_drc_characteristic_struct* split_drc_cha
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_compressor_io_nodes_lt(ia_split_drc_characteristic_struct* split_drc_characteristic,
|
impd_compressor_io_nodes_lt(
|
||||||
FLOAT32 in_db_level,
|
ia_split_drc_characteristic_struct* split_drc_characteristic,
|
||||||
FLOAT32 *out_db_gain)
|
FLOAT32 in_db_level, FLOAT32* out_db_gain) {
|
||||||
{
|
|
||||||
WORD32 n;
|
WORD32 n;
|
||||||
FLOAT32 w;
|
FLOAT32 w;
|
||||||
FLOAT32* node_level = split_drc_characteristic->node_level;
|
FLOAT32* node_level = split_drc_characteristic->node_level;
|
||||||
FLOAT32* node_gain = split_drc_characteristic->node_gain;
|
FLOAT32* node_gain = split_drc_characteristic->node_gain;
|
||||||
|
|
||||||
if (in_db_level > DRC_INPUT_LOUDNESS_TARGET)
|
if (in_db_level > DRC_INPUT_LOUDNESS_TARGET) {
|
||||||
{
|
|
||||||
return (UNEXPECTED_ERROR);
|
return (UNEXPECTED_ERROR);
|
||||||
}
|
}
|
||||||
for (n = 1; n <= split_drc_characteristic->characteristic_node_count; n++) {
|
for (n = 1; n <= split_drc_characteristic->characteristic_node_count; n++) {
|
||||||
|
|
@ -177,35 +168,33 @@ impd_compressor_io_nodes_lt(ia_split_drc_characteristic_struct* split_drc_charac
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_compressor_io_nodes_rt(ia_split_drc_characteristic_struct* split_drc_characteristic,
|
impd_compressor_io_nodes_rt(
|
||||||
FLOAT32 in_db_level,
|
ia_split_drc_characteristic_struct* split_drc_characteristic,
|
||||||
FLOAT32 *out_db_gain)
|
FLOAT32 in_db_level, FLOAT32* out_db_gain) {
|
||||||
{
|
|
||||||
WORD32 n;
|
WORD32 n;
|
||||||
FLOAT32 w;
|
FLOAT32 w;
|
||||||
FLOAT32* node_level = split_drc_characteristic->node_level;
|
FLOAT32* node_level = split_drc_characteristic->node_level;
|
||||||
FLOAT32* node_gain = split_drc_characteristic->node_gain;
|
FLOAT32* node_gain = split_drc_characteristic->node_gain;
|
||||||
|
|
||||||
if (in_db_level < DRC_INPUT_LOUDNESS_TARGET)
|
if (in_db_level < DRC_INPUT_LOUDNESS_TARGET) {
|
||||||
{
|
|
||||||
return (UNEXPECTED_ERROR);
|
return (UNEXPECTED_ERROR);
|
||||||
}
|
}
|
||||||
for (n = 1; n <= split_drc_characteristic->characteristic_node_count; n++) {
|
for (n = 1; n <= split_drc_characteristic->characteristic_node_count; n++) {
|
||||||
if ((in_db_level >= node_level[n - 1]) && (in_db_level < node_level[n])) {
|
if ((in_db_level >= node_level[n - 1]) && (in_db_level < node_level[n])) {
|
||||||
w =(FLOAT32) (node_level[n]- in_db_level)/(node_level[n]-node_level[n-1]);
|
w = (FLOAT32)(node_level[n] - in_db_level) /
|
||||||
|
(node_level[n] - node_level[n - 1]);
|
||||||
*out_db_gain = (FLOAT32)(w * node_gain[n - 1] + (1.0 - w) * node_gain[n]);
|
*out_db_gain = (FLOAT32)(w * node_gain[n - 1] + (1.0 - w) * node_gain[n]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*out_db_gain = (node_gain[split_drc_characteristic->characteristic_node_count]);
|
*out_db_gain =
|
||||||
|
(node_gain[split_drc_characteristic->characteristic_node_count]);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_compressor_io_nodes_inverse(ia_split_drc_characteristic_struct* split_drc_characteristic,
|
impd_compressor_io_nodes_inverse(
|
||||||
FLOAT32 loc_db_gain,
|
ia_split_drc_characteristic_struct* split_drc_characteristic,
|
||||||
FLOAT32 *in_level)
|
FLOAT32 loc_db_gain, FLOAT32* in_level) {
|
||||||
{
|
|
||||||
WORD32 n;
|
WORD32 n;
|
||||||
FLOAT32 w;
|
FLOAT32 w;
|
||||||
FLOAT32* node_level = split_drc_characteristic->node_level;
|
FLOAT32* node_level = split_drc_characteristic->node_level;
|
||||||
|
|
@ -215,34 +204,35 @@ impd_compressor_io_nodes_inverse(ia_split_drc_characteristic_struct* split_drc_c
|
||||||
if (node_gain[1] < 0.0f) {
|
if (node_gain[1] < 0.0f) {
|
||||||
if (loc_db_gain <= node_gain[node_count]) {
|
if (loc_db_gain <= node_gain[node_count]) {
|
||||||
*in_level = node_level[node_count];
|
*in_level = node_level[node_count];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (loc_db_gain >= 0.0f) {
|
if (loc_db_gain >= 0.0f) {
|
||||||
*in_level = DRC_INPUT_LOUDNESS_TARGET;
|
*in_level = DRC_INPUT_LOUDNESS_TARGET;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
for (n = 1; n <= node_count; n++) {
|
for (n = 1; n <= node_count; n++) {
|
||||||
if ((loc_db_gain <= node_gain[n-1]) && (loc_db_gain > node_gain[n])) {
|
if ((loc_db_gain <= node_gain[n - 1]) &&
|
||||||
w = (node_gain[n]-loc_db_gain)/(node_gain[n]-node_gain[n-1]);
|
(loc_db_gain > node_gain[n])) {
|
||||||
*in_level =(FLOAT32) (w * node_level[n-1] + (1.0-w) * node_level[n]);
|
w = (node_gain[n] - loc_db_gain) /
|
||||||
|
(node_gain[n] - node_gain[n - 1]);
|
||||||
|
*in_level =
|
||||||
|
(FLOAT32)(w * node_level[n - 1] + (1.0 - w) * node_level[n]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (loc_db_gain >= node_gain[node_count]) {
|
if (loc_db_gain >= node_gain[node_count]) {
|
||||||
*in_level = node_level[node_count];
|
*in_level = node_level[node_count];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (loc_db_gain <= 0.0f) {
|
if (loc_db_gain <= 0.0f) {
|
||||||
*in_level = DRC_INPUT_LOUDNESS_TARGET;
|
*in_level = DRC_INPUT_LOUDNESS_TARGET;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
for (n = 1; n <= node_count; n++) {
|
for (n = 1; n <= node_count; n++) {
|
||||||
if ((loc_db_gain >= node_gain[n-1]) && (loc_db_gain < node_gain[n])) {
|
if ((loc_db_gain >= node_gain[n - 1]) &&
|
||||||
w = (FLOAT32)(node_gain[n]-loc_db_gain)/(node_gain[n]-node_gain[n-1]);
|
(loc_db_gain < node_gain[n])) {
|
||||||
*in_level =(FLOAT32) (w * node_level[n-1] + (1.0-w) * node_level[n]);
|
w = (FLOAT32)(node_gain[n] - loc_db_gain) /
|
||||||
|
(node_gain[n] - node_gain[n - 1]);
|
||||||
|
*in_level =
|
||||||
|
(FLOAT32)(w * node_level[n - 1] + (1.0 - w) * node_level[n]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -251,24 +241,23 @@ impd_compressor_io_nodes_inverse(ia_split_drc_characteristic_struct* split_drc_c
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_map_gain(
|
impd_map_gain(
|
||||||
ia_split_drc_characteristic_struct* split_drc_characteristic_source,
|
ia_split_drc_characteristic_struct* split_drc_characteristic_source,
|
||||||
ia_split_drc_characteristic_struct* split_drc_characteristic_target,
|
ia_split_drc_characteristic_struct* split_drc_characteristic_target,
|
||||||
FLOAT32 gain_in_db,
|
FLOAT32 gain_in_db, FLOAT32* gain_out_db) {
|
||||||
FLOAT32* gain_out_db)
|
|
||||||
{
|
|
||||||
FLOAT32 inLevel;
|
FLOAT32 inLevel;
|
||||||
WORD32 err = 0;
|
WORD32 err = 0;
|
||||||
|
|
||||||
switch (split_drc_characteristic_source->characteristic_format) {
|
switch (split_drc_characteristic_source->characteristic_format) {
|
||||||
case CHARACTERISTIC_SIGMOID:
|
case CHARACTERISTIC_SIGMOID:
|
||||||
err = impd_compressor_io_sigmoid_inv(split_drc_characteristic_source, gain_in_db, &inLevel);
|
err = impd_compressor_io_sigmoid_inv(split_drc_characteristic_source,
|
||||||
|
gain_in_db, &inLevel);
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
break;
|
break;
|
||||||
case CHARACTERISTIC_NODES:
|
case CHARACTERISTIC_NODES:
|
||||||
err = impd_compressor_io_nodes_inverse(split_drc_characteristic_source, gain_in_db, &inLevel);
|
err = impd_compressor_io_nodes_inverse(split_drc_characteristic_source,
|
||||||
|
gain_in_db, &inLevel);
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
break;
|
break;
|
||||||
case CHARACTERISTIC_PASS_THRU:
|
case CHARACTERISTIC_PASS_THRU:
|
||||||
|
|
@ -280,16 +269,18 @@ impd_map_gain (
|
||||||
}
|
}
|
||||||
switch (split_drc_characteristic_target->characteristic_format) {
|
switch (split_drc_characteristic_target->characteristic_format) {
|
||||||
case CHARACTERISTIC_SIGMOID:
|
case CHARACTERISTIC_SIGMOID:
|
||||||
err = impd_compressor_io_sigmoid(split_drc_characteristic_target, inLevel, gain_out_db);
|
err = impd_compressor_io_sigmoid(split_drc_characteristic_target, inLevel,
|
||||||
|
gain_out_db);
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
break;
|
break;
|
||||||
case CHARACTERISTIC_NODES:
|
case CHARACTERISTIC_NODES:
|
||||||
if (inLevel < DRC_INPUT_LOUDNESS_TARGET) {
|
if (inLevel < DRC_INPUT_LOUDNESS_TARGET) {
|
||||||
err = impd_compressor_io_nodes_lt(split_drc_characteristic_target, inLevel, gain_out_db);
|
err = impd_compressor_io_nodes_lt(split_drc_characteristic_target,
|
||||||
|
inLevel, gain_out_db);
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
}
|
} else {
|
||||||
else {
|
err = impd_compressor_io_nodes_rt(split_drc_characteristic_target,
|
||||||
err = impd_compressor_io_nodes_rt(split_drc_characteristic_target, inLevel, gain_out_db);
|
inLevel, gain_out_db);
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -304,68 +295,69 @@ impd_map_gain (
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_conv_to_linear_domain(ia_interp_params_struct* interp_params_str,
|
impd_conv_to_linear_domain(ia_interp_params_struct* interp_params_str,
|
||||||
WORD32 drc_band,
|
WORD32 drc_band, FLOAT32 in_param_db_gain,
|
||||||
FLOAT32 in_param_db_gain,
|
|
||||||
FLOAT32 in_param_db_slope,
|
FLOAT32 in_param_db_slope,
|
||||||
FLOAT32* out_param_lin_gain,
|
FLOAT32* out_param_lin_gain,
|
||||||
FLOAT32* out_param_lin_slope)
|
FLOAT32* out_param_lin_slope) {
|
||||||
{
|
|
||||||
WORD32 err = 0;
|
WORD32 err = 0;
|
||||||
FLOAT32 loc_db_gain = in_param_db_gain;
|
FLOAT32 loc_db_gain = in_param_db_gain;
|
||||||
FLOAT32 gain_ratio = 1.0;
|
FLOAT32 gain_ratio = 1.0;
|
||||||
FLOAT32 mapped_db_gain;
|
FLOAT32 mapped_db_gain;
|
||||||
ia_gain_modifiers_struct* pstr_gain_modifiers = interp_params_str->pstr_gain_modifiers;
|
ia_gain_modifiers_struct* pstr_gain_modifiers =
|
||||||
|
interp_params_str->pstr_gain_modifiers;
|
||||||
if (interp_params_str->gain_modification_flag) {
|
if (interp_params_str->gain_modification_flag) {
|
||||||
ia_split_drc_characteristic_struct* split_drc_characteristic_source;
|
ia_split_drc_characteristic_struct* split_drc_characteristic_source;
|
||||||
|
|
||||||
WORD32 slopeIsNegative;
|
WORD32 slopeIsNegative;
|
||||||
|
|
||||||
if (interp_params_str->drc_characteristic_present) {
|
if (interp_params_str->drc_characteristic_present) {
|
||||||
if (interp_params_str->drc_source_characteristic_cicp_format)
|
if (interp_params_str->drc_source_characteristic_cicp_format) {
|
||||||
{
|
} else {
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
slopeIsNegative = 0;
|
slopeIsNegative = 0;
|
||||||
split_drc_characteristic_source = interp_params_str->split_source_characteristic_left;
|
split_drc_characteristic_source =
|
||||||
if (split_drc_characteristic_source->characteristic_format == 0)
|
interp_params_str->split_source_characteristic_left;
|
||||||
{
|
if (split_drc_characteristic_source->characteristic_format == 0) {
|
||||||
slopeIsNegative = 1;
|
slopeIsNegative = 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
if (split_drc_characteristic_source->node_gain[1] > 0.0f) {
|
if (split_drc_characteristic_source->node_gain[1] > 0.0f) {
|
||||||
slopeIsNegative = 1;
|
slopeIsNegative = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (loc_db_gain == 0.0f) {
|
if (loc_db_gain == 0.0f) {
|
||||||
if (((pstr_gain_modifiers->target_characteristic_left_present[drc_band] == 1) &&
|
if (((pstr_gain_modifiers
|
||||||
(interp_params_str->split_target_characteristic_left->characteristic_format == CHARACTERISTIC_PASS_THRU)) ||
|
->target_characteristic_left_present[drc_band] == 1) &&
|
||||||
((pstr_gain_modifiers->target_characteristic_right_present[drc_band] == 1) &&
|
(interp_params_str->split_target_characteristic_left
|
||||||
(interp_params_str->split_target_characteristic_right->characteristic_format == CHARACTERISTIC_PASS_THRU)))
|
->characteristic_format == CHARACTERISTIC_PASS_THRU)) ||
|
||||||
{
|
((pstr_gain_modifiers
|
||||||
|
->target_characteristic_right_present[drc_band] == 1) &&
|
||||||
|
(interp_params_str->split_target_characteristic_right
|
||||||
|
->characteristic_format == CHARACTERISTIC_PASS_THRU))) {
|
||||||
mapped_db_gain = DRC_INPUT_LOUDNESS_TARGET;
|
mapped_db_gain = DRC_INPUT_LOUDNESS_TARGET;
|
||||||
loc_db_gain = DRC_INPUT_LOUDNESS_TARGET;
|
loc_db_gain = DRC_INPUT_LOUDNESS_TARGET;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
if (((loc_db_gain > 0.0f) && (slopeIsNegative == 1)) ||
|
||||||
{
|
((loc_db_gain < 0.0f) && (slopeIsNegative == 0))) {
|
||||||
if (((loc_db_gain > 0.0f) && (slopeIsNegative == 1)) || ((loc_db_gain < 0.0f) && (slopeIsNegative == 0)))
|
if (pstr_gain_modifiers
|
||||||
{
|
->target_characteristic_left_present[drc_band] == 1) {
|
||||||
if (pstr_gain_modifiers->target_characteristic_left_present[drc_band] == 1)
|
err = impd_map_gain(
|
||||||
{
|
split_drc_characteristic_source,
|
||||||
err = impd_map_gain(split_drc_characteristic_source, interp_params_str->split_target_characteristic_left, loc_db_gain, &mapped_db_gain);
|
interp_params_str->split_target_characteristic_left,
|
||||||
|
loc_db_gain, &mapped_db_gain);
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
gain_ratio = mapped_db_gain / loc_db_gain;
|
gain_ratio = mapped_db_gain / loc_db_gain;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else if (((loc_db_gain < 0.0f) && (slopeIsNegative == 1)) ||
|
||||||
else if (((loc_db_gain < 0.0f) && (slopeIsNegative == 1)) || ((loc_db_gain > 0.0f) && (slopeIsNegative == 0)))
|
((loc_db_gain > 0.0f) && (slopeIsNegative == 0))) {
|
||||||
{
|
if (pstr_gain_modifiers
|
||||||
if (pstr_gain_modifiers->target_characteristic_right_present[drc_band] == 1)
|
->target_characteristic_right_present[drc_band] == 1) {
|
||||||
{
|
split_drc_characteristic_source =
|
||||||
split_drc_characteristic_source = interp_params_str->split_source_characteristic_right;
|
interp_params_str->split_source_characteristic_right;
|
||||||
err = impd_map_gain(split_drc_characteristic_source, interp_params_str->split_target_characteristic_right, loc_db_gain, &mapped_db_gain);
|
err = impd_map_gain(
|
||||||
|
split_drc_characteristic_source,
|
||||||
|
interp_params_str->split_target_characteristic_right,
|
||||||
|
loc_db_gain, &mapped_db_gain);
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
gain_ratio = mapped_db_gain / loc_db_gain;
|
gain_ratio = mapped_db_gain / loc_db_gain;
|
||||||
}
|
}
|
||||||
|
|
@ -376,38 +368,42 @@ impd_conv_to_linear_domain (ia_interp_params_struct* interp_params_str,
|
||||||
|
|
||||||
if (loc_db_gain < 0.0f) {
|
if (loc_db_gain < 0.0f) {
|
||||||
gain_ratio *= interp_params_str->compress;
|
gain_ratio *= interp_params_str->compress;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
gain_ratio *= interp_params_str->boost;
|
gain_ratio *= interp_params_str->boost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pstr_gain_modifiers->gain_scaling_flag[drc_band] == 1) {
|
if (pstr_gain_modifiers->gain_scaling_flag[drc_band] == 1) {
|
||||||
if (loc_db_gain < 0.0) {
|
if (loc_db_gain < 0.0) {
|
||||||
gain_ratio *= pstr_gain_modifiers->attn_scaling[drc_band];
|
gain_ratio *= pstr_gain_modifiers->attn_scaling[drc_band];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
gain_ratio *= pstr_gain_modifiers->ampl_scaling[drc_band];
|
gain_ratio *= pstr_gain_modifiers->ampl_scaling[drc_band];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((interp_params_str->pstr_ducking_modifiers->ducking_scaling_flag == 1) && (interp_params_str->ducking_flag == 1)) {
|
if ((interp_params_str->pstr_ducking_modifiers->ducking_scaling_flag == 1) &&
|
||||||
|
(interp_params_str->ducking_flag == 1)) {
|
||||||
gain_ratio *= interp_params_str->pstr_ducking_modifiers->ducking_scaling;
|
gain_ratio *= interp_params_str->pstr_ducking_modifiers->ducking_scaling;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interp_params_str->interpolation_loud_eq == 1)
|
if (interp_params_str->interpolation_loud_eq == 1) {
|
||||||
{
|
*out_param_lin_gain =
|
||||||
*out_param_lin_gain = gain_ratio * loc_db_gain + pstr_gain_modifiers->gain_offset[drc_band];
|
gain_ratio * loc_db_gain + pstr_gain_modifiers->gain_offset[drc_band];
|
||||||
*out_param_lin_slope = 0.0f;
|
*out_param_lin_slope = 0.0f;
|
||||||
}
|
} else {
|
||||||
else
|
*out_param_lin_gain =
|
||||||
{
|
(FLOAT32)pow(2.0, (FLOAT64)(gain_ratio * loc_db_gain / 6.0f));
|
||||||
*out_param_lin_gain = (FLOAT32)pow(2.0, (FLOAT64)(gain_ratio * loc_db_gain / 6.0f));
|
*out_param_lin_slope = SLOPE_FACTOR_DB_TO_LINEAR * gain_ratio *
|
||||||
*out_param_lin_slope = SLOPE_FACTOR_DB_TO_LINEAR * gain_ratio * *out_param_lin_gain * in_param_db_slope;
|
*out_param_lin_gain * in_param_db_slope;
|
||||||
|
|
||||||
if (pstr_gain_modifiers->gain_offset_flag[drc_band] == 1) {
|
if (pstr_gain_modifiers->gain_offset_flag[drc_band] == 1) {
|
||||||
*out_param_lin_gain *= (FLOAT32)pow(2.0, (FLOAT64)(pstr_gain_modifiers->gain_offset[drc_band]/6.0f));
|
*out_param_lin_gain *= (FLOAT32)pow(
|
||||||
|
2.0, (FLOAT64)(pstr_gain_modifiers->gain_offset[drc_band] / 6.0f));
|
||||||
}
|
}
|
||||||
if ((interp_params_str->limiter_peak_target_present == 1) && (interp_params_str->clipping_flag == 1)) {
|
if ((interp_params_str->limiter_peak_target_present == 1) &&
|
||||||
*out_param_lin_gain *= (FLOAT32)pow(2.0, max(0.0, -interp_params_str->limiter_peak_target - interp_params_str->loudness_normalization_gain_db)/6.0);
|
(interp_params_str->clipping_flag == 1)) {
|
||||||
|
*out_param_lin_gain *= (FLOAT32)pow(
|
||||||
|
2.0, max(0.0, -interp_params_str->limiter_peak_target -
|
||||||
|
interp_params_str->loudness_normalization_gain_db) /
|
||||||
|
6.0);
|
||||||
if (*out_param_lin_gain >= 1.0) {
|
if (*out_param_lin_gain >= 1.0) {
|
||||||
*out_param_lin_gain = 1.0;
|
*out_param_lin_gain = 1.0;
|
||||||
*out_param_lin_slope = 0.0;
|
*out_param_lin_slope = 0.0;
|
||||||
|
|
@ -418,14 +414,9 @@ impd_conv_to_linear_domain (ia_interp_params_struct* interp_params_str,
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32 impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
|
WORD32 impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
|
||||||
WORD32 drc_band,
|
WORD32 drc_band, WORD32 gain_step_tdomain,
|
||||||
WORD32 gain_step_tdomain,
|
FLOAT32 gain0, FLOAT32 gain1, FLOAT32 slope0,
|
||||||
FLOAT32 gain0,
|
FLOAT32 slope1, FLOAT32* result) {
|
||||||
FLOAT32 gain1,
|
|
||||||
FLOAT32 slope0,
|
|
||||||
FLOAT32 slope1,
|
|
||||||
FLOAT32* result)
|
|
||||||
{
|
|
||||||
WORD32 err = 0;
|
WORD32 err = 0;
|
||||||
WORD32 n;
|
WORD32 n;
|
||||||
FLOAT32 k1, k2, a, b, c, d;
|
FLOAT32 k1, k2, a, b, c, d;
|
||||||
|
|
@ -438,23 +429,24 @@ WORD32 impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
|
||||||
WORD32 node_inser;
|
WORD32 node_inser;
|
||||||
FLOAT32 node_inser_float;
|
FLOAT32 node_inser_float;
|
||||||
|
|
||||||
if (gain_step_tdomain <= 0)
|
if (gain_step_tdomain <= 0) {
|
||||||
{
|
|
||||||
return (UNEXPECTED_ERROR);
|
return (UNEXPECTED_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interp_params_str->gain_interpolation_type == GAIN_INTERPOLATION_TYPE_SPLINE) {
|
if (interp_params_str->gain_interpolation_type ==
|
||||||
err = impd_conv_to_linear_domain(interp_params_str, drc_band, gain0, slope0, &gain_t1, &slope_t1);
|
GAIN_INTERPOLATION_TYPE_SPLINE) {
|
||||||
if (err)
|
err = impd_conv_to_linear_domain(interp_params_str, drc_band, gain0, slope0,
|
||||||
return (err);
|
&gain_t1, &slope_t1);
|
||||||
err = impd_conv_to_linear_domain (interp_params_str, drc_band, gain1, slope1, &gain_t2, &slope_t2);
|
if (err) return (err);
|
||||||
if (err)
|
err = impd_conv_to_linear_domain(interp_params_str, drc_band, gain1, slope1,
|
||||||
return (err);
|
&gain_t2, &slope_t2);
|
||||||
|
if (err) return (err);
|
||||||
|
|
||||||
slope_t1 = slope_t1 / (FLOAT32)interp_params_str->delta_tmin;
|
slope_t1 = slope_t1 / (FLOAT32)interp_params_str->delta_tmin;
|
||||||
slope_t2 = slope_t2 / (FLOAT32)interp_params_str->delta_tmin;
|
slope_t2 = slope_t2 / (FLOAT32)interp_params_str->delta_tmin;
|
||||||
if ((FLOAT32)fabs((FLOAT64)slope_t1) > (FLOAT32)fabs((FLOAT64)slope_t2)) {
|
if ((FLOAT32)fabs((FLOAT64)slope_t1) > (FLOAT32)fabs((FLOAT64)slope_t2)) {
|
||||||
node_inser_float = 2.0f * (gain_t2 - gain_t1 - slope_t2 * gain_step_tdomain) /
|
node_inser_float = 2.0f *
|
||||||
|
(gain_t2 - gain_t1 - slope_t2 * gain_step_tdomain) /
|
||||||
(slope_t1 - slope_t2);
|
(slope_t1 - slope_t2);
|
||||||
node_inser = (WORD32)(0.5f + node_inser_float);
|
node_inser = (WORD32)(0.5f + node_inser_float);
|
||||||
if ((node_inser >= 0) && (node_inser < gain_step_tdomain)) {
|
if ((node_inser >= 0) && (node_inser < gain_step_tdomain)) {
|
||||||
|
|
@ -478,10 +470,10 @@ WORD32 impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
|
||||||
result[n] = a * t + b;
|
result[n] = a * t + b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if ((FLOAT32)fabs((FLOAT64)slope_t1) <
|
||||||
else if ((FLOAT32)fabs((FLOAT64)slope_t1) < (FLOAT32)fabs((FLOAT64)slope_t2))
|
(FLOAT32)fabs((FLOAT64)slope_t2)) {
|
||||||
{
|
node_inser_float = 2.0f *
|
||||||
node_inser_float = 2.0f * (gain_t1 - gain_t2 + slope_t1 * gain_step_tdomain) /
|
(gain_t1 - gain_t2 + slope_t1 * gain_step_tdomain) /
|
||||||
(slope_t1 - slope_t2);
|
(slope_t1 - slope_t2);
|
||||||
node_inser_float = gain_step_tdomain - node_inser_float;
|
node_inser_float = gain_step_tdomain - node_inser_float;
|
||||||
node_inser = (WORD32)(0.5f + node_inser_float);
|
node_inser = (WORD32)(0.5f + node_inser_float);
|
||||||
|
|
@ -497,7 +489,8 @@ WORD32 impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
|
||||||
FLOAT32 t = (FLOAT32)n;
|
FLOAT32 t = (FLOAT32)n;
|
||||||
result[n] = a * t + b;
|
result[n] = a * t + b;
|
||||||
}
|
}
|
||||||
a = (slope_t2 - slope_t1) / (2.0f * (gain_step_tdomain - node_inser_float));
|
a = (slope_t2 - slope_t1) /
|
||||||
|
(2.0f * (gain_step_tdomain - node_inser_float));
|
||||||
b = -slope_t2;
|
b = -slope_t2;
|
||||||
c = gain_t2;
|
c = gain_t2;
|
||||||
for (; n < gain_step_tdomain; n++) {
|
for (; n < gain_step_tdomain; n++) {
|
||||||
|
|
@ -508,8 +501,7 @@ WORD32 impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cubic_interpolation == 1)
|
if (cubic_interpolation == 1) {
|
||||||
{
|
|
||||||
FLOAT32 gain_step_inv = 1.0f / (FLOAT32)gain_step_tdomain;
|
FLOAT32 gain_step_inv = 1.0f / (FLOAT32)gain_step_tdomain;
|
||||||
FLOAT32 gain_step_inv2 = gain_step_inv * gain_step_inv;
|
FLOAT32 gain_step_inv2 = gain_step_inv * gain_step_inv;
|
||||||
|
|
||||||
|
|
@ -529,12 +521,10 @@ WORD32 impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
|
||||||
result[n] = max(0.0f, result[n]);
|
result[n] = max(0.0f, result[n]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
err = impd_conv_to_linear_domain(interp_params_str, drc_band, gain1, slope1,
|
||||||
|
&gain_t2, &slope_t2);
|
||||||
err = impd_conv_to_linear_domain(interp_params_str, drc_band, gain1, slope1, &gain_t2, &slope_t2);
|
if (err) return (err);
|
||||||
if (err)
|
|
||||||
return (err);
|
|
||||||
|
|
||||||
a = 0;
|
a = 0;
|
||||||
b = gain_t2;
|
b = gain_t2;
|
||||||
|
|
@ -550,48 +540,40 @@ WORD32 impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_advance_buf(WORD32 drc_frame_size,
|
impd_advance_buf(WORD32 drc_frame_size, ia_gain_buffer_struct* pstr_gain_buf) {
|
||||||
ia_gain_buffer_struct* pstr_gain_buf)
|
|
||||||
{
|
|
||||||
WORD32 n;
|
WORD32 n;
|
||||||
ia_interp_buf_struct* buf_interpolation;
|
ia_interp_buf_struct* buf_interpolation;
|
||||||
|
|
||||||
for (n=0; n<pstr_gain_buf->buf_interpolation_count; n++)
|
for (n = 0; n < pstr_gain_buf->buf_interpolation_count; n++) {
|
||||||
{
|
|
||||||
buf_interpolation = &(pstr_gain_buf->buf_interpolation[n]);
|
buf_interpolation = &(pstr_gain_buf->buf_interpolation[n]);
|
||||||
buf_interpolation->prev_node = buf_interpolation->str_node;
|
buf_interpolation->prev_node = buf_interpolation->str_node;
|
||||||
buf_interpolation->prev_node.time -= drc_frame_size;
|
buf_interpolation->prev_node.time -= drc_frame_size;
|
||||||
memmove(buf_interpolation->lpcm_gains, buf_interpolation->lpcm_gains + drc_frame_size, sizeof(FLOAT32) * (drc_frame_size + MAX_SIGNAL_DELAY));
|
memmove(buf_interpolation->lpcm_gains,
|
||||||
|
buf_interpolation->lpcm_gains + drc_frame_size,
|
||||||
|
sizeof(FLOAT32) * (drc_frame_size + MAX_SIGNAL_DELAY));
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
WORD32
|
WORD32
|
||||||
impd_concatenate_segments(WORD32 drc_frame_size,
|
impd_concatenate_segments(WORD32 drc_frame_size, WORD32 drc_band,
|
||||||
WORD32 drc_band,
|
|
||||||
ia_interp_params_struct* interp_params_str,
|
ia_interp_params_struct* interp_params_str,
|
||||||
ia_spline_nodes_struct* str_spline_nodes,
|
ia_spline_nodes_struct* str_spline_nodes,
|
||||||
ia_interp_buf_struct* buf_interpolation)
|
ia_interp_buf_struct* buf_interpolation) {
|
||||||
{
|
|
||||||
WORD32 timePrev, duration, n, err = 0;
|
WORD32 timePrev, duration, n, err = 0;
|
||||||
FLOAT32 loc_db_gain = 0.0f, prev_db_gain, slope = 0.0f, slopePrev;
|
FLOAT32 loc_db_gain = 0.0f, prev_db_gain, slope = 0.0f, slopePrev;
|
||||||
|
|
||||||
timePrev = buf_interpolation->prev_node.time;
|
timePrev = buf_interpolation->prev_node.time;
|
||||||
prev_db_gain = buf_interpolation->prev_node.loc_db_gain;
|
prev_db_gain = buf_interpolation->prev_node.loc_db_gain;
|
||||||
slopePrev = buf_interpolation->prev_node.slope;
|
slopePrev = buf_interpolation->prev_node.slope;
|
||||||
for (n=0; n<str_spline_nodes->num_nodes; n++)
|
for (n = 0; n < str_spline_nodes->num_nodes; n++) {
|
||||||
{
|
|
||||||
duration = str_spline_nodes->str_node[n].time - timePrev;
|
duration = str_spline_nodes->str_node[n].time - timePrev;
|
||||||
loc_db_gain = str_spline_nodes->str_node[n].loc_db_gain;
|
loc_db_gain = str_spline_nodes->str_node[n].loc_db_gain;
|
||||||
slope = str_spline_nodes->str_node[n].slope;
|
slope = str_spline_nodes->str_node[n].slope;
|
||||||
|
|
||||||
err = impd_interpolate_drc_gain(interp_params_str,
|
err = impd_interpolate_drc_gain(
|
||||||
drc_band,
|
interp_params_str, drc_band, duration, prev_db_gain, loc_db_gain,
|
||||||
duration,
|
slopePrev, slope, buf_interpolation->lpcm_gains + MAX_SIGNAL_DELAY +
|
||||||
prev_db_gain,
|
drc_frame_size + timePrev);
|
||||||
loc_db_gain,
|
|
||||||
slopePrev,
|
|
||||||
slope,
|
|
||||||
buf_interpolation->lpcm_gains + MAX_SIGNAL_DELAY + drc_frame_size + timePrev);
|
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
|
|
||||||
timePrev = str_spline_nodes->str_node[n].time;
|
timePrev = str_spline_nodes->str_node[n].time;
|
||||||
|
|
@ -603,145 +585,187 @@ impd_concatenate_segments(WORD32 drc_frame_size,
|
||||||
buf_interpolation->str_node.slope = slope;
|
buf_interpolation->str_node.slope = slope;
|
||||||
buf_interpolation->str_node.time = timePrev;
|
buf_interpolation->str_node.time = timePrev;
|
||||||
|
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_get_drc_gain(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
impd_get_drc_gain(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_gain_struct* pstr_drc_gain,
|
ia_drc_gain_struct* pstr_drc_gain, FLOAT32 compress,
|
||||||
FLOAT32 compress,
|
FLOAT32 boost, WORD32 characteristic_index,
|
||||||
FLOAT32 boost,
|
FLOAT32 loudness_normalization_gain_db, WORD32 sel_drc_index,
|
||||||
WORD32 characteristic_index,
|
ia_drc_gain_buffers_struct* drc_gain_buffers) {
|
||||||
FLOAT32 loudness_normalization_gain_db,
|
ia_drc_params_struct* ia_drc_params_struct =
|
||||||
WORD32 sel_drc_index,
|
&(p_drc_gain_dec_structs->ia_drc_params_struct);
|
||||||
ia_drc_gain_buffers_struct* drc_gain_buffers)
|
WORD32 drc_instructions_index =
|
||||||
{
|
ia_drc_params_struct->sel_drc_array[sel_drc_index].drc_instructions_index;
|
||||||
ia_drc_params_struct* ia_drc_params_struct = &(p_drc_gain_dec_structs->ia_drc_params_struct);
|
if (drc_instructions_index >= 0) {
|
||||||
WORD32 drc_instructions_index = ia_drc_params_struct->sel_drc_array[sel_drc_index].drc_instructions_index;
|
|
||||||
if (drc_instructions_index >= 0)
|
|
||||||
{
|
|
||||||
WORD32 b, g, gainElementIndex, err = 0;
|
WORD32 b, g, gainElementIndex, err = 0;
|
||||||
WORD32 parametricDrcInstanceIndex = 0;
|
WORD32 parametricDrcInstanceIndex = 0;
|
||||||
ia_interp_params_struct interp_params_str = {0};
|
ia_interp_params_struct interp_params_str = {0};
|
||||||
|
|
||||||
ia_drc_instructions_struct* str_drc_instruction_str = &(pstr_drc_config->str_drc_instruction_str[drc_instructions_index]);
|
ia_drc_instructions_struct* str_drc_instruction_str =
|
||||||
|
&(pstr_drc_config->str_drc_instruction_str[drc_instructions_index]);
|
||||||
WORD32 drc_set_effect = str_drc_instruction_str->drc_set_effect;
|
WORD32 drc_set_effect = str_drc_instruction_str->drc_set_effect;
|
||||||
WORD32 num_drc_ch_groups = str_drc_instruction_str->num_drc_ch_groups;
|
WORD32 num_drc_ch_groups = str_drc_instruction_str->num_drc_ch_groups;
|
||||||
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc = NULL;
|
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc = NULL;
|
||||||
WORD32 drc_coeff_idx = ia_drc_params_struct->sel_drc_array[sel_drc_index].drc_coeff_idx;
|
WORD32 drc_coeff_idx =
|
||||||
if (drc_coeff_idx >= 0)
|
ia_drc_params_struct->sel_drc_array[sel_drc_index].drc_coeff_idx;
|
||||||
{
|
if (drc_coeff_idx >= 0) {
|
||||||
str_p_loc_drc_coefficients_uni_drc = &(pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[drc_coeff_idx]);
|
str_p_loc_drc_coefficients_uni_drc =
|
||||||
|
&(pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[drc_coeff_idx]);
|
||||||
interp_params_str.interpolation_loud_eq = 0;
|
interp_params_str.interpolation_loud_eq = 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return (UNEXPECTED_ERROR);
|
return (UNEXPECTED_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
interp_params_str.loudness_normalization_gain_db = loudness_normalization_gain_db;
|
interp_params_str.loudness_normalization_gain_db =
|
||||||
|
loudness_normalization_gain_db;
|
||||||
interp_params_str.characteristic_index = characteristic_index;
|
interp_params_str.characteristic_index = characteristic_index;
|
||||||
interp_params_str.compress = compress;
|
interp_params_str.compress = compress;
|
||||||
interp_params_str.boost = boost;
|
interp_params_str.boost = boost;
|
||||||
interp_params_str.limiter_peak_target_present = str_drc_instruction_str->limiter_peak_target_present;
|
interp_params_str.limiter_peak_target_present =
|
||||||
interp_params_str.limiter_peak_target = str_drc_instruction_str->limiter_peak_target;
|
str_drc_instruction_str->limiter_peak_target_present;
|
||||||
|
interp_params_str.limiter_peak_target =
|
||||||
|
str_drc_instruction_str->limiter_peak_target;
|
||||||
|
|
||||||
if ( ((drc_set_effect & (EFFECT_BIT_DUCK_OTHER | EFFECT_BIT_DUCK_SELF)) == 0) && (drc_set_effect != EFFECT_BIT_FADE) && (drc_set_effect != EFFECT_BIT_CLIPPING))
|
if (((drc_set_effect & (EFFECT_BIT_DUCK_OTHER | EFFECT_BIT_DUCK_SELF)) ==
|
||||||
{
|
0) &&
|
||||||
|
(drc_set_effect != EFFECT_BIT_FADE) &&
|
||||||
|
(drc_set_effect != EFFECT_BIT_CLIPPING)) {
|
||||||
interp_params_str.gain_modification_flag = 1;
|
interp_params_str.gain_modification_flag = 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
interp_params_str.gain_modification_flag = 0;
|
interp_params_str.gain_modification_flag = 0;
|
||||||
}
|
}
|
||||||
if (drc_set_effect & (EFFECT_BIT_DUCK_OTHER | EFFECT_BIT_DUCK_SELF))
|
if (drc_set_effect & (EFFECT_BIT_DUCK_OTHER | EFFECT_BIT_DUCK_SELF)) {
|
||||||
{
|
|
||||||
interp_params_str.ducking_flag = 1;
|
interp_params_str.ducking_flag = 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
interp_params_str.ducking_flag = 0;
|
interp_params_str.ducking_flag = 0;
|
||||||
}
|
}
|
||||||
if (drc_set_effect == EFFECT_BIT_CLIPPING)
|
if (drc_set_effect == EFFECT_BIT_CLIPPING) {
|
||||||
{
|
|
||||||
interp_params_str.clipping_flag = 1;
|
interp_params_str.clipping_flag = 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
interp_params_str.clipping_flag = 0;
|
interp_params_str.clipping_flag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = impd_advance_buf(ia_drc_params_struct->drc_frame_size, &(drc_gain_buffers->pstr_gain_buf[sel_drc_index]));
|
err = impd_advance_buf(ia_drc_params_struct->drc_frame_size,
|
||||||
|
&(drc_gain_buffers->pstr_gain_buf[sel_drc_index]));
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
|
|
||||||
gainElementIndex = 0;
|
gainElementIndex = 0;
|
||||||
for(g=0; g<num_drc_ch_groups; g++)
|
for (g = 0; g < num_drc_ch_groups; g++) {
|
||||||
{
|
|
||||||
WORD32 gainSet = 0;
|
WORD32 gainSet = 0;
|
||||||
WORD32 num_drc_bands = 0;
|
WORD32 num_drc_bands = 0;
|
||||||
interp_params_str.gain_interpolation_type = str_drc_instruction_str->gain_interpolation_type_for_channel_group[g];
|
interp_params_str.gain_interpolation_type =
|
||||||
interp_params_str.delta_tmin = str_drc_instruction_str->time_delta_min_for_channel_group[g];
|
str_drc_instruction_str->gain_interpolation_type_for_channel_group[g];
|
||||||
interp_params_str.pstr_ducking_modifiers = &(str_drc_instruction_str->str_ducking_modifiers_for_channel_group[g]);
|
interp_params_str.delta_tmin =
|
||||||
interp_params_str.pstr_gain_modifiers = &(str_drc_instruction_str->str_gain_modifiers_of_ch_group[g]);
|
str_drc_instruction_str->time_delta_min_for_channel_group[g];
|
||||||
|
interp_params_str.pstr_ducking_modifiers = &(
|
||||||
|
str_drc_instruction_str->str_ducking_modifiers_for_channel_group[g]);
|
||||||
|
interp_params_str.pstr_gain_modifiers =
|
||||||
|
&(str_drc_instruction_str->str_gain_modifiers_of_ch_group[g]);
|
||||||
if (str_drc_instruction_str->ch_group_parametric_drc_flag[g] == 0) {
|
if (str_drc_instruction_str->ch_group_parametric_drc_flag[g] == 0) {
|
||||||
gainSet = str_drc_instruction_str->gain_set_index_for_channel_group[g];
|
gainSet = str_drc_instruction_str->gain_set_index_for_channel_group[g];
|
||||||
num_drc_bands = str_drc_instruction_str->band_count_of_ch_group[g];
|
num_drc_bands = str_drc_instruction_str->band_count_of_ch_group[g];
|
||||||
for(b=0; b<num_drc_bands; b++)
|
for (b = 0; b < num_drc_bands; b++) {
|
||||||
{
|
ia_gain_params_struct* gain_params =
|
||||||
ia_gain_params_struct* gain_params = &(str_p_loc_drc_coefficients_uni_drc->gain_set_params[gainSet].gain_params[b]);
|
&(str_p_loc_drc_coefficients_uni_drc->gain_set_params[gainSet]
|
||||||
|
.gain_params[b]);
|
||||||
WORD32 seq = gain_params->gain_seq_idx;
|
WORD32 seq = gain_params->gain_seq_idx;
|
||||||
interp_params_str.drc_characteristic_present = gain_params->drc_characteristic_present;
|
interp_params_str.drc_characteristic_present =
|
||||||
interp_params_str.drc_source_characteristic_cicp_format = gain_params->drc_characteristic_format_is_cicp;
|
gain_params->drc_characteristic_present;
|
||||||
interp_params_str.source_drc_characteristic = gain_params->drc_characteristic;
|
interp_params_str.drc_source_characteristic_cicp_format =
|
||||||
interp_params_str.split_source_characteristic_left = &(str_p_loc_drc_coefficients_uni_drc->str_split_characteristic_left [gain_params->drc_characteristic_left_index]);
|
gain_params->drc_characteristic_format_is_cicp;
|
||||||
interp_params_str.split_source_characteristic_right = &(str_p_loc_drc_coefficients_uni_drc->str_split_characteristic_right[gain_params->drc_characteristic_right_index]);
|
interp_params_str.source_drc_characteristic =
|
||||||
interp_params_str.split_target_characteristic_left = &(str_p_loc_drc_coefficients_uni_drc->str_split_characteristic_left [interp_params_str.pstr_gain_modifiers->target_characteristic_left_index[b]]);
|
gain_params->drc_characteristic;
|
||||||
interp_params_str.split_target_characteristic_right = &(str_p_loc_drc_coefficients_uni_drc->str_split_characteristic_right[interp_params_str.pstr_gain_modifiers->target_characteristic_right_index[b]]);
|
interp_params_str.split_source_characteristic_left = &(
|
||||||
err = impd_concatenate_segments (ia_drc_params_struct->drc_frame_size,
|
str_p_loc_drc_coefficients_uni_drc->str_split_characteristic_left
|
||||||
b,
|
[gain_params->drc_characteristic_left_index]);
|
||||||
&interp_params_str,
|
interp_params_str.split_source_characteristic_right = &(
|
||||||
|
str_p_loc_drc_coefficients_uni_drc->str_split_characteristic_right
|
||||||
|
[gain_params->drc_characteristic_right_index]);
|
||||||
|
interp_params_str.split_target_characteristic_left = &(
|
||||||
|
str_p_loc_drc_coefficients_uni_drc->str_split_characteristic_left
|
||||||
|
[interp_params_str.pstr_gain_modifiers
|
||||||
|
->target_characteristic_left_index[b]]);
|
||||||
|
interp_params_str.split_target_characteristic_right = &(
|
||||||
|
str_p_loc_drc_coefficients_uni_drc->str_split_characteristic_right
|
||||||
|
[interp_params_str.pstr_gain_modifiers
|
||||||
|
->target_characteristic_right_index[b]]);
|
||||||
|
err = impd_concatenate_segments(
|
||||||
|
ia_drc_params_struct->drc_frame_size, b, &interp_params_str,
|
||||||
&(pstr_drc_gain->drc_gain_sequence[seq].str_spline_nodes[0]),
|
&(pstr_drc_gain->drc_gain_sequence[seq].str_spline_nodes[0]),
|
||||||
&(drc_gain_buffers->pstr_gain_buf[sel_drc_index].buf_interpolation[gainElementIndex]));
|
&(drc_gain_buffers->pstr_gain_buf[sel_drc_index]
|
||||||
|
.buf_interpolation[gainElementIndex]));
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
gainElementIndex++;
|
gainElementIndex++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ia_drc_params_struct->sub_band_domain_mode == SUBBAND_DOMAIN_MODE_OFF && !(p_drc_gain_dec_structs->parametricdrc_params.str_parametric_drc_instance_params[parametricDrcInstanceIndex].parametric_drc_type == PARAM_DRC_TYPE_LIM)) {
|
if (ia_drc_params_struct->sub_band_domain_mode ==
|
||||||
err = impd_parametric_drc_instance_process (p_drc_gain_dec_structs->audio_in_out_buf.audio_in_out_buf,
|
SUBBAND_DOMAIN_MODE_OFF &&
|
||||||
NULL,
|
!(p_drc_gain_dec_structs->parametricdrc_params
|
||||||
NULL,
|
.str_parametric_drc_instance_params
|
||||||
&p_drc_gain_dec_structs->parametricdrc_params,
|
[parametricDrcInstanceIndex]
|
||||||
&p_drc_gain_dec_structs->parametricdrc_params.str_parametric_drc_instance_params[parametricDrcInstanceIndex]);
|
.parametric_drc_type == PARAM_DRC_TYPE_LIM)) {
|
||||||
|
err = impd_parametric_drc_instance_process(
|
||||||
|
p_drc_gain_dec_structs->audio_in_out_buf.audio_in_out_buf, NULL,
|
||||||
|
NULL, &p_drc_gain_dec_structs->parametricdrc_params,
|
||||||
|
&p_drc_gain_dec_structs->parametricdrc_params
|
||||||
|
.str_parametric_drc_instance_params
|
||||||
|
[parametricDrcInstanceIndex]);
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
|
|
||||||
err = impd_concatenate_segments(ia_drc_params_struct->drc_frame_size,
|
err = impd_concatenate_segments(
|
||||||
0,
|
ia_drc_params_struct->drc_frame_size, 0, &interp_params_str,
|
||||||
&interp_params_str,
|
&p_drc_gain_dec_structs->parametricdrc_params
|
||||||
&p_drc_gain_dec_structs->parametricdrc_params.str_parametric_drc_instance_params[parametricDrcInstanceIndex].str_spline_nodes,
|
.str_parametric_drc_instance_params
|
||||||
&(drc_gain_buffers->pstr_gain_buf[sel_drc_index].buf_interpolation[gainElementIndex]));
|
[parametricDrcInstanceIndex]
|
||||||
|
.str_spline_nodes,
|
||||||
|
&(drc_gain_buffers->pstr_gain_buf[sel_drc_index]
|
||||||
|
.buf_interpolation[gainElementIndex]));
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
} else if (ia_drc_params_struct->sub_band_domain_mode == SUBBAND_DOMAIN_MODE_OFF && p_drc_gain_dec_structs->parametricdrc_params.str_parametric_drc_instance_params[parametricDrcInstanceIndex].parametric_drc_type == PARAM_DRC_TYPE_LIM) {
|
} else if (ia_drc_params_struct->sub_band_domain_mode ==
|
||||||
FLOAT32* lpcm_gains = (drc_gain_buffers->pstr_gain_buf[sel_drc_index].buf_interpolation[gainElementIndex]).lpcm_gains + MAX_SIGNAL_DELAY;
|
SUBBAND_DOMAIN_MODE_OFF &&
|
||||||
err = impd_parametric_lim_type_drc_process(p_drc_gain_dec_structs->audio_in_out_buf.audio_in_out_buf,
|
p_drc_gain_dec_structs->parametricdrc_params
|
||||||
|
.str_parametric_drc_instance_params
|
||||||
|
[parametricDrcInstanceIndex]
|
||||||
|
.parametric_drc_type == PARAM_DRC_TYPE_LIM) {
|
||||||
|
FLOAT32* lpcm_gains = (drc_gain_buffers->pstr_gain_buf[sel_drc_index]
|
||||||
|
.buf_interpolation[gainElementIndex])
|
||||||
|
.lpcm_gains +
|
||||||
|
MAX_SIGNAL_DELAY;
|
||||||
|
err = impd_parametric_lim_type_drc_process(
|
||||||
|
p_drc_gain_dec_structs->audio_in_out_buf.audio_in_out_buf,
|
||||||
loudness_normalization_gain_db,
|
loudness_normalization_gain_db,
|
||||||
&p_drc_gain_dec_structs->parametricdrc_params.str_parametric_drc_instance_params[parametricDrcInstanceIndex].str_parametric_drc_type_lim_params,
|
&p_drc_gain_dec_structs->parametricdrc_params
|
||||||
|
.str_parametric_drc_instance_params
|
||||||
|
[parametricDrcInstanceIndex]
|
||||||
|
.str_parametric_drc_type_lim_params,
|
||||||
lpcm_gains);
|
lpcm_gains);
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
} else if (ia_drc_params_struct->sub_band_domain_mode != SUBBAND_DOMAIN_MODE_OFF && !(p_drc_gain_dec_structs->parametricdrc_params.str_parametric_drc_instance_params[parametricDrcInstanceIndex].parametric_drc_type == PARAM_DRC_TYPE_LIM)) {
|
} else if (ia_drc_params_struct->sub_band_domain_mode !=
|
||||||
err = impd_parametric_drc_instance_process (NULL,
|
SUBBAND_DOMAIN_MODE_OFF &&
|
||||||
p_drc_gain_dec_structs->audio_in_out_buf.audio_real_buff,
|
!(p_drc_gain_dec_structs->parametricdrc_params
|
||||||
|
.str_parametric_drc_instance_params
|
||||||
|
[parametricDrcInstanceIndex]
|
||||||
|
.parametric_drc_type == PARAM_DRC_TYPE_LIM)) {
|
||||||
|
err = impd_parametric_drc_instance_process(
|
||||||
|
NULL, p_drc_gain_dec_structs->audio_in_out_buf.audio_real_buff,
|
||||||
p_drc_gain_dec_structs->audio_in_out_buf.audio_imag_buff,
|
p_drc_gain_dec_structs->audio_in_out_buf.audio_imag_buff,
|
||||||
&p_drc_gain_dec_structs->parametricdrc_params,
|
&p_drc_gain_dec_structs->parametricdrc_params,
|
||||||
&p_drc_gain_dec_structs->parametricdrc_params.str_parametric_drc_instance_params[parametricDrcInstanceIndex]);
|
&p_drc_gain_dec_structs->parametricdrc_params
|
||||||
|
.str_parametric_drc_instance_params
|
||||||
|
[parametricDrcInstanceIndex]);
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
|
|
||||||
err = impd_concatenate_segments(ia_drc_params_struct->drc_frame_size,
|
err = impd_concatenate_segments(
|
||||||
0,
|
ia_drc_params_struct->drc_frame_size, 0, &interp_params_str,
|
||||||
&interp_params_str,
|
&p_drc_gain_dec_structs->parametricdrc_params
|
||||||
&p_drc_gain_dec_structs->parametricdrc_params.str_parametric_drc_instance_params[parametricDrcInstanceIndex].str_spline_nodes,
|
.str_parametric_drc_instance_params
|
||||||
&(drc_gain_buffers->pstr_gain_buf[sel_drc_index].buf_interpolation[gainElementIndex]));
|
[parametricDrcInstanceIndex]
|
||||||
|
.str_spline_nodes,
|
||||||
|
&(drc_gain_buffers->pstr_gain_buf[sel_drc_index]
|
||||||
|
.buf_interpolation[gainElementIndex]));
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -754,4 +778,3 @@ impd_get_drc_gain (ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,7 @@
|
||||||
#define IMPD_DRC_GAIN_DEC_H
|
#define IMPD_DRC_GAIN_DEC_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -66,7 +65,6 @@ typedef struct {
|
||||||
FLOAT32 boost;
|
FLOAT32 boost;
|
||||||
} ia_interp_params_struct;
|
} ia_interp_params_struct;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WORD32 drc_instructions_index;
|
WORD32 drc_instructions_index;
|
||||||
WORD32 drc_coeff_idx;
|
WORD32 drc_coeff_idx;
|
||||||
|
|
@ -90,7 +88,6 @@ typedef struct {
|
||||||
|
|
||||||
} ia_drc_params_struct;
|
} ia_drc_params_struct;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -38,436 +38,442 @@
|
||||||
#include "impd_drc_gain_decoder.h"
|
#include "impd_drc_gain_decoder.h"
|
||||||
#include "impd_drc_dec.h"
|
#include "impd_drc_dec.h"
|
||||||
|
|
||||||
IA_ERRORCODE impd_init_drc_decode( WORD32 frame_size,
|
IA_ERRORCODE impd_init_drc_decode(
|
||||||
WORD32 sample_rate,
|
WORD32 frame_size, WORD32 sample_rate, WORD32 gain_delay_samples,
|
||||||
WORD32 gain_delay_samples,
|
WORD32 delay_mode, WORD32 sub_band_domain_mode,
|
||||||
WORD32 delay_mode,
|
ia_drc_gain_dec_struct* p_drc_gain_dec_structs) {
|
||||||
WORD32 sub_band_domain_mode,
|
|
||||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs)
|
|
||||||
{
|
|
||||||
IA_ERRORCODE err_code = IA_NO_ERROR;
|
IA_ERRORCODE err_code = IA_NO_ERROR;
|
||||||
|
|
||||||
|
err_code = impd_init_drc_params(
|
||||||
|
frame_size, sample_rate, gain_delay_samples, delay_mode,
|
||||||
|
sub_band_domain_mode, &p_drc_gain_dec_structs->ia_drc_params_struct);
|
||||||
|
|
||||||
err_code = impd_init_drc_params(frame_size,
|
if (err_code != IA_NO_ERROR) return (err_code);
|
||||||
sample_rate,
|
|
||||||
gain_delay_samples,
|
|
||||||
delay_mode,
|
|
||||||
sub_band_domain_mode,
|
|
||||||
&p_drc_gain_dec_structs->ia_drc_params_struct);
|
|
||||||
|
|
||||||
if (err_code!=IA_NO_ERROR)
|
impd_init_parametric_drc(
|
||||||
return (err_code);
|
p_drc_gain_dec_structs->ia_drc_params_struct.drc_frame_size, sample_rate,
|
||||||
|
sub_band_domain_mode, &p_drc_gain_dec_structs->parametricdrc_params);
|
||||||
|
|
||||||
impd_init_parametric_drc(p_drc_gain_dec_structs->ia_drc_params_struct.drc_frame_size,
|
if (err_code != IA_NO_ERROR) return (err_code);
|
||||||
sample_rate,
|
|
||||||
sub_band_domain_mode,
|
|
||||||
&p_drc_gain_dec_structs->parametricdrc_params);
|
|
||||||
|
|
||||||
if (err_code!=IA_NO_ERROR)
|
|
||||||
return (err_code);
|
|
||||||
|
|
||||||
return err_code;
|
return err_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IA_ERRORCODE impd_init_drc_decode_post_config(
|
||||||
IA_ERRORCODE impd_init_drc_decode_post_config(WORD32 audio_num_chan,
|
WORD32 audio_num_chan, WORD32* drc_set_id_processed,
|
||||||
WORD32* drc_set_id_processed,
|
WORD32* downmix_id_processed, WORD32 num_sets_processed,
|
||||||
WORD32* downmix_id_processed,
|
|
||||||
WORD32 num_sets_processed,
|
|
||||||
WORD32 eq_set_id_processed,
|
WORD32 eq_set_id_processed,
|
||||||
|
|
||||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info, pVOID* mem_ptr) {
|
||||||
pVOID *mem_ptr
|
|
||||||
)
|
|
||||||
{
|
|
||||||
|
|
||||||
IA_ERRORCODE err_code = 0;
|
IA_ERRORCODE err_code = 0;
|
||||||
WORD32 i, j, k, maxMultibandAudioSignalCount = 0;
|
WORD32 i, j, k, maxMultibandAudioSignalCount = 0;
|
||||||
ia_drc_params_struct* p_drc_params_struct = &p_drc_gain_dec_structs->ia_drc_params_struct;
|
ia_drc_params_struct* p_drc_params_struct =
|
||||||
ia_audio_in_out_buf* p_audio_in_out_buf = &p_drc_gain_dec_structs->audio_in_out_buf;
|
&p_drc_gain_dec_structs->ia_drc_params_struct;
|
||||||
|
ia_audio_in_out_buf* p_audio_in_out_buf =
|
||||||
|
&p_drc_gain_dec_structs->audio_in_out_buf;
|
||||||
|
|
||||||
for (i = 0; i < num_sets_processed; i++)
|
for (i = 0; i < num_sets_processed; i++) {
|
||||||
{
|
err_code = impd_init_selected_drc_set(
|
||||||
err_code = impd_init_selected_drc_set(pstr_drc_config,
|
pstr_drc_config, p_drc_params_struct,
|
||||||
p_drc_params_struct,
|
&p_drc_gain_dec_structs->parametricdrc_params, audio_num_chan,
|
||||||
&p_drc_gain_dec_structs->parametricdrc_params,
|
drc_set_id_processed[i], downmix_id_processed[i],
|
||||||
audio_num_chan,
|
|
||||||
drc_set_id_processed[i],
|
|
||||||
downmix_id_processed[i],
|
|
||||||
&p_drc_gain_dec_structs->ia_filter_banks_struct,
|
&p_drc_gain_dec_structs->ia_filter_banks_struct,
|
||||||
&p_drc_gain_dec_structs->str_overlap_params
|
&p_drc_gain_dec_structs->str_overlap_params,
|
||||||
,p_drc_gain_dec_structs->shape_filter_block
|
p_drc_gain_dec_structs->shape_filter_block);
|
||||||
);
|
if (err_code) return (err_code);
|
||||||
if (err_code)
|
|
||||||
return (err_code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p_drc_gain_dec_structs->audio_num_chan = audio_num_chan;
|
p_drc_gain_dec_structs->audio_num_chan = audio_num_chan;
|
||||||
p_drc_gain_dec_structs->ia_drc_params_struct.audio_delay_samples = p_drc_gain_dec_structs->ia_drc_params_struct.parametric_drc_delay;
|
p_drc_gain_dec_structs->ia_drc_params_struct.audio_delay_samples =
|
||||||
|
p_drc_gain_dec_structs->ia_drc_params_struct.parametric_drc_delay;
|
||||||
if (pstr_drc_config->str_drc_config_ext.parametric_drc_present) {
|
if (pstr_drc_config->str_drc_config_ext.parametric_drc_present) {
|
||||||
err_code = impd_init_parametric_drc_after_config(pstr_drc_config,
|
err_code = impd_init_parametric_drc_after_config(
|
||||||
pstr_loudness_info,
|
pstr_drc_config, pstr_loudness_info,
|
||||||
&p_drc_gain_dec_structs->parametricdrc_params,
|
&p_drc_gain_dec_structs->parametricdrc_params, mem_ptr);
|
||||||
mem_ptr);
|
if (err_code) return (err_code);
|
||||||
if (err_code)
|
|
||||||
return (err_code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p_audio_in_out_buf->audio_num_chan = audio_num_chan;
|
p_audio_in_out_buf->audio_num_chan = audio_num_chan;
|
||||||
p_audio_in_out_buf->audio_delay_samples = p_drc_params_struct->audio_delay_samples;
|
p_audio_in_out_buf->audio_delay_samples =
|
||||||
|
p_drc_params_struct->audio_delay_samples;
|
||||||
p_audio_in_out_buf->frame_size = p_drc_params_struct->drc_frame_size;
|
p_audio_in_out_buf->frame_size = p_drc_params_struct->drc_frame_size;
|
||||||
|
|
||||||
|
|
||||||
if (p_drc_params_struct->sub_band_domain_mode == SUBBAND_DOMAIN_MODE_QMF64) {
|
if (p_drc_params_struct->sub_band_domain_mode == SUBBAND_DOMAIN_MODE_QMF64) {
|
||||||
p_audio_in_out_buf->audio_delay_sub_band_samples = p_drc_params_struct->audio_delay_samples / AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64;
|
p_audio_in_out_buf->audio_delay_sub_band_samples =
|
||||||
p_audio_in_out_buf->audio_sub_band_frame_size = p_drc_params_struct->drc_frame_size / AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64;
|
p_drc_params_struct->audio_delay_samples /
|
||||||
|
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64;
|
||||||
|
p_audio_in_out_buf->audio_sub_band_frame_size =
|
||||||
|
p_drc_params_struct->drc_frame_size /
|
||||||
|
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF64;
|
||||||
p_audio_in_out_buf->audio_sub_band_count = AUDIO_CODEC_SUBBAND_COUNT_QMF64;
|
p_audio_in_out_buf->audio_sub_band_count = AUDIO_CODEC_SUBBAND_COUNT_QMF64;
|
||||||
}
|
} else if (p_drc_params_struct->sub_band_domain_mode ==
|
||||||
else if(p_drc_params_struct->sub_band_domain_mode == SUBBAND_DOMAIN_MODE_QMF71){
|
SUBBAND_DOMAIN_MODE_QMF71) {
|
||||||
p_audio_in_out_buf->audio_delay_sub_band_samples = p_drc_params_struct->audio_delay_samples / AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF71;
|
p_audio_in_out_buf->audio_delay_sub_band_samples =
|
||||||
p_audio_in_out_buf->audio_sub_band_frame_size = p_drc_params_struct->drc_frame_size / AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF71;
|
p_drc_params_struct->audio_delay_samples /
|
||||||
|
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF71;
|
||||||
|
p_audio_in_out_buf->audio_sub_band_frame_size =
|
||||||
|
p_drc_params_struct->drc_frame_size /
|
||||||
|
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_QMF71;
|
||||||
p_audio_in_out_buf->audio_sub_band_count = AUDIO_CODEC_SUBBAND_COUNT_QMF71;
|
p_audio_in_out_buf->audio_sub_band_count = AUDIO_CODEC_SUBBAND_COUNT_QMF71;
|
||||||
}
|
} else if (p_drc_params_struct->sub_band_domain_mode ==
|
||||||
else if(p_drc_params_struct->sub_band_domain_mode == SUBBAND_DOMAIN_MODE_STFT256){
|
SUBBAND_DOMAIN_MODE_STFT256) {
|
||||||
p_audio_in_out_buf->audio_delay_sub_band_samples = p_drc_params_struct->audio_delay_samples / AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_STFT256;
|
p_audio_in_out_buf->audio_delay_sub_band_samples =
|
||||||
p_audio_in_out_buf->audio_sub_band_frame_size = p_drc_params_struct->drc_frame_size / AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_STFT256;
|
p_drc_params_struct->audio_delay_samples /
|
||||||
p_audio_in_out_buf->audio_sub_band_count = AUDIO_CODEC_SUBBAND_COUNT_STFT256;
|
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_STFT256;
|
||||||
}
|
p_audio_in_out_buf->audio_sub_band_frame_size =
|
||||||
else{
|
p_drc_params_struct->drc_frame_size /
|
||||||
|
AUDIO_CODEC_SUBBAND_DOWNSAMPLING_FACTOR_STFT256;
|
||||||
|
p_audio_in_out_buf->audio_sub_band_count =
|
||||||
|
AUDIO_CODEC_SUBBAND_COUNT_STFT256;
|
||||||
|
} else {
|
||||||
p_audio_in_out_buf->audio_delay_sub_band_samples = 0;
|
p_audio_in_out_buf->audio_delay_sub_band_samples = 0;
|
||||||
p_audio_in_out_buf->audio_sub_band_frame_size = 0;
|
p_audio_in_out_buf->audio_sub_band_frame_size = 0;
|
||||||
p_audio_in_out_buf->audio_sub_band_count = 0;
|
p_audio_in_out_buf->audio_sub_band_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (k = 0; k < SEL_DRC_COUNT; k++) {
|
||||||
|
if (p_drc_params_struct->sel_drc_array[k].drc_instructions_index >= 0) {
|
||||||
|
ia_drc_instructions_struct* drc_instruction_str =
|
||||||
|
&(pstr_drc_config->str_drc_instruction_str
|
||||||
|
[p_drc_params_struct->sel_drc_array[k].drc_instructions_index]);
|
||||||
|
if (drc_instruction_str->gain_element_count > 0) {
|
||||||
|
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[k]
|
||||||
|
.buf_interpolation = (ia_interp_buf_struct*)*mem_ptr;
|
||||||
|
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
|
||||||
|
drc_instruction_str->gain_element_count *
|
||||||
|
sizeof(ia_interp_buf_struct) +
|
||||||
|
32);
|
||||||
|
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[k]
|
||||||
|
.buf_interpolation_count = drc_instruction_str->gain_element_count;
|
||||||
|
for (i = 0;
|
||||||
|
i < p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i]
|
||||||
|
.buf_interpolation_count;
|
||||||
|
i++) {
|
||||||
|
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i]
|
||||||
|
.buf_interpolation[i]
|
||||||
|
.str_node.time = 0;
|
||||||
|
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i]
|
||||||
|
.buf_interpolation[i]
|
||||||
|
.prev_node.time = -1;
|
||||||
|
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i]
|
||||||
|
.buf_interpolation[i]
|
||||||
|
.str_node.loc_db_gain = 0.0f;
|
||||||
|
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i]
|
||||||
|
.buf_interpolation[i]
|
||||||
|
.str_node.slope = 0.0f;
|
||||||
|
|
||||||
|
for (j = 0; j < 2 * AUDIO_CODEC_FRAME_SIZE_MAX + MAX_SIGNAL_DELAY;
|
||||||
|
j++) {
|
||||||
for (k=0; k<SEL_DRC_COUNT; k++)
|
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i]
|
||||||
{
|
.buf_interpolation[i]
|
||||||
if (p_drc_params_struct->sel_drc_array[k].drc_instructions_index >= 0)
|
.lpcm_gains[j] = 1.f;
|
||||||
{
|
|
||||||
ia_drc_instructions_struct* drc_instruction_str = &(pstr_drc_config->str_drc_instruction_str[p_drc_params_struct->sel_drc_array[k].drc_instructions_index]);
|
|
||||||
if (drc_instruction_str->gain_element_count > 0)
|
|
||||||
{
|
|
||||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[k].buf_interpolation = (ia_interp_buf_struct*)*mem_ptr;
|
|
||||||
*mem_ptr=(pVOID)((SIZE_T)*mem_ptr+drc_instruction_str->gain_element_count*sizeof(ia_interp_buf_struct)+32);
|
|
||||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[k].buf_interpolation_count = drc_instruction_str->gain_element_count;
|
|
||||||
for (i=0; i<p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i].buf_interpolation_count; i++)
|
|
||||||
{
|
|
||||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i].buf_interpolation[i].str_node.time = 0;
|
|
||||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i].buf_interpolation[i].prev_node.time = -1;
|
|
||||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i].buf_interpolation[i].str_node.loc_db_gain = 0.0f;
|
|
||||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i].buf_interpolation[i].str_node.slope = 0.0f;
|
|
||||||
|
|
||||||
for (j=0; j<2 * AUDIO_CODEC_FRAME_SIZE_MAX + MAX_SIGNAL_DELAY; j++)
|
|
||||||
{
|
|
||||||
p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[i].buf_interpolation[i].lpcm_gains[j] = 1.f;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (eq_set_id_processed > 0) {
|
||||||
|
for (i = 0; i < pstr_drc_config->str_drc_config_ext.eq_instructions_count;
|
||||||
|
i++) {
|
||||||
if (eq_set_id_processed > 0)
|
if (pstr_drc_config->str_drc_config_ext.str_eq_instructions[i]
|
||||||
{
|
.eq_set_id == eq_set_id_processed)
|
||||||
for(i=0; i<pstr_drc_config->str_drc_config_ext.eq_instructions_count; i++)
|
|
||||||
{
|
|
||||||
if (pstr_drc_config->str_drc_config_ext.str_eq_instructions[i].eq_set_id == eq_set_id_processed)
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i==pstr_drc_config->str_drc_config_ext.eq_instructions_count)
|
if (i == pstr_drc_config->str_drc_config_ext.eq_instructions_count) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
p_drc_gain_dec_structs->eq_set = (ia_eq_set_struct*)*mem_ptr;
|
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) + 32);
|
||||||
|
|
||||||
if (err_code)
|
if (err_code) return (err_code);
|
||||||
return (err_code);
|
|
||||||
|
|
||||||
err_code = impd_derive_eq_set (&pstr_drc_config->str_drc_config_ext.str_eq_coeff,
|
err_code = impd_derive_eq_set(
|
||||||
|
&pstr_drc_config->str_drc_config_ext.str_eq_coeff,
|
||||||
&(pstr_drc_config->str_drc_config_ext.str_eq_instructions[i]),
|
&(pstr_drc_config->str_drc_config_ext.str_eq_instructions[i]),
|
||||||
(FLOAT32)p_drc_gain_dec_structs->ia_drc_params_struct.sample_rate,
|
(FLOAT32)p_drc_gain_dec_structs->ia_drc_params_struct.sample_rate,
|
||||||
p_drc_gain_dec_structs->ia_drc_params_struct.drc_frame_size,
|
p_drc_gain_dec_structs->ia_drc_params_struct.drc_frame_size,
|
||||||
p_drc_gain_dec_structs->ia_drc_params_struct.sub_band_domain_mode,
|
p_drc_gain_dec_structs->ia_drc_params_struct.sub_band_domain_mode,
|
||||||
p_drc_gain_dec_structs->eq_set);
|
p_drc_gain_dec_structs->eq_set);
|
||||||
if (err_code)
|
if (err_code) return (err_code);
|
||||||
return (err_code);
|
|
||||||
|
|
||||||
impd_get_eq_set_delay (p_drc_gain_dec_structs->eq_set,
|
impd_get_eq_set_delay(
|
||||||
|
p_drc_gain_dec_structs->eq_set,
|
||||||
&p_drc_gain_dec_structs->ia_drc_params_struct.eq_delay);
|
&p_drc_gain_dec_structs->ia_drc_params_struct.eq_delay);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < p_drc_params_struct->drc_set_counter; i++) {
|
||||||
|
|
||||||
for (i=0; i<p_drc_params_struct->drc_set_counter; i++)
|
|
||||||
{
|
|
||||||
ia_drc_instructions_struct* drc_instruction_str;
|
ia_drc_instructions_struct* drc_instruction_str;
|
||||||
drc_instruction_str = &(pstr_drc_config->str_drc_instruction_str[p_drc_params_struct->sel_drc_array[i].drc_instructions_index]);
|
drc_instruction_str =
|
||||||
maxMultibandAudioSignalCount = max(maxMultibandAudioSignalCount, drc_instruction_str->multiband_audio_sig_count);
|
&(pstr_drc_config->str_drc_instruction_str
|
||||||
|
[p_drc_params_struct->sel_drc_array[i].drc_instructions_index]);
|
||||||
|
maxMultibandAudioSignalCount =
|
||||||
|
max(maxMultibandAudioSignalCount,
|
||||||
|
drc_instruction_str->multiband_audio_sig_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
p_drc_gain_dec_structs->audio_band_buffer.non_interleaved_audio = *mem_ptr;
|
p_drc_gain_dec_structs->audio_band_buffer.non_interleaved_audio = *mem_ptr;
|
||||||
*mem_ptr = (pVOID) ((SIZE_T)*mem_ptr+(maxMultibandAudioSignalCount*sizeof(FLOAT32*))+32);
|
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
|
||||||
|
(maxMultibandAudioSignalCount * sizeof(FLOAT32*)) + 32);
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
p_drc_gain_dec_structs->audio_band_buffer.multiband_audio_sig_count = maxMultibandAudioSignalCount;
|
p_drc_gain_dec_structs->audio_band_buffer.multiband_audio_sig_count =
|
||||||
p_drc_gain_dec_structs->audio_band_buffer.frame_size = p_drc_params_struct->drc_frame_size;;
|
maxMultibandAudioSignalCount;
|
||||||
|
p_drc_gain_dec_structs->audio_band_buffer.frame_size =
|
||||||
|
p_drc_params_struct->drc_frame_size;
|
||||||
|
;
|
||||||
|
|
||||||
|
if (p_drc_params_struct->sub_band_domain_mode == SUBBAND_DOMAIN_MODE_OFF &&
|
||||||
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_delay_samples) {
|
||||||
p_audio_in_out_buf->audio_io_buffer_delayed = *mem_ptr;
|
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*)) + 32);
|
||||||
p_audio_in_out_buf->audio_in_out_buf = *mem_ptr;
|
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*)) + 32);
|
||||||
|
|
||||||
for (i = 0; i < p_audio_in_out_buf->audio_num_chan; i++) {
|
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;
|
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);
|
*mem_ptr = (pVOID)((SIZE_T)*mem_ptr +
|
||||||
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];
|
((p_audio_in_out_buf->frame_size +
|
||||||
|
p_audio_in_out_buf->audio_delay_samples) *
|
||||||
|
sizeof(FLOAT32*)) +
|
||||||
|
32);
|
||||||
|
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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p_drc_params_struct->sub_band_domain_mode != SUBBAND_DOMAIN_MODE_OFF && p_audio_in_out_buf->audio_delay_sub_band_samples) {
|
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;
|
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*)) + 32);
|
||||||
p_audio_in_out_buf->audio_buffer_delayed_imag = *mem_ptr;
|
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*)) + 32);
|
||||||
p_audio_in_out_buf->audio_real_buff = *mem_ptr;
|
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*)) + 32);
|
||||||
p_audio_in_out_buf->audio_imag_buff = *mem_ptr;
|
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*)) + 32);
|
||||||
|
|
||||||
for (i = 0; i < p_audio_in_out_buf->audio_num_chan; i++) {
|
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;
|
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);
|
*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);
|
||||||
p_audio_in_out_buf->audio_buffer_delayed_imag[i] = *mem_ptr;
|
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);
|
*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);
|
||||||
|
|
||||||
p_audio_in_out_buf->audio_real_buff[i] = &p_audio_in_out_buf->audio_buffer_delayed_real[i][ p_audio_in_out_buf->audio_delay_sub_band_samples * p_audio_in_out_buf->audio_sub_band_count];
|
p_audio_in_out_buf->audio_real_buff[i] =
|
||||||
p_audio_in_out_buf->audio_imag_buff[i] = &p_audio_in_out_buf->audio_buffer_delayed_imag[i][ p_audio_in_out_buf->audio_delay_sub_band_samples * p_audio_in_out_buf->audio_sub_band_count];
|
&p_audio_in_out_buf->audio_buffer_delayed_real
|
||||||
|
[i][p_audio_in_out_buf->audio_delay_sub_band_samples *
|
||||||
|
p_audio_in_out_buf->audio_sub_band_count];
|
||||||
|
p_audio_in_out_buf->audio_imag_buff[i] =
|
||||||
|
&p_audio_in_out_buf->audio_buffer_delayed_imag
|
||||||
|
[i][p_audio_in_out_buf->audio_delay_sub_band_samples *
|
||||||
|
p_audio_in_out_buf->audio_sub_band_count];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err_code;
|
return err_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IA_ERRORCODE impd_drc_process_time_domain(
|
||||||
|
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||||
|
ia_drc_config* pstr_drc_config, ia_drc_gain_struct* pstr_drc_gain,
|
||||||
|
FLOAT32* audio_in_out_buf[], FLOAT32 loudness_normalization_gain_db,
|
||||||
IA_ERRORCODE impd_drc_process_time_domain( ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
FLOAT32 boost, FLOAT32 compress, WORD32 drc_characteristic_target) {
|
||||||
ia_drc_config* pstr_drc_config,
|
|
||||||
ia_drc_gain_struct* pstr_drc_gain,
|
|
||||||
FLOAT32* audio_in_out_buf[],
|
|
||||||
FLOAT32 loudness_normalization_gain_db,
|
|
||||||
FLOAT32 boost,
|
|
||||||
FLOAT32 compress,
|
|
||||||
WORD32 drc_characteristic_target)
|
|
||||||
{
|
|
||||||
WORD32 sel_drc_index;
|
WORD32 sel_drc_index;
|
||||||
IA_ERRORCODE err_code = 0;
|
IA_ERRORCODE err_code = 0;
|
||||||
WORD32 passThru;
|
WORD32 passThru;
|
||||||
ia_drc_instructions_struct* str_drc_instruction_str = pstr_drc_config->str_drc_instruction_str;
|
ia_drc_instructions_struct* str_drc_instruction_str =
|
||||||
|
pstr_drc_config->str_drc_instruction_str;
|
||||||
|
|
||||||
if (p_drc_gain_dec_structs->eq_set)
|
if (p_drc_gain_dec_structs->eq_set) {
|
||||||
{
|
|
||||||
WORD32 ch;
|
WORD32 ch;
|
||||||
FLOAT32* audio_channel;
|
FLOAT32* audio_channel;
|
||||||
for (ch=0; ch<p_drc_gain_dec_structs->eq_set->audio_num_chan; ch++)
|
for (ch = 0; ch < p_drc_gain_dec_structs->eq_set->audio_num_chan; ch++) {
|
||||||
{
|
|
||||||
audio_channel = audio_in_out_buf[ch];
|
audio_channel = audio_in_out_buf[ch];
|
||||||
|
|
||||||
impd_process_eq_set_time_domain(p_drc_gain_dec_structs->eq_set, ch, audio_channel, audio_channel, p_drc_gain_dec_structs->ia_drc_params_struct.drc_frame_size);
|
impd_process_eq_set_time_domain(
|
||||||
|
p_drc_gain_dec_structs->eq_set, ch, audio_channel, audio_channel,
|
||||||
|
p_drc_gain_dec_structs->ia_drc_params_struct.drc_frame_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err_code = impd_store_audio_io_buffer_time(audio_in_out_buf,
|
err_code = impd_store_audio_io_buffer_time(
|
||||||
&p_drc_gain_dec_structs->audio_in_out_buf);
|
audio_in_out_buf, &p_drc_gain_dec_structs->audio_in_out_buf);
|
||||||
if(err_code!=IA_NO_ERROR)
|
if (err_code != IA_NO_ERROR) return (err_code);
|
||||||
return (err_code);
|
|
||||||
|
|
||||||
if (pstr_drc_config->apply_drc)
|
if (pstr_drc_config->apply_drc) {
|
||||||
{
|
for (sel_drc_index = 0;
|
||||||
for (sel_drc_index=0; sel_drc_index<p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter; sel_drc_index++)
|
sel_drc_index <
|
||||||
{
|
p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter;
|
||||||
err_code = impd_get_drc_gain (p_drc_gain_dec_structs,
|
sel_drc_index++) {
|
||||||
pstr_drc_config,
|
err_code = impd_get_drc_gain(
|
||||||
pstr_drc_gain,
|
p_drc_gain_dec_structs, pstr_drc_config, pstr_drc_gain, compress,
|
||||||
compress,
|
boost, drc_characteristic_target, loudness_normalization_gain_db,
|
||||||
boost,
|
sel_drc_index, &p_drc_gain_dec_structs->drc_gain_buffers);
|
||||||
drc_characteristic_target,
|
if (err_code != IA_NO_ERROR) return (err_code);
|
||||||
loudness_normalization_gain_db,
|
|
||||||
sel_drc_index,
|
|
||||||
&p_drc_gain_dec_structs->drc_gain_buffers);
|
|
||||||
if(err_code!=IA_NO_ERROR)
|
|
||||||
return (err_code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter == 0)
|
if (p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter == 0) {
|
||||||
{
|
err_code = impd_retrieve_audio_io_buffer_time(
|
||||||
err_code = impd_retrieve_audio_io_buffer_time(audio_in_out_buf,
|
audio_in_out_buf, &p_drc_gain_dec_structs->audio_in_out_buf);
|
||||||
&p_drc_gain_dec_structs->audio_in_out_buf);
|
|
||||||
if (err_code) return (err_code);
|
if (err_code) return (err_code);
|
||||||
} else
|
} else {
|
||||||
{
|
for (sel_drc_index = 0;
|
||||||
|
sel_drc_index <
|
||||||
for (sel_drc_index=0; sel_drc_index<p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter; sel_drc_index++)
|
p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter;
|
||||||
{
|
sel_drc_index++) {
|
||||||
if (p_drc_gain_dec_structs->ia_drc_params_struct.multiband_sel_drc_idx == sel_drc_index)
|
if (p_drc_gain_dec_structs->ia_drc_params_struct
|
||||||
{
|
.multiband_sel_drc_idx == sel_drc_index) {
|
||||||
passThru = 0;
|
passThru = 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
passThru = 1;
|
passThru = 1;
|
||||||
}
|
}
|
||||||
err_code = impd_filter_banks_process(str_drc_instruction_str,
|
err_code = impd_filter_banks_process(
|
||||||
p_drc_gain_dec_structs->ia_drc_params_struct.sel_drc_array[sel_drc_index].drc_instructions_index,
|
str_drc_instruction_str,
|
||||||
|
p_drc_gain_dec_structs->ia_drc_params_struct
|
||||||
|
.sel_drc_array[sel_drc_index]
|
||||||
|
.drc_instructions_index,
|
||||||
&p_drc_gain_dec_structs->ia_drc_params_struct,
|
&p_drc_gain_dec_structs->ia_drc_params_struct,
|
||||||
p_drc_gain_dec_structs->audio_in_out_buf.audio_io_buffer_delayed,
|
p_drc_gain_dec_structs->audio_in_out_buf.audio_io_buffer_delayed,
|
||||||
&p_drc_gain_dec_structs->audio_band_buffer,
|
&p_drc_gain_dec_structs->audio_band_buffer,
|
||||||
&p_drc_gain_dec_structs->ia_filter_banks_struct,
|
&p_drc_gain_dec_structs->ia_filter_banks_struct, passThru);
|
||||||
passThru);
|
if (err_code != IA_NO_ERROR) return (err_code);
|
||||||
if(err_code!=IA_NO_ERROR)
|
|
||||||
return (err_code);
|
|
||||||
|
|
||||||
err_code = impd_apply_gains_and_add(str_drc_instruction_str,
|
err_code = impd_apply_gains_and_add(
|
||||||
p_drc_gain_dec_structs->ia_drc_params_struct.sel_drc_array[sel_drc_index].drc_instructions_index,
|
str_drc_instruction_str,
|
||||||
|
p_drc_gain_dec_structs->ia_drc_params_struct
|
||||||
|
.sel_drc_array[sel_drc_index]
|
||||||
|
.drc_instructions_index,
|
||||||
&p_drc_gain_dec_structs->ia_drc_params_struct,
|
&p_drc_gain_dec_structs->ia_drc_params_struct,
|
||||||
&(p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[sel_drc_index]),
|
&(p_drc_gain_dec_structs->drc_gain_buffers
|
||||||
|
.pstr_gain_buf[sel_drc_index]),
|
||||||
p_drc_gain_dec_structs->shape_filter_block,
|
p_drc_gain_dec_structs->shape_filter_block,
|
||||||
p_drc_gain_dec_structs->audio_band_buffer.non_interleaved_audio,
|
p_drc_gain_dec_structs->audio_band_buffer.non_interleaved_audio,
|
||||||
audio_in_out_buf,
|
audio_in_out_buf, 1);
|
||||||
1);
|
if (err_code != IA_NO_ERROR) return (err_code);
|
||||||
if(err_code!=IA_NO_ERROR)
|
|
||||||
return (err_code);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err_code = impd_advance_audio_io_buffer_time(&p_drc_gain_dec_structs->audio_in_out_buf);
|
err_code = impd_advance_audio_io_buffer_time(
|
||||||
if(err_code!=IA_NO_ERROR)
|
&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||||
return (err_code);
|
if (err_code != IA_NO_ERROR) return (err_code);
|
||||||
|
|
||||||
return err_code;
|
return err_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IA_ERRORCODE impd_drc_process_freq_domain(
|
||||||
IA_ERRORCODE impd_drc_process_freq_domain( ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_drc_config* pstr_drc_config, ia_drc_gain_struct* pstr_drc_gain,
|
||||||
ia_drc_gain_struct* pstr_drc_gain,
|
FLOAT32* audio_real_buff[], FLOAT32* audio_imag_buff[],
|
||||||
FLOAT32* audio_real_buff[],
|
FLOAT32 loudness_normalization_gain_db, FLOAT32 boost, FLOAT32 compress,
|
||||||
FLOAT32* audio_imag_buff[],
|
WORD32 drc_characteristic_target) {
|
||||||
FLOAT32 loudness_normalization_gain_db,
|
|
||||||
FLOAT32 boost,
|
|
||||||
FLOAT32 compress,
|
|
||||||
WORD32 drc_characteristic_target)
|
|
||||||
{
|
|
||||||
WORD32 sel_drc_index;
|
WORD32 sel_drc_index;
|
||||||
IA_ERRORCODE err_code = 0;
|
IA_ERRORCODE err_code = 0;
|
||||||
ia_drc_instructions_struct* str_drc_instruction_str = pstr_drc_config->str_drc_instruction_str;
|
ia_drc_instructions_struct* str_drc_instruction_str =
|
||||||
|
pstr_drc_config->str_drc_instruction_str;
|
||||||
|
|
||||||
if (p_drc_gain_dec_structs->eq_set)
|
if (p_drc_gain_dec_structs->eq_set) {
|
||||||
{
|
|
||||||
WORD32 ch;
|
WORD32 ch;
|
||||||
|
|
||||||
for (ch=0; ch<p_drc_gain_dec_structs->eq_set->audio_num_chan; ch++)
|
for (ch = 0; ch < p_drc_gain_dec_structs->eq_set->audio_num_chan; ch++) {
|
||||||
{
|
err_code = impd_process_eq_set_subband_domain(
|
||||||
err_code = impd_process_eq_set_subband_domain(p_drc_gain_dec_structs->eq_set,
|
p_drc_gain_dec_structs->eq_set, ch, audio_real_buff[ch],
|
||||||
ch,
|
|
||||||
audio_real_buff[ch],
|
|
||||||
audio_imag_buff[ch]);
|
audio_imag_buff[ch]);
|
||||||
if(err_code!=IA_NO_ERROR)
|
if (err_code != IA_NO_ERROR) return (err_code);
|
||||||
return (err_code);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err_code = impd_store_audio_io_buffer_freq(audio_real_buff,
|
err_code = impd_store_audio_io_buffer_freq(
|
||||||
audio_imag_buff,
|
audio_real_buff, audio_imag_buff,
|
||||||
&p_drc_gain_dec_structs->audio_in_out_buf);
|
&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||||
if(err_code!=IA_NO_ERROR)
|
if (err_code != IA_NO_ERROR) return (err_code);
|
||||||
return (err_code);
|
|
||||||
|
|
||||||
if (pstr_drc_config->apply_drc)
|
if (pstr_drc_config->apply_drc) {
|
||||||
{
|
for (sel_drc_index = 0;
|
||||||
for (sel_drc_index=0; sel_drc_index<p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter; sel_drc_index++)
|
sel_drc_index <
|
||||||
{
|
p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter;
|
||||||
|
sel_drc_index++) {
|
||||||
err_code = impd_get_drc_gain (p_drc_gain_dec_structs,
|
err_code = impd_get_drc_gain(
|
||||||
pstr_drc_config,
|
p_drc_gain_dec_structs, pstr_drc_config, pstr_drc_gain, compress,
|
||||||
pstr_drc_gain,
|
boost, drc_characteristic_target, loudness_normalization_gain_db,
|
||||||
compress,
|
sel_drc_index, &p_drc_gain_dec_structs->drc_gain_buffers);
|
||||||
boost,
|
if (err_code != IA_NO_ERROR) return (err_code);
|
||||||
drc_characteristic_target,
|
|
||||||
loudness_normalization_gain_db,
|
|
||||||
sel_drc_index,
|
|
||||||
&p_drc_gain_dec_structs->drc_gain_buffers);
|
|
||||||
if(err_code!=IA_NO_ERROR)
|
|
||||||
return (err_code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter == 0)
|
if (p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter == 0) {
|
||||||
{
|
err_code = impd_retrieve_audio_buffer_freq(
|
||||||
err_code = impd_retrieve_audio_buffer_freq(audio_real_buff,
|
audio_real_buff, audio_imag_buff,
|
||||||
audio_imag_buff,
|
|
||||||
&p_drc_gain_dec_structs->audio_in_out_buf);
|
&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||||
if(err_code!=IA_NO_ERROR)
|
if (err_code != IA_NO_ERROR) return (err_code);
|
||||||
return (err_code);
|
} else {
|
||||||
} else
|
for (sel_drc_index = 0;
|
||||||
{
|
sel_drc_index <
|
||||||
for (sel_drc_index=0; sel_drc_index<p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter; sel_drc_index++)
|
p_drc_gain_dec_structs->ia_drc_params_struct.drc_set_counter;
|
||||||
{
|
sel_drc_index++) {
|
||||||
err_code = impd_apply_gains_subband(str_drc_instruction_str,
|
err_code = impd_apply_gains_subband(
|
||||||
p_drc_gain_dec_structs->ia_drc_params_struct.sel_drc_array[sel_drc_index].drc_instructions_index,
|
str_drc_instruction_str,
|
||||||
|
p_drc_gain_dec_structs->ia_drc_params_struct
|
||||||
|
.sel_drc_array[sel_drc_index]
|
||||||
|
.drc_instructions_index,
|
||||||
&p_drc_gain_dec_structs->ia_drc_params_struct,
|
&p_drc_gain_dec_structs->ia_drc_params_struct,
|
||||||
&(p_drc_gain_dec_structs->drc_gain_buffers.pstr_gain_buf[sel_drc_index]),
|
&(p_drc_gain_dec_structs->drc_gain_buffers
|
||||||
|
.pstr_gain_buf[sel_drc_index]),
|
||||||
&p_drc_gain_dec_structs->str_overlap_params,
|
&p_drc_gain_dec_structs->str_overlap_params,
|
||||||
p_drc_gain_dec_structs->audio_in_out_buf.audio_buffer_delayed_real,
|
p_drc_gain_dec_structs->audio_in_out_buf.audio_buffer_delayed_real,
|
||||||
p_drc_gain_dec_structs->audio_in_out_buf.audio_buffer_delayed_imag,
|
p_drc_gain_dec_structs->audio_in_out_buf.audio_buffer_delayed_imag,
|
||||||
audio_real_buff,
|
audio_real_buff, audio_imag_buff);
|
||||||
audio_imag_buff);
|
if (err_code != IA_NO_ERROR) return (err_code);
|
||||||
if(err_code!=IA_NO_ERROR)
|
|
||||||
return (err_code);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err_code = impd_advance_audio_buff_freq(&p_drc_gain_dec_structs->audio_in_out_buf);
|
err_code =
|
||||||
|
impd_advance_audio_buff_freq(&p_drc_gain_dec_structs->audio_in_out_buf);
|
||||||
|
|
||||||
return err_code;
|
return err_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID impd_get_parametric_drc_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
VOID impd_get_parametric_drc_delay(
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||||
WORD32* parametric_drc_delay,
|
ia_drc_config* pstr_drc_config, WORD32* parametric_drc_delay,
|
||||||
WORD32* parametric_drc_delay_max)
|
WORD32* parametric_drc_delay_max) {
|
||||||
{
|
*parametric_drc_delay =
|
||||||
*parametric_drc_delay = p_drc_gain_dec_structs->ia_drc_params_struct.parametric_drc_delay;
|
p_drc_gain_dec_structs->ia_drc_params_struct.parametric_drc_delay;
|
||||||
|
|
||||||
if (pstr_drc_config->str_drc_config_ext.parametric_drc_present && pstr_drc_config->str_drc_config_ext.str_drc_coeff_param_drc.parametric_drc_delay_max_present) {
|
if (pstr_drc_config->str_drc_config_ext.parametric_drc_present &&
|
||||||
*parametric_drc_delay_max = pstr_drc_config->str_drc_config_ext.str_drc_coeff_param_drc.parametric_drc_delay_max;
|
pstr_drc_config->str_drc_config_ext.str_drc_coeff_param_drc
|
||||||
|
.parametric_drc_delay_max_present) {
|
||||||
|
*parametric_drc_delay_max =
|
||||||
|
pstr_drc_config->str_drc_config_ext.str_drc_coeff_param_drc
|
||||||
|
.parametric_drc_delay_max;
|
||||||
} else if (pstr_drc_config->str_drc_config_ext.parametric_drc_present == 0) {
|
} else if (pstr_drc_config->str_drc_config_ext.parametric_drc_present == 0) {
|
||||||
*parametric_drc_delay_max = 0;
|
*parametric_drc_delay_max = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -478,14 +484,14 @@ VOID impd_get_parametric_drc_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_struc
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID impd_get_eq_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
VOID impd_get_eq_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_drc_config* pstr_drc_config, WORD32* eq_delay,
|
||||||
WORD32* eq_delay,
|
WORD32* eq_delay_max) {
|
||||||
WORD32* eq_delay_max)
|
|
||||||
{
|
|
||||||
*eq_delay = p_drc_gain_dec_structs->ia_drc_params_struct.eq_delay;
|
*eq_delay = p_drc_gain_dec_structs->ia_drc_params_struct.eq_delay;
|
||||||
|
|
||||||
if (pstr_drc_config->str_drc_config_ext.eq_flag && pstr_drc_config->str_drc_config_ext.str_eq_coeff.eq_delay_max_present) {
|
if (pstr_drc_config->str_drc_config_ext.eq_flag &&
|
||||||
*eq_delay_max = pstr_drc_config->str_drc_config_ext.str_eq_coeff.eq_delay_max;
|
pstr_drc_config->str_drc_config_ext.str_eq_coeff.eq_delay_max_present) {
|
||||||
|
*eq_delay_max =
|
||||||
|
pstr_drc_config->str_drc_config_ext.str_eq_coeff.eq_delay_max;
|
||||||
} else if (pstr_drc_config->str_drc_config_ext.eq_flag == 0) {
|
} else if (pstr_drc_config->str_drc_config_ext.eq_flag == 0) {
|
||||||
*eq_delay_max = 0;
|
*eq_delay_max = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -494,5 +500,3 @@ VOID impd_get_eq_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,11 @@
|
||||||
#ifndef IMPD_DRC_GAIN_DECODER2_H
|
#ifndef IMPD_DRC_GAIN_DECODER2_H
|
||||||
#define IMPD_DRC_GAIN_DECODER2_H
|
#define IMPD_DRC_GAIN_DECODER2_H
|
||||||
|
|
||||||
|
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
#define M_PI (3.14159265358979323846)
|
#define M_PI (3.14159265358979323846)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct ia_drc_gain_dec_struct
|
typedef struct ia_drc_gain_dec_struct {
|
||||||
{
|
|
||||||
WORD32 audio_num_chan;
|
WORD32 audio_num_chan;
|
||||||
ia_drc_params_struct ia_drc_params_struct;
|
ia_drc_params_struct ia_drc_params_struct;
|
||||||
ia_drc_gain_buffers_struct drc_gain_buffers;
|
ia_drc_gain_buffers_struct drc_gain_buffers;
|
||||||
|
|
@ -39,69 +37,50 @@ typedef struct ia_drc_gain_dec_struct
|
||||||
ia_eq_set_struct* eq_set;
|
ia_eq_set_struct* eq_set;
|
||||||
} ia_drc_gain_dec_struct;
|
} ia_drc_gain_dec_struct;
|
||||||
|
|
||||||
|
WORD32 impd_init_drc_decode(WORD32 frame_size, WORD32 sample_rate,
|
||||||
WORD32 impd_init_drc_decode( WORD32 frame_size,
|
WORD32 gain_delay_samples, WORD32 delay_mode,
|
||||||
WORD32 sample_rate,
|
|
||||||
WORD32 gain_delay_samples,
|
|
||||||
WORD32 delay_mode,
|
|
||||||
WORD32 sub_band_domain_mode,
|
WORD32 sub_band_domain_mode,
|
||||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs);
|
ia_drc_gain_dec_struct* p_drc_gain_dec_structs);
|
||||||
|
|
||||||
WORD32 impd_init_drc_decode_post_config( WORD32 audio_num_chan,
|
WORD32 impd_init_drc_decode_post_config(
|
||||||
WORD32* drc_set_id_processed,
|
WORD32 audio_num_chan, WORD32* drc_set_id_processed,
|
||||||
WORD32* downmix_id_processed,
|
WORD32* downmix_id_processed, WORD32 num_sets_processed,
|
||||||
WORD32 num_sets_processed,
|
|
||||||
WORD32 eq_set_id_processed,
|
WORD32 eq_set_id_processed,
|
||||||
|
|
||||||
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info, pVOID* mem_ptr
|
||||||
pVOID *mem_ptr
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
WORD32 impd_drc_process_time_domain( ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
WORD32 impd_drc_process_time_domain(
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||||
ia_drc_gain_struct* pstr_drc_gain,
|
ia_drc_config* pstr_drc_config, ia_drc_gain_struct* pstr_drc_gain,
|
||||||
FLOAT32* audio_in_out_buf[],
|
FLOAT32* audio_in_out_buf[], FLOAT32 loudness_normalization_gain_db,
|
||||||
FLOAT32 loudness_normalization_gain_db,
|
FLOAT32 boost, FLOAT32 compress, WORD32 drc_characteristic);
|
||||||
FLOAT32 boost,
|
|
||||||
FLOAT32 compress,
|
WORD32 impd_drc_process_freq_domain(
|
||||||
|
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||||
|
ia_drc_config* pstr_drc_config, ia_drc_gain_struct* pstr_drc_gain,
|
||||||
|
FLOAT32* audio_real_buff[], FLOAT32* audio_imag_buff[],
|
||||||
|
FLOAT32 loudness_normalization_gain_db, FLOAT32 boost, FLOAT32 compress,
|
||||||
WORD32 drc_characteristic);
|
WORD32 drc_characteristic);
|
||||||
|
|
||||||
WORD32 impd_drc_process_freq_domain(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
VOID impd_get_parametric_drc_delay(
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||||
ia_drc_gain_struct* pstr_drc_gain,
|
ia_drc_config* pstr_drc_config, WORD32* parametric_drc_delay,
|
||||||
FLOAT32* audio_real_buff[],
|
|
||||||
FLOAT32* audio_imag_buff[],
|
|
||||||
FLOAT32 loudness_normalization_gain_db,
|
|
||||||
FLOAT32 boost,
|
|
||||||
FLOAT32 compress,
|
|
||||||
WORD32 drc_characteristic);
|
|
||||||
|
|
||||||
VOID impd_get_parametric_drc_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
|
||||||
ia_drc_config* pstr_drc_config,
|
|
||||||
WORD32* parametric_drc_delay,
|
|
||||||
WORD32* parametric_drc_delay_max);
|
WORD32* parametric_drc_delay_max);
|
||||||
|
|
||||||
VOID impd_get_eq_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
VOID impd_get_eq_delay(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_drc_config* pstr_drc_config, WORD32* eq_delay,
|
||||||
WORD32* eq_delay,
|
|
||||||
WORD32* eq_delay_max);
|
WORD32* eq_delay_max);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_get_drc_gain(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
impd_get_drc_gain(ia_drc_gain_dec_struct* p_drc_gain_dec_structs,
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_gain_struct* pstr_drc_gain,
|
ia_drc_gain_struct* pstr_drc_gain, FLOAT32 compress,
|
||||||
FLOAT32 compress,
|
FLOAT32 boost, WORD32 characteristic_index,
|
||||||
FLOAT32 boost,
|
FLOAT32 loudness_normalization_gain_db, WORD32 sub_drc_index,
|
||||||
WORD32 characteristic_index,
|
|
||||||
FLOAT32 loudness_normalization_gain_db,
|
|
||||||
WORD32 sub_drc_index,
|
|
||||||
ia_drc_gain_buffers_struct* drc_gain_buffers);
|
ia_drc_gain_buffers_struct* drc_gain_buffers);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
#ifndef IMPD_DRC_HASHDEFINES_H
|
#ifndef IMPD_DRC_HASHDEFINES_H
|
||||||
#define IMPD_DRC_HASHDEFINES_H
|
#define IMPD_DRC_HASHDEFINES_H
|
||||||
|
|
||||||
|
|
||||||
#define DEC_TYPE_TD 0
|
#define DEC_TYPE_TD 0
|
||||||
#define DEC_TYPE_TD_QMF64 1
|
#define DEC_TYPE_TD_QMF64 1
|
||||||
#define DEC_TYPE_QMF64 2
|
#define DEC_TYPE_QMF64 2
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,8 @@
|
||||||
#include "impd_drc_filter_bank.h"
|
#include "impd_drc_filter_bank.h"
|
||||||
#include "impd_drc_rom.h"
|
#include "impd_drc_rom.h"
|
||||||
|
|
||||||
|
WORD32 impd_set_default_params_selection_process(
|
||||||
WORD32 impd_set_default_params_selection_process(ia_drc_sel_proc_params_struct *pstr_drc_sel_proc_params)
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params) {
|
||||||
{
|
|
||||||
pstr_drc_sel_proc_params->base_channel_count = -1;
|
pstr_drc_sel_proc_params->base_channel_count = -1;
|
||||||
pstr_drc_sel_proc_params->base_layout = -1;
|
pstr_drc_sel_proc_params->base_layout = -1;
|
||||||
pstr_drc_sel_proc_params->target_config_request_type = 0;
|
pstr_drc_sel_proc_params->target_config_request_type = 0;
|
||||||
|
|
@ -42,101 +41,138 @@ WORD32 impd_set_default_params_selection_process(ia_drc_sel_proc_params_struct *
|
||||||
pstr_drc_sel_proc_params->loudness_normalization_on = 0;
|
pstr_drc_sel_proc_params->loudness_normalization_on = 0;
|
||||||
pstr_drc_sel_proc_params->target_loudness = -24.0f;
|
pstr_drc_sel_proc_params->target_loudness = -24.0f;
|
||||||
|
|
||||||
pstr_drc_sel_proc_params->loudness_deviation_max = LOUDNESS_DEVIATION_MAX_DEFAULT;
|
pstr_drc_sel_proc_params->loudness_deviation_max =
|
||||||
|
LOUDNESS_DEVIATION_MAX_DEFAULT;
|
||||||
|
|
||||||
pstr_drc_sel_proc_params->loudness_measurement_method = USER_METHOD_DEFINITION_DEFAULT;
|
pstr_drc_sel_proc_params->loudness_measurement_method =
|
||||||
pstr_drc_sel_proc_params->loudness_measurement_system = USER_MEASUREMENT_SYSTEM_DEFAULT;
|
USER_METHOD_DEFINITION_DEFAULT;
|
||||||
pstr_drc_sel_proc_params->loudness_measurement_pre_proc = USER_LOUDNESS_PREPROCESSING_DEFAULT;
|
pstr_drc_sel_proc_params->loudness_measurement_system =
|
||||||
|
USER_MEASUREMENT_SYSTEM_DEFAULT;
|
||||||
|
pstr_drc_sel_proc_params->loudness_measurement_pre_proc =
|
||||||
|
USER_LOUDNESS_PREPROCESSING_DEFAULT;
|
||||||
pstr_drc_sel_proc_params->device_cut_off_frequency = 500;
|
pstr_drc_sel_proc_params->device_cut_off_frequency = 500;
|
||||||
pstr_drc_sel_proc_params->loudness_norm_gain_db_max = LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT;
|
pstr_drc_sel_proc_params->loudness_norm_gain_db_max =
|
||||||
|
LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT;
|
||||||
pstr_drc_sel_proc_params->loudness_norm_gain_modification_db = 0.0f;
|
pstr_drc_sel_proc_params->loudness_norm_gain_modification_db = 0.0f;
|
||||||
pstr_drc_sel_proc_params->output_peak_level_max = 0.0f;
|
pstr_drc_sel_proc_params->output_peak_level_max = 0.0f;
|
||||||
if (pstr_drc_sel_proc_params->peak_limiter == 1) {
|
if (pstr_drc_sel_proc_params->peak_limiter == 1) {
|
||||||
|
|
||||||
pstr_drc_sel_proc_params->output_peak_level_max = 6.0f;
|
pstr_drc_sel_proc_params->output_peak_level_max = 6.0f;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pstr_drc_sel_proc_params->dynamic_range_control_on = 1;
|
pstr_drc_sel_proc_params->dynamic_range_control_on = 1;
|
||||||
pstr_drc_sel_proc_params->num_bands_supported = 4;
|
pstr_drc_sel_proc_params->num_bands_supported = 4;
|
||||||
pstr_drc_sel_proc_params->num_drc_feature_requests = 0;
|
pstr_drc_sel_proc_params->num_drc_feature_requests = 0;
|
||||||
|
|
||||||
|
|
||||||
pstr_drc_sel_proc_params->boost = 1.f;
|
pstr_drc_sel_proc_params->boost = 1.f;
|
||||||
pstr_drc_sel_proc_params->compress = 1.f;
|
pstr_drc_sel_proc_params->compress = 1.f;
|
||||||
pstr_drc_sel_proc_params->drc_characteristic_target = 0;
|
pstr_drc_sel_proc_params->drc_characteristic_target = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
WORD32 impd_set_custom_params(const WORD32 param_set_idx,
|
WORD32 impd_set_custom_params(
|
||||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params)
|
const WORD32 param_set_idx,
|
||||||
{
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params) {
|
||||||
WORD32 i, k;
|
WORD32 i, k;
|
||||||
|
|
||||||
const ia_loc_sys_interface_struct* system_interface = &(loc_sys_interface[param_set_idx-1]);
|
const ia_loc_sys_interface_struct* system_interface =
|
||||||
|
&(loc_sys_interface[param_set_idx - 1]);
|
||||||
|
|
||||||
const ia_loc_loudness_norm_ctrl_interface_struct* loudness_norm_ctrl_interface = &(loc_loudness_norm_ctrl_interface[param_set_idx-1]);
|
const ia_loc_loudness_norm_ctrl_interface_struct*
|
||||||
const ia_loc_loudness_norm_param_interface_struct* loudness_norm_param_interface = &(loc_loudness_norm_param_interface[param_set_idx-1]);
|
loudness_norm_ctrl_interface =
|
||||||
|
&(loc_loudness_norm_ctrl_interface[param_set_idx - 1]);
|
||||||
|
const ia_loc_loudness_norm_param_interface_struct*
|
||||||
|
loudness_norm_param_interface =
|
||||||
|
&(loc_loudness_norm_param_interface[param_set_idx - 1]);
|
||||||
|
|
||||||
const ia_loc_drc_interface_struct* drc_ctrl_interface = &(loc_dyn_range_ctrl_interface[param_set_idx-1]);
|
const ia_loc_drc_interface_struct* drc_ctrl_interface =
|
||||||
const ia_loc_requested_drc_effect_struct* requested_drc_effect_type = &(loc_requested_drc_effect_type_str[param_set_idx-1]);
|
&(loc_dyn_range_ctrl_interface[param_set_idx - 1]);
|
||||||
const ia_loc_drc_parameter_interface_struct* drc_parameter_interface = &(loc_drc_parameter_interface[param_set_idx-1]);
|
const ia_loc_requested_drc_effect_struct* requested_drc_effect_type =
|
||||||
|
&(loc_requested_drc_effect_type_str[param_set_idx - 1]);
|
||||||
|
const ia_loc_drc_parameter_interface_struct* drc_parameter_interface =
|
||||||
|
&(loc_drc_parameter_interface[param_set_idx - 1]);
|
||||||
|
|
||||||
pstr_drc_sel_proc_params->target_config_request_type = system_interface->target_config_request_type;
|
pstr_drc_sel_proc_params->target_config_request_type =
|
||||||
|
system_interface->target_config_request_type;
|
||||||
switch (system_interface->target_config_request_type) {
|
switch (system_interface->target_config_request_type) {
|
||||||
case 1:
|
case 1:
|
||||||
pstr_drc_sel_proc_params->requested_target_layout = system_interface->requested_target_layout;
|
pstr_drc_sel_proc_params->requested_target_layout =
|
||||||
|
system_interface->requested_target_layout;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
pstr_drc_sel_proc_params->requested_target_ch_count = system_interface->requested_target_ch_count;
|
pstr_drc_sel_proc_params->requested_target_ch_count =
|
||||||
|
system_interface->requested_target_ch_count;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
pstr_drc_sel_proc_params->num_downmix_id_requests = system_interface->num_downmix_id_requests;
|
pstr_drc_sel_proc_params->num_downmix_id_requests =
|
||||||
|
system_interface->num_downmix_id_requests;
|
||||||
for (i = 0; i < system_interface->num_downmix_id_requests; i++) {
|
for (i = 0; i < system_interface->num_downmix_id_requests; i++) {
|
||||||
pstr_drc_sel_proc_params->requested_dwnmix_id[i] = system_interface->requested_dwnmix_id[i];
|
pstr_drc_sel_proc_params->requested_dwnmix_id[i] =
|
||||||
|
system_interface->requested_dwnmix_id[i];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pstr_drc_sel_proc_params->loudness_normalization_on = loudness_norm_ctrl_interface->loudness_normalization_on;
|
pstr_drc_sel_proc_params->loudness_normalization_on =
|
||||||
pstr_drc_sel_proc_params->target_loudness = loudness_norm_ctrl_interface->target_loudness;
|
loudness_norm_ctrl_interface->loudness_normalization_on;
|
||||||
|
pstr_drc_sel_proc_params->target_loudness =
|
||||||
|
loudness_norm_ctrl_interface->target_loudness;
|
||||||
|
|
||||||
pstr_drc_sel_proc_params->album_mode = loudness_norm_param_interface->album_mode;
|
pstr_drc_sel_proc_params->album_mode =
|
||||||
pstr_drc_sel_proc_params->peak_limiter = loudness_norm_param_interface->peak_limiter;
|
loudness_norm_param_interface->album_mode;
|
||||||
pstr_drc_sel_proc_params->loudness_deviation_max = loudness_norm_param_interface->loudness_deviation_max;
|
pstr_drc_sel_proc_params->peak_limiter =
|
||||||
pstr_drc_sel_proc_params->loudness_measurement_method = loudness_norm_param_interface->loudness_measurement_method;
|
loudness_norm_param_interface->peak_limiter;
|
||||||
pstr_drc_sel_proc_params->loudness_measurement_system = loudness_norm_param_interface->loudness_measurement_system;
|
pstr_drc_sel_proc_params->loudness_deviation_max =
|
||||||
pstr_drc_sel_proc_params->loudness_measurement_pre_proc = loudness_norm_param_interface->loudness_measurement_pre_proc;
|
loudness_norm_param_interface->loudness_deviation_max;
|
||||||
pstr_drc_sel_proc_params->device_cut_off_frequency= loudness_norm_param_interface->device_cut_off_frequency;
|
pstr_drc_sel_proc_params->loudness_measurement_method =
|
||||||
pstr_drc_sel_proc_params->loudness_norm_gain_db_max = loudness_norm_param_interface->loudness_norm_gain_db_max;
|
loudness_norm_param_interface->loudness_measurement_method;
|
||||||
pstr_drc_sel_proc_params->loudness_norm_gain_modification_db = loudness_norm_param_interface->loudness_norm_gain_modification_db;
|
pstr_drc_sel_proc_params->loudness_measurement_system =
|
||||||
pstr_drc_sel_proc_params->output_peak_level_max = loudness_norm_param_interface->output_peak_level_max;
|
loudness_norm_param_interface->loudness_measurement_system;
|
||||||
|
pstr_drc_sel_proc_params->loudness_measurement_pre_proc =
|
||||||
|
loudness_norm_param_interface->loudness_measurement_pre_proc;
|
||||||
|
pstr_drc_sel_proc_params->device_cut_off_frequency =
|
||||||
|
loudness_norm_param_interface->device_cut_off_frequency;
|
||||||
|
pstr_drc_sel_proc_params->loudness_norm_gain_db_max =
|
||||||
|
loudness_norm_param_interface->loudness_norm_gain_db_max;
|
||||||
|
pstr_drc_sel_proc_params->loudness_norm_gain_modification_db =
|
||||||
|
loudness_norm_param_interface->loudness_norm_gain_modification_db;
|
||||||
|
pstr_drc_sel_proc_params->output_peak_level_max =
|
||||||
|
loudness_norm_param_interface->output_peak_level_max;
|
||||||
|
|
||||||
pstr_drc_sel_proc_params->dynamic_range_control_on = drc_ctrl_interface->dynamic_range_control_on;
|
pstr_drc_sel_proc_params->dynamic_range_control_on =
|
||||||
pstr_drc_sel_proc_params->num_drc_feature_requests = drc_ctrl_interface->num_drc_feature_requests;
|
drc_ctrl_interface->dynamic_range_control_on;
|
||||||
for (i=0; i<drc_ctrl_interface->num_drc_feature_requests; i++)
|
pstr_drc_sel_proc_params->num_drc_feature_requests =
|
||||||
{
|
drc_ctrl_interface->num_drc_feature_requests;
|
||||||
pstr_drc_sel_proc_params->drc_feature_req_type[i] = drc_ctrl_interface->drc_feature_req_type[i];
|
for (i = 0; i < drc_ctrl_interface->num_drc_feature_requests; i++) {
|
||||||
switch (drc_ctrl_interface->drc_feature_req_type[i])
|
pstr_drc_sel_proc_params->drc_feature_req_type[i] =
|
||||||
{
|
drc_ctrl_interface->drc_feature_req_type[i];
|
||||||
|
switch (drc_ctrl_interface->drc_feature_req_type[i]) {
|
||||||
case MATCH_EFFECT_TYPE:
|
case MATCH_EFFECT_TYPE:
|
||||||
pstr_drc_sel_proc_params->requested_num_drc_effects[i] = requested_drc_effect_type->requested_num_drc_effects;
|
pstr_drc_sel_proc_params->requested_num_drc_effects[i] =
|
||||||
pstr_drc_sel_proc_params->desired_num_drc_effects_of_requested[i] = requested_drc_effect_type->desired_num_drc_effects_of_requested;
|
requested_drc_effect_type->requested_num_drc_effects;
|
||||||
for (k=0; k<requested_drc_effect_type->requested_num_drc_effects; k++)
|
pstr_drc_sel_proc_params->desired_num_drc_effects_of_requested[i] =
|
||||||
{
|
requested_drc_effect_type->desired_num_drc_effects_of_requested;
|
||||||
pstr_drc_sel_proc_params->requested_drc_effect_type[i][k] = requested_drc_effect_type->requested_drc_effect_type[k];
|
for (k = 0; k < requested_drc_effect_type->requested_num_drc_effects;
|
||||||
|
k++) {
|
||||||
|
pstr_drc_sel_proc_params->requested_drc_effect_type[i][k] =
|
||||||
|
requested_drc_effect_type->requested_drc_effect_type[k];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MATCH_DYNAMIC_RANGE:
|
case MATCH_DYNAMIC_RANGE:
|
||||||
pstr_drc_sel_proc_params->requested_dyn_range_measur_type[i] = drc_ctrl_interface->requested_dyn_rng_measurement_type;
|
pstr_drc_sel_proc_params->requested_dyn_range_measur_type[i] =
|
||||||
pstr_drc_sel_proc_params->requested_dyn_range_range_flag[i] = drc_ctrl_interface->requested_dyn_range_is_single_val_flag;
|
drc_ctrl_interface->requested_dyn_rng_measurement_type;
|
||||||
pstr_drc_sel_proc_params->requested_dyn_range_value[i] = drc_ctrl_interface->requested_dyn_range_value;
|
pstr_drc_sel_proc_params->requested_dyn_range_range_flag[i] =
|
||||||
pstr_drc_sel_proc_params->requested_dyn_range_min_val[i] = drc_ctrl_interface->requested_dyn_range_min_val;
|
drc_ctrl_interface->requested_dyn_range_is_single_val_flag;
|
||||||
pstr_drc_sel_proc_params->requested_dyn_range_max_val[i] = drc_ctrl_interface->requested_dyn_range_max_val;
|
pstr_drc_sel_proc_params->requested_dyn_range_value[i] =
|
||||||
|
drc_ctrl_interface->requested_dyn_range_value;
|
||||||
|
pstr_drc_sel_proc_params->requested_dyn_range_min_val[i] =
|
||||||
|
drc_ctrl_interface->requested_dyn_range_min_val;
|
||||||
|
pstr_drc_sel_proc_params->requested_dyn_range_max_val[i] =
|
||||||
|
drc_ctrl_interface->requested_dyn_range_max_val;
|
||||||
break;
|
break;
|
||||||
case MATCH_DRC_CHARACTERISTIC:
|
case MATCH_DRC_CHARACTERISTIC:
|
||||||
pstr_drc_sel_proc_params->requested_drc_characteristic[i] = drc_ctrl_interface->requested_drc_characteristic;
|
pstr_drc_sel_proc_params->requested_drc_characteristic[i] =
|
||||||
|
drc_ctrl_interface->requested_drc_characteristic;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return (UNEXPECTED_ERROR);
|
return (UNEXPECTED_ERROR);
|
||||||
|
|
@ -145,16 +181,17 @@ WORD32 impd_set_custom_params(const WORD32 param_set_idx,
|
||||||
|
|
||||||
pstr_drc_sel_proc_params->boost = drc_parameter_interface->boost;
|
pstr_drc_sel_proc_params->boost = drc_parameter_interface->boost;
|
||||||
pstr_drc_sel_proc_params->compress = drc_parameter_interface->compress;
|
pstr_drc_sel_proc_params->compress = drc_parameter_interface->compress;
|
||||||
pstr_drc_sel_proc_params->drc_characteristic_target = drc_parameter_interface->drc_characteristic_target;
|
pstr_drc_sel_proc_params->drc_characteristic_target =
|
||||||
|
drc_parameter_interface->drc_characteristic_target;
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
WORD32 impd_eval_custom_params_selection_process(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params)
|
WORD32 impd_eval_custom_params_selection_process(
|
||||||
{
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params) {
|
||||||
pstr_drc_sel_proc_params->loudness_norm_gain_db_max = max (0.0f, pstr_drc_sel_proc_params->loudness_norm_gain_db_max);
|
pstr_drc_sel_proc_params->loudness_norm_gain_db_max =
|
||||||
pstr_drc_sel_proc_params->loudness_deviation_max = max (0, pstr_drc_sel_proc_params->loudness_deviation_max);
|
max(0.0f, pstr_drc_sel_proc_params->loudness_norm_gain_db_max);
|
||||||
|
pstr_drc_sel_proc_params->loudness_deviation_max =
|
||||||
|
max(0, pstr_drc_sel_proc_params->loudness_deviation_max);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,15 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
WORD32 impd_set_default_params_selection_process(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params);
|
WORD32 impd_set_default_params_selection_process(
|
||||||
|
|
||||||
WORD32 impd_set_custom_params(const WORD32 param_set_idx,
|
|
||||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params);
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params);
|
||||||
|
|
||||||
WORD32 impd_eval_custom_params_selection_process(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params);
|
WORD32 impd_set_custom_params(
|
||||||
|
const WORD32 param_set_idx,
|
||||||
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params);
|
||||||
|
|
||||||
|
WORD32 impd_eval_custom_params_selection_process(
|
||||||
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,39 +42,34 @@
|
||||||
#include "impd_drc_peak_limiter.h"
|
#include "impd_drc_peak_limiter.h"
|
||||||
#include "impd_drc_host_params.h"
|
#include "impd_drc_host_params.h"
|
||||||
|
|
||||||
|
|
||||||
#define PARAMETRIC_DRC_DELAY_MAX_DEFAULT 4096
|
#define PARAMETRIC_DRC_DELAY_MAX_DEFAULT 4096
|
||||||
#define EQ_DELAY_MAX_DEFAULT 256
|
#define EQ_DELAY_MAX_DEFAULT 256
|
||||||
|
|
||||||
IA_ERRORCODE impd_drc_mem_api(ia_drc_api_struct *p_obj_drc,
|
IA_ERRORCODE impd_drc_mem_api(ia_drc_api_struct *p_obj_drc, WORD32 iCmd,
|
||||||
WORD32 iCmd, WORD32 iIdx, pVOID pvValue);
|
WORD32 iIdx, pVOID pvValue);
|
||||||
|
|
||||||
IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc);
|
IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_dec_interface_process(
|
impd_drc_dec_interface_process(ia_bit_buf_struct *it_bit_buff,
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
|
||||||
ia_drc_interface_struct *pstr_drc_interface,
|
ia_drc_interface_struct *pstr_drc_interface,
|
||||||
UWORD8* it_bit_buf,
|
UWORD8 *it_bit_buf, WORD32 num_bit_stream_bits,
|
||||||
WORD32 num_bit_stream_bits,
|
|
||||||
WORD32 *num_bits_read);
|
WORD32 *num_bits_read);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_dec_interface_add_effect_type(ia_drc_interface_struct* pstr_drc_interface,
|
impd_drc_dec_interface_add_effect_type(
|
||||||
WORD32 drc_effect_type,WORD32 target_loudness, WORD32 loud_norm);
|
ia_drc_interface_struct *pstr_drc_interface, WORD32 drc_effect_type,
|
||||||
|
WORD32 target_loudness, WORD32 loud_norm);
|
||||||
|
|
||||||
#define NUM_GAIN_DEC_INSTANCES 2
|
#define NUM_GAIN_DEC_INSTANCES 2
|
||||||
|
|
||||||
#define BITSTREAM_FILE_FORMAT_SPLIT 1
|
#define BITSTREAM_FILE_FORMAT_SPLIT 1
|
||||||
#define LIM_DEFAULT_THRESHOLD (0.89125094f)
|
#define LIM_DEFAULT_THRESHOLD (0.89125094f)
|
||||||
|
|
||||||
static WORD32 impd_match_downmix(WORD32 downmix_id, WORD32 dec_downmix_id)
|
static WORD32 impd_match_downmix(WORD32 downmix_id, WORD32 dec_downmix_id) {
|
||||||
{
|
|
||||||
WORD32 id_match = 0;
|
WORD32 id_match = 0;
|
||||||
|
|
||||||
switch (dec_downmix_id )
|
switch (dec_downmix_id) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
id_match = (downmix_id == 0);
|
id_match = (downmix_id == 0);
|
||||||
break;
|
break;
|
||||||
|
|
@ -94,8 +89,7 @@ static WORD32 impd_match_downmix(WORD32 downmix_id, WORD32 dec_downmix_id)
|
||||||
return id_match;
|
return id_match;
|
||||||
}
|
}
|
||||||
|
|
||||||
IA_ERRORCODE impd_drc_set_default_config(ia_drc_api_struct *p_obj_drc)
|
IA_ERRORCODE impd_drc_set_default_config(ia_drc_api_struct *p_obj_drc) {
|
||||||
{
|
|
||||||
p_obj_drc->str_config.bitstream_file_format = 0;
|
p_obj_drc->str_config.bitstream_file_format = 0;
|
||||||
p_obj_drc->str_config.dec_type = 0;
|
p_obj_drc->str_config.dec_type = 0;
|
||||||
p_obj_drc->str_config.sub_band_domain_mode = 0;
|
p_obj_drc->str_config.sub_band_domain_mode = 0;
|
||||||
|
|
@ -134,9 +128,8 @@ IA_ERRORCODE impd_drc_set_default_config(ia_drc_api_struct *p_obj_drc)
|
||||||
return IA_NO_ERROR;
|
return IA_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IA_ERRORCODE impd_drc_set_default_bitstream_config(
|
||||||
IA_ERRORCODE impd_drc_set_default_bitstream_config(ia_drc_config *pstr_drc_config)
|
ia_drc_config *pstr_drc_config) {
|
||||||
{
|
|
||||||
WORD32 i;
|
WORD32 i;
|
||||||
|
|
||||||
pstr_drc_config->sample_rate_present = 0;
|
pstr_drc_config->sample_rate_present = 0;
|
||||||
|
|
@ -157,32 +150,50 @@ IA_ERRORCODE impd_drc_set_default_bitstream_config(ia_drc_config *pstr_drc_confi
|
||||||
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].version = 1;
|
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].version = 1;
|
||||||
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].drc_location = 1;
|
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].drc_location = 1;
|
||||||
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_count = 4;
|
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_count = 4;
|
||||||
for(i=0;i<pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_count;i++)
|
for (i = 0;
|
||||||
{
|
i <
|
||||||
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params[i].gain_interpolation_type=1;
|
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_count;
|
||||||
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params[i].band_count=1;
|
i++) {
|
||||||
|
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0]
|
||||||
|
.gain_set_params[i]
|
||||||
|
.gain_interpolation_type = 1;
|
||||||
|
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0]
|
||||||
|
.gain_set_params[i]
|
||||||
|
.band_count = 1;
|
||||||
}
|
}
|
||||||
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_sequence_count=4;
|
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_sequence_count =
|
||||||
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params_index_for_gain_sequence[0]=0;
|
4;
|
||||||
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params_index_for_gain_sequence[1]=1;
|
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0]
|
||||||
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params_index_for_gain_sequence[2]=2;
|
.gain_set_params_index_for_gain_sequence[0] = 0;
|
||||||
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params_index_for_gain_sequence[3]=3;
|
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0]
|
||||||
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_count_plus=4;
|
.gain_set_params_index_for_gain_sequence[1] = 1;
|
||||||
|
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0]
|
||||||
|
.gain_set_params_index_for_gain_sequence[2] = 2;
|
||||||
|
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0]
|
||||||
|
.gain_set_params_index_for_gain_sequence[3] = 3;
|
||||||
|
pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_count_plus =
|
||||||
|
4;
|
||||||
pstr_drc_config->str_drc_instruction_str[0].drc_set_id = 1;
|
pstr_drc_config->str_drc_instruction_str[0].drc_set_id = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[0].drc_set_complexity_level = 2;
|
pstr_drc_config->str_drc_instruction_str[0].drc_set_complexity_level = 2;
|
||||||
pstr_drc_config->str_drc_instruction_str[0].drc_location = 1;
|
pstr_drc_config->str_drc_instruction_str[0].drc_location = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[0].dwnmix_id_count = 1;
|
pstr_drc_config->str_drc_instruction_str[0].dwnmix_id_count = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[0].drc_set_effect = 1;
|
pstr_drc_config->str_drc_instruction_str[0].drc_set_effect = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[0].gain_set_index[1] = 1;
|
pstr_drc_config->str_drc_instruction_str[0].gain_set_index[1] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[0].drc_set_target_loudness_value_lower=-63;
|
pstr_drc_config->str_drc_instruction_str[0]
|
||||||
|
.drc_set_target_loudness_value_lower = -63;
|
||||||
pstr_drc_config->str_drc_instruction_str[0].num_drc_ch_groups = 2;
|
pstr_drc_config->str_drc_instruction_str[0].num_drc_ch_groups = 2;
|
||||||
pstr_drc_config->str_drc_instruction_str[0].gain_set_index_for_channel_group[1]=1;
|
pstr_drc_config->str_drc_instruction_str[0]
|
||||||
|
.gain_set_index_for_channel_group[1] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[0].band_count_of_ch_group[0] = 1;
|
pstr_drc_config->str_drc_instruction_str[0].band_count_of_ch_group[0] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[0].band_count_of_ch_group[1] = 1;
|
pstr_drc_config->str_drc_instruction_str[0].band_count_of_ch_group[1] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[0].gain_interpolation_type_for_channel_group[0]=1;
|
pstr_drc_config->str_drc_instruction_str[0]
|
||||||
pstr_drc_config->str_drc_instruction_str[0].gain_interpolation_type_for_channel_group[1]=1;
|
.gain_interpolation_type_for_channel_group[0] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[0].time_delta_min_for_channel_group[0]=32;
|
pstr_drc_config->str_drc_instruction_str[0]
|
||||||
pstr_drc_config->str_drc_instruction_str[0].time_delta_min_for_channel_group[1]=32;
|
.gain_interpolation_type_for_channel_group[1] = 1;
|
||||||
|
pstr_drc_config->str_drc_instruction_str[0]
|
||||||
|
.time_delta_min_for_channel_group[0] = 32;
|
||||||
|
pstr_drc_config->str_drc_instruction_str[0]
|
||||||
|
.time_delta_min_for_channel_group[1] = 32;
|
||||||
pstr_drc_config->str_drc_instruction_str[0].channel_group_of_ch[1] = 1;
|
pstr_drc_config->str_drc_instruction_str[0].channel_group_of_ch[1] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[0].gain_element_count = 2;
|
pstr_drc_config->str_drc_instruction_str[0].gain_element_count = 2;
|
||||||
|
|
||||||
|
|
@ -193,16 +204,23 @@ IA_ERRORCODE impd_drc_set_default_bitstream_config(ia_drc_config *pstr_drc_confi
|
||||||
pstr_drc_config->str_drc_instruction_str[1].drc_set_effect = 2;
|
pstr_drc_config->str_drc_instruction_str[1].drc_set_effect = 2;
|
||||||
pstr_drc_config->str_drc_instruction_str[1].gain_set_index[0] = 1;
|
pstr_drc_config->str_drc_instruction_str[1].gain_set_index[0] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[1].gain_set_index[1] = 2;
|
pstr_drc_config->str_drc_instruction_str[1].gain_set_index[1] = 2;
|
||||||
pstr_drc_config->str_drc_instruction_str[1].drc_set_target_loudness_value_lower=-63;
|
pstr_drc_config->str_drc_instruction_str[1]
|
||||||
|
.drc_set_target_loudness_value_lower = -63;
|
||||||
pstr_drc_config->str_drc_instruction_str[1].num_drc_ch_groups = 2;
|
pstr_drc_config->str_drc_instruction_str[1].num_drc_ch_groups = 2;
|
||||||
pstr_drc_config->str_drc_instruction_str[1].gain_set_index_for_channel_group[0]=1;
|
pstr_drc_config->str_drc_instruction_str[1]
|
||||||
pstr_drc_config->str_drc_instruction_str[1].gain_set_index_for_channel_group[1]=2;
|
.gain_set_index_for_channel_group[0] = 1;
|
||||||
|
pstr_drc_config->str_drc_instruction_str[1]
|
||||||
|
.gain_set_index_for_channel_group[1] = 2;
|
||||||
pstr_drc_config->str_drc_instruction_str[1].band_count_of_ch_group[0] = 1;
|
pstr_drc_config->str_drc_instruction_str[1].band_count_of_ch_group[0] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[1].band_count_of_ch_group[1] = 1;
|
pstr_drc_config->str_drc_instruction_str[1].band_count_of_ch_group[1] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[1].gain_interpolation_type_for_channel_group[0]=1;
|
pstr_drc_config->str_drc_instruction_str[1]
|
||||||
pstr_drc_config->str_drc_instruction_str[1].gain_interpolation_type_for_channel_group[1]=1;
|
.gain_interpolation_type_for_channel_group[0] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[1].time_delta_min_for_channel_group[0]=32;
|
pstr_drc_config->str_drc_instruction_str[1]
|
||||||
pstr_drc_config->str_drc_instruction_str[1].time_delta_min_for_channel_group[1]=32;
|
.gain_interpolation_type_for_channel_group[1] = 1;
|
||||||
|
pstr_drc_config->str_drc_instruction_str[1]
|
||||||
|
.time_delta_min_for_channel_group[0] = 32;
|
||||||
|
pstr_drc_config->str_drc_instruction_str[1]
|
||||||
|
.time_delta_min_for_channel_group[1] = 32;
|
||||||
pstr_drc_config->str_drc_instruction_str[1].channel_group_of_ch[1] = 1;
|
pstr_drc_config->str_drc_instruction_str[1].channel_group_of_ch[1] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[1].gain_element_count = 2;
|
pstr_drc_config->str_drc_instruction_str[1].gain_element_count = 2;
|
||||||
|
|
||||||
|
|
@ -213,16 +231,23 @@ IA_ERRORCODE impd_drc_set_default_bitstream_config(ia_drc_config *pstr_drc_confi
|
||||||
pstr_drc_config->str_drc_instruction_str[2].drc_set_effect = 4;
|
pstr_drc_config->str_drc_instruction_str[2].drc_set_effect = 4;
|
||||||
pstr_drc_config->str_drc_instruction_str[2].gain_set_index[0] = 2;
|
pstr_drc_config->str_drc_instruction_str[2].gain_set_index[0] = 2;
|
||||||
pstr_drc_config->str_drc_instruction_str[2].gain_set_index[1] = 3;
|
pstr_drc_config->str_drc_instruction_str[2].gain_set_index[1] = 3;
|
||||||
pstr_drc_config->str_drc_instruction_str[2].drc_set_target_loudness_value_lower=-63;
|
pstr_drc_config->str_drc_instruction_str[2]
|
||||||
|
.drc_set_target_loudness_value_lower = -63;
|
||||||
pstr_drc_config->str_drc_instruction_str[2].num_drc_ch_groups = 2;
|
pstr_drc_config->str_drc_instruction_str[2].num_drc_ch_groups = 2;
|
||||||
pstr_drc_config->str_drc_instruction_str[2].gain_set_index_for_channel_group[0]=2;
|
pstr_drc_config->str_drc_instruction_str[2]
|
||||||
pstr_drc_config->str_drc_instruction_str[2].gain_set_index_for_channel_group[1]=3;
|
.gain_set_index_for_channel_group[0] = 2;
|
||||||
|
pstr_drc_config->str_drc_instruction_str[2]
|
||||||
|
.gain_set_index_for_channel_group[1] = 3;
|
||||||
pstr_drc_config->str_drc_instruction_str[2].band_count_of_ch_group[0] = 1;
|
pstr_drc_config->str_drc_instruction_str[2].band_count_of_ch_group[0] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[2].band_count_of_ch_group[1] = 1;
|
pstr_drc_config->str_drc_instruction_str[2].band_count_of_ch_group[1] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[2].gain_interpolation_type_for_channel_group[0]=1;
|
pstr_drc_config->str_drc_instruction_str[2]
|
||||||
pstr_drc_config->str_drc_instruction_str[2].gain_interpolation_type_for_channel_group[1]=1;
|
.gain_interpolation_type_for_channel_group[0] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[2].time_delta_min_for_channel_group[0]=32;
|
pstr_drc_config->str_drc_instruction_str[2]
|
||||||
pstr_drc_config->str_drc_instruction_str[2].time_delta_min_for_channel_group[1]=32;
|
.gain_interpolation_type_for_channel_group[1] = 1;
|
||||||
|
pstr_drc_config->str_drc_instruction_str[2]
|
||||||
|
.time_delta_min_for_channel_group[0] = 32;
|
||||||
|
pstr_drc_config->str_drc_instruction_str[2]
|
||||||
|
.time_delta_min_for_channel_group[1] = 32;
|
||||||
pstr_drc_config->str_drc_instruction_str[2].channel_group_of_ch[1] = 1;
|
pstr_drc_config->str_drc_instruction_str[2].channel_group_of_ch[1] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[2].gain_element_count = 2;
|
pstr_drc_config->str_drc_instruction_str[2].gain_element_count = 2;
|
||||||
|
|
||||||
|
|
@ -233,16 +258,23 @@ IA_ERRORCODE impd_drc_set_default_bitstream_config(ia_drc_config *pstr_drc_confi
|
||||||
pstr_drc_config->str_drc_instruction_str[3].drc_set_effect = 32;
|
pstr_drc_config->str_drc_instruction_str[3].drc_set_effect = 32;
|
||||||
pstr_drc_config->str_drc_instruction_str[3].gain_set_index[0] = 3;
|
pstr_drc_config->str_drc_instruction_str[3].gain_set_index[0] = 3;
|
||||||
pstr_drc_config->str_drc_instruction_str[3].gain_set_index[1] = 0;
|
pstr_drc_config->str_drc_instruction_str[3].gain_set_index[1] = 0;
|
||||||
pstr_drc_config->str_drc_instruction_str[3].drc_set_target_loudness_value_lower=-63;
|
pstr_drc_config->str_drc_instruction_str[3]
|
||||||
|
.drc_set_target_loudness_value_lower = -63;
|
||||||
pstr_drc_config->str_drc_instruction_str[3].num_drc_ch_groups = 2;
|
pstr_drc_config->str_drc_instruction_str[3].num_drc_ch_groups = 2;
|
||||||
pstr_drc_config->str_drc_instruction_str[3].gain_set_index_for_channel_group[0]=3;
|
pstr_drc_config->str_drc_instruction_str[3]
|
||||||
pstr_drc_config->str_drc_instruction_str[3].gain_set_index_for_channel_group[1]=0;
|
.gain_set_index_for_channel_group[0] = 3;
|
||||||
|
pstr_drc_config->str_drc_instruction_str[3]
|
||||||
|
.gain_set_index_for_channel_group[1] = 0;
|
||||||
pstr_drc_config->str_drc_instruction_str[3].band_count_of_ch_group[0] = 1;
|
pstr_drc_config->str_drc_instruction_str[3].band_count_of_ch_group[0] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[3].band_count_of_ch_group[1] = 1;
|
pstr_drc_config->str_drc_instruction_str[3].band_count_of_ch_group[1] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[3].gain_interpolation_type_for_channel_group[0]=1;
|
pstr_drc_config->str_drc_instruction_str[3]
|
||||||
pstr_drc_config->str_drc_instruction_str[3].gain_interpolation_type_for_channel_group[1]=1;
|
.gain_interpolation_type_for_channel_group[0] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[3].time_delta_min_for_channel_group[0]=32;
|
pstr_drc_config->str_drc_instruction_str[3]
|
||||||
pstr_drc_config->str_drc_instruction_str[3].time_delta_min_for_channel_group[1]=32;
|
.gain_interpolation_type_for_channel_group[1] = 1;
|
||||||
|
pstr_drc_config->str_drc_instruction_str[3]
|
||||||
|
.time_delta_min_for_channel_group[0] = 32;
|
||||||
|
pstr_drc_config->str_drc_instruction_str[3]
|
||||||
|
.time_delta_min_for_channel_group[1] = 32;
|
||||||
pstr_drc_config->str_drc_instruction_str[3].channel_group_of_ch[1] = 1;
|
pstr_drc_config->str_drc_instruction_str[3].channel_group_of_ch[1] = 1;
|
||||||
pstr_drc_config->str_drc_instruction_str[3].gain_element_count = 2;
|
pstr_drc_config->str_drc_instruction_str[3].gain_element_count = 2;
|
||||||
|
|
||||||
|
|
@ -253,43 +285,54 @@ IA_ERRORCODE impd_drc_set_default_bitstream_config(ia_drc_config *pstr_drc_confi
|
||||||
return IA_NO_ERROR;
|
return IA_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IA_ERRORCODE impd_drc_set_struct_pointer(ia_drc_api_struct *p_obj_drc) {
|
||||||
IA_ERRORCODE impd_drc_set_struct_pointer(ia_drc_api_struct *p_obj_drc)
|
|
||||||
{
|
|
||||||
SIZE_T persistant_ptr = (SIZE_T)p_obj_drc->p_state->persistant_ptr;
|
SIZE_T persistant_ptr = (SIZE_T)p_obj_drc->p_state->persistant_ptr;
|
||||||
|
|
||||||
p_obj_drc->str_payload.pstr_bitstream_dec = (ia_drc_bits_dec_struct*)persistant_ptr;
|
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 = (SIZE_T)persistant_ptr + sizeof(ia_drc_bits_dec_struct) + 32;
|
||||||
|
|
||||||
p_obj_drc->str_payload.pstr_gain_dec[0] = (ia_drc_gain_dec_struct*)persistant_ptr;
|
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 = (SIZE_T)persistant_ptr + sizeof(ia_drc_gain_dec_struct) + 32;
|
||||||
|
|
||||||
p_obj_drc->str_payload.pstr_gain_dec[1] = (ia_drc_gain_dec_struct*)persistant_ptr;
|
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 = (SIZE_T)persistant_ptr + sizeof(ia_drc_gain_dec_struct) + 32;
|
||||||
|
|
||||||
p_obj_drc->str_payload.pstr_loudness_info = (ia_drc_loudness_info_set_struct*)persistant_ptr;
|
p_obj_drc->str_payload.pstr_loudness_info =
|
||||||
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_loudness_info_set_struct)+32;
|
(ia_drc_loudness_info_set_struct *)persistant_ptr;
|
||||||
|
persistant_ptr =
|
||||||
|
(SIZE_T)persistant_ptr + sizeof(ia_drc_loudness_info_set_struct) + 32;
|
||||||
|
|
||||||
p_obj_drc->str_payload.pstr_drc_gain = (ia_drc_gain_struct*)persistant_ptr;;
|
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 = (SIZE_T)persistant_ptr + sizeof(ia_drc_gain_struct) + 32;
|
||||||
|
|
||||||
p_obj_drc->str_payload.pstr_drc_interface = (ia_drc_interface_struct*)persistant_ptr;
|
p_obj_drc->str_payload.pstr_drc_interface =
|
||||||
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_interface_struct)+32;
|
(ia_drc_interface_struct *)persistant_ptr;
|
||||||
|
persistant_ptr =
|
||||||
|
(SIZE_T)persistant_ptr + sizeof(ia_drc_interface_struct) + 32;
|
||||||
|
|
||||||
p_obj_drc->str_payload.pstr_drc_config = (ia_drc_config *)persistant_ptr;
|
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 = (SIZE_T)persistant_ptr + sizeof(ia_drc_config) + 32;
|
||||||
|
|
||||||
p_obj_drc->str_payload.pstr_selection_proc = (ia_drc_sel_pro_struct*)persistant_ptr;
|
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 = (SIZE_T)persistant_ptr + sizeof(ia_drc_sel_pro_struct) + 32;
|
||||||
|
|
||||||
p_obj_drc->str_bit_handler.it_bit_buf = (UWORD8 *)persistant_ptr;
|
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 = (SIZE_T)persistant_ptr + 32 * 1024; /*varify the sizelater*/
|
||||||
|
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_params = (ia_drc_sel_proc_params_struct*)persistant_ptr;
|
p_obj_drc->str_payload.pstr_drc_sel_proc_params =
|
||||||
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_sel_proc_params_struct);
|
(ia_drc_sel_proc_params_struct *)persistant_ptr;
|
||||||
|
persistant_ptr =
|
||||||
|
(SIZE_T)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;
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output =
|
||||||
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_sel_proc_output_struct)+16*1024;
|
(ia_drc_sel_proc_output_struct *)persistant_ptr;
|
||||||
|
persistant_ptr = (SIZE_T)persistant_ptr +
|
||||||
|
sizeof(ia_drc_sel_proc_output_struct) + 16 * 1024;
|
||||||
|
|
||||||
p_obj_drc->str_bit_handler.bitstream_drc_config = (UWORD8 *)persistant_ptr;
|
p_obj_drc->str_bit_handler.bitstream_drc_config = (UWORD8 *)persistant_ptr;
|
||||||
persistant_ptr = (SIZE_T)persistant_ptr + 8 * 1024;
|
persistant_ptr = (SIZE_T)persistant_ptr + 8 * 1024;
|
||||||
|
|
@ -297,16 +340,22 @@ IA_ERRORCODE impd_drc_set_struct_pointer(ia_drc_api_struct *p_obj_drc)
|
||||||
p_obj_drc->str_bit_handler.bitstream_loudness_info = (UWORD8 *)persistant_ptr;
|
p_obj_drc->str_bit_handler.bitstream_loudness_info = (UWORD8 *)persistant_ptr;
|
||||||
persistant_ptr = (SIZE_T)persistant_ptr + 8 * 1024;
|
persistant_ptr = (SIZE_T)persistant_ptr + 8 * 1024;
|
||||||
|
|
||||||
p_obj_drc->str_bit_handler.bitstream_unidrc_interface = (UWORD8*)persistant_ptr;
|
p_obj_drc->str_bit_handler.bitstream_unidrc_interface =
|
||||||
|
(UWORD8 *)persistant_ptr;
|
||||||
persistant_ptr = (SIZE_T)persistant_ptr + 8 * 1024;
|
persistant_ptr = (SIZE_T)persistant_ptr + 8 * 1024;
|
||||||
|
|
||||||
p_obj_drc->str_payload.pstr_peak_limiter = (ia_drc_peak_limiter_struct*)persistant_ptr;
|
p_obj_drc->str_payload.pstr_peak_limiter =
|
||||||
persistant_ptr = (SIZE_T)persistant_ptr + sizeof(ia_drc_peak_limiter_struct)+32;
|
(ia_drc_peak_limiter_struct *)persistant_ptr;
|
||||||
|
persistant_ptr =
|
||||||
|
(SIZE_T)persistant_ptr + sizeof(ia_drc_peak_limiter_struct) + 32;
|
||||||
|
|
||||||
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);
|
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;
|
persistant_ptr = (SIZE_T)persistant_ptr + 16 * 1024;
|
||||||
|
|
||||||
p_obj_drc->str_payload.pstr_qmf_filter = (ia_drc_qmf_filt_struct*)persistant_ptr;
|
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 = (SIZE_T)persistant_ptr + sizeof(ia_drc_qmf_filt_struct) + 32;
|
||||||
|
|
||||||
p_obj_drc->str_payload.pstr_qmf_filter->ana_buff = (FLOAT64 *)persistant_ptr;
|
p_obj_drc->str_payload.pstr_qmf_filter->ana_buff = (FLOAT64 *)persistant_ptr;
|
||||||
|
|
@ -319,30 +368,25 @@ IA_ERRORCODE impd_drc_set_struct_pointer(ia_drc_api_struct *p_obj_drc)
|
||||||
return IA_NO_ERROR;
|
return IA_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID init_qmf_filt_bank(ia_drc_qmf_filt_struct *qmf_filt)
|
VOID init_qmf_filt_bank(ia_drc_qmf_filt_struct *qmf_filt) {
|
||||||
{
|
|
||||||
|
|
||||||
WORD32 l, k;
|
WORD32 l, k;
|
||||||
|
|
||||||
FLOAT64 gain_ana = 64.0 / QMF_FILT_RESOLUTION;
|
FLOAT64 gain_ana = 64.0 / QMF_FILT_RESOLUTION;
|
||||||
FLOAT64 gain_syn = 1.0 / 64.0;
|
FLOAT64 gain_syn = 1.0 / 64.0;
|
||||||
for ( l=0; l<2*QMF_FILT_RESOLUTION; l++ )
|
for (l = 0; l < 2 * QMF_FILT_RESOLUTION; l++) {
|
||||||
{
|
for (k = 0; k < QMF_FILT_RESOLUTION; k++) {
|
||||||
for ( k=0; k<QMF_FILT_RESOLUTION; k++ )
|
qmf_filt->syn_tab_real[l][k] =
|
||||||
{
|
gain_syn * cos((0.0245436926) * (k + 0.5) * (2 * l - 255.0));
|
||||||
qmf_filt->syn_tab_real[l][k] = gain_syn * cos((0.0245436926) * (k+0.5) * (2*l-255.0));
|
qmf_filt->syn_tab_imag[l][k] =
|
||||||
qmf_filt->syn_tab_imag[l][k] = gain_syn * sin((0.0245436926) * (k+0.5) * (2*l-255.0));
|
gain_syn * sin((0.0245436926) * (k + 0.5) * (2 * l - 255.0));
|
||||||
qmf_filt->ana_tab_real[k][l] = gain_ana * cos((0.0245436926) * (k+0.5) * (2*l-1.0));
|
qmf_filt->ana_tab_real[k][l] =
|
||||||
qmf_filt->ana_tab_imag[k][l] = gain_ana * sin((0.0245436926) * (k+0.5) * (2*l-1.0));
|
gain_ana * cos((0.0245436926) * (k + 0.5) * (2 * l - 1.0));
|
||||||
|
qmf_filt->ana_tab_imag[k][l] =
|
||||||
|
gain_ana * sin((0.0245436926) * (k + 0.5) * (2 * l - 1.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc) {
|
IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc) {
|
||||||
IA_ERRORCODE err_code = IA_NO_ERROR;
|
IA_ERRORCODE err_code = IA_NO_ERROR;
|
||||||
WORD32 i, j;
|
WORD32 i, j;
|
||||||
|
|
@ -353,23 +397,18 @@ IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc){
|
||||||
|
|
||||||
WORD32 decDownmixIdList[NUM_GAIN_DEC_INSTANCES] = {0, 4};
|
WORD32 decDownmixIdList[NUM_GAIN_DEC_INSTANCES] = {0, 4};
|
||||||
|
|
||||||
|
|
||||||
p_obj_drc->p_state->delay_in_output = 0;
|
p_obj_drc->p_state->delay_in_output = 0;
|
||||||
p_obj_drc->str_payload.pstr_selection_proc->first_frame = 1;
|
p_obj_drc->str_payload.pstr_selection_proc->first_frame = 1;
|
||||||
|
|
||||||
|
p_obj_drc->pstr_bit_buf = impd_create_init_bit_buf(
|
||||||
p_obj_drc->pstr_bit_buf = impd_create_init_bit_buf(&p_obj_drc->str_bit_buf, p_obj_drc->str_bit_handler.it_bit_buf, p_obj_drc->str_bit_handler.num_bytes_bs/8);
|
&p_obj_drc->str_bit_buf, p_obj_drc->str_bit_handler.it_bit_buf,
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs / 8);
|
||||||
it_bit_buff = p_obj_drc->pstr_bit_buf;
|
it_bit_buff = p_obj_drc->pstr_bit_buf;
|
||||||
|
|
||||||
|
err_code = impd_init_drc_bitstream_dec(
|
||||||
err_code = impd_init_drc_bitstream_dec(p_obj_drc->str_payload.pstr_bitstream_dec,
|
p_obj_drc->str_payload.pstr_bitstream_dec,
|
||||||
p_obj_drc->str_config.sampling_rate,
|
p_obj_drc->str_config.sampling_rate, p_obj_drc->str_config.frame_size,
|
||||||
p_obj_drc->str_config.frame_size,
|
p_obj_drc->str_config.delay_mode, -1, 0);
|
||||||
p_obj_drc->str_config.delay_mode,
|
|
||||||
-1,
|
|
||||||
0);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < NUM_GAIN_DEC_INSTANCES; i++) {
|
for (i = 0; i < NUM_GAIN_DEC_INSTANCES; i++) {
|
||||||
err_code = impd_init_drc_decode(p_obj_drc->str_config.frame_size,
|
err_code = impd_init_drc_decode(p_obj_drc->str_config.frame_size,
|
||||||
|
|
@ -378,47 +417,45 @@ IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc){
|
||||||
p_obj_drc->str_config.delay_mode,
|
p_obj_drc->str_config.delay_mode,
|
||||||
p_obj_drc->str_config.sub_band_domain_mode,
|
p_obj_drc->str_config.sub_band_domain_mode,
|
||||||
p_obj_drc->str_payload.pstr_gain_dec[i]);
|
p_obj_drc->str_payload.pstr_gain_dec[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_obj_drc->str_config.interface_bitstream_present) {
|
if (p_obj_drc->str_config.interface_bitstream_present) {
|
||||||
|
err_code = impd_drc_dec_interface_add_effect_type(
|
||||||
|
p_obj_drc->str_payload.pstr_drc_interface,
|
||||||
err_code = impd_drc_dec_interface_add_effect_type(p_obj_drc->str_payload.pstr_drc_interface,
|
|
||||||
p_obj_drc->str_config.effect_type,
|
p_obj_drc->str_config.effect_type,
|
||||||
p_obj_drc->str_config.target_loudness,
|
p_obj_drc->str_config.target_loudness,
|
||||||
p_obj_drc->str_config.loud_norm_flag);
|
p_obj_drc->str_config.loud_norm_flag);
|
||||||
|
|
||||||
|
if (err_code != IA_NO_ERROR) return err_code;
|
||||||
|
|
||||||
|
err_code = impd_drc_uni_selction_proc_init(
|
||||||
if (err_code!=IA_NO_ERROR)
|
p_obj_drc->str_payload.pstr_selection_proc, 0,
|
||||||
return err_code;
|
|
||||||
|
|
||||||
err_code = impd_drc_uni_selction_proc_init(p_obj_drc->str_payload.pstr_selection_proc,
|
|
||||||
0,
|
|
||||||
p_obj_drc->str_payload.pstr_drc_interface,
|
p_obj_drc->str_payload.pstr_drc_interface,
|
||||||
p_obj_drc->str_config.sub_band_domain_mode);
|
p_obj_drc->str_config.sub_band_domain_mode);
|
||||||
if (err_code!=IA_NO_ERROR)
|
if (err_code != IA_NO_ERROR) return err_code;
|
||||||
return err_code;
|
|
||||||
|
|
||||||
if (p_obj_drc->str_payload.pstr_drc_interface->loudness_norm_parameter_interface_flag && p_obj_drc->str_payload.pstr_drc_interface->loudness_norm_param_interface.peak_limiter) {
|
if (p_obj_drc->str_payload.pstr_drc_interface
|
||||||
|
->loudness_norm_parameter_interface_flag &&
|
||||||
|
p_obj_drc->str_payload.pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.peak_limiter) {
|
||||||
p_obj_drc->str_config.peak_limiter = 1;
|
p_obj_drc->str_config.peak_limiter = 1;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
err_code = impd_set_default_params_selection_process(
|
||||||
|
p_obj_drc->str_payload.pstr_drc_sel_proc_params);
|
||||||
err_code = impd_set_default_params_selection_process(p_obj_drc->str_payload.pstr_drc_sel_proc_params);
|
if (err_code != IA_NO_ERROR) return err_code;
|
||||||
if (err_code!=IA_NO_ERROR)
|
err_code =
|
||||||
return err_code;
|
impd_set_custom_params(p_obj_drc->str_config.control_parameter_index,
|
||||||
err_code = impd_set_custom_params(p_obj_drc->str_config.control_parameter_index,p_obj_drc->str_payload.pstr_drc_sel_proc_params);
|
p_obj_drc->str_payload.pstr_drc_sel_proc_params);
|
||||||
if (err_code!=IA_NO_ERROR)
|
if (err_code != IA_NO_ERROR) return err_code;
|
||||||
return err_code;
|
err_code = impd_eval_custom_params_selection_process(
|
||||||
err_code = impd_eval_custom_params_selection_process(p_obj_drc->str_payload.pstr_drc_sel_proc_params);
|
p_obj_drc->str_payload.pstr_drc_sel_proc_params);
|
||||||
if (err_code!=IA_NO_ERROR)
|
if (err_code != IA_NO_ERROR) return err_code;
|
||||||
return err_code;
|
err_code = impd_drc_uni_selction_proc_init(
|
||||||
err_code = impd_drc_uni_selction_proc_init(p_obj_drc->str_payload.pstr_selection_proc, p_obj_drc->str_payload.pstr_drc_sel_proc_params, 0, p_obj_drc->str_config.sub_band_domain_mode);
|
p_obj_drc->str_payload.pstr_selection_proc,
|
||||||
if (err_code!=IA_NO_ERROR)
|
p_obj_drc->str_payload.pstr_drc_sel_proc_params, 0,
|
||||||
return err_code;
|
p_obj_drc->str_config.sub_band_domain_mode);
|
||||||
|
if (err_code != IA_NO_ERROR) return err_code;
|
||||||
|
|
||||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_params->peak_limiter) {
|
if (p_obj_drc->str_payload.pstr_drc_sel_proc_params->peak_limiter) {
|
||||||
p_obj_drc->str_config.peak_limiter = 1;
|
p_obj_drc->str_config.peak_limiter = 1;
|
||||||
|
|
@ -429,154 +466,158 @@ IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc){
|
||||||
p_obj_drc->str_payload.pstr_loudness_info->loudness_info_set_ext_present = 0;
|
p_obj_drc->str_payload.pstr_loudness_info->loudness_info_set_ext_present = 0;
|
||||||
p_obj_drc->p_state->ui_exe_done = 0;
|
p_obj_drc->p_state->ui_exe_done = 0;
|
||||||
|
|
||||||
if(p_obj_drc->str_config.bitstream_file_format == BITSTREAM_FILE_FORMAT_SPLIT) {
|
if (p_obj_drc->str_config.bitstream_file_format ==
|
||||||
|
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||||
err_code = impd_process_drc_bitstream_dec_config(p_obj_drc->str_payload.pstr_bitstream_dec,
|
err_code = impd_process_drc_bitstream_dec_config(
|
||||||
p_obj_drc->pstr_bit_buf,
|
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
&p_obj_drc->str_bit_handler.bitstream_drc_config[0],
|
&p_obj_drc->str_bit_handler.bitstream_drc_config[0],
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs_drc_config);
|
p_obj_drc->str_bit_handler.num_bytes_bs_drc_config);
|
||||||
|
|
||||||
|
if (err_code == 1) {
|
||||||
|
err_code = impd_drc_set_default_bitstream_config(
|
||||||
if(err_code==1)
|
p_obj_drc->str_payload.pstr_drc_config);
|
||||||
{
|
p_obj_drc->str_payload.pstr_drc_config->channel_layout
|
||||||
err_code=impd_drc_set_default_bitstream_config(p_obj_drc->str_payload.pstr_drc_config);
|
.base_channel_count = p_obj_drc->str_config.num_ch_in;
|
||||||
p_obj_drc->str_payload.pstr_drc_config->channel_layout.base_channel_count =
|
|
||||||
p_obj_drc->str_config.num_ch_in;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (err_code != IA_NO_ERROR) return err_code;
|
||||||
if (err_code!=IA_NO_ERROR)
|
err_code = impd_process_drc_bitstream_dec_loudness_info_set(
|
||||||
return err_code;
|
p_obj_drc->pstr_bit_buf, p_obj_drc->str_payload.pstr_loudness_info,
|
||||||
err_code = impd_process_drc_bitstream_dec_loudness_info_set(p_obj_drc->pstr_bit_buf,
|
|
||||||
p_obj_drc->str_payload.pstr_loudness_info,
|
|
||||||
&p_obj_drc->str_bit_handler.bitstream_loudness_info[0],
|
&p_obj_drc->str_bit_handler.bitstream_loudness_info[0],
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs_loudness_info
|
p_obj_drc->str_bit_handler.num_bytes_bs_loudness_info);
|
||||||
);
|
if (err_code != IA_NO_ERROR) return err_code;
|
||||||
if (err_code!=IA_NO_ERROR)
|
|
||||||
return err_code;
|
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
err_code = impd_process_drc_bitstream_dec(
|
||||||
err_code = impd_process_drc_bitstream_dec(p_obj_drc->str_payload.pstr_bitstream_dec,
|
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||||
p_obj_drc->pstr_bit_buf,
|
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_loudness_info,
|
p_obj_drc->str_payload.pstr_loudness_info,
|
||||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
&p_obj_drc->str_bit_handler
|
||||||
|
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||||
|
|
||||||
if (err_code > PROC_COMPLETE)
|
if (err_code > PROC_COMPLETE) return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||||
|
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err_code = impd_drc_uni_sel_proc_process(
|
||||||
err_code = impd_drc_uni_sel_proc_process(p_obj_drc->str_payload.pstr_selection_proc,
|
p_obj_drc->str_payload.pstr_selection_proc,
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_loudness_info,
|
p_obj_drc->str_payload.pstr_loudness_info,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output);
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output);
|
||||||
if (err_code!=IA_NO_ERROR)
|
if (err_code != IA_NO_ERROR) return err_code;
|
||||||
return err_code;
|
|
||||||
|
|
||||||
for (i = 0; i < NUM_GAIN_DEC_INSTANCES; i++) {
|
for (i = 0; i < NUM_GAIN_DEC_INSTANCES; i++) {
|
||||||
|
|
||||||
WORD32 audio_num_chan = 0;
|
WORD32 audio_num_chan = 0;
|
||||||
WORD32 numMatchingDrcSets = 0;
|
WORD32 numMatchingDrcSets = 0;
|
||||||
WORD32 matchingDrcSetIds[3], matchingDownmixIds[3];
|
WORD32 matchingDrcSetIds[3], matchingDownmixIds[3];
|
||||||
for (j=0; j<p_obj_drc->str_payload.pstr_drc_sel_proc_output->num_sel_drc_sets; j++) {
|
for (j = 0;
|
||||||
|
j < p_obj_drc->str_payload.pstr_drc_sel_proc_output->num_sel_drc_sets;
|
||||||
if (impd_match_downmix(p_obj_drc->str_payload.pstr_drc_sel_proc_output->sel_downmix_ids[j], decDownmixIdList[i])) {
|
j++) {
|
||||||
matchingDrcSetIds[numMatchingDrcSets] = p_obj_drc->str_payload.pstr_drc_sel_proc_output->sel_drc_set_ids[j];
|
if (impd_match_downmix(p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
matchingDownmixIds[numMatchingDrcSets] = p_obj_drc->str_payload.pstr_drc_sel_proc_output->sel_downmix_ids[j];
|
->sel_downmix_ids[j],
|
||||||
|
decDownmixIdList[i])) {
|
||||||
|
matchingDrcSetIds[numMatchingDrcSets] =
|
||||||
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->sel_drc_set_ids[j];
|
||||||
|
matchingDownmixIds[numMatchingDrcSets] =
|
||||||
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->sel_downmix_ids[j];
|
||||||
numMatchingDrcSets++;
|
numMatchingDrcSets++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i==0)
|
if (i == 0) {
|
||||||
{
|
if (p_obj_drc->str_config.num_ch_in !=
|
||||||
if (p_obj_drc->str_config.num_ch_in != p_obj_drc->str_payload.pstr_drc_sel_proc_output->base_channel_count)
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->base_channel_count)
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
audio_num_chan = p_obj_drc->str_config.num_ch_in;
|
audio_num_chan = p_obj_drc->str_config.num_ch_in;
|
||||||
} else if (i==1)
|
} else if (i == 1) {
|
||||||
{
|
p_obj_drc->str_config.num_ch_out =
|
||||||
p_obj_drc->str_config.num_ch_out = p_obj_drc->str_payload.pstr_drc_sel_proc_output->target_channel_count;
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->target_channel_count;
|
||||||
audio_num_chan = p_obj_drc->str_config.num_ch_out;
|
audio_num_chan = p_obj_drc->str_config.num_ch_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
err_code = impd_init_drc_decode_post_config(audio_num_chan,
|
err_code = impd_init_drc_decode_post_config(
|
||||||
matchingDrcSetIds,
|
audio_num_chan, matchingDrcSetIds, matchingDownmixIds,
|
||||||
matchingDownmixIds,
|
numMatchingDrcSets,
|
||||||
numMatchingDrcSets
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->sel_eq_set_ids[i]
|
||||||
, p_obj_drc->str_payload.pstr_drc_sel_proc_output->sel_eq_set_ids[i]
|
|
||||||
|
|
||||||
, p_obj_drc->str_payload.pstr_gain_dec[i]
|
,
|
||||||
, p_obj_drc->str_payload.pstr_drc_config
|
p_obj_drc->str_payload.pstr_gain_dec[i],
|
||||||
, p_obj_drc->str_payload.pstr_loudness_info
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
, &persistant_ptr
|
p_obj_drc->str_payload.pstr_loudness_info, &persistant_ptr);
|
||||||
);
|
|
||||||
|
|
||||||
impd_get_parametric_drc_delay(p_obj_drc->str_payload.pstr_gain_dec[i], p_obj_drc->str_payload.pstr_drc_config, & p_obj_drc->str_config.parametric_drc_delay_gain_dec_instance, &p_obj_drc->str_config.parametric_drc_delay_max);
|
|
||||||
impd_get_eq_delay(p_obj_drc->str_payload.pstr_gain_dec[i], p_obj_drc->str_payload.pstr_drc_config, & p_obj_drc->str_config.eq_delay_gain_dec_instance, & p_obj_drc->str_config.eq_delay_max);
|
|
||||||
p_obj_drc->str_config.parametric_drc_delay += p_obj_drc->str_config.parametric_drc_delay_gain_dec_instance;
|
|
||||||
p_obj_drc->str_config.eq_delay += p_obj_drc->str_config.eq_delay_gain_dec_instance;
|
|
||||||
|
|
||||||
|
impd_get_parametric_drc_delay(
|
||||||
|
p_obj_drc->str_payload.pstr_gain_dec[i],
|
||||||
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
|
&p_obj_drc->str_config.parametric_drc_delay_gain_dec_instance,
|
||||||
|
&p_obj_drc->str_config.parametric_drc_delay_max);
|
||||||
|
impd_get_eq_delay(p_obj_drc->str_payload.pstr_gain_dec[i],
|
||||||
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
|
&p_obj_drc->str_config.eq_delay_gain_dec_instance,
|
||||||
|
&p_obj_drc->str_config.eq_delay_max);
|
||||||
|
p_obj_drc->str_config.parametric_drc_delay +=
|
||||||
|
p_obj_drc->str_config.parametric_drc_delay_gain_dec_instance;
|
||||||
|
p_obj_drc->str_config.eq_delay +=
|
||||||
|
p_obj_drc->str_config.eq_delay_gain_dec_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
if (p_obj_drc->str_config.parametric_drc_delay_max == -1) {
|
if (p_obj_drc->str_config.parametric_drc_delay_max == -1) {
|
||||||
p_obj_drc->str_config.parametric_drc_delay_max = PARAMETRIC_DRC_DELAY_MAX_DEFAULT;
|
p_obj_drc->str_config.parametric_drc_delay_max =
|
||||||
|
PARAMETRIC_DRC_DELAY_MAX_DEFAULT;
|
||||||
}
|
}
|
||||||
if (p_obj_drc->str_config.eq_delay_max == -1) {
|
if (p_obj_drc->str_config.eq_delay_max == -1) {
|
||||||
p_obj_drc->str_config.eq_delay_max = EQ_DELAY_MAX_DEFAULT;
|
p_obj_drc->str_config.eq_delay_max = EQ_DELAY_MAX_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!p_obj_drc->str_config.constant_delay_on) {
|
if (!p_obj_drc->str_config.constant_delay_on) {
|
||||||
|
p_obj_drc->p_state->delay_in_output +=
|
||||||
p_obj_drc->p_state->delay_in_output += p_obj_drc->str_config.parametric_drc_delay + p_obj_drc->str_config.eq_delay + p_obj_drc->str_config.audio_delay_samples;
|
p_obj_drc->str_config.parametric_drc_delay +
|
||||||
p_obj_drc->str_config.delay_line_samples = p_obj_drc->str_config.audio_delay_samples;
|
p_obj_drc->str_config.eq_delay +
|
||||||
|
p_obj_drc->str_config.audio_delay_samples;
|
||||||
|
p_obj_drc->str_config.delay_line_samples =
|
||||||
|
p_obj_drc->str_config.audio_delay_samples;
|
||||||
|
|
||||||
if (!p_obj_drc->str_config.absorb_delay_on) {
|
if (!p_obj_drc->str_config.absorb_delay_on) {
|
||||||
p_obj_drc->p_state->delay_in_output = 0;
|
p_obj_drc->p_state->delay_in_output = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p_obj_drc->p_state->delay_in_output += p_obj_drc->str_config.parametric_drc_delay_max + p_obj_drc->str_config.eq_delay_max + p_obj_drc->str_config.audio_delay_samples;
|
p_obj_drc->p_state->delay_in_output +=
|
||||||
p_obj_drc->str_config.delay_line_samples = p_obj_drc->p_state->delay_in_output - p_obj_drc->str_config.parametric_drc_delay + p_obj_drc->str_config.eq_delay;
|
p_obj_drc->str_config.parametric_drc_delay_max +
|
||||||
|
p_obj_drc->str_config.eq_delay_max +
|
||||||
|
p_obj_drc->str_config.audio_delay_samples;
|
||||||
|
p_obj_drc->str_config.delay_line_samples =
|
||||||
|
p_obj_drc->p_state->delay_in_output -
|
||||||
|
p_obj_drc->str_config.parametric_drc_delay +
|
||||||
|
p_obj_drc->str_config.eq_delay;
|
||||||
|
|
||||||
if (!p_obj_drc->str_config.absorb_delay_on) {
|
if (!p_obj_drc->str_config.absorb_delay_on) {
|
||||||
p_obj_drc->p_state->delay_in_output = 0;
|
p_obj_drc->p_state->delay_in_output = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if(p_obj_drc->str_config.dec_type==1)
|
if (p_obj_drc->str_config.dec_type == 1) {
|
||||||
{
|
|
||||||
init_qmf_filt_bank(p_obj_drc->str_payload.pstr_qmf_filter);
|
init_qmf_filt_bank(p_obj_drc->str_payload.pstr_qmf_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_obj_drc->str_config.peak_limiter)
|
if (p_obj_drc->str_config.peak_limiter) {
|
||||||
{
|
impd_peak_limiter_init(
|
||||||
impd_peak_limiter_init(p_obj_drc->str_payload.pstr_peak_limiter,
|
p_obj_drc->str_payload.pstr_peak_limiter, DEFAULT_ATTACK_TIME_MS,
|
||||||
DEFAULT_ATTACK_TIME_MS,
|
DEFAULT_RELEASE_TIME_MS, LIM_DEFAULT_THRESHOLD,
|
||||||
DEFAULT_RELEASE_TIME_MS,
|
p_obj_drc->str_config.num_ch_out, p_obj_drc->str_config.sampling_rate,
|
||||||
LIM_DEFAULT_THRESHOLD,
|
|
||||||
p_obj_drc->str_config.num_ch_out,
|
|
||||||
p_obj_drc->str_config.sampling_rate,
|
|
||||||
p_obj_drc->str_payload.pstr_peak_limiter->buffer);
|
p_obj_drc->str_payload.pstr_peak_limiter->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return IA_NO_ERROR;
|
return IA_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,8 @@ typedef struct {
|
||||||
WORD32 drc_feature_req_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
WORD32 drc_feature_req_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
WORD32 requested_num_drc_effects[MAX_NUM_DRC_FEATURE_REQUESTS];
|
WORD32 requested_num_drc_effects[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
WORD32 desired_num_drc_effects_of_requested[MAX_NUM_DRC_FEATURE_REQUESTS];
|
WORD32 desired_num_drc_effects_of_requested[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
WORD32 requested_drc_effect_type[MAX_NUM_DRC_FEATURE_REQUESTS][MAX_NUM_DRC_EFFECT_TYPE_REQUESTS];
|
WORD32 requested_drc_effect_type[MAX_NUM_DRC_FEATURE_REQUESTS]
|
||||||
|
[MAX_NUM_DRC_EFFECT_TYPE_REQUESTS];
|
||||||
WORD32 requested_dyn_rng_measurement_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
WORD32 requested_dyn_rng_measurement_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
WORD32 requested_dyn_range_is_single_val_flag[MAX_NUM_DRC_FEATURE_REQUESTS];
|
WORD32 requested_dyn_range_is_single_val_flag[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
FLOAT32 requested_dyn_range_value[MAX_NUM_DRC_FEATURE_REQUESTS];
|
FLOAT32 requested_dyn_range_value[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
|
|
|
||||||
|
|
@ -30,17 +30,15 @@
|
||||||
#include "impd_drc_parser_interface.h"
|
#include "impd_drc_parser_interface.h"
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_dec_interface_process(
|
impd_drc_dec_interface_process(ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
|
||||||
ia_drc_interface_struct* pstr_drc_interface,
|
ia_drc_interface_struct* pstr_drc_interface,
|
||||||
UWORD8* it_bit_buf,
|
UWORD8* it_bit_buf, WORD32 num_bit_stream_bits,
|
||||||
WORD32 num_bit_stream_bits,
|
WORD32* num_bits_read) {
|
||||||
WORD32* num_bits_read)
|
|
||||||
{
|
|
||||||
WORD32 err = 0;
|
WORD32 err = 0;
|
||||||
|
|
||||||
if (it_bit_buff != NULL && num_bit_stream_bits) {
|
if (it_bit_buff != NULL && num_bit_stream_bits) {
|
||||||
it_bit_buff = impd_create_init_bit_buf(it_bit_buff, it_bit_buf, num_bit_stream_bits/8);
|
it_bit_buff = impd_create_init_bit_buf(it_bit_buff, it_bit_buf,
|
||||||
|
num_bit_stream_bits / 8);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -52,97 +50,112 @@ impd_drc_dec_interface_process(
|
||||||
*num_bits_read = (it_bit_buff->size) - it_bit_buff->cnt_bits;
|
*num_bits_read = (it_bit_buff->size) - it_bit_buff->cnt_bits;
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_dec_interface_add_effect_type(ia_drc_interface_struct* pstr_drc_interface,
|
impd_drc_dec_interface_add_effect_type(
|
||||||
WORD32 drc_effect_type,
|
ia_drc_interface_struct* pstr_drc_interface, WORD32 drc_effect_type,
|
||||||
WORD32 target_loudness,
|
WORD32 target_loudness, WORD32 loud_norm) {
|
||||||
WORD32 loud_norm)
|
|
||||||
{
|
|
||||||
WORD32 err = 0;
|
WORD32 err = 0;
|
||||||
WORD32 i = 0;
|
WORD32 i = 0;
|
||||||
|
|
||||||
if (pstr_drc_interface != NULL)
|
if (pstr_drc_interface != NULL) {
|
||||||
{
|
|
||||||
pstr_drc_interface->interface_signat_flag = 0;
|
pstr_drc_interface->interface_signat_flag = 0;
|
||||||
for (i = 0; i < MAX_SIGNATURE_DATA_LENGTH_PLUS_ONE * 8; i++)
|
for (i = 0; i < MAX_SIGNATURE_DATA_LENGTH_PLUS_ONE * 8; i++)
|
||||||
pstr_drc_interface->drc_uni_interface_signature.interface_signat_data[i] = 0;
|
pstr_drc_interface->drc_uni_interface_signature.interface_signat_data[i] =
|
||||||
|
0;
|
||||||
|
|
||||||
pstr_drc_interface->drc_uni_interface_signature.interface_signat_data_len = 0;
|
pstr_drc_interface->drc_uni_interface_signature.interface_signat_data_len =
|
||||||
|
0;
|
||||||
|
|
||||||
pstr_drc_interface->system_interface_flag = 1;
|
pstr_drc_interface->system_interface_flag = 1;
|
||||||
|
|
||||||
pstr_drc_interface->system_interface.target_config_request_type = 0;
|
pstr_drc_interface->system_interface.target_config_request_type = 0;
|
||||||
pstr_drc_interface->system_interface.num_downmix_id_requests = 0;
|
pstr_drc_interface->system_interface.num_downmix_id_requests = 0;
|
||||||
for (i = 0; i < MAX_NUM_DOWNMIX_ID_REQUESTS; i++)
|
for (i = 0; i < MAX_NUM_DOWNMIX_ID_REQUESTS; i++) {
|
||||||
{
|
|
||||||
pstr_drc_interface->system_interface.requested_dwnmix_id[i] = 0;
|
pstr_drc_interface->system_interface.requested_dwnmix_id[i] = 0;
|
||||||
}
|
}
|
||||||
pstr_drc_interface->system_interface.requested_target_layout = 0;
|
pstr_drc_interface->system_interface.requested_target_layout = 0;
|
||||||
pstr_drc_interface->system_interface.requested_target_ch_count = 0;
|
pstr_drc_interface->system_interface.requested_target_ch_count = 0;
|
||||||
|
|
||||||
pstr_drc_interface->loudness_norm_ctrl_interface_flag = 1;
|
pstr_drc_interface->loudness_norm_ctrl_interface_flag = 1;
|
||||||
if(loud_norm==1)
|
if (loud_norm == 1) {
|
||||||
{
|
pstr_drc_interface->loudness_norm_ctrl_interface
|
||||||
pstr_drc_interface->loudness_norm_ctrl_interface.loudness_normalization_on = 1;
|
.loudness_normalization_on = 1;
|
||||||
|
} else {
|
||||||
|
pstr_drc_interface->loudness_norm_ctrl_interface
|
||||||
|
.loudness_normalization_on = 0;
|
||||||
}
|
}
|
||||||
else
|
pstr_drc_interface->loudness_norm_ctrl_interface.target_loudness =
|
||||||
{
|
(FLOAT32)target_loudness;
|
||||||
pstr_drc_interface->loudness_norm_ctrl_interface.loudness_normalization_on = 0;
|
|
||||||
}
|
|
||||||
pstr_drc_interface->loudness_norm_ctrl_interface.target_loudness = (FLOAT32)target_loudness;
|
|
||||||
|
|
||||||
pstr_drc_interface->loudness_norm_parameter_interface_flag = 1;
|
pstr_drc_interface->loudness_norm_parameter_interface_flag = 1;
|
||||||
pstr_drc_interface->loudness_norm_param_interface.album_mode = 0;
|
pstr_drc_interface->loudness_norm_param_interface.album_mode = 0;
|
||||||
pstr_drc_interface->loudness_norm_param_interface.peak_limiter = 0;
|
pstr_drc_interface->loudness_norm_param_interface.peak_limiter = 0;
|
||||||
pstr_drc_interface->loudness_norm_param_interface.change_loudness_deviation_max = 1;
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
pstr_drc_interface->loudness_norm_param_interface.loudness_deviation_max = 63;
|
.change_loudness_deviation_max = 1;
|
||||||
pstr_drc_interface->loudness_norm_param_interface.change_loudness_measur_method = 1;
|
pstr_drc_interface->loudness_norm_param_interface.loudness_deviation_max =
|
||||||
pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_method = 1;
|
63;
|
||||||
pstr_drc_interface->loudness_norm_param_interface.change_loudness_measur_system = 1;
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_system = 1;
|
.change_loudness_measur_method = 1;
|
||||||
pstr_drc_interface->loudness_norm_param_interface.change_loudness_measur_pre_proc = 0;
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_pre_proc = 0;
|
.loudness_measurement_method = 1;
|
||||||
pstr_drc_interface->loudness_norm_param_interface.change_device_cut_off_freq = 1;
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
pstr_drc_interface->loudness_norm_param_interface.device_cut_off_frequency = 20;
|
.change_loudness_measur_system = 1;
|
||||||
pstr_drc_interface->loudness_norm_param_interface.change_loudness_norm_gain_db_max = 1;
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
pstr_drc_interface->loudness_norm_param_interface.loudness_norm_gain_db_max = 1000.0;
|
.loudness_measurement_system = 1;
|
||||||
pstr_drc_interface->loudness_norm_param_interface.change_loudness_norm_gain_modification_db = 1;
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
pstr_drc_interface->loudness_norm_param_interface.loudness_norm_gain_modification_db = 0.0;
|
.change_loudness_measur_pre_proc = 0;
|
||||||
pstr_drc_interface->loudness_norm_param_interface.change_output_peak_level_max = 1;
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
pstr_drc_interface->loudness_norm_param_interface.output_peak_level_max = 0.0;
|
.loudness_measurement_pre_proc = 0;
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.change_device_cut_off_freq = 1;
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface.device_cut_off_frequency =
|
||||||
|
20;
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.change_loudness_norm_gain_db_max = 1;
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.loudness_norm_gain_db_max = 1000.0;
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.change_loudness_norm_gain_modification_db = 1;
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.loudness_norm_gain_modification_db = 0.0;
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.change_output_peak_level_max = 1;
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface.output_peak_level_max =
|
||||||
|
0.0;
|
||||||
|
|
||||||
pstr_drc_interface->drc_interface_flag = 1;
|
pstr_drc_interface->drc_interface_flag = 1;
|
||||||
if(drc_effect_type==-1)
|
if (drc_effect_type == -1) {
|
||||||
{
|
|
||||||
pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on = 0;
|
pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on = 0;
|
||||||
pstr_drc_interface->drc_ctrl_interface.requested_drc_effect_type[0][0] = 0;
|
pstr_drc_interface->drc_ctrl_interface.requested_drc_effect_type[0][0] =
|
||||||
}
|
0;
|
||||||
else if(drc_effect_type==0)
|
} else if (drc_effect_type == 0) {
|
||||||
{
|
|
||||||
pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on = 1;
|
pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on = 1;
|
||||||
pstr_drc_interface->drc_ctrl_interface.num_drc_feature_requests = 0;
|
pstr_drc_interface->drc_ctrl_interface.num_drc_feature_requests = 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on = 1;
|
pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on = 1;
|
||||||
pstr_drc_interface->drc_ctrl_interface.requested_drc_effect_type[0][0] = drc_effect_type;
|
pstr_drc_interface->drc_ctrl_interface.requested_drc_effect_type[0][0] =
|
||||||
|
drc_effect_type;
|
||||||
pstr_drc_interface->drc_ctrl_interface.num_drc_feature_requests = 3;
|
pstr_drc_interface->drc_ctrl_interface.num_drc_feature_requests = 3;
|
||||||
pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[0] = 0;
|
pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[0] = 0;
|
||||||
pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[1] = 1;
|
pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[1] = 1;
|
||||||
pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[2] = 2;
|
pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[2] = 2;
|
||||||
pstr_drc_interface->drc_ctrl_interface.requested_num_drc_effects[0] = 1;
|
pstr_drc_interface->drc_ctrl_interface.requested_num_drc_effects[0] = 1;
|
||||||
pstr_drc_interface->drc_ctrl_interface.desired_num_drc_effects_of_requested[0] = 1;
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.desired_num_drc_effects_of_requested[0] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pstr_drc_interface->drc_ctrl_interface.requested_dyn_rng_measurement_type[0] = 0;
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_is_single_val_flag[0] = 0;
|
.requested_dyn_rng_measurement_type[0] = 0;
|
||||||
pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_is_single_val_flag[1] = 0;
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_min_val[1] = 3.0f;
|
.requested_dyn_range_is_single_val_flag[0] = 0;
|
||||||
pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_max_val[1] = 10.0f;
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_dyn_range_is_single_val_flag[1] = 0;
|
||||||
|
pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_min_val[1] =
|
||||||
|
3.0f;
|
||||||
|
pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_max_val[1] =
|
||||||
|
10.0f;
|
||||||
pstr_drc_interface->drc_ctrl_interface.requested_drc_characteristic[2] = 3;
|
pstr_drc_interface->drc_ctrl_interface.requested_drc_characteristic[2] = 3;
|
||||||
|
|
||||||
pstr_drc_interface->drc_parameter_interface_flag = 1;
|
pstr_drc_interface->drc_parameter_interface_flag = 1;
|
||||||
|
|
@ -150,19 +163,15 @@ impd_drc_dec_interface_add_effect_type(ia_drc_interface_struct* pstr_drc_interfa
|
||||||
pstr_drc_interface->drc_parameter_interface.change_boost = 1;
|
pstr_drc_interface->drc_parameter_interface.change_boost = 1;
|
||||||
pstr_drc_interface->drc_parameter_interface.compress = 1.0f;
|
pstr_drc_interface->drc_parameter_interface.compress = 1.0f;
|
||||||
pstr_drc_interface->drc_parameter_interface.boost = 1.0f;
|
pstr_drc_interface->drc_parameter_interface.boost = 1.0f;
|
||||||
pstr_drc_interface->drc_parameter_interface.change_drc_characteristic_target = 1;
|
pstr_drc_interface->drc_parameter_interface
|
||||||
|
.change_drc_characteristic_target = 1;
|
||||||
pstr_drc_interface->drc_parameter_interface.drc_characteristic_target = 0;
|
pstr_drc_interface->drc_parameter_interface.drc_characteristic_target = 0;
|
||||||
|
|
||||||
|
|
||||||
pstr_drc_interface->drc_uni_interface_ext_flag = 0;
|
pstr_drc_interface->drc_uni_interface_ext_flag = 0;
|
||||||
|
|
||||||
|
} else {
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return UNEXPECTED_ERROR;
|
return UNEXPECTED_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,44 +28,42 @@
|
||||||
#include "impd_drc_extr_delta_coded_info.h"
|
#include "impd_drc_extr_delta_coded_info.h"
|
||||||
#include "impd_drc_struct.h"
|
#include "impd_drc_struct.h"
|
||||||
|
|
||||||
WORD32 impd_unidrc_interface_signature_read(ia_bit_buf_struct* it_bit_buff,
|
WORD32 impd_unidrc_interface_signature_read(
|
||||||
ia_drc_uni_interface_signat_struct* drc_uni_interface_signature)
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
{
|
ia_drc_uni_interface_signat_struct* drc_uni_interface_signature) {
|
||||||
// WORD32 err = 0
|
// WORD32 err = 0
|
||||||
WORD32 interface_signat_data_len = 0, i, tmp;
|
WORD32 interface_signat_data_len = 0, i, tmp;
|
||||||
|
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 16);
|
tmp = impd_read_bits_buf(it_bit_buff, 16);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
|
|
||||||
drc_uni_interface_signature->interface_signat_type = (tmp >> 8) & 0xff;
|
drc_uni_interface_signature->interface_signat_type = (tmp >> 8) & 0xff;
|
||||||
drc_uni_interface_signature->interface_signat_data_len = tmp & 0xff;
|
drc_uni_interface_signature->interface_signat_data_len = tmp & 0xff;
|
||||||
|
|
||||||
interface_signat_data_len = drc_uni_interface_signature->interface_signat_data_len + 1;
|
interface_signat_data_len =
|
||||||
|
drc_uni_interface_signature->interface_signat_data_len + 1;
|
||||||
for (i = 0; i < interface_signat_data_len; i++) {
|
for (i = 0; i < interface_signat_data_len; i++) {
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
drc_uni_interface_signature->interface_signat_data[i] = (UWORD32)tmp;
|
drc_uni_interface_signature->interface_signat_data[i] = (UWORD32)tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
WORD32 impd_sys_interface_read(ia_bit_buf_struct* it_bit_buff,
|
WORD32 impd_sys_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_system_interface_struct* system_interface)
|
ia_system_interface_struct* system_interface) {
|
||||||
{
|
|
||||||
// WORD32 err = 0;
|
// WORD32 err = 0;
|
||||||
WORD32 i = 0, tmp = 0;
|
WORD32 i = 0, tmp = 0;
|
||||||
|
|
||||||
system_interface->target_config_request_type = impd_read_bits_buf(it_bit_buff, 2);
|
system_interface->target_config_request_type =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 2);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
|
|
||||||
switch (system_interface->target_config_request_type) {
|
switch (system_interface->target_config_request_type) {
|
||||||
case 0:
|
case 0:
|
||||||
system_interface->num_downmix_id_requests = impd_read_bits_buf(it_bit_buff, 4);
|
system_interface->num_downmix_id_requests =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 4);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
|
|
||||||
if (system_interface->num_downmix_id_requests == 0) {
|
if (system_interface->num_downmix_id_requests == 0) {
|
||||||
system_interface->num_downmix_id_requests = 1;
|
system_interface->num_downmix_id_requests = 1;
|
||||||
|
|
@ -73,20 +71,19 @@ WORD32 impd_sys_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (i = 0; i < system_interface->num_downmix_id_requests; i++) {
|
for (i = 0; i < system_interface->num_downmix_id_requests; i++) {
|
||||||
system_interface->requested_dwnmix_id[i] = impd_read_bits_buf(it_bit_buff, 7);
|
system_interface->requested_dwnmix_id[i] =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 7);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
system_interface->requested_target_layout = impd_read_bits_buf(it_bit_buff, 8);
|
system_interface->requested_target_layout =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 8);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 7);
|
tmp = impd_read_bits_buf(it_bit_buff, 7);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
system_interface->requested_target_ch_count = tmp + 1;
|
system_interface->requested_target_ch_count = tmp + 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -96,204 +93,204 @@ WORD32 impd_sys_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32 impd_loudness_norm_control_interface_read(ia_bit_buf_struct* it_bit_buff,
|
WORD32 impd_loudness_norm_control_interface_read(
|
||||||
ia_loudness_norm_ctrl_interface_struct* loudness_norm_ctrl_interface)
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
{
|
ia_loudness_norm_ctrl_interface_struct* loudness_norm_ctrl_interface) {
|
||||||
// WORD32 err = 0;
|
// WORD32 err = 0;
|
||||||
WORD32 tmp = 0;
|
WORD32 tmp = 0;
|
||||||
|
|
||||||
loudness_norm_ctrl_interface->loudness_normalization_on = impd_read_bits_buf(it_bit_buff, 1);
|
loudness_norm_ctrl_interface->loudness_normalization_on =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
|
|
||||||
if (loudness_norm_ctrl_interface->loudness_normalization_on == 1) {
|
if (loudness_norm_ctrl_interface->loudness_normalization_on == 1) {
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 12);
|
tmp = impd_read_bits_buf(it_bit_buff, 12);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
loudness_norm_ctrl_interface->target_loudness = -tmp * 0.03125f;
|
loudness_norm_ctrl_interface->target_loudness = -tmp * 0.03125f;
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32 impd_loudness_norm_param_interface_read(ia_bit_buf_struct* it_bit_buff,
|
WORD32 impd_loudness_norm_param_interface_read(
|
||||||
ia_loudness_norm_parameter_interface_struct* loudness_norm_param_interface)
|
ia_bit_buf_struct* it_bit_buff, ia_loudness_norm_parameter_interface_struct*
|
||||||
{
|
loudness_norm_param_interface) {
|
||||||
// WORD32 err = 0;
|
// WORD32 err = 0;
|
||||||
WORD32 tmp = 0;
|
WORD32 tmp = 0;
|
||||||
|
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 3);
|
tmp = impd_read_bits_buf(it_bit_buff, 3);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
|
|
||||||
loudness_norm_param_interface->album_mode = (tmp >> 2) & 1;
|
loudness_norm_param_interface->album_mode = (tmp >> 2) & 1;
|
||||||
loudness_norm_param_interface->peak_limiter = (tmp >> 1) & 1;
|
loudness_norm_param_interface->peak_limiter = (tmp >> 1) & 1;
|
||||||
loudness_norm_param_interface->change_loudness_deviation_max = tmp & 1;
|
loudness_norm_param_interface->change_loudness_deviation_max = tmp & 1;
|
||||||
|
|
||||||
if (loudness_norm_param_interface->change_loudness_deviation_max == 1) {
|
if (loudness_norm_param_interface->change_loudness_deviation_max == 1) {
|
||||||
loudness_norm_param_interface->loudness_deviation_max = impd_read_bits_buf(it_bit_buff, 6);
|
loudness_norm_param_interface->loudness_deviation_max =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 6);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
loudness_norm_param_interface->change_loudness_measur_method = impd_read_bits_buf(it_bit_buff, 1);
|
loudness_norm_param_interface->change_loudness_measur_method =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
if (loudness_norm_param_interface->change_loudness_measur_method == 1) {
|
if (loudness_norm_param_interface->change_loudness_measur_method == 1) {
|
||||||
loudness_norm_param_interface->loudness_measurement_method = impd_read_bits_buf(it_bit_buff, 3);
|
loudness_norm_param_interface->loudness_measurement_method =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 3);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
loudness_norm_param_interface->change_loudness_measur_system = impd_read_bits_buf(it_bit_buff, 1);
|
loudness_norm_param_interface->change_loudness_measur_system =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
if (loudness_norm_param_interface->change_loudness_measur_system == 1) {
|
if (loudness_norm_param_interface->change_loudness_measur_system == 1) {
|
||||||
loudness_norm_param_interface->loudness_measurement_system = impd_read_bits_buf(it_bit_buff, 4);
|
loudness_norm_param_interface->loudness_measurement_system =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 4);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
loudness_norm_param_interface->change_loudness_measur_pre_proc = impd_read_bits_buf(it_bit_buff, 1);
|
loudness_norm_param_interface->change_loudness_measur_pre_proc =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
if (loudness_norm_param_interface->change_loudness_measur_pre_proc == 1) {
|
if (loudness_norm_param_interface->change_loudness_measur_pre_proc == 1) {
|
||||||
loudness_norm_param_interface->loudness_measurement_pre_proc = impd_read_bits_buf(it_bit_buff, 2);
|
loudness_norm_param_interface->loudness_measurement_pre_proc =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 2);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
loudness_norm_param_interface->change_device_cut_off_freq = impd_read_bits_buf(it_bit_buff, 1);
|
loudness_norm_param_interface->change_device_cut_off_freq =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
if (loudness_norm_param_interface->change_device_cut_off_freq == 1) {
|
if (loudness_norm_param_interface->change_device_cut_off_freq == 1) {
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 6);
|
tmp = impd_read_bits_buf(it_bit_buff, 6);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
loudness_norm_param_interface->device_cut_off_frequency =
|
||||||
loudness_norm_param_interface->device_cut_off_frequency = max(min(tmp*10,500),20);
|
max(min(tmp * 10, 500), 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
loudness_norm_param_interface->change_loudness_norm_gain_db_max = impd_read_bits_buf(it_bit_buff, 1);
|
loudness_norm_param_interface->change_loudness_norm_gain_db_max =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
if (loudness_norm_param_interface->change_loudness_norm_gain_db_max == 1) {
|
if (loudness_norm_param_interface->change_loudness_norm_gain_db_max == 1) {
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 6);
|
tmp = impd_read_bits_buf(it_bit_buff, 6);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
if (tmp < 63) {
|
if (tmp < 63) {
|
||||||
loudness_norm_param_interface->loudness_norm_gain_db_max = tmp * 0.5f;
|
loudness_norm_param_interface->loudness_norm_gain_db_max = tmp * 0.5f;
|
||||||
} else {
|
} else {
|
||||||
loudness_norm_param_interface->loudness_norm_gain_db_max = LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT;
|
loudness_norm_param_interface->loudness_norm_gain_db_max =
|
||||||
|
LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loudness_norm_param_interface->change_loudness_norm_gain_modification_db = impd_read_bits_buf(it_bit_buff, 1);
|
loudness_norm_param_interface->change_loudness_norm_gain_modification_db =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
if (loudness_norm_param_interface->change_loudness_norm_gain_modification_db == 1) {
|
if (loudness_norm_param_interface
|
||||||
|
->change_loudness_norm_gain_modification_db == 1) {
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 10);
|
tmp = impd_read_bits_buf(it_bit_buff, 10);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
loudness_norm_param_interface->loudness_norm_gain_modification_db =
|
||||||
loudness_norm_param_interface->loudness_norm_gain_modification_db = -16+tmp*0.03125f;
|
-16 + tmp * 0.03125f;
|
||||||
}
|
}
|
||||||
|
|
||||||
loudness_norm_param_interface->change_output_peak_level_max = impd_read_bits_buf(it_bit_buff, 1);
|
loudness_norm_param_interface->change_output_peak_level_max =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
if (loudness_norm_param_interface->change_output_peak_level_max == 1) {
|
if (loudness_norm_param_interface->change_output_peak_level_max == 1) {
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 6);
|
tmp = impd_read_bits_buf(it_bit_buff, 6);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
loudness_norm_param_interface->output_peak_level_max = tmp * 0.5f;
|
loudness_norm_param_interface->output_peak_level_max = tmp * 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32 impd_drc_interface_read(ia_bit_buf_struct* it_bit_buff,
|
WORD32 impd_drc_interface_read(
|
||||||
ia_dyn_rng_ctrl_interface_struct* drc_ctrl_interface)
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
{
|
ia_dyn_rng_ctrl_interface_struct* drc_ctrl_interface) {
|
||||||
// WORD32 err = 0;
|
// WORD32 err = 0;
|
||||||
WORD32 i = 0, j = 0, tmp = 0;
|
WORD32 i = 0, j = 0, tmp = 0;
|
||||||
|
|
||||||
drc_ctrl_interface->dynamic_range_control_on = impd_read_bits_buf(it_bit_buff, 1);
|
drc_ctrl_interface->dynamic_range_control_on =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
|
|
||||||
if (drc_ctrl_interface->dynamic_range_control_on == 1) {
|
if (drc_ctrl_interface->dynamic_range_control_on == 1) {
|
||||||
drc_ctrl_interface->num_drc_feature_requests = impd_read_bits_buf(it_bit_buff, 3);
|
drc_ctrl_interface->num_drc_feature_requests =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 3);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
|
|
||||||
for (i = 0; i < drc_ctrl_interface->num_drc_feature_requests; i++) {
|
for (i = 0; i < drc_ctrl_interface->num_drc_feature_requests; i++) {
|
||||||
drc_ctrl_interface->drc_feature_req_type[i] = impd_read_bits_buf(it_bit_buff, 2);
|
drc_ctrl_interface->drc_feature_req_type[i] =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 2);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
|
|
||||||
switch (drc_ctrl_interface->drc_feature_req_type[i]) {
|
switch (drc_ctrl_interface->drc_feature_req_type[i]) {
|
||||||
case 0:
|
case 0:
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
|
|
||||||
drc_ctrl_interface->requested_num_drc_effects[i] = (tmp >> 4) & 0xf;
|
drc_ctrl_interface->requested_num_drc_effects[i] = (tmp >> 4) & 0xf;
|
||||||
drc_ctrl_interface->desired_num_drc_effects_of_requested[i] = tmp&0xf;
|
drc_ctrl_interface->desired_num_drc_effects_of_requested[i] =
|
||||||
|
tmp & 0xf;
|
||||||
|
|
||||||
for (j=0; j<drc_ctrl_interface->requested_num_drc_effects[i]; j++)
|
for (j = 0; j < drc_ctrl_interface->requested_num_drc_effects[i];
|
||||||
{
|
j++) {
|
||||||
drc_ctrl_interface->requested_drc_effect_type[i][j] = impd_read_bits_buf(it_bit_buff, 4);
|
drc_ctrl_interface->requested_drc_effect_type[i][j] =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 4);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 3);
|
tmp = impd_read_bits_buf(it_bit_buff, 3);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
|
|
||||||
drc_ctrl_interface->requested_dyn_rng_measurement_type[i] = (tmp>>1)&3;
|
drc_ctrl_interface->requested_dyn_rng_measurement_type[i] =
|
||||||
drc_ctrl_interface->requested_dyn_range_is_single_val_flag[i] = tmp&1;
|
(tmp >> 1) & 3;
|
||||||
|
drc_ctrl_interface->requested_dyn_range_is_single_val_flag[i] =
|
||||||
|
tmp & 1;
|
||||||
|
|
||||||
if (drc_ctrl_interface->requested_dyn_range_is_single_val_flag[i] == 0) {
|
if (drc_ctrl_interface->requested_dyn_range_is_single_val_flag[i] ==
|
||||||
|
0) {
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
if (tmp == 0)
|
if (tmp == 0)
|
||||||
drc_ctrl_interface->requested_dyn_range_value[i] = 0.0f;
|
drc_ctrl_interface->requested_dyn_range_value[i] = 0.0f;
|
||||||
else if (tmp <= 128)
|
else if (tmp <= 128)
|
||||||
drc_ctrl_interface->requested_dyn_range_value[i] = tmp * 0.25f;
|
drc_ctrl_interface->requested_dyn_range_value[i] = tmp * 0.25f;
|
||||||
else if (tmp <= 204)
|
else if (tmp <= 204)
|
||||||
drc_ctrl_interface->requested_dyn_range_value[i] = 0.5f * tmp - 32.0f;
|
drc_ctrl_interface->requested_dyn_range_value[i] =
|
||||||
|
0.5f * tmp - 32.0f;
|
||||||
else
|
else
|
||||||
drc_ctrl_interface->requested_dyn_range_value[i] = tmp - 134.0f;
|
drc_ctrl_interface->requested_dyn_range_value[i] = tmp - 134.0f;
|
||||||
} else {
|
} else {
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
if (tmp == 0)
|
if (tmp == 0)
|
||||||
drc_ctrl_interface->requested_dyn_range_min_val[i] = 0.0f;
|
drc_ctrl_interface->requested_dyn_range_min_val[i] = 0.0f;
|
||||||
else if (tmp <= 128)
|
else if (tmp <= 128)
|
||||||
drc_ctrl_interface->requested_dyn_range_min_val[i] = tmp * 0.25f;
|
drc_ctrl_interface->requested_dyn_range_min_val[i] = tmp * 0.25f;
|
||||||
else if (tmp <= 204)
|
else if (tmp <= 204)
|
||||||
drc_ctrl_interface->requested_dyn_range_min_val[i] = 0.5f * tmp - 32.0f;
|
drc_ctrl_interface->requested_dyn_range_min_val[i] =
|
||||||
|
0.5f * tmp - 32.0f;
|
||||||
else
|
else
|
||||||
drc_ctrl_interface->requested_dyn_range_min_val[i] = tmp - 134.0f;
|
drc_ctrl_interface->requested_dyn_range_min_val[i] = tmp - 134.0f;
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
if (tmp == 0)
|
if (tmp == 0)
|
||||||
drc_ctrl_interface->requested_dyn_range_max_val[i] = 0.0f;
|
drc_ctrl_interface->requested_dyn_range_max_val[i] = 0.0f;
|
||||||
else if (tmp <= 128)
|
else if (tmp <= 128)
|
||||||
drc_ctrl_interface->requested_dyn_range_max_val[i] = tmp * 0.25f;
|
drc_ctrl_interface->requested_dyn_range_max_val[i] = tmp * 0.25f;
|
||||||
else if (tmp <= 204)
|
else if (tmp <= 204)
|
||||||
drc_ctrl_interface->requested_dyn_range_max_val[i] = 0.5f * tmp - 32.0f;
|
drc_ctrl_interface->requested_dyn_range_max_val[i] =
|
||||||
|
0.5f * tmp - 32.0f;
|
||||||
else
|
else
|
||||||
drc_ctrl_interface->requested_dyn_range_max_val[i] = tmp - 134.0f;
|
drc_ctrl_interface->requested_dyn_range_max_val[i] = tmp - 134.0f;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
drc_ctrl_interface->requested_drc_characteristic[i] = impd_read_bits_buf(it_bit_buff, 7);
|
drc_ctrl_interface->requested_drc_characteristic[i] =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 7);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return (1);
|
return (1);
|
||||||
|
|
@ -304,23 +301,21 @@ WORD32 impd_drc_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32 impd_drc_param_interface_read(ia_bit_buf_struct* it_bit_buff,
|
WORD32 impd_drc_param_interface_read(
|
||||||
ia_drc_parameter_interface_struct* drc_parameter_interface)
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
{
|
ia_drc_parameter_interface_struct* drc_parameter_interface) {
|
||||||
// WORD32 err = 0;
|
// WORD32 err = 0;
|
||||||
WORD32 tmp = 0;
|
WORD32 tmp = 0;
|
||||||
|
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 2);
|
tmp = impd_read_bits_buf(it_bit_buff, 2);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
|
|
||||||
drc_parameter_interface->change_compress = (tmp >> 1) & 1;
|
drc_parameter_interface->change_compress = (tmp >> 1) & 1;
|
||||||
drc_parameter_interface->change_boost = tmp & 1;
|
drc_parameter_interface->change_boost = tmp & 1;
|
||||||
|
|
||||||
if (drc_parameter_interface->change_compress == 1) {
|
if (drc_parameter_interface->change_compress == 1) {
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
if (tmp < 255) {
|
if (tmp < 255) {
|
||||||
drc_parameter_interface->compress = 1 - tmp * 0.00390625f;
|
drc_parameter_interface->compress = 1 - tmp * 0.00390625f;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -330,8 +325,7 @@ WORD32 impd_drc_param_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||||
|
|
||||||
if (drc_parameter_interface->change_boost == 1) {
|
if (drc_parameter_interface->change_boost == 1) {
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
tmp = impd_read_bits_buf(it_bit_buff, 8);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
if (tmp < 255) {
|
if (tmp < 255) {
|
||||||
drc_parameter_interface->boost = 1 - tmp * 0.00390625f;
|
drc_parameter_interface->boost = 1 - tmp * 0.00390625f;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -339,175 +333,180 @@ WORD32 impd_drc_param_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
drc_parameter_interface->change_drc_characteristic_target = impd_read_bits_buf(it_bit_buff, 1);
|
drc_parameter_interface->change_drc_characteristic_target =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
|
|
||||||
if (drc_parameter_interface->change_drc_characteristic_target == 1) {
|
if (drc_parameter_interface->change_drc_characteristic_target == 1) {
|
||||||
drc_parameter_interface->drc_characteristic_target = impd_read_bits_buf(it_bit_buff, 8);
|
drc_parameter_interface->drc_characteristic_target =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 8);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static WORD32 impd_parse_loud_eq_param_interface(ia_bit_buf_struct* it_bit_buff,
|
static WORD32 impd_parse_loud_eq_param_interface(
|
||||||
ia_loudness_eq_parameter_interface_struct* loudness_eq_parameter_interface)
|
ia_bit_buf_struct* it_bit_buff, ia_loudness_eq_parameter_interface_struct*
|
||||||
{
|
loudness_eq_parameter_interface) {
|
||||||
// WORD32 err = 0;
|
// WORD32 err = 0;
|
||||||
WORD32 bsSensitivity, bsPlaybackGain;
|
WORD32 bsSensitivity, bsPlaybackGain;
|
||||||
|
|
||||||
loudness_eq_parameter_interface->loudness_eq_request_flag = impd_read_bits_buf(it_bit_buff, 1);
|
loudness_eq_parameter_interface->loudness_eq_request_flag =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
if (loudness_eq_parameter_interface->loudness_eq_request_flag) {
|
if (loudness_eq_parameter_interface->loudness_eq_request_flag) {
|
||||||
loudness_eq_parameter_interface->loudness_eq_request = impd_read_bits_buf(it_bit_buff, 2);
|
loudness_eq_parameter_interface->loudness_eq_request =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 2);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
}
|
}
|
||||||
loudness_eq_parameter_interface->sensitivity_flag = impd_read_bits_buf(it_bit_buff, 1);
|
loudness_eq_parameter_interface->sensitivity_flag =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
if (loudness_eq_parameter_interface->sensitivity_flag) {
|
if (loudness_eq_parameter_interface->sensitivity_flag) {
|
||||||
bsSensitivity = impd_read_bits_buf(it_bit_buff, 7);
|
bsSensitivity = impd_read_bits_buf(it_bit_buff, 7);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
loudness_eq_parameter_interface->sensitivity = bsSensitivity + 23.0f;
|
loudness_eq_parameter_interface->sensitivity = bsSensitivity + 23.0f;
|
||||||
}
|
}
|
||||||
loudness_eq_parameter_interface->playback_gain_flag = impd_read_bits_buf(it_bit_buff, 1);
|
loudness_eq_parameter_interface->playback_gain_flag =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
if (loudness_eq_parameter_interface->playback_gain_flag) {
|
if (loudness_eq_parameter_interface->playback_gain_flag) {
|
||||||
bsPlaybackGain = impd_read_bits_buf(it_bit_buff, 7);
|
bsPlaybackGain = impd_read_bits_buf(it_bit_buff, 7);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
loudness_eq_parameter_interface->playback_gain = (FLOAT32)-bsPlaybackGain;
|
loudness_eq_parameter_interface->playback_gain = (FLOAT32)-bsPlaybackGain;
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_unidrc_interface_extension_read(ia_bit_buf_struct* it_bit_buff,
|
impd_unidrc_interface_extension_read(
|
||||||
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_drc_interface_struct* impd_drc_uni_interface,
|
ia_drc_interface_struct* impd_drc_uni_interface,
|
||||||
ia_drc_uni_interface_ext_struct* drc_uni_interface_ext)
|
ia_drc_uni_interface_ext_struct* drc_uni_interface_ext) {
|
||||||
{
|
|
||||||
WORD32 err = 0, i = 0, tmp = 0, dummy;
|
WORD32 err = 0, i = 0, tmp = 0, dummy;
|
||||||
WORD32 uni_drc_interface_ext_type;
|
WORD32 uni_drc_interface_ext_type;
|
||||||
ia_specific_interface_extension_struct* specific_interface_ext;
|
ia_specific_interface_extension_struct* specific_interface_ext;
|
||||||
|
|
||||||
uni_drc_interface_ext_type = impd_read_bits_buf(it_bit_buff, 4);
|
uni_drc_interface_ext_type = impd_read_bits_buf(it_bit_buff, 4);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
|
|
||||||
while (uni_drc_interface_ext_type != UNIDRCINTERFACEEXT_TERM) {
|
while (uni_drc_interface_ext_type != UNIDRCINTERFACEEXT_TERM) {
|
||||||
specific_interface_ext = &(drc_uni_interface_ext->specific_interface_ext[i]);
|
specific_interface_ext =
|
||||||
specific_interface_ext->uni_drc_interface_ext_type = uni_drc_interface_ext_type;
|
&(drc_uni_interface_ext->specific_interface_ext[i]);
|
||||||
|
specific_interface_ext->uni_drc_interface_ext_type =
|
||||||
|
uni_drc_interface_ext_type;
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, 4);
|
tmp = impd_read_bits_buf(it_bit_buff, 4);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
specific_interface_ext->ext_size_bits = tmp + 4;
|
specific_interface_ext->ext_size_bits = tmp + 4;
|
||||||
|
|
||||||
tmp = impd_read_bits_buf(it_bit_buff, specific_interface_ext->ext_size_bits);
|
tmp =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, specific_interface_ext->ext_size_bits);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
|
|
||||||
specific_interface_ext->ext_bit_size = tmp + 1;
|
specific_interface_ext->ext_bit_size = tmp + 1;
|
||||||
|
|
||||||
switch (uni_drc_interface_ext_type) {
|
switch (uni_drc_interface_ext_type) {
|
||||||
case UNIDRCINTERFACEEXT_EQ:
|
case UNIDRCINTERFACEEXT_EQ:
|
||||||
impd_drc_uni_interface->drc_uni_interface_ext.loudness_eq_parameter_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
impd_drc_uni_interface->drc_uni_interface_ext
|
||||||
if(it_bit_buff->error)
|
.loudness_eq_parameter_interface_flag =
|
||||||
return it_bit_buff->error;
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
if (impd_drc_uni_interface->drc_uni_interface_ext.loudness_eq_parameter_interface_flag) {
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
err = impd_parse_loud_eq_param_interface(it_bit_buff, &(impd_drc_uni_interface->drc_uni_interface_ext.loudness_eq_parameter_interface));
|
if (impd_drc_uni_interface->drc_uni_interface_ext
|
||||||
|
.loudness_eq_parameter_interface_flag) {
|
||||||
|
err = impd_parse_loud_eq_param_interface(
|
||||||
|
it_bit_buff, &(impd_drc_uni_interface->drc_uni_interface_ext
|
||||||
|
.loudness_eq_parameter_interface));
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
}
|
}
|
||||||
impd_drc_uni_interface->drc_uni_interface_ext.eq_ctrl_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
impd_drc_uni_interface->drc_uni_interface_ext.eq_ctrl_interface_flag =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
if (impd_drc_uni_interface->drc_uni_interface_ext.eq_ctrl_interface_flag) {
|
if (impd_drc_uni_interface->drc_uni_interface_ext
|
||||||
impd_drc_uni_interface->drc_uni_interface_ext.eq_ctrl_interface.eq_set_purpose_request = impd_read_bits_buf(it_bit_buff, 16);
|
.eq_ctrl_interface_flag) {
|
||||||
if(it_bit_buff->error)
|
impd_drc_uni_interface->drc_uni_interface_ext.eq_ctrl_interface
|
||||||
return it_bit_buff->error;
|
.eq_set_purpose_request = impd_read_bits_buf(it_bit_buff, 16);
|
||||||
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dummy = impd_read_bits_buf(it_bit_buff, specific_interface_ext->ext_bit_size);
|
dummy = impd_read_bits_buf(it_bit_buff,
|
||||||
if(it_bit_buff->error)
|
specific_interface_ext->ext_bit_size);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
if (i==EXT_COUNT_MAX)
|
if (i == EXT_COUNT_MAX) {
|
||||||
{
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
uni_drc_interface_ext_type = impd_read_bits_buf(it_bit_buff, 4);
|
uni_drc_interface_ext_type = impd_read_bits_buf(it_bit_buff, 4);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
}
|
}
|
||||||
drc_uni_interface_ext->interface_ext_count = i;
|
drc_uni_interface_ext->interface_ext_count = i;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
WORD32 impd_unidrc_interface_read(ia_bit_buf_struct* it_bit_buff,
|
WORD32 impd_unidrc_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_drc_interface_struct* uniDrcInterface)
|
ia_drc_interface_struct* uniDrcInterface) {
|
||||||
{
|
|
||||||
WORD32 err = 0;
|
WORD32 err = 0;
|
||||||
|
|
||||||
uniDrcInterface->interface_signat_flag = impd_read_bits_buf(it_bit_buff, 1);
|
uniDrcInterface->interface_signat_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
if (uniDrcInterface->interface_signat_flag == 1) {
|
if (uniDrcInterface->interface_signat_flag == 1) {
|
||||||
err = impd_unidrc_interface_signature_read(it_bit_buff, &(uniDrcInterface->drc_uni_interface_signature));
|
err = impd_unidrc_interface_signature_read(
|
||||||
|
it_bit_buff, &(uniDrcInterface->drc_uni_interface_signature));
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
uniDrcInterface->system_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
uniDrcInterface->system_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
if (uniDrcInterface->system_interface_flag == 1) {
|
if (uniDrcInterface->system_interface_flag == 1) {
|
||||||
err = impd_sys_interface_read(it_bit_buff, &(uniDrcInterface->system_interface));
|
err = impd_sys_interface_read(it_bit_buff,
|
||||||
|
&(uniDrcInterface->system_interface));
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
uniDrcInterface->loudness_norm_ctrl_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
uniDrcInterface->loudness_norm_ctrl_interface_flag =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
if (uniDrcInterface->loudness_norm_ctrl_interface_flag == 1) {
|
if (uniDrcInterface->loudness_norm_ctrl_interface_flag == 1) {
|
||||||
err = impd_loudness_norm_control_interface_read(it_bit_buff, &(uniDrcInterface->loudness_norm_ctrl_interface));
|
err = impd_loudness_norm_control_interface_read(
|
||||||
|
it_bit_buff, &(uniDrcInterface->loudness_norm_ctrl_interface));
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
uniDrcInterface->loudness_norm_parameter_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
uniDrcInterface->loudness_norm_parameter_interface_flag =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
if (uniDrcInterface->loudness_norm_parameter_interface_flag == 1) {
|
if (uniDrcInterface->loudness_norm_parameter_interface_flag == 1) {
|
||||||
err = impd_loudness_norm_param_interface_read(it_bit_buff, &(uniDrcInterface->loudness_norm_param_interface));
|
err = impd_loudness_norm_param_interface_read(
|
||||||
|
it_bit_buff, &(uniDrcInterface->loudness_norm_param_interface));
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
uniDrcInterface->drc_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
uniDrcInterface->drc_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
||||||
if(it_bit_buff->error)
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
return it_bit_buff->error;
|
|
||||||
if (uniDrcInterface->drc_interface_flag == 1) {
|
if (uniDrcInterface->drc_interface_flag == 1) {
|
||||||
err = impd_drc_interface_read(it_bit_buff, &(uniDrcInterface->drc_ctrl_interface));
|
err = impd_drc_interface_read(it_bit_buff,
|
||||||
|
&(uniDrcInterface->drc_ctrl_interface));
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
uniDrcInterface->drc_parameter_interface_flag = impd_read_bits_buf(it_bit_buff, 1);
|
uniDrcInterface->drc_parameter_interface_flag =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
if (uniDrcInterface->drc_parameter_interface_flag == 1) {
|
if (uniDrcInterface->drc_parameter_interface_flag == 1) {
|
||||||
err = impd_drc_param_interface_read(it_bit_buff, &(uniDrcInterface->drc_parameter_interface));
|
err = impd_drc_param_interface_read(
|
||||||
|
it_bit_buff, &(uniDrcInterface->drc_parameter_interface));
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
uniDrcInterface->drc_uni_interface_ext_flag = impd_read_bits_buf(it_bit_buff, 1);
|
uniDrcInterface->drc_uni_interface_ext_flag =
|
||||||
if(it_bit_buff->error)
|
impd_read_bits_buf(it_bit_buff, 1);
|
||||||
return it_bit_buff->error;
|
if (it_bit_buff->error) return it_bit_buff->error;
|
||||||
if (uniDrcInterface->drc_uni_interface_ext_flag == 1) {
|
if (uniDrcInterface->drc_uni_interface_ext_flag == 1) {
|
||||||
err = impd_unidrc_interface_extension_read(it_bit_buff, uniDrcInterface, &(uniDrcInterface->drc_uni_interface_ext));
|
err = impd_unidrc_interface_extension_read(
|
||||||
|
it_bit_buff, uniDrcInterface,
|
||||||
|
&(uniDrcInterface->drc_uni_interface_ext));
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,36 +34,33 @@
|
||||||
#include "impd_drc_uni_process_audio.h"
|
#include "impd_drc_uni_process_audio.h"
|
||||||
#include "impd_drc_rom.h"
|
#include "impd_drc_rom.h"
|
||||||
|
|
||||||
|
WORD32 impd_parametric_drc_instance_reset(
|
||||||
WORD32 impd_parametric_drc_instance_reset(WORD32 instance_idx,
|
WORD32 instance_idx, ia_parametric_drc_instance_params_struct*
|
||||||
ia_parametric_drc_instance_params_struct* pstr_parametric_drc_instance_params)
|
pstr_parametric_drc_instance_params) {
|
||||||
{
|
|
||||||
WORD32 err = 0;
|
WORD32 err = 0;
|
||||||
|
|
||||||
if (pstr_parametric_drc_instance_params->parametric_drc_type == PARAM_DRC_TYPE_FF)
|
if (pstr_parametric_drc_instance_params->parametric_drc_type ==
|
||||||
{
|
PARAM_DRC_TYPE_FF) {
|
||||||
|
ia_parametric_drc_type_ff_params_struct*
|
||||||
|
pstr_parametric_ffwd_type_drc_params =
|
||||||
|
&(pstr_parametric_drc_instance_params
|
||||||
|
->str_parametric_drc_type_ff_params);
|
||||||
|
err = impd_parametric_ffwd_type_drc_reset(
|
||||||
|
pstr_parametric_ffwd_type_drc_params);
|
||||||
|
if (err) return (err);
|
||||||
|
|
||||||
ia_parametric_drc_type_ff_params_struct* pstr_parametric_ffwd_type_drc_params = &(pstr_parametric_drc_instance_params->str_parametric_drc_type_ff_params);
|
} else {
|
||||||
err = impd_parametric_ffwd_type_drc_reset(pstr_parametric_ffwd_type_drc_params);
|
|
||||||
if (err)
|
|
||||||
return (err);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return (UNEXPECTED_ERROR);
|
return (UNEXPECTED_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32 impd_add_drc_band_audio(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
WORD32 impd_add_drc_band_audio(
|
||||||
|
ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||||
const WORD32 drc_instructions_index,
|
const WORD32 drc_instructions_index,
|
||||||
ia_drc_params_struct* ia_drc_params_struct,
|
ia_drc_params_struct* ia_drc_params_struct,
|
||||||
ia_audio_band_buffer_struct* audio_band_buffer,
|
ia_audio_band_buffer_struct* audio_band_buffer, FLOAT32* audio_io_buf[]) {
|
||||||
FLOAT32* audio_io_buf[])
|
|
||||||
{
|
|
||||||
WORD32 g, b, i, c;
|
WORD32 g, b, i, c;
|
||||||
FLOAT32 sum;
|
FLOAT32 sum;
|
||||||
WORD32 signalIndex = 0;
|
WORD32 signalIndex = 0;
|
||||||
|
|
@ -75,46 +72,37 @@ WORD32 impd_add_drc_band_audio(ia_drc_instructions_struct* pstr_drc_instruction_
|
||||||
channel_audio = audio_io_buf;
|
channel_audio = audio_io_buf;
|
||||||
|
|
||||||
if (drc_instructions_index >= 0) {
|
if (drc_instructions_index >= 0) {
|
||||||
str_drc_instruction_str = &(pstr_drc_instruction_arr[drc_instructions_index]);
|
str_drc_instruction_str =
|
||||||
|
&(pstr_drc_instruction_arr[drc_instructions_index]);
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_drc_instruction_str->drc_set_id > 0)
|
if (str_drc_instruction_str->drc_set_id > 0) {
|
||||||
{
|
|
||||||
|
|
||||||
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
||||||
|
|
||||||
{
|
{
|
||||||
g = str_drc_instruction_str->channel_group_of_ch[c];
|
g = str_drc_instruction_str->channel_group_of_ch[c];
|
||||||
if (g>=0)
|
if (g >= 0) {
|
||||||
{
|
for (i = 0; i < ia_drc_params_struct->drc_frame_size; i++) {
|
||||||
for (i=0; i<ia_drc_params_struct->drc_frame_size; i++)
|
|
||||||
{
|
|
||||||
sum = 0.0f;
|
sum = 0.0f;
|
||||||
for (b=0; b<str_drc_instruction_str->band_count_of_ch_group[g]; b++)
|
for (b = 0; b < str_drc_instruction_str->band_count_of_ch_group[g];
|
||||||
{
|
b++) {
|
||||||
sum += drcBandAudio[signalIndex + b][i];
|
sum += drcBandAudio[signalIndex + b][i];
|
||||||
}
|
}
|
||||||
|
|
||||||
channel_audio[c][i] = sum;
|
channel_audio[c][i] = sum;
|
||||||
|
|
||||||
}
|
}
|
||||||
signalIndex += str_drc_instruction_str->band_count_of_ch_group[g];
|
signalIndex += str_drc_instruction_str->band_count_of_ch_group[g];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
signalIndex++;
|
signalIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
||||||
|
|
||||||
{
|
{
|
||||||
for (i=0; i<ia_drc_params_struct->drc_frame_size; i++)
|
for (i = 0; i < ia_drc_params_struct->drc_frame_size; i++) {
|
||||||
{
|
|
||||||
channel_audio[c][i] = drcBandAudio[c][i];
|
channel_audio[c][i] = drcBandAudio[c][i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -122,64 +110,56 @@ WORD32 impd_add_drc_band_audio(ia_drc_instructions_struct* pstr_drc_instruction_
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32 removeTables(void)
|
WORD32 removeTables(void) { return (0); }
|
||||||
{
|
|
||||||
|
|
||||||
return(0);
|
const ia_slope_code_table_struct* impd_get_slope_code_tbl_by_value(void) {
|
||||||
}
|
|
||||||
|
|
||||||
const ia_slope_code_table_struct*
|
|
||||||
impd_get_slope_code_tbl_by_value(void)
|
|
||||||
{
|
|
||||||
return (&(slopeCodeTableEntryByValue[0]));
|
return (&(slopeCodeTableEntryByValue[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
FLOAT32 impd_decode_slope_idx(const WORD32 slopeCodeIndex)
|
FLOAT32 impd_decode_slope_idx(const WORD32 slopeCodeIndex) {
|
||||||
{
|
const ia_slope_code_table_struct* slopeCodeTable =
|
||||||
const ia_slope_code_table_struct* slopeCodeTable = impd_get_slope_code_tbl_by_value();
|
impd_get_slope_code_tbl_by_value();
|
||||||
return slopeCodeTable[slopeCodeIndex].value;
|
return slopeCodeTable[slopeCodeIndex].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
FLOAT32 impd_decode_slope_idx_magnitude(const WORD32 slopeCodeIndex)
|
FLOAT32 impd_decode_slope_idx_magnitude(const WORD32 slopeCodeIndex) {
|
||||||
{
|
const ia_slope_code_table_struct* slopeCodeTable =
|
||||||
const ia_slope_code_table_struct* slopeCodeTable = impd_get_slope_code_tbl_by_value();
|
impd_get_slope_code_tbl_by_value();
|
||||||
return (FLOAT32)fabs((FLOAT64)slopeCodeTable[slopeCodeIndex].value);
|
return (FLOAT32)fabs((FLOAT64)slopeCodeTable[slopeCodeIndex].value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WORD32 impd_get_multi_band_drc_present(ia_drc_config* pstr_drc_config,
|
WORD32 impd_get_multi_band_drc_present(ia_drc_config* pstr_drc_config,
|
||||||
WORD32 numSets[3],
|
WORD32 numSets[3],
|
||||||
WORD32 multiBandDrcPresent[3])
|
WORD32 multiBandDrcPresent[3]) {
|
||||||
{
|
|
||||||
WORD32 err = 0, k, m;
|
WORD32 err = 0, k, m;
|
||||||
for(k=0; k<pstr_drc_config->drc_instructions_uni_drc_count; k++)
|
for (k = 0; k < pstr_drc_config->drc_instructions_uni_drc_count; k++) {
|
||||||
{
|
if ((pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] ==
|
||||||
if ((pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] == ID_FOR_BASE_LAYOUT) || (pstr_drc_config->str_drc_instruction_str[k].drc_apply_to_dwnmix == 0))
|
ID_FOR_BASE_LAYOUT) ||
|
||||||
{
|
(pstr_drc_config->str_drc_instruction_str[k].drc_apply_to_dwnmix ==
|
||||||
|
0)) {
|
||||||
numSets[0]++;
|
numSets[0]++;
|
||||||
}
|
} else if (pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] ==
|
||||||
else if (pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] == ID_FOR_ANY_DOWNMIX)
|
ID_FOR_ANY_DOWNMIX) {
|
||||||
{
|
|
||||||
numSets[1]++;
|
numSets[1]++;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
numSets[2]++;
|
numSets[2]++;
|
||||||
}
|
}
|
||||||
for (m=0; m<pstr_drc_config->str_drc_instruction_str[k].num_drc_ch_groups; m++)
|
for (m = 0;
|
||||||
{
|
m < pstr_drc_config->str_drc_instruction_str[k].num_drc_ch_groups;
|
||||||
if (pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0].gain_set_params[pstr_drc_config->str_drc_instruction_str->gain_set_index_for_channel_group[m]].band_count > 1)
|
m++) {
|
||||||
{
|
if (pstr_drc_config->str_p_loc_drc_coefficients_uni_drc[0]
|
||||||
if ((pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] == ID_FOR_BASE_LAYOUT) || (pstr_drc_config->str_drc_instruction_str[k].drc_apply_to_dwnmix == 0))
|
.gain_set_params[pstr_drc_config->str_drc_instruction_str
|
||||||
{
|
->gain_set_index_for_channel_group[m]]
|
||||||
|
.band_count > 1) {
|
||||||
|
if ((pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] ==
|
||||||
|
ID_FOR_BASE_LAYOUT) ||
|
||||||
|
(pstr_drc_config->str_drc_instruction_str[k].drc_apply_to_dwnmix ==
|
||||||
|
0)) {
|
||||||
multiBandDrcPresent[0] = 1;
|
multiBandDrcPresent[0] = 1;
|
||||||
}
|
} else if (pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] ==
|
||||||
else if (pstr_drc_config->str_drc_instruction_str[k].downmix_id[0] == ID_FOR_ANY_DOWNMIX)
|
ID_FOR_ANY_DOWNMIX) {
|
||||||
{
|
|
||||||
multiBandDrcPresent[1] = 1;
|
multiBandDrcPresent[1] = 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
multiBandDrcPresent[2] = 1;
|
multiBandDrcPresent[2] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -187,5 +167,3 @@ WORD32 impd_get_multi_band_drc_present(ia_drc_config* pstr_drc_config,
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -25,28 +25,25 @@ extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_mixing_level_info(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
impd_mixing_level_info(
|
||||||
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
WORD32 requested_dwnmix_id,
|
WORD32 requested_dwnmix_id, WORD32 drc_set_id_requested,
|
||||||
WORD32 drc_set_id_requested,
|
WORD32 eq_set_id_requested, FLOAT32* mixing_level);
|
||||||
WORD32 eq_set_id_requested,
|
|
||||||
FLOAT32* mixing_level);
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_signal_peak_level_info(ia_drc_config* pstr_drc_config,
|
impd_signal_peak_level_info(ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||||
WORD32 requested_dwnmix_id,
|
WORD32 requested_dwnmix_id, WORD32 album_mode,
|
||||||
WORD32 album_mode,
|
|
||||||
WORD32 num_compression_eq_count,
|
WORD32 num_compression_eq_count,
|
||||||
WORD32* num_compression_eq_id,
|
WORD32* num_compression_eq_id,
|
||||||
WORD32* peak_info_count,
|
WORD32* peak_info_count, WORD32 eq_set_id[],
|
||||||
WORD32 eq_set_id[],
|
|
||||||
FLOAT32 signal_peak_level[],
|
FLOAT32 signal_peak_level[],
|
||||||
WORD32 explicit_peak_information_present[]);
|
WORD32 explicit_peak_information_present[]);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_extract_loudness_peak_to_average_info(ia_loudness_info_struct* loudness_info,
|
impd_extract_loudness_peak_to_average_info(
|
||||||
WORD32 dyn_range_measurement_type,
|
ia_loudness_info_struct* loudness_info, WORD32 dyn_range_measurement_type,
|
||||||
WORD32* loudness_peak_2_avg_value_present,
|
WORD32* loudness_peak_2_avg_value_present,
|
||||||
FLOAT32* loudness_peak_2_avg_value);
|
FLOAT32* loudness_peak_2_avg_value);
|
||||||
|
|
||||||
|
|
@ -54,10 +51,8 @@ WORD32
|
||||||
impd_loudness_peak_to_average_info(
|
impd_loudness_peak_to_average_info(
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||||
WORD32 requested_dwnmix_id,
|
WORD32 requested_dwnmix_id, WORD32 dyn_range_measurement_type,
|
||||||
WORD32 dyn_range_measurement_type,
|
WORD32 album_mode, WORD32* loudness_peak_2_avg_value_present,
|
||||||
WORD32 album_mode,
|
|
||||||
WORD32* loudness_peak_2_avg_value_present,
|
|
||||||
FLOAT32* loudness_peak_2_avg_value);
|
FLOAT32* loudness_peak_2_avg_value);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
|
|
@ -65,12 +60,11 @@ impd_overall_loudness_present( ia_loudness_info_struct* loudness_info,
|
||||||
WORD32* loudness_info_present);
|
WORD32* loudness_info_present);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_find_overall_loudness_info(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
impd_find_overall_loudness_info(
|
||||||
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
WORD32 requested_dwnmix_id,
|
WORD32 requested_dwnmix_id, WORD32 drc_set_id_requested,
|
||||||
WORD32 drc_set_id_requested,
|
WORD32* overall_loudness_info_present, WORD32* loudness_info_count,
|
||||||
WORD32* overall_loudness_info_present,
|
|
||||||
WORD32* loudness_info_count,
|
|
||||||
ia_loudness_info_struct* loudness_info[]);
|
ia_loudness_info_struct* loudness_info[]);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
|
|
@ -81,24 +75,18 @@ impd_high_pass_loudness_adjust_info( ia_loudness_info_struct* loudness_info,
|
||||||
WORD32
|
WORD32
|
||||||
impd_find_high_pass_loudness_adjust(
|
impd_find_high_pass_loudness_adjust(
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
WORD32 requested_dwnmix_id,
|
WORD32 requested_dwnmix_id, WORD32 drc_set_id_requested, WORD32 album_mode,
|
||||||
WORD32 drc_set_id_requested,
|
FLOAT32 device_cutoff_freq, WORD32* loudness_hp_adjust_present,
|
||||||
WORD32 album_mode,
|
|
||||||
FLOAT32 device_cutoff_freq,
|
|
||||||
WORD32* loudness_hp_adjust_present,
|
|
||||||
FLOAT32* loudness_hp_adjust);
|
FLOAT32* loudness_hp_adjust);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_init_loudness_control (ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
impd_init_loudness_control(
|
||||||
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
WORD32 requested_dwnmix_id,
|
WORD32 requested_dwnmix_id, WORD32 drc_set_id_requested,
|
||||||
WORD32 drc_set_id_requested,
|
WORD32 num_compression_eq_count, WORD32* num_compression_eq_id,
|
||||||
WORD32 num_compression_eq_count,
|
WORD32* loudness_info_count, WORD32 eq_set_id[],
|
||||||
WORD32* num_compression_eq_id,
|
FLOAT32 loudness_normalization_gain_db[], FLOAT32 loudness[]);
|
||||||
WORD32* loudness_info_count,
|
|
||||||
WORD32 eq_set_id[],
|
|
||||||
FLOAT32 loudness_normalization_gain_db[],
|
|
||||||
FLOAT32 loudness[]);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,32 +41,28 @@
|
||||||
|
|
||||||
#define BITSTREAM_FILE_FORMAT_SPLIT 1
|
#define BITSTREAM_FILE_FORMAT_SPLIT 1
|
||||||
|
|
||||||
static WORD32 impd_down_mix ( ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output, FLOAT32** input_audio, WORD32 frame_len)
|
static WORD32 impd_down_mix(
|
||||||
{
|
ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output,
|
||||||
|
FLOAT32 **input_audio, WORD32 frame_len) {
|
||||||
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
||||||
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
||||||
WORD32 i, i_ch, o_ch;
|
WORD32 i, i_ch, o_ch;
|
||||||
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
||||||
|
|
||||||
if (uni_drc_sel_proc_output->downmix_matrix_present == 0)
|
if (uni_drc_sel_proc_output->downmix_matrix_present == 0) return 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (input_audio == 0)
|
if (input_audio == 0) return 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (num_target_ch > MAX_CHANNEL_COUNT)
|
if (num_target_ch > MAX_CHANNEL_COUNT) return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (num_target_ch > num_base_ch)
|
if (num_target_ch > num_base_ch) return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
for (i = 0; i < frame_len; i++) {
|
for (i = 0; i < frame_len; i++) {
|
||||||
for (o_ch=0; o_ch<num_target_ch; o_ch++)
|
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||||
{
|
|
||||||
tmp_out[o_ch] = 0.0f;
|
tmp_out[o_ch] = 0.0f;
|
||||||
for (i_ch=0; i_ch<num_base_ch; i_ch++)
|
for (i_ch = 0; i_ch < num_base_ch; i_ch++) {
|
||||||
{
|
tmp_out[o_ch] += input_audio[i_ch][i] *
|
||||||
tmp_out[o_ch] += input_audio[i_ch][i] * uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||||
|
|
@ -77,7 +73,6 @@ static WORD32 impd_down_mix ( ia_drc_sel_proc_output_struct *uni_drc_sel_proc_ou
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,104 +90,120 @@ WORD32 impd_init_process_audio_main_qmf (ia_drc_api_struct *p_obj_drc)
|
||||||
input_buffer = (FLOAT32 *)p_obj_drc->pp_mem[2];
|
input_buffer = (FLOAT32 *)p_obj_drc->pp_mem[2];
|
||||||
output_buffer = (FLOAT32 *)p_obj_drc->pp_mem[3];
|
output_buffer = (FLOAT32 *)p_obj_drc->pp_mem[3];
|
||||||
|
|
||||||
if(p_obj_drc->p_state->ui_in_bytes<=0)
|
if (p_obj_drc->p_state->ui_in_bytes <= 0) {
|
||||||
{
|
|
||||||
p_obj_drc->p_state->ui_out_bytes = 0;
|
p_obj_drc->p_state->ui_out_bytes = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((p_obj_drc->p_state->ui_in_bytes/p_obj_drc->str_config.num_ch_in/(p_obj_drc->str_config.pcm_size>>3)) < (UWORD32)p_obj_drc->str_config.frame_size)
|
if ((p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in /
|
||||||
|
(p_obj_drc->str_config.pcm_size >> 3)) <
|
||||||
|
(UWORD32)p_obj_drc->str_config.frame_size)
|
||||||
last_frame = 1;
|
last_frame = 1;
|
||||||
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||||
audio_io_buf_real[i]=scratch_buffer+i*(p_obj_drc->str_config.frame_size+32);
|
audio_io_buf_real[i] =
|
||||||
audio_io_buf_imag[i]=scratch_buffer+p_obj_drc->str_config.num_ch_in*p_obj_drc->str_config.frame_size+p_obj_drc->str_config.num_ch_in*64+i*(p_obj_drc->str_config.frame_size+64);
|
scratch_buffer + i * (p_obj_drc->str_config.frame_size + 32);
|
||||||
|
audio_io_buf_imag[i] =
|
||||||
|
scratch_buffer +
|
||||||
|
p_obj_drc->str_config.num_ch_in * p_obj_drc->str_config.frame_size +
|
||||||
|
p_obj_drc->str_config.num_ch_in * 64 +
|
||||||
|
i * (p_obj_drc->str_config.frame_size + 64);
|
||||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||||
audio_io_buf_real[i][j]=input_buffer[j*p_obj_drc->str_config.num_ch_in + i];
|
audio_io_buf_real[i][j] =
|
||||||
audio_io_buf_imag[i][j]=input_buffer[p_obj_drc->str_config.num_ch_in*p_obj_drc->str_config.frame_size+j*p_obj_drc->str_config.num_ch_in + i];
|
input_buffer[j * p_obj_drc->str_config.num_ch_in + i];
|
||||||
|
audio_io_buf_imag[i][j] =
|
||||||
|
input_buffer[p_obj_drc->str_config.num_ch_in *
|
||||||
|
p_obj_drc->str_config.frame_size +
|
||||||
|
j * p_obj_drc->str_config.num_ch_in + i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
error = impd_process_drc_bitstream_dec_gain(p_obj_drc->str_payload.pstr_bitstream_dec,
|
error = impd_process_drc_bitstream_dec_gain(
|
||||||
p_obj_drc->pstr_bit_buf,
|
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_drc_gain,
|
p_obj_drc->str_payload.pstr_drc_gain,
|
||||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
&p_obj_drc->str_bit_handler
|
||||||
|
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (error > PROC_COMPLETE) return -1;
|
if (error > PROC_COMPLETE) return -1;
|
||||||
|
|
||||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||||
if(p_obj_drc->str_bit_handler.gain_stream_flag==0) //ITTIAM: Flag for applying gain frame by frame
|
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||||
|
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
|
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||||
|
0) // ITTIAM: Flag for applying gain frame by frame
|
||||||
{
|
{
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p_obj_drc->str_config.bitstream_file_format ==
|
||||||
|
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||||
|
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0) {
|
||||||
|
p_obj_drc->str_bit_handler.num_bits_read_bs =
|
||||||
|
p_obj_drc->str_bit_handler.num_bits_read_bs + 8 -
|
||||||
|
p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||||
if (p_obj_drc->str_config.bitstream_file_format == BITSTREAM_FILE_FORMAT_SPLIT) {
|
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0)
|
p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||||
{
|
|
||||||
p_obj_drc->str_bit_handler.num_bits_read_bs = p_obj_drc->str_bit_handler.num_bits_read_bs + 8 - p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
|
||||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||||
p_obj_drc->str_bit_handler.byte_index_bs = p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
p_obj_drc->str_bit_handler.byte_index_bs =
|
||||||
if(p_obj_drc->str_bit_handler.gain_stream_flag==0) //ITTIAM: Flag for applying gain frame by frame
|
p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||||
|
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||||
|
0) // ITTIAM: Flag for applying gain frame by frame
|
||||||
{
|
{
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs = p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
p_obj_drc->str_bit_handler.num_bytes_bs =
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
error = impd_drc_process_freq_domain(p_obj_drc->str_payload.pstr_gain_dec[0],
|
error = impd_drc_process_freq_domain(
|
||||||
|
p_obj_drc->str_payload.pstr_gain_dec[0],
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_drc_gain,
|
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||||
audio_io_buf_real,
|
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
audio_io_buf_imag,
|
->loudness_normalization_gain_db,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db,
|
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->drc_characteristic_target);
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
|
->drc_characteristic_target);
|
||||||
if (error) return -1;
|
if (error) return -1;
|
||||||
|
|
||||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||||
audio_io_buf_real,
|
audio_io_buf_real, p_obj_drc->str_config.frame_size);
|
||||||
p_obj_drc->str_config.frame_size);
|
|
||||||
if (error) return -1;
|
if (error) return -1;
|
||||||
|
|
||||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||||
audio_io_buf_imag,
|
audio_io_buf_imag, p_obj_drc->str_config.frame_size);
|
||||||
p_obj_drc->str_config.frame_size);
|
|
||||||
if (error) return -1;
|
if (error) return -1;
|
||||||
|
|
||||||
error = impd_drc_process_freq_domain(p_obj_drc->str_payload.pstr_gain_dec[1],
|
error = impd_drc_process_freq_domain(
|
||||||
|
p_obj_drc->str_payload.pstr_gain_dec[1],
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_drc_gain,
|
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||||
audio_io_buf_real,
|
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
audio_io_buf_imag,
|
->loudness_normalization_gain_db,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db,
|
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->drc_characteristic_target);
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
|
->drc_characteristic_target);
|
||||||
if (error) return -1;
|
if (error) return -1;
|
||||||
|
|
||||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db != 0.0f)
|
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
{
|
->loudness_normalization_gain_db != 0.0f) {
|
||||||
FLOAT32 loudness_normalization_gain = (FLOAT32)pow(10.0,p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db/20.0);
|
FLOAT32 loudness_normalization_gain =
|
||||||
|
(FLOAT32)pow(10.0, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
|
->loudness_normalization_gain_db /
|
||||||
|
20.0);
|
||||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||||
audio_io_buf_real[i][j] *= loudness_normalization_gain;
|
audio_io_buf_real[i][j] *= loudness_normalization_gain;
|
||||||
audio_io_buf_imag[i][j] *= loudness_normalization_gain;
|
audio_io_buf_imag[i][j] *= loudness_normalization_gain;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -200,38 +211,44 @@ WORD32 impd_init_process_audio_main_qmf (ia_drc_api_struct *p_obj_drc)
|
||||||
|
|
||||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||||
output_buffer[j*p_obj_drc->str_config.num_ch_out + i] = audio_io_buf_real[i][j];
|
output_buffer[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||||
output_buffer[p_obj_drc->str_config.frame_size*p_obj_drc->str_config.num_ch_in+j*p_obj_drc->str_config.num_ch_out + i] = audio_io_buf_imag[i][j];
|
audio_io_buf_real[i][j];
|
||||||
|
output_buffer[p_obj_drc->str_config.frame_size *
|
||||||
|
p_obj_drc->str_config.num_ch_in +
|
||||||
|
j * p_obj_drc->str_config.num_ch_out + i] =
|
||||||
|
audio_io_buf_imag[i][j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p_obj_drc->p_state->ui_out_bytes=p_obj_drc->str_config.num_ch_out*(p_obj_drc->str_config.frame_size)*4;
|
p_obj_drc->p_state->ui_out_bytes =
|
||||||
p_obj_drc->p_state->ui_out_bytes=p_obj_drc->str_config.num_ch_out*(p_obj_drc->p_state->ui_in_bytes/p_obj_drc->str_config.num_ch_in);
|
p_obj_drc->str_config.num_ch_out * (p_obj_drc->str_config.frame_size) * 4;
|
||||||
|
p_obj_drc->p_state->ui_out_bytes =
|
||||||
|
p_obj_drc->str_config.num_ch_out *
|
||||||
|
(p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in);
|
||||||
|
|
||||||
if (last_frame == 0) {
|
if (last_frame == 0) {
|
||||||
|
if (p_obj_drc->str_config.bitstream_file_format !=
|
||||||
if (p_obj_drc->str_config.bitstream_file_format != BITSTREAM_FILE_FORMAT_SPLIT) {
|
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||||
error = impd_process_drc_bitstream_dec(p_obj_drc->str_payload.pstr_bitstream_dec,
|
error = impd_process_drc_bitstream_dec(
|
||||||
p_obj_drc->pstr_bit_buf,
|
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_loudness_info,
|
p_obj_drc->str_payload.pstr_loudness_info,
|
||||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
&p_obj_drc->str_bit_handler
|
||||||
|
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||||
|
|
||||||
if (error > PROC_COMPLETE)
|
if (error > PROC_COMPLETE) return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
|
||||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
|
||||||
|
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||||
|
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||||
|
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||||
|
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||||
|
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,30 +39,28 @@
|
||||||
|
|
||||||
#define BITSTREAM_FILE_FORMAT_SPLIT 1
|
#define BITSTREAM_FILE_FORMAT_SPLIT 1
|
||||||
|
|
||||||
static WORD32 impd_down_mix(ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output, FLOAT32** input_audio, WORD32 frame_len)
|
static WORD32 impd_down_mix(
|
||||||
{
|
ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output,
|
||||||
|
FLOAT32 **input_audio, WORD32 frame_len) {
|
||||||
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
||||||
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
||||||
WORD32 i, i_ch, o_ch;
|
WORD32 i, i_ch, o_ch;
|
||||||
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
||||||
|
|
||||||
if (uni_drc_sel_proc_output->downmix_matrix_present == 0)
|
if (uni_drc_sel_proc_output->downmix_matrix_present == 0) return 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (input_audio == 0)
|
if (input_audio == 0) return 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (num_target_ch > MAX_CHANNEL_COUNT)
|
if (num_target_ch > MAX_CHANNEL_COUNT) return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (num_target_ch > num_base_ch)
|
if (num_target_ch > num_base_ch) return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
for (i = 0; i < frame_len; i++) {
|
for (i = 0; i < frame_len; i++) {
|
||||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||||
tmp_out[o_ch] = 0.0f;
|
tmp_out[o_ch] = 0.0f;
|
||||||
for (i_ch = 0; i_ch < num_base_ch; i_ch++) {
|
for (i_ch = 0; i_ch < num_base_ch; i_ch++) {
|
||||||
tmp_out[o_ch] += input_audio[i_ch][i] * uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
tmp_out[o_ch] += input_audio[i_ch][i] *
|
||||||
|
uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||||
|
|
@ -73,13 +71,9 @@ static WORD32 impd_down_mix(ia_drc_sel_proc_output_struct *uni_drc_sel_proc_outp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WORD32 impd_init_process_audio_main_stft(ia_drc_api_struct *p_obj_drc)
|
WORD32 impd_init_process_audio_main_stft(ia_drc_api_struct *p_obj_drc)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -94,99 +88,120 @@ WORD32 impd_init_process_audio_main_stft (ia_drc_api_struct *p_obj_drc)
|
||||||
input_buffer = (FLOAT32 *)p_obj_drc->pp_mem[2];
|
input_buffer = (FLOAT32 *)p_obj_drc->pp_mem[2];
|
||||||
output_buffer = (FLOAT32 *)p_obj_drc->pp_mem[3];
|
output_buffer = (FLOAT32 *)p_obj_drc->pp_mem[3];
|
||||||
|
|
||||||
|
|
||||||
if (p_obj_drc->p_state->ui_in_bytes <= 0) {
|
if (p_obj_drc->p_state->ui_in_bytes <= 0) {
|
||||||
p_obj_drc->p_state->ui_out_bytes = 0;
|
p_obj_drc->p_state->ui_out_bytes = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((p_obj_drc->p_state->ui_in_bytes/p_obj_drc->str_config.num_ch_in/(p_obj_drc->str_config.pcm_size>>3)) < (UWORD32)p_obj_drc->str_config.frame_size)
|
if ((p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in /
|
||||||
|
(p_obj_drc->str_config.pcm_size >> 3)) <
|
||||||
|
(UWORD32)p_obj_drc->str_config.frame_size)
|
||||||
last_frame = 1;
|
last_frame = 1;
|
||||||
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||||
audio_io_buf_real[i]=scratch_buffer+i*(p_obj_drc->str_config.frame_size+32);
|
audio_io_buf_real[i] =
|
||||||
audio_io_buf_imag[i]=scratch_buffer+p_obj_drc->str_config.num_ch_in*p_obj_drc->str_config.frame_size+p_obj_drc->str_config.num_ch_in*64+i*(p_obj_drc->str_config.frame_size+64);
|
scratch_buffer + i * (p_obj_drc->str_config.frame_size + 32);
|
||||||
|
audio_io_buf_imag[i] =
|
||||||
|
scratch_buffer +
|
||||||
|
p_obj_drc->str_config.num_ch_in * p_obj_drc->str_config.frame_size +
|
||||||
|
p_obj_drc->str_config.num_ch_in * 64 +
|
||||||
|
i * (p_obj_drc->str_config.frame_size + 64);
|
||||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||||
audio_io_buf_real[i][j]=input_buffer[j*p_obj_drc->str_config.num_ch_in + i];
|
audio_io_buf_real[i][j] =
|
||||||
audio_io_buf_imag[i][j]=input_buffer[p_obj_drc->str_config.num_ch_in*p_obj_drc->str_config.frame_size+j*p_obj_drc->str_config.num_ch_in + i];
|
input_buffer[j * p_obj_drc->str_config.num_ch_in + i];
|
||||||
|
audio_io_buf_imag[i][j] =
|
||||||
|
input_buffer[p_obj_drc->str_config.num_ch_in *
|
||||||
|
p_obj_drc->str_config.frame_size +
|
||||||
|
j * p_obj_drc->str_config.num_ch_in + i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
error = impd_process_drc_bitstream_dec_gain(p_obj_drc->str_payload.pstr_bitstream_dec,
|
error = impd_process_drc_bitstream_dec_gain(
|
||||||
p_obj_drc->pstr_bit_buf,
|
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_drc_gain,
|
p_obj_drc->str_payload.pstr_drc_gain,
|
||||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
&p_obj_drc->str_bit_handler
|
||||||
|
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (error > PROC_COMPLETE) return -1;
|
if (error > PROC_COMPLETE) return -1;
|
||||||
|
|
||||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||||
if(p_obj_drc->str_bit_handler.gain_stream_flag==0) //ITTIAM: Flag for applying gain frame by frame
|
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||||
|
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
|
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||||
|
0) // ITTIAM: Flag for applying gain frame by frame
|
||||||
{
|
{
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p_obj_drc->str_config.bitstream_file_format ==
|
||||||
if (p_obj_drc->str_config.bitstream_file_format == BITSTREAM_FILE_FORMAT_SPLIT) {
|
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0)
|
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0) {
|
||||||
{
|
p_obj_drc->str_bit_handler.num_bits_read_bs =
|
||||||
p_obj_drc->str_bit_handler.num_bits_read_bs = p_obj_drc->str_bit_handler.num_bits_read_bs + 8 - p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
p_obj_drc->str_bit_handler.num_bits_read_bs + 8 -
|
||||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||||
p_obj_drc->str_bit_handler.byte_index_bs = p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
p_obj_drc->str_bit_handler.byte_index_bs =
|
||||||
if(p_obj_drc->str_bit_handler.gain_stream_flag==0) //ITTIAM: Flag for applying gain frame by frame
|
p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||||
|
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||||
|
0) // ITTIAM: Flag for applying gain frame by frame
|
||||||
{
|
{
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs = p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
p_obj_drc->str_bit_handler.num_bytes_bs =
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
error = impd_drc_process_freq_domain(p_obj_drc->str_payload.pstr_gain_dec[0],
|
error = impd_drc_process_freq_domain(
|
||||||
|
p_obj_drc->str_payload.pstr_gain_dec[0],
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_drc_gain,
|
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||||
audio_io_buf_real,
|
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
audio_io_buf_imag,
|
->loudness_normalization_gain_db,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db,
|
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->drc_characteristic_target);
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
|
->drc_characteristic_target);
|
||||||
if (error) return -1;
|
if (error) return -1;
|
||||||
|
|
||||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||||
audio_io_buf_real,
|
audio_io_buf_real, p_obj_drc->str_config.frame_size);
|
||||||
p_obj_drc->str_config.frame_size);
|
|
||||||
if (error) return -1;
|
if (error) return -1;
|
||||||
|
|
||||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||||
audio_io_buf_imag,
|
audio_io_buf_imag, p_obj_drc->str_config.frame_size);
|
||||||
p_obj_drc->str_config.frame_size);
|
|
||||||
if (error) return -1;
|
if (error) return -1;
|
||||||
|
|
||||||
error = impd_drc_process_freq_domain(p_obj_drc->str_payload.pstr_gain_dec[1],
|
error = impd_drc_process_freq_domain(
|
||||||
|
p_obj_drc->str_payload.pstr_gain_dec[1],
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_drc_gain,
|
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||||
audio_io_buf_real,
|
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
audio_io_buf_imag,
|
->loudness_normalization_gain_db,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db,
|
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->drc_characteristic_target);
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
|
->drc_characteristic_target);
|
||||||
if (error) return -1;
|
if (error) return -1;
|
||||||
|
|
||||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db != 0.0f)
|
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
{
|
->loudness_normalization_gain_db != 0.0f) {
|
||||||
FLOAT32 loudness_normalization_gain = (FLOAT32)pow(10.0,p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db/20.0);
|
FLOAT32 loudness_normalization_gain =
|
||||||
|
(FLOAT32)pow(10.0, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
|
->loudness_normalization_gain_db /
|
||||||
|
20.0);
|
||||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||||
audio_io_buf_real[i][j] *= loudness_normalization_gain;
|
audio_io_buf_real[i][j] *= loudness_normalization_gain;
|
||||||
audio_io_buf_imag[i][j] *= loudness_normalization_gain;
|
audio_io_buf_imag[i][j] *= loudness_normalization_gain;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -195,38 +210,45 @@ WORD32 impd_init_process_audio_main_stft (ia_drc_api_struct *p_obj_drc)
|
||||||
|
|
||||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||||
output_buffer[j*p_obj_drc->str_config.num_ch_out + i] = audio_io_buf_real[i][j];
|
output_buffer[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||||
output_buffer[p_obj_drc->str_config.frame_size*p_obj_drc->str_config.num_ch_in+j*p_obj_drc->str_config.num_ch_out + i] = audio_io_buf_imag[i][j];
|
audio_io_buf_real[i][j];
|
||||||
|
output_buffer[p_obj_drc->str_config.frame_size *
|
||||||
|
p_obj_drc->str_config.num_ch_in +
|
||||||
|
j * p_obj_drc->str_config.num_ch_out + i] =
|
||||||
|
audio_io_buf_imag[i][j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p_obj_drc->p_state->ui_out_bytes=p_obj_drc->str_config.num_ch_out*(p_obj_drc->str_config.frame_size)*4;
|
p_obj_drc->p_state->ui_out_bytes =
|
||||||
p_obj_drc->p_state->ui_out_bytes=p_obj_drc->str_config.num_ch_out*(p_obj_drc->p_state->ui_in_bytes/p_obj_drc->str_config.num_ch_in);
|
p_obj_drc->str_config.num_ch_out * (p_obj_drc->str_config.frame_size) * 4;
|
||||||
|
p_obj_drc->p_state->ui_out_bytes =
|
||||||
|
p_obj_drc->str_config.num_ch_out *
|
||||||
|
(p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in);
|
||||||
|
|
||||||
if (last_frame == 0) {
|
if (last_frame == 0) {
|
||||||
|
if (p_obj_drc->str_config.bitstream_file_format !=
|
||||||
if (p_obj_drc->str_config.bitstream_file_format != BITSTREAM_FILE_FORMAT_SPLIT) {
|
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||||
error = impd_process_drc_bitstream_dec(p_obj_drc->str_payload.pstr_bitstream_dec,
|
error = impd_process_drc_bitstream_dec(
|
||||||
p_obj_drc->pstr_bit_buf,
|
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_loudness_info,
|
p_obj_drc->str_payload.pstr_loudness_info,
|
||||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
&p_obj_drc->str_bit_handler
|
||||||
|
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||||
|
|
||||||
if (error > PROC_COMPLETE)
|
if (error > PROC_COMPLETE) return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
|
||||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
|
||||||
|
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||||
|
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||||
|
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||||
|
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||||
|
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,46 +41,38 @@
|
||||||
#include "impd_drc_hashdefines.h"
|
#include "impd_drc_hashdefines.h"
|
||||||
#include "impd_drc_peak_limiter.h"
|
#include "impd_drc_peak_limiter.h"
|
||||||
|
|
||||||
static IA_ERRORCODE impd_down_mix ( ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output, FLOAT32** input_audio, WORD32 frame_len)
|
static IA_ERRORCODE impd_down_mix(
|
||||||
{
|
ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output,
|
||||||
|
FLOAT32 **input_audio, WORD32 frame_len) {
|
||||||
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
||||||
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
||||||
WORD32 i, i_ch, o_ch;
|
WORD32 i, i_ch, o_ch;
|
||||||
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
||||||
|
|
||||||
|
if (num_target_ch > MAX_CHANNEL_COUNT) return -1;
|
||||||
|
|
||||||
if (num_target_ch > MAX_CHANNEL_COUNT)
|
if (num_target_ch > num_base_ch) return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (num_target_ch > num_base_ch)
|
for (i = 0; i < frame_len; i++) {
|
||||||
return -1;
|
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||||
|
|
||||||
for (i=0; i<frame_len; i++)
|
|
||||||
{
|
|
||||||
for (o_ch=0; o_ch<num_target_ch; o_ch++)
|
|
||||||
{
|
|
||||||
tmp_out[o_ch] = 0.0f;
|
tmp_out[o_ch] = 0.0f;
|
||||||
for (i_ch=0; i_ch<num_base_ch; i_ch++)
|
for (i_ch = 0; i_ch < num_base_ch; i_ch++) {
|
||||||
{
|
tmp_out[o_ch] += input_audio[i_ch][i] *
|
||||||
tmp_out[o_ch] += input_audio[i_ch][i] * uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (o_ch=0; o_ch<num_target_ch; o_ch++)
|
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||||
{
|
|
||||||
input_audio[o_ch][i] = tmp_out[o_ch];
|
input_audio[o_ch][i] = tmp_out[o_ch];
|
||||||
}
|
}
|
||||||
for ( ; o_ch<num_base_ch; o_ch++)
|
for (; o_ch < num_base_ch; o_ch++) {
|
||||||
{
|
|
||||||
input_audio[o_ch][i] = 0.0f;
|
input_audio[o_ch][i] = 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return IA_NO_ERROR;
|
return IA_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc)
|
IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc) {
|
||||||
{
|
|
||||||
IA_ERRORCODE err_code = IA_NO_ERROR;
|
IA_ERRORCODE err_code = IA_NO_ERROR;
|
||||||
WORD32 i, j;
|
WORD32 i, j;
|
||||||
FLOAT32 *input_buffer;
|
FLOAT32 *input_buffer;
|
||||||
|
|
@ -101,109 +93,119 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc)
|
||||||
return IA_NO_ERROR;
|
return IA_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
err_code = impd_process_drc_bitstream_dec_gain(p_obj_drc->str_payload.pstr_bitstream_dec,
|
err_code = impd_process_drc_bitstream_dec_gain(
|
||||||
p_obj_drc->pstr_bit_buf,
|
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_drc_gain,
|
p_obj_drc->str_payload.pstr_drc_gain,
|
||||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
&p_obj_drc->str_bit_handler
|
||||||
|
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||||
|
|
||||||
if (err_code > PROC_COMPLETE)
|
if (err_code > PROC_COMPLETE) return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||||
if(p_obj_drc->str_bit_handler.gain_stream_flag==0) //ITTIAM: Flag for applying gain frame by frame
|
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||||
|
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
|
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||||
|
0) // ITTIAM: Flag for applying gain frame by frame
|
||||||
{
|
{
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_obj_drc->str_config.bitstream_file_format == BITSTREAM_FILE_FORMAT_SPLIT) {
|
if (p_obj_drc->str_config.bitstream_file_format ==
|
||||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0)
|
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||||
{
|
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0) {
|
||||||
p_obj_drc->str_bit_handler.num_bits_read_bs = p_obj_drc->str_bit_handler.num_bits_read_bs + 8
|
p_obj_drc->str_bit_handler.num_bits_read_bs =
|
||||||
- p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
p_obj_drc->str_bit_handler.num_bits_read_bs + 8 -
|
||||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||||
p_obj_drc->str_bit_handler.byte_index_bs = p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
p_obj_drc->str_bit_handler.byte_index_bs =
|
||||||
if(p_obj_drc->str_bit_handler.gain_stream_flag==0)
|
p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||||
{
|
if (p_obj_drc->str_bit_handler.gain_stream_flag == 0) {
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs = p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
p_obj_drc->str_bit_handler.num_bytes_bs =
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
num_sample_to_process=(p_obj_drc->p_state->ui_in_bytes/p_obj_drc->str_config.num_ch_in/(p_obj_drc->str_config.pcm_size>>3));
|
num_sample_to_process =
|
||||||
|
(p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in /
|
||||||
|
(p_obj_drc->str_config.pcm_size >> 3));
|
||||||
|
|
||||||
p_obj_drc->str_config.frame_size = num_sample_to_process;
|
p_obj_drc->str_config.frame_size = num_sample_to_process;
|
||||||
|
|
||||||
if(num_sample_to_process<p_obj_drc->str_config.frame_size)
|
if (num_sample_to_process < p_obj_drc->str_config.frame_size) last_frame = 1;
|
||||||
last_frame=1;
|
|
||||||
|
|
||||||
if(p_obj_drc->str_config.pcm_size==16)
|
if (p_obj_drc->str_config.pcm_size == 16) {
|
||||||
{
|
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||||
for(i=0;i<p_obj_drc->str_config.num_ch_in;i++)
|
audio_buff[i] =
|
||||||
{
|
scratch_buffer + i * (p_obj_drc->str_config.frame_size + 32);
|
||||||
audio_buff[i]=scratch_buffer+i*(p_obj_drc->str_config.frame_size+32);
|
|
||||||
|
|
||||||
for(j=0;j<num_sample_to_process;j++)
|
for (j = 0; j < num_sample_to_process; j++) {
|
||||||
{
|
audio_buff[i][j] =
|
||||||
|
((FLOAT32)input_buffer16[j * p_obj_drc->str_config.num_ch_in + i]) /
|
||||||
audio_buff[i][j]=((FLOAT32)input_buffer16[j*p_obj_drc->str_config.num_ch_in + i])/32767.0f;
|
32767.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||||
{
|
audio_buff[i] =
|
||||||
for(i=0;i<p_obj_drc->str_config.num_ch_in;i++)
|
scratch_buffer + i * (p_obj_drc->str_config.frame_size + 32);
|
||||||
{
|
|
||||||
audio_buff[i]=scratch_buffer+i*(p_obj_drc->str_config.frame_size+32);
|
|
||||||
|
|
||||||
for(j=0;j<num_sample_to_process;j++)
|
for (j = 0; j < num_sample_to_process; j++) {
|
||||||
{
|
audio_buff[i][j] =
|
||||||
audio_buff[i][j]=input_buffer[j*p_obj_drc->str_config.num_ch_in + i];
|
input_buffer[j * p_obj_drc->str_config.num_ch_in + i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err_code = impd_drc_process_time_domain(p_obj_drc->str_payload.pstr_gain_dec[0],
|
err_code = impd_drc_process_time_domain(
|
||||||
|
p_obj_drc->str_payload.pstr_gain_dec[0],
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_drc_gain,
|
p_obj_drc->str_payload.pstr_drc_gain, audio_buff,
|
||||||
audio_buff,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db,
|
->loudness_normalization_gain_db,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->drc_characteristic_target);
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
|
->drc_characteristic_target);
|
||||||
|
|
||||||
if (err_code!=IA_NO_ERROR)
|
if (err_code != IA_NO_ERROR) return err_code;
|
||||||
return err_code;
|
|
||||||
|
|
||||||
if(p_obj_drc->str_payload.pstr_drc_sel_proc_output->downmix_matrix_present!=0)
|
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output->downmix_matrix_present !=
|
||||||
|
0)
|
||||||
err_code = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
err_code = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||||
audio_buff,
|
audio_buff, p_obj_drc->str_config.frame_size);
|
||||||
p_obj_drc->str_config.frame_size);
|
|
||||||
|
|
||||||
if (err_code!=IA_NO_ERROR)
|
if (err_code != IA_NO_ERROR) return err_code;
|
||||||
return err_code;
|
|
||||||
|
|
||||||
err_code = impd_drc_process_time_domain(p_obj_drc->str_payload.pstr_gain_dec[1],
|
err_code = impd_drc_process_time_domain(
|
||||||
|
p_obj_drc->str_payload.pstr_gain_dec[1],
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_drc_gain,
|
p_obj_drc->str_payload.pstr_drc_gain, audio_buff,
|
||||||
audio_buff,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db,
|
->loudness_normalization_gain_db,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->drc_characteristic_target);
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
|
->drc_characteristic_target);
|
||||||
|
|
||||||
if (err_code!=IA_NO_ERROR)
|
if (err_code != IA_NO_ERROR) return err_code;
|
||||||
return err_code;
|
|
||||||
|
|
||||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db != 0.0f)
|
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
{
|
->loudness_normalization_gain_db != 0.0f) {
|
||||||
FLOAT32 gain_value = (FLOAT32)pow(10.0,p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db/20.0);
|
FLOAT32 gain_value =
|
||||||
|
(FLOAT32)pow(10.0, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
|
->loudness_normalization_gain_db /
|
||||||
|
20.0);
|
||||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||||
audio_buff[i][j] *= gain_value;
|
audio_buff[i][j] *= gain_value;
|
||||||
|
|
@ -211,35 +213,31 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_obj_drc->str_config.peak_limiter)
|
if (p_obj_drc->str_config.peak_limiter) {
|
||||||
{
|
|
||||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||||
output_buffer[j*p_obj_drc->str_config.num_ch_out + i] = audio_buff[i][j];
|
output_buffer[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||||
|
audio_buff[i][j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err_code=impd_limiter_process(p_obj_drc->str_payload.pstr_peak_limiter,
|
err_code =
|
||||||
output_buffer,
|
impd_limiter_process(p_obj_drc->str_payload.pstr_peak_limiter,
|
||||||
p_obj_drc->str_config.frame_size);
|
output_buffer, p_obj_drc->str_config.frame_size);
|
||||||
|
|
||||||
|
if (err_code != IA_NO_ERROR) return err_code;
|
||||||
if (err_code!=IA_NO_ERROR)
|
|
||||||
return err_code;
|
|
||||||
|
|
||||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||||
audio_buff[i][j] = output_buffer[j*p_obj_drc->str_config.num_ch_out + i];
|
audio_buff[i][j] =
|
||||||
|
output_buffer[j * p_obj_drc->str_config.num_ch_out + i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(p_obj_drc->str_config.pcm_size==16)
|
if (p_obj_drc->str_config.pcm_size == 16) {
|
||||||
{
|
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||||
for (i=0; i < p_obj_drc->str_config.num_ch_out; i++)
|
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||||
{
|
|
||||||
for (j=0; j < p_obj_drc->str_config.frame_size; j++)
|
|
||||||
{
|
|
||||||
if (audio_buff[i][j] < -1.0f)
|
if (audio_buff[i][j] < -1.0f)
|
||||||
output_buffer16[j * p_obj_drc->str_config.num_ch_out + i] = -32767;
|
output_buffer16[j * p_obj_drc->str_config.num_ch_out + i] = -32767;
|
||||||
|
|
||||||
|
|
@ -247,68 +245,81 @@ IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc)
|
||||||
output_buffer16[j * p_obj_drc->str_config.num_ch_out + i] = 32767;
|
output_buffer16[j * p_obj_drc->str_config.num_ch_out + i] = 32767;
|
||||||
|
|
||||||
else
|
else
|
||||||
output_buffer16[j*p_obj_drc->str_config.num_ch_out + i] = (WORD16)(audio_buff[i][j]*32767.0f);
|
output_buffer16[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||||
|
(WORD16)(audio_buff[i][j] * 32767.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||||
{
|
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||||
for (i=0; i < p_obj_drc->str_config.num_ch_out; i++)
|
output_buffer[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||||
{
|
audio_buff[i][j];
|
||||||
for (j=0; j < p_obj_drc->str_config.frame_size; j++)
|
|
||||||
{
|
|
||||||
output_buffer[j*p_obj_drc->str_config.num_ch_out + i] = audio_buff[i][j];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p_obj_drc->p_state->ui_out_bytes=p_obj_drc->str_config.num_ch_out*(p_obj_drc->p_state->ui_in_bytes/p_obj_drc->str_config.num_ch_in);
|
p_obj_drc->p_state->ui_out_bytes =
|
||||||
|
p_obj_drc->str_config.num_ch_out *
|
||||||
|
(p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in);
|
||||||
|
|
||||||
if (p_obj_drc->p_state->delay_in_output != 0) {
|
if (p_obj_drc->p_state->delay_in_output != 0) {
|
||||||
p_obj_drc->p_state->ui_out_bytes=p_obj_drc->str_config.num_ch_out*(p_obj_drc->str_config.frame_size-p_obj_drc->p_state->delay_in_output)*(p_obj_drc->str_config.pcm_size>>3);
|
p_obj_drc->p_state->ui_out_bytes = p_obj_drc->str_config.num_ch_out *
|
||||||
|
(p_obj_drc->str_config.frame_size -
|
||||||
|
p_obj_drc->p_state->delay_in_output) *
|
||||||
|
(p_obj_drc->str_config.pcm_size >> 3);
|
||||||
if (p_obj_drc->str_config.pcm_size == 16)
|
if (p_obj_drc->str_config.pcm_size == 16)
|
||||||
memcpy(output_buffer16,(output_buffer16+(p_obj_drc->p_state->delay_in_output*p_obj_drc->str_config.num_ch_out)),p_obj_drc->p_state->ui_out_bytes);
|
memcpy(output_buffer16,
|
||||||
|
(output_buffer16 + (p_obj_drc->p_state->delay_in_output *
|
||||||
|
p_obj_drc->str_config.num_ch_out)),
|
||||||
|
p_obj_drc->p_state->ui_out_bytes);
|
||||||
else
|
else
|
||||||
memcpy(output_buffer,(output_buffer+(p_obj_drc->p_state->delay_in_output*p_obj_drc->str_config.num_ch_out)),p_obj_drc->p_state->ui_out_bytes);
|
memcpy(output_buffer,
|
||||||
|
(output_buffer + (p_obj_drc->p_state->delay_in_output *
|
||||||
|
p_obj_drc->str_config.num_ch_out)),
|
||||||
|
p_obj_drc->p_state->ui_out_bytes);
|
||||||
|
|
||||||
p_obj_drc->p_state->delay_adjust_samples = p_obj_drc->p_state->delay_in_output;
|
p_obj_drc->p_state->delay_adjust_samples =
|
||||||
|
p_obj_drc->p_state->delay_in_output;
|
||||||
p_obj_drc->p_state->delay_in_output = 0;
|
p_obj_drc->p_state->delay_in_output = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
if(last_frame==1)
|
if (last_frame == 1) {
|
||||||
{
|
if ((num_sample_to_process + p_obj_drc->p_state->delay_adjust_samples) <=
|
||||||
if((num_sample_to_process+p_obj_drc->p_state->delay_adjust_samples)<=p_obj_drc->str_config.frame_size)
|
p_obj_drc->str_config.frame_size)
|
||||||
p_obj_drc->p_state->ui_out_bytes = (num_sample_to_process+p_obj_drc->p_state->delay_adjust_samples)*p_obj_drc->str_config.num_ch_out*(p_obj_drc->str_config.pcm_size>>3);
|
p_obj_drc->p_state->ui_out_bytes =
|
||||||
|
(num_sample_to_process + p_obj_drc->p_state->delay_adjust_samples) *
|
||||||
|
p_obj_drc->str_config.num_ch_out *
|
||||||
|
(p_obj_drc->str_config.pcm_size >> 3);
|
||||||
else
|
else
|
||||||
p_obj_drc->p_state->ui_out_bytes = (p_obj_drc->str_config.frame_size)*p_obj_drc->str_config.num_ch_out*(p_obj_drc->str_config.pcm_size>>3);
|
p_obj_drc->p_state->ui_out_bytes = (p_obj_drc->str_config.frame_size) *
|
||||||
|
p_obj_drc->str_config.num_ch_out *
|
||||||
|
(p_obj_drc->str_config.pcm_size >> 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (last_frame == 0) {
|
if (last_frame == 0) {
|
||||||
|
if (p_obj_drc->str_config.bitstream_file_format !=
|
||||||
|
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||||
|
err_code = impd_process_drc_bitstream_dec(
|
||||||
if (p_obj_drc->str_config.bitstream_file_format != BITSTREAM_FILE_FORMAT_SPLIT) {
|
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||||
err_code = impd_process_drc_bitstream_dec(p_obj_drc->str_payload.pstr_bitstream_dec,
|
|
||||||
p_obj_drc->pstr_bit_buf,
|
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_loudness_info,
|
p_obj_drc->str_payload.pstr_loudness_info,
|
||||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
&p_obj_drc->str_bit_handler
|
||||||
|
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||||
|
|
||||||
if (err_code > PROC_COMPLETE)
|
if (err_code > PROC_COMPLETE) return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
|
||||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
|
||||||
|
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||||
|
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||||
|
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||||
|
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||||
|
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err_code;
|
return err_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,13 +39,9 @@
|
||||||
#include "impd_drc_hashdefines.h"
|
#include "impd_drc_hashdefines.h"
|
||||||
#include "impd_drc_rom.h"
|
#include "impd_drc_rom.h"
|
||||||
|
|
||||||
|
VOID process_qmf_syn_filt_bank(ia_drc_qmf_filt_struct *qmf_filt, FLOAT64 *buff,
|
||||||
VOID process_qmf_syn_filt_bank(ia_drc_qmf_filt_struct *qmf_filt,
|
FLOAT32 *input_real, FLOAT32 *input_imag,
|
||||||
FLOAT64 *buff,
|
FLOAT32 *output) {
|
||||||
FLOAT32 *input_real,
|
|
||||||
FLOAT32 *input_imag,
|
|
||||||
FLOAT32 *output)
|
|
||||||
{
|
|
||||||
WORD32 i, j;
|
WORD32 i, j;
|
||||||
FLOAT64 U[10 * QMF_NUM_FILT_BANDS];
|
FLOAT64 U[10 * QMF_NUM_FILT_BANDS];
|
||||||
FLOAT64 W[10 * QMF_NUM_FILT_BANDS];
|
FLOAT64 W[10 * QMF_NUM_FILT_BANDS];
|
||||||
|
|
@ -56,33 +52,28 @@ VOID process_qmf_syn_filt_bank(ia_drc_qmf_filt_struct *qmf_filt,
|
||||||
buff[i] = buff[i - 2 * QMF_FILT_RESOLUTION];
|
buff[i] = buff[i - 2 * QMF_FILT_RESOLUTION];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < 2 * QMF_FILT_RESOLUTION; i++) {
|
for (i = 0; i < 2 * QMF_FILT_RESOLUTION; i++) {
|
||||||
tmp = 0.0;
|
tmp = 0.0;
|
||||||
for (j = 0; j < QMF_FILT_RESOLUTION; j++) {
|
for (j = 0; j < QMF_FILT_RESOLUTION; j++) {
|
||||||
tmp = tmp
|
tmp = tmp + input_real[j] * qmf_filt->syn_tab_real[i][j] -
|
||||||
+ input_real[j] * qmf_filt->syn_tab_real[i][j]
|
input_imag[j] * qmf_filt->syn_tab_imag[i][j];
|
||||||
- input_imag[j] * qmf_filt->syn_tab_imag[i][j];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
buff[i] = tmp;
|
buff[i] = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
for (j = 0; j < QMF_FILT_RESOLUTION; j++) {
|
for (j = 0; j < QMF_FILT_RESOLUTION; j++) {
|
||||||
U[2*QMF_FILT_RESOLUTION*i+j] = buff[4*QMF_FILT_RESOLUTION*i+j];
|
U[2 * QMF_FILT_RESOLUTION * i + j] =
|
||||||
U[2*QMF_FILT_RESOLUTION*i+QMF_FILT_RESOLUTION+j] = buff[4*QMF_FILT_RESOLUTION*i+3*QMF_FILT_RESOLUTION+j];
|
buff[4 * QMF_FILT_RESOLUTION * i + j];
|
||||||
|
U[2 * QMF_FILT_RESOLUTION * i + QMF_FILT_RESOLUTION + j] =
|
||||||
|
buff[4 * QMF_FILT_RESOLUTION * i + 3 * QMF_FILT_RESOLUTION + j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < 10 * QMF_FILT_RESOLUTION; i++) {
|
for (i = 0; i < 10 * QMF_FILT_RESOLUTION; i++) {
|
||||||
|
|
||||||
W[i] = U[i] * qmf_filter_coeff[i];
|
W[i] = U[i] * qmf_filter_coeff[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < QMF_FILT_RESOLUTION; i++) {
|
for (i = 0; i < QMF_FILT_RESOLUTION; i++) {
|
||||||
tmp = 0.0;
|
tmp = 0.0;
|
||||||
for (j = 0; j < 10; j++) {
|
for (j = 0; j < 10; j++) {
|
||||||
|
|
@ -92,13 +83,9 @@ VOID process_qmf_syn_filt_bank(ia_drc_qmf_filt_struct *qmf_filt,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID process_qmf_ana_filt_bank(ia_drc_qmf_filt_struct *qmf_filt, FLOAT64 *buff,
|
||||||
VOID process_qmf_ana_filt_bank(ia_drc_qmf_filt_struct *qmf_filt,
|
FLOAT32 *input, FLOAT32 *output_real,
|
||||||
FLOAT64 *buff,
|
FLOAT32 *output_imag) {
|
||||||
FLOAT32 *input,
|
|
||||||
FLOAT32 *output_real,
|
|
||||||
FLOAT32 *output_imag)
|
|
||||||
{
|
|
||||||
WORD32 i, j;
|
WORD32 i, j;
|
||||||
FLOAT32 Z[10 * QMF_NUM_FILT_BANDS];
|
FLOAT32 Z[10 * QMF_NUM_FILT_BANDS];
|
||||||
FLOAT32 Y[2 * QMF_NUM_FILT_BANDS];
|
FLOAT32 Y[2 * QMF_NUM_FILT_BANDS];
|
||||||
|
|
@ -107,16 +94,12 @@ VOID process_qmf_ana_filt_bank(ia_drc_qmf_filt_struct *qmf_filt,
|
||||||
buff[i] = buff[i - QMF_FILT_RESOLUTION];
|
buff[i] = buff[i - QMF_FILT_RESOLUTION];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i = QMF_FILT_RESOLUTION - 1; i >= 0; i--) {
|
for (i = QMF_FILT_RESOLUTION - 1; i >= 0; i--) {
|
||||||
buff[i] = input[QMF_FILT_RESOLUTION - 1 - i];
|
buff[i] = input[QMF_FILT_RESOLUTION - 1 - i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < 10 * QMF_FILT_RESOLUTION; i++) {
|
for (i = 0; i < 10 * QMF_FILT_RESOLUTION; i++) {
|
||||||
|
|
||||||
Z[i] = (FLOAT32)(buff[i] * qmf_filter_coeff[i]);
|
Z[i] = (FLOAT32)(buff[i] * qmf_filter_coeff[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 2 * QMF_FILT_RESOLUTION; i++) {
|
for (i = 0; i < 2 * QMF_FILT_RESOLUTION; i++) {
|
||||||
|
|
@ -134,29 +117,26 @@ VOID process_qmf_ana_filt_bank(ia_drc_qmf_filt_struct *qmf_filt,
|
||||||
output_imag[i] += (FLOAT32)(Y[j] * qmf_filt->ana_tab_imag[i][j]);
|
output_imag[i] += (FLOAT32)(Y[j] * qmf_filt->ana_tab_imag[i][j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static WORD32 impd_down_mix(
|
||||||
static WORD32 impd_down_mix ( ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output, FLOAT32** input_audio, WORD32 frame_len)
|
ia_drc_sel_proc_output_struct *uni_drc_sel_proc_output,
|
||||||
{
|
FLOAT32 **input_audio, WORD32 frame_len) {
|
||||||
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
WORD32 num_base_ch = uni_drc_sel_proc_output->base_channel_count;
|
||||||
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
WORD32 num_target_ch = uni_drc_sel_proc_output->target_channel_count;
|
||||||
WORD32 i, i_ch, o_ch;
|
WORD32 i, i_ch, o_ch;
|
||||||
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
FLOAT32 tmp_out[MAX_CHANNEL_COUNT];
|
||||||
|
|
||||||
|
if (num_target_ch > MAX_CHANNEL_COUNT) return -1;
|
||||||
|
|
||||||
if (num_target_ch > MAX_CHANNEL_COUNT)
|
if (num_target_ch > num_base_ch) return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (num_target_ch > num_base_ch)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
for (i = 0; i < frame_len; i++) {
|
for (i = 0; i < frame_len; i++) {
|
||||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||||
tmp_out[o_ch] = 0.0f;
|
tmp_out[o_ch] = 0.0f;
|
||||||
for (i_ch = 0; i_ch < num_base_ch; i_ch++) {
|
for (i_ch = 0; i_ch < num_base_ch; i_ch++) {
|
||||||
tmp_out[o_ch] += input_audio[i_ch][i] * uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
tmp_out[o_ch] += input_audio[i_ch][i] *
|
||||||
|
uni_drc_sel_proc_output->downmix_matrix[i_ch][o_ch];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
for (o_ch = 0; o_ch < num_target_ch; o_ch++) {
|
||||||
|
|
@ -167,14 +147,9 @@ static WORD32 impd_down_mix ( ia_drc_sel_proc_output_struct *uni_drc_sel_proc_o
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WORD32 impd_init_process_audio_main_td_qmf(ia_drc_api_struct *p_obj_drc)
|
WORD32 impd_init_process_audio_main_td_qmf(ia_drc_api_struct *p_obj_drc)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -195,177 +170,195 @@ WORD32 impd_init_process_audio_main_td_qmf (ia_drc_api_struct *p_obj_drc)
|
||||||
input_buffer16 = (WORD16 *)p_obj_drc->pp_mem[2];
|
input_buffer16 = (WORD16 *)p_obj_drc->pp_mem[2];
|
||||||
output_buffer16 = (WORD16 *)p_obj_drc->pp_mem[3];
|
output_buffer16 = (WORD16 *)p_obj_drc->pp_mem[3];
|
||||||
|
|
||||||
|
|
||||||
if (p_obj_drc->p_state->ui_in_bytes <= 0) {
|
if (p_obj_drc->p_state->ui_in_bytes <= 0) {
|
||||||
p_obj_drc->p_state->ui_out_bytes = 0;
|
p_obj_drc->p_state->ui_out_bytes = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((p_obj_drc->p_state->ui_in_bytes/p_obj_drc->str_config.num_ch_in/(p_obj_drc->str_config.pcm_size>>3)) < (UWORD32)p_obj_drc->str_config.frame_size)
|
if ((p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in /
|
||||||
|
(p_obj_drc->str_config.pcm_size >> 3)) <
|
||||||
|
(UWORD32)p_obj_drc->str_config.frame_size)
|
||||||
last_frame = 1;
|
last_frame = 1;
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||||
audio_in_out_buf[i] = scratch_buffer;
|
audio_in_out_buf[i] = scratch_buffer;
|
||||||
scratch_buffer = scratch_buffer + (p_obj_drc->str_config.frame_size + 32);
|
scratch_buffer = scratch_buffer + (p_obj_drc->str_config.frame_size + 32);
|
||||||
audio_io_buf_real[i]=scratch_buffer+(p_obj_drc->str_config.frame_size*p_obj_drc->str_config.num_ch_in+512);
|
audio_io_buf_real[i] =
|
||||||
audio_io_buf_imag[i]=scratch_buffer+2*(p_obj_drc->str_config.frame_size*p_obj_drc->str_config.num_ch_in+512);;
|
scratch_buffer +
|
||||||
|
(p_obj_drc->str_config.frame_size * p_obj_drc->str_config.num_ch_in +
|
||||||
|
512);
|
||||||
|
audio_io_buf_imag[i] = scratch_buffer +
|
||||||
|
2 * (p_obj_drc->str_config.frame_size *
|
||||||
|
p_obj_drc->str_config.num_ch_in +
|
||||||
|
512);
|
||||||
|
;
|
||||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||||
if (p_obj_drc->str_config.pcm_size == 16) {
|
if (p_obj_drc->str_config.pcm_size == 16) {
|
||||||
audio_in_out_buf[i][j]=((FLOAT32)input_buffer16[j*p_obj_drc->str_config.num_ch_in + i])/32767.0f;
|
audio_in_out_buf[i][j] =
|
||||||
}
|
((FLOAT32)input_buffer16[j * p_obj_drc->str_config.num_ch_in + i]) /
|
||||||
else {
|
32767.0f;
|
||||||
audio_in_out_buf[i][j]=input_buffer[j*p_obj_drc->str_config.num_ch_in + i];
|
} else {
|
||||||
|
audio_in_out_buf[i][j] =
|
||||||
|
input_buffer[j * p_obj_drc->str_config.num_ch_in + i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error = impd_process_drc_bitstream_dec_gain(
|
||||||
error = impd_process_drc_bitstream_dec_gain(p_obj_drc->str_payload.pstr_bitstream_dec,
|
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||||
p_obj_drc->pstr_bit_buf,
|
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_drc_gain,
|
p_obj_drc->str_payload.pstr_drc_gain,
|
||||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
&p_obj_drc->str_bit_handler
|
||||||
|
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (error > PROC_COMPLETE) return -1;
|
if (error > PROC_COMPLETE) return -1;
|
||||||
|
|
||||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||||
if(p_obj_drc->str_bit_handler.gain_stream_flag==0) //ITTIAM: Flag for applying gain frame by frame
|
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||||
|
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
|
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||||
|
0) // ITTIAM: Flag for applying gain frame by frame
|
||||||
{
|
{
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
}
|
}
|
||||||
if (p_obj_drc->str_config.bitstream_file_format == BITSTREAM_FILE_FORMAT_SPLIT) {
|
if (p_obj_drc->str_config.bitstream_file_format ==
|
||||||
|
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||||
/* shift over fill-bits for frame byte alignment */
|
/* shift over fill-bits for frame byte alignment */
|
||||||
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0)
|
if (p_obj_drc->str_bit_handler.num_bits_offset_bs != 0) {
|
||||||
{
|
p_obj_drc->str_bit_handler.num_bits_read_bs =
|
||||||
p_obj_drc->str_bit_handler.num_bits_read_bs = p_obj_drc->str_bit_handler.num_bits_read_bs + 8 - p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
p_obj_drc->str_bit_handler.num_bits_read_bs + 8 -
|
||||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
p_obj_drc->str_bit_handler.num_bits_offset_bs;
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs + 1;
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
p_obj_drc->str_bit_handler.num_bits_offset_bs = 0;
|
||||||
p_obj_drc->str_bit_handler.byte_index_bs = p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
p_obj_drc->str_bit_handler.byte_index_bs =
|
||||||
if(p_obj_drc->str_bit_handler.gain_stream_flag==0) //ITTIAM: Flag for applying gain frame by frame
|
p_obj_drc->str_bit_handler.byte_index_bs + 1;
|
||||||
|
if (p_obj_drc->str_bit_handler.gain_stream_flag ==
|
||||||
|
0) // ITTIAM: Flag for applying gain frame by frame
|
||||||
{
|
{
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs = p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
p_obj_drc->str_bit_handler.num_bytes_bs =
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
for (i = 0; i < p_obj_drc->str_config.num_ch_in; i++) {
|
||||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j += 64) {
|
for (j = 0; j < p_obj_drc->str_config.frame_size; j += 64) {
|
||||||
|
process_qmf_ana_filt_bank(
|
||||||
process_qmf_ana_filt_bank(p_obj_drc->str_payload.pstr_qmf_filter,
|
p_obj_drc->str_payload.pstr_qmf_filter,
|
||||||
p_obj_drc->str_payload.pstr_qmf_filter->ana_buff+i*4*p_obj_drc->str_config.frame_size,
|
p_obj_drc->str_payload.pstr_qmf_filter->ana_buff +
|
||||||
&(audio_in_out_buf[i][j]),
|
i * 4 * p_obj_drc->str_config.frame_size,
|
||||||
&(audio_io_buf_real[i][j]),
|
&(audio_in_out_buf[i][j]), &(audio_io_buf_real[i][j]),
|
||||||
&(audio_io_buf_imag[i][j]));
|
&(audio_io_buf_imag[i][j]));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
error = impd_drc_process_freq_domain(p_obj_drc->str_payload.pstr_gain_dec[0],
|
error = impd_drc_process_freq_domain(
|
||||||
|
p_obj_drc->str_payload.pstr_gain_dec[0],
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_drc_gain,
|
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||||
audio_io_buf_real,
|
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
audio_io_buf_imag,
|
->loudness_normalization_gain_db,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db,
|
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->drc_characteristic_target);
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
|
->drc_characteristic_target);
|
||||||
|
|
||||||
if (error) return error;
|
if (error) return error;
|
||||||
|
|
||||||
if(p_obj_drc->str_payload.pstr_drc_sel_proc_output->target_channel_count<p_obj_drc->str_payload.pstr_drc_sel_proc_output->base_channel_count){
|
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output->target_channel_count <
|
||||||
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->base_channel_count) {
|
||||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||||
audio_io_buf_real,
|
audio_io_buf_real, p_obj_drc->str_config.frame_size);
|
||||||
p_obj_drc->str_config.frame_size);
|
|
||||||
if (error) return error;
|
if (error) return error;
|
||||||
|
|
||||||
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
error = impd_down_mix(p_obj_drc->str_payload.pstr_drc_sel_proc_output,
|
||||||
audio_io_buf_imag,
|
audio_io_buf_imag, p_obj_drc->str_config.frame_size);
|
||||||
p_obj_drc->str_config.frame_size);
|
|
||||||
if (error) return error;
|
if (error) return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = impd_drc_process_freq_domain(p_obj_drc->str_payload.pstr_gain_dec[1],
|
error = impd_drc_process_freq_domain(
|
||||||
|
p_obj_drc->str_payload.pstr_gain_dec[1],
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_drc_gain,
|
p_obj_drc->str_payload.pstr_drc_gain, audio_io_buf_real,
|
||||||
audio_io_buf_real,
|
audio_io_buf_imag, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
audio_io_buf_imag,
|
->loudness_normalization_gain_db,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db,
|
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->boost,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output->compress,
|
||||||
p_obj_drc->str_payload.pstr_drc_sel_proc_output->drc_characteristic_target);
|
p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
|
->drc_characteristic_target);
|
||||||
if (error) return -1;
|
if (error) return -1;
|
||||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j += 64) {
|
for (j = 0; j < p_obj_drc->str_config.frame_size; j += 64) {
|
||||||
|
process_qmf_syn_filt_bank(
|
||||||
process_qmf_syn_filt_bank(p_obj_drc->str_payload.pstr_qmf_filter,
|
p_obj_drc->str_payload.pstr_qmf_filter,
|
||||||
p_obj_drc->str_payload.pstr_qmf_filter->syn_buff+i*4*p_obj_drc->str_config.frame_size,
|
p_obj_drc->str_payload.pstr_qmf_filter->syn_buff +
|
||||||
&(audio_io_buf_real[i][j]),
|
i * 4 * p_obj_drc->str_config.frame_size,
|
||||||
&(audio_io_buf_imag[i][j]),
|
&(audio_io_buf_real[i][j]), &(audio_io_buf_imag[i][j]),
|
||||||
&(audio_in_out_buf[i][j]));
|
&(audio_in_out_buf[i][j]));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db != 0.0f)
|
if (p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
{
|
->loudness_normalization_gain_db != 0.0f) {
|
||||||
FLOAT32 loudness_normalization_gain = (FLOAT32)pow(10.0,p_obj_drc->str_payload.pstr_drc_sel_proc_output->loudness_normalization_gain_db/20.0);
|
FLOAT32 loudness_normalization_gain =
|
||||||
|
(FLOAT32)pow(10.0, p_obj_drc->str_payload.pstr_drc_sel_proc_output
|
||||||
|
->loudness_normalization_gain_db /
|
||||||
|
20.0);
|
||||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||||
audio_io_buf_real[i][j] *= loudness_normalization_gain;
|
audio_io_buf_real[i][j] *= loudness_normalization_gain;
|
||||||
audio_io_buf_imag[i][j] *= loudness_normalization_gain;
|
audio_io_buf_imag[i][j] *= loudness_normalization_gain;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
num_samples_per_channel = p_obj_drc->str_config.frame_size;
|
num_samples_per_channel = p_obj_drc->str_config.frame_size;
|
||||||
|
|
||||||
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
for (i = 0; i < p_obj_drc->str_config.num_ch_out; i++) {
|
||||||
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
for (j = 0; j < p_obj_drc->str_config.frame_size; j++) {
|
||||||
if (p_obj_drc->str_config.pcm_size == 16) {
|
if (p_obj_drc->str_config.pcm_size == 16) {
|
||||||
output_buffer16[j*p_obj_drc->str_config.num_ch_out + i] = (WORD16)(audio_in_out_buf[i][j]*32767.0f);
|
output_buffer16[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||||
|
(WORD16)(audio_in_out_buf[i][j] * 32767.0f);
|
||||||
|
} else {
|
||||||
|
output_buffer[j * p_obj_drc->str_config.num_ch_out + i] =
|
||||||
|
audio_in_out_buf[i][j];
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
output_buffer[j*p_obj_drc->str_config.num_ch_out + i] = audio_in_out_buf[i][j];
|
}
|
||||||
|
p_obj_drc->p_state->ui_out_bytes =
|
||||||
|
p_obj_drc->str_config.num_ch_out *
|
||||||
|
(p_obj_drc->p_state->ui_in_bytes / p_obj_drc->str_config.num_ch_in);
|
||||||
|
|
||||||
}
|
if (p_obj_drc->str_config.bitstream_file_format !=
|
||||||
}
|
BITSTREAM_FILE_FORMAT_SPLIT) {
|
||||||
}
|
error = impd_process_drc_bitstream_dec(
|
||||||
p_obj_drc->p_state->ui_out_bytes=p_obj_drc->str_config.num_ch_out*(p_obj_drc->p_state->ui_in_bytes/p_obj_drc->str_config.num_ch_in);
|
p_obj_drc->str_payload.pstr_bitstream_dec, p_obj_drc->pstr_bit_buf,
|
||||||
|
|
||||||
if (p_obj_drc->str_config.bitstream_file_format != BITSTREAM_FILE_FORMAT_SPLIT) {
|
|
||||||
error = impd_process_drc_bitstream_dec(p_obj_drc->str_payload.pstr_bitstream_dec,
|
|
||||||
p_obj_drc->pstr_bit_buf,
|
|
||||||
p_obj_drc->str_payload.pstr_drc_config,
|
p_obj_drc->str_payload.pstr_drc_config,
|
||||||
p_obj_drc->str_payload.pstr_loudness_info,
|
p_obj_drc->str_payload.pstr_loudness_info,
|
||||||
&p_obj_drc->str_bit_handler.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
&p_obj_drc->str_bit_handler
|
||||||
|
.it_bit_buf[p_obj_drc->str_bit_handler.byte_index_bs],
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs,
|
p_obj_drc->str_bit_handler.num_bytes_bs,
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
p_obj_drc->str_bit_handler.num_bits_offset_bs,
|
||||||
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
&p_obj_drc->str_bit_handler.num_bits_read_bs);
|
||||||
|
|
||||||
if (error > PROC_COMPLETE)
|
if (error > PROC_COMPLETE) return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
p_obj_drc->str_bit_handler.num_bytes_read_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
|
||||||
p_obj_drc->str_bit_handler.num_bits_offset_bs = (p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
|
||||||
p_obj_drc->str_bit_handler.byte_index_bs += p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
|
||||||
p_obj_drc->str_bit_handler.num_bytes_bs -= p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
|
||||||
|
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs =
|
||||||
|
(p_obj_drc->str_bit_handler.num_bits_read_bs >> 3);
|
||||||
|
p_obj_drc->str_bit_handler.num_bits_offset_bs =
|
||||||
|
(p_obj_drc->str_bit_handler.num_bits_read_bs & 7);
|
||||||
|
p_obj_drc->str_bit_handler.byte_index_bs +=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_bs -=
|
||||||
|
p_obj_drc->str_bit_handler.num_bytes_read_bs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,11 @@
|
||||||
#ifndef IMPD_DRC_MULTI_BAND_H
|
#ifndef IMPD_DRC_MULTI_BAND_H
|
||||||
#define IMPD_DRC_MULTI_BAND_H
|
#define IMPD_DRC_MULTI_BAND_H
|
||||||
|
|
||||||
#define DRC_SUBBAND_COUNT_WITH_AUDIO_CODEC_FILTERBANK_MAX FILTER_BANK_PARAMETER_COUNT
|
#define DRC_SUBBAND_COUNT_WITH_AUDIO_CODEC_FILTERBANK_MAX \
|
||||||
|
FILTER_BANK_PARAMETER_COUNT
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -36,35 +36,29 @@ typedef struct {
|
||||||
} ia_group_overlap_params_struct;
|
} ia_group_overlap_params_struct;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ia_group_overlap_params_struct str_group_overlap_params[CHANNEL_GROUP_COUNT_MAX];
|
ia_group_overlap_params_struct
|
||||||
|
str_group_overlap_params[CHANNEL_GROUP_COUNT_MAX];
|
||||||
} ia_overlap_params_struct;
|
} ia_overlap_params_struct;
|
||||||
|
|
||||||
|
WORD32
|
||||||
|
impd_fcenter_norm_sb_init(WORD32 num_subbands, FLOAT32* fcenter_norm_subband);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_fcenter_norm_sb_init(WORD32 num_subbands,
|
impd_generate_slope(WORD32 num_subbands, FLOAT32* fcenter_norm_subband,
|
||||||
FLOAT32* fcenter_norm_subband);
|
FLOAT32 fcross_norm_lo, FLOAT32 fcross_norm_hi,
|
||||||
|
|
||||||
WORD32
|
|
||||||
impd_generate_slope (WORD32 num_subbands,
|
|
||||||
FLOAT32* fcenter_norm_subband,
|
|
||||||
FLOAT32 fcross_norm_lo,
|
|
||||||
FLOAT32 fcross_norm_hi,
|
|
||||||
FLOAT32* response);
|
FLOAT32* response);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_generate_overlap_weights (WORD32 num_drc_bands,
|
impd_generate_overlap_weights(
|
||||||
WORD32 drc_band_type,
|
WORD32 num_drc_bands, WORD32 drc_band_type,
|
||||||
ia_gain_params_struct* gain_params,
|
ia_gain_params_struct* gain_params, WORD32 dec_subband_count,
|
||||||
WORD32 dec_subband_count,
|
|
||||||
ia_group_overlap_params_struct* pstr_group_overlap_params);
|
ia_group_overlap_params_struct* pstr_group_overlap_params);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_init_overlap_weight ( ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
impd_init_overlap_weight(
|
||||||
|
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||||
WORD32 sub_band_domain_mode,
|
WORD32 sub_band_domain_mode, ia_overlap_params_struct* pstr_overlap_params);
|
||||||
ia_overlap_params_struct* pstr_overlap_params);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,7 @@
|
||||||
#include "impd_drc_rom.h"
|
#include "impd_drc_rom.h"
|
||||||
|
|
||||||
IA_ERRORCODE impd_fcenter_norm_sb_init(WORD32 num_subbands,
|
IA_ERRORCODE impd_fcenter_norm_sb_init(WORD32 num_subbands,
|
||||||
FLOAT32* fcenter_norm_subband)
|
FLOAT32* fcenter_norm_subband) {
|
||||||
{
|
|
||||||
WORD32 s;
|
WORD32 s;
|
||||||
for (s = 0; s < num_subbands; s++) {
|
for (s = 0; s < num_subbands; s++) {
|
||||||
fcenter_norm_subband[s] = (s + 0.5f) / (2.0f * num_subbands);
|
fcenter_norm_subband[s] = (s + 0.5f) / (2.0f * num_subbands);
|
||||||
|
|
@ -41,40 +40,31 @@ IA_ERRORCODE impd_fcenter_norm_sb_init(WORD32 num_subbands,
|
||||||
|
|
||||||
IA_ERRORCODE impd_generate_slope(WORD32 num_sub_bands,
|
IA_ERRORCODE impd_generate_slope(WORD32 num_sub_bands,
|
||||||
FLOAT32* fcenter_norm_subband,
|
FLOAT32* fcenter_norm_subband,
|
||||||
FLOAT32 fcross_norm_lo,
|
FLOAT32 fcross_norm_lo, FLOAT32 fcross_norm_hi,
|
||||||
FLOAT32 fcross_norm_hi,
|
FLOAT32* response) {
|
||||||
FLOAT32* response)
|
|
||||||
{
|
|
||||||
WORD32 i;
|
WORD32 i;
|
||||||
FLOAT32 filter_slope = -24.0f;
|
FLOAT32 filter_slope = -24.0f;
|
||||||
FLOAT32 inv_log10_2 = 3.32192809f;
|
FLOAT32 inv_log10_2 = 3.32192809f;
|
||||||
FLOAT32 norm = 0.05f * filter_slope * inv_log10_2;
|
FLOAT32 norm = 0.05f * filter_slope * inv_log10_2;
|
||||||
|
|
||||||
for (i=0; i<num_sub_bands; i++)
|
for (i = 0; i < num_sub_bands; i++) {
|
||||||
{
|
if (fcenter_norm_subband[i] < fcross_norm_lo) {
|
||||||
if (fcenter_norm_subband[i] < fcross_norm_lo)
|
response[i] = (FLOAT32)pow(
|
||||||
{
|
10.0, norm * log10(fcross_norm_lo / fcenter_norm_subband[i]));
|
||||||
response[i] = (FLOAT32)pow (10.0, norm * log10(fcross_norm_lo / fcenter_norm_subband[i]));
|
} else if (fcenter_norm_subband[i] < fcross_norm_hi) {
|
||||||
}
|
|
||||||
else if (fcenter_norm_subband[i] < fcross_norm_hi)
|
|
||||||
{
|
|
||||||
response[i] = 1.0f;
|
response[i] = 1.0f;
|
||||||
}
|
} else {
|
||||||
else
|
response[i] = (FLOAT32)pow(
|
||||||
{
|
10.0, norm * log10(fcenter_norm_subband[i] / fcross_norm_hi));
|
||||||
response[i] = (FLOAT32)pow (10.0, norm * log10(fcenter_norm_subband[i] / fcross_norm_hi));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IA_ERRORCODE impd_generate_overlap_weights(
|
||||||
IA_ERRORCODE impd_generate_overlap_weights (WORD32 num_drc_bands,
|
WORD32 num_drc_bands, WORD32 drc_band_type,
|
||||||
WORD32 drc_band_type,
|
ia_gain_params_struct* gain_params, WORD32 dec_subband_count,
|
||||||
ia_gain_params_struct* gain_params,
|
ia_group_overlap_params_struct* pstr_group_overlap_params) {
|
||||||
WORD32 dec_subband_count,
|
|
||||||
ia_group_overlap_params_struct* pstr_group_overlap_params)
|
|
||||||
{
|
|
||||||
FLOAT32 fcenter_norm_subband[AUDIO_CODEC_SUBBAND_COUNT_MAX];
|
FLOAT32 fcenter_norm_subband[AUDIO_CODEC_SUBBAND_COUNT_MAX];
|
||||||
FLOAT32 w_norm[AUDIO_CODEC_SUBBAND_COUNT_MAX];
|
FLOAT32 w_norm[AUDIO_CODEC_SUBBAND_COUNT_MAX];
|
||||||
FLOAT32 fcross_norm_lo, fcross_norm_hi;
|
FLOAT32 fcross_norm_lo, fcross_norm_hi;
|
||||||
|
|
@ -83,61 +73,51 @@ IA_ERRORCODE impd_generate_overlap_weights (WORD32 num_drc_bands,
|
||||||
|
|
||||||
if (drc_band_type == 1) {
|
if (drc_band_type == 1) {
|
||||||
fcross_norm_lo = 0.0f;
|
fcross_norm_lo = 0.0f;
|
||||||
for (b=0; b<num_drc_bands; b++)
|
for (b = 0; b < num_drc_bands; b++) {
|
||||||
{
|
if (b < num_drc_bands - 1) {
|
||||||
if (b<num_drc_bands - 1)
|
fcross_norm_hi =
|
||||||
{
|
normal_cross_freq[gain_params[b + 1].crossover_freq_idx]
|
||||||
fcross_norm_hi = normal_cross_freq[gain_params[b+1].crossover_freq_idx].f_cross_norm;
|
.f_cross_norm;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
fcross_norm_hi = 0.5f;
|
fcross_norm_hi = 0.5f;
|
||||||
}
|
}
|
||||||
impd_generate_slope (dec_subband_count,
|
impd_generate_slope(
|
||||||
fcenter_norm_subband,
|
dec_subband_count, fcenter_norm_subband, fcross_norm_lo,
|
||||||
fcross_norm_lo,
|
|
||||||
fcross_norm_hi,
|
fcross_norm_hi,
|
||||||
pstr_group_overlap_params->str_band_overlap_params[b].overlap_weight);
|
pstr_group_overlap_params->str_band_overlap_params[b].overlap_weight);
|
||||||
|
|
||||||
fcross_norm_lo = fcross_norm_hi;
|
fcross_norm_lo = fcross_norm_hi;
|
||||||
}
|
}
|
||||||
for (s=0; s<dec_subband_count; s++)
|
for (s = 0; s < dec_subband_count; s++) {
|
||||||
{
|
w_norm[s] = pstr_group_overlap_params->str_band_overlap_params[0]
|
||||||
w_norm[s] = pstr_group_overlap_params->str_band_overlap_params[0].overlap_weight[s];
|
.overlap_weight[s];
|
||||||
for (b=1; b<num_drc_bands; b++)
|
for (b = 1; b < num_drc_bands; b++) {
|
||||||
{
|
w_norm[s] += pstr_group_overlap_params->str_band_overlap_params[b]
|
||||||
w_norm[s] += pstr_group_overlap_params->str_band_overlap_params[b].overlap_weight[s];
|
.overlap_weight[s];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (s=0; s<dec_subband_count; s++)
|
for (s = 0; s < dec_subband_count; s++) {
|
||||||
{
|
for (b = 0; b < num_drc_bands; b++) {
|
||||||
for (b=0; b<num_drc_bands; b++)
|
pstr_group_overlap_params->str_band_overlap_params[b]
|
||||||
{
|
.overlap_weight[s] /= w_norm[s];
|
||||||
pstr_group_overlap_params->str_band_overlap_params[b].overlap_weight[s] /= w_norm[s];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
start_subband_index = 0;
|
start_subband_index = 0;
|
||||||
for (b=0; b<num_drc_bands; b++)
|
for (b = 0; b < num_drc_bands; b++) {
|
||||||
{
|
if (b < num_drc_bands - 1) {
|
||||||
if (b < num_drc_bands-1)
|
|
||||||
{
|
|
||||||
stop_sub_band_index = gain_params[b + 1].start_subband_index - 1;
|
stop_sub_band_index = gain_params[b + 1].start_subband_index - 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
stop_sub_band_index = dec_subband_count - 1;
|
stop_sub_band_index = dec_subband_count - 1;
|
||||||
}
|
}
|
||||||
for (s=0; s<dec_subband_count; s++)
|
for (s = 0; s < dec_subband_count; s++) {
|
||||||
{
|
if (s >= start_subband_index && s <= stop_sub_band_index) {
|
||||||
if (s >= start_subband_index && s <= stop_sub_band_index)
|
pstr_group_overlap_params->str_band_overlap_params[b]
|
||||||
{
|
.overlap_weight[s] = 1.0;
|
||||||
pstr_group_overlap_params->str_band_overlap_params[b].overlap_weight[s] = 1.0;
|
} else {
|
||||||
}
|
pstr_group_overlap_params->str_band_overlap_params[b]
|
||||||
else
|
.overlap_weight[s] = 0.0;
|
||||||
{
|
|
||||||
pstr_group_overlap_params->str_band_overlap_params[b].overlap_weight[s] = 0.0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
start_subband_index = stop_sub_band_index + 1;
|
start_subband_index = stop_sub_band_index + 1;
|
||||||
|
|
@ -147,11 +127,11 @@ IA_ERRORCODE impd_generate_overlap_weights (WORD32 num_drc_bands,
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
IA_ERRORCODE impd_init_overlap_weight ( ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
IA_ERRORCODE impd_init_overlap_weight(
|
||||||
|
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||||
WORD32 sub_band_domain_mode,
|
WORD32 sub_band_domain_mode,
|
||||||
ia_overlap_params_struct* pstr_overlap_params)
|
ia_overlap_params_struct* pstr_overlap_params) {
|
||||||
{
|
|
||||||
WORD32 err = 0, g;
|
WORD32 err = 0, g;
|
||||||
WORD32 dec_subband_count = 0;
|
WORD32 dec_subband_count = 0;
|
||||||
switch (sub_band_domain_mode) {
|
switch (sub_band_domain_mode) {
|
||||||
|
|
@ -166,13 +146,18 @@ IA_ERRORCODE impd_init_overlap_weight ( ia_uni_drc_coeffs_struct* str_p_loc_drc_
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups; g++)
|
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||||
{
|
if (str_drc_instruction_str->band_count_of_ch_group[g] > 1) {
|
||||||
if (str_drc_instruction_str->band_count_of_ch_group[g] > 1)
|
err = impd_generate_overlap_weights(
|
||||||
{
|
str_drc_instruction_str->band_count_of_ch_group[g],
|
||||||
err = impd_generate_overlap_weights(str_drc_instruction_str->band_count_of_ch_group[g],
|
str_p_loc_drc_coefficients_uni_drc
|
||||||
str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].drc_band_type,
|
->gain_set_params[str_drc_instruction_str
|
||||||
str_p_loc_drc_coefficients_uni_drc->gain_set_params[str_drc_instruction_str->gain_set_index_for_channel_group[g]].gain_params,
|
->gain_set_index_for_channel_group[g]]
|
||||||
|
.drc_band_type,
|
||||||
|
str_p_loc_drc_coefficients_uni_drc
|
||||||
|
->gain_set_params[str_drc_instruction_str
|
||||||
|
->gain_set_index_for_channel_group[g]]
|
||||||
|
.gain_params,
|
||||||
dec_subband_count,
|
dec_subband_count,
|
||||||
&(pstr_overlap_params->str_group_overlap_params[g]));
|
&(pstr_overlap_params->str_group_overlap_params[g]));
|
||||||
if (err) return (err);
|
if (err) return (err);
|
||||||
|
|
@ -181,6 +166,3 @@ IA_ERRORCODE impd_init_overlap_weight ( ia_uni_drc_coeffs_struct* str_p_loc_drc_
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -26,71 +26,65 @@ impd_dec_ducking_scaling(ia_bit_buf_struct* it_bit_buff,
|
||||||
FLOAT32* ducking_scaling);
|
FLOAT32* ducking_scaling);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_loudness_info(ia_bit_buf_struct* it_bit_buff,
|
impd_parse_loudness_info(ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
||||||
WORD32 version,
|
|
||||||
ia_loudness_info_struct* loudness_info);
|
ia_loudness_info_struct* loudness_info);
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_loudness_info_set_ext(ia_bit_buf_struct* it_bit_buff,
|
impd_parse_loudness_info_set_ext(
|
||||||
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_drc_loudness_info_set_struct* loudness_info_set);
|
ia_drc_loudness_info_set_struct* loudness_info_set);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_sel_drc_coeff(ia_drc_config* drc_config,
|
impd_sel_drc_coeff(
|
||||||
WORD32 location,
|
ia_drc_config* drc_config, WORD32 location,
|
||||||
ia_uni_drc_coeffs_struct** str_p_loc_drc_coefficients_uni_drc);
|
ia_uni_drc_coeffs_struct** str_p_loc_drc_coefficients_uni_drc);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_parse_instructions_basic(ia_bit_buf_struct* it_bit_buff,
|
impd_drc_parse_instructions_basic(
|
||||||
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_drc_instructions_basic_struct* str_drc_instructions_basic);
|
ia_drc_instructions_basic_struct* str_drc_instructions_basic);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_drc_instructions_uni_drc(ia_bit_buf_struct* it_bit_buff,
|
impd_parse_drc_instructions_uni_drc(
|
||||||
WORD32 version,
|
ia_bit_buf_struct* it_bit_buff, WORD32 version, ia_drc_config* drc_config,
|
||||||
ia_drc_config* drc_config,
|
|
||||||
ia_drc_instructions_struct* str_drc_instruction_str);
|
ia_drc_instructions_struct* str_drc_instruction_str);
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_gain_set_params(ia_bit_buf_struct* it_bit_buff,
|
impd_parse_gain_set_params(ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
||||||
WORD32 version,
|
|
||||||
WORD32* gain_seq_idx,
|
WORD32* gain_seq_idx,
|
||||||
ia_gain_set_params_struct* gain_set_params);
|
ia_gain_set_params_struct* gain_set_params);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_parse_coeff(ia_bit_buf_struct* it_bit_buff,
|
impd_drc_parse_coeff(
|
||||||
WORD32 version,
|
ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
||||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||||
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc);
|
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_dwnmix_instructions(ia_bit_buf_struct* it_bit_buff,
|
impd_parse_dwnmix_instructions(
|
||||||
WORD32 version,
|
ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
||||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||||
ia_channel_layout_struct* channel_layout,
|
ia_channel_layout_struct* channel_layout,
|
||||||
ia_downmix_instructions_struct* dwnmix_instructions);
|
ia_downmix_instructions_struct* dwnmix_instructions);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_drc_ext_v1(
|
impd_parse_drc_ext_v1(ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
|
||||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||||
ia_drc_config* drc_config,
|
ia_drc_config* drc_config,
|
||||||
ia_drc_config_ext* str_drc_config_ext);
|
ia_drc_config_ext* str_drc_config_ext);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_drc_config(
|
impd_parse_drc_config(ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
|
||||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||||
ia_drc_config* drc_config
|
ia_drc_config* drc_config);
|
||||||
);
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_loudness_info_set(ia_bit_buf_struct* it_bit_buff,
|
impd_parse_loudness_info_set(
|
||||||
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_drc_loudness_info_set_struct* loudness_info_set);
|
ia_drc_loudness_info_set_struct* loudness_info_set);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_drc_gain_sequence(
|
impd_parse_drc_gain_sequence(ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
|
||||||
ia_drc_bits_dec_struct* pstr_drc_uni_bs_dec,
|
ia_drc_bits_dec_struct* pstr_drc_uni_bs_dec,
|
||||||
ia_gain_set_params_struct* gain_set_params,
|
ia_gain_set_params_struct* gain_set_params,
|
||||||
ia_drc_gain_sequence_struct* drc_gain_sequence);
|
ia_drc_gain_sequence_struct* drc_gain_sequence);
|
||||||
|
|
@ -99,11 +93,9 @@ WORD32
|
||||||
impd_parse_uni_drc_gain_ext(ia_bit_buf_struct* it_bit_buff,
|
impd_parse_uni_drc_gain_ext(ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_uni_drc_gain_ext_struct* uni_drc_gain_ext);
|
ia_uni_drc_gain_ext_struct* uni_drc_gain_ext);
|
||||||
|
|
||||||
WORD32 impd_drc_uni_gain_read(
|
WORD32 impd_drc_uni_gain_read(ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
|
||||||
ia_drc_bits_dec_struct* pstr_drc_uni_bs_dec,
|
ia_drc_bits_dec_struct* pstr_drc_uni_bs_dec,
|
||||||
ia_drc_config* drc_config,
|
ia_drc_config* drc_config,
|
||||||
ia_drc_gain_struct* pstr_uni_drc_gain);
|
ia_drc_gain_struct* pstr_uni_drc_gain);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,8 @@
|
||||||
#define IMPD_DRC_PARSER_INTERFACE_H
|
#define IMPD_DRC_PARSER_INTERFACE_H
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_unidrc_interface_signature_read(ia_bit_buf_struct* it_bit_buff,
|
impd_unidrc_interface_signature_read(
|
||||||
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_drc_uni_interface_signat_struct* drc_uni_interface_signature);
|
ia_drc_uni_interface_signat_struct* drc_uni_interface_signature);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
|
|
@ -29,11 +30,13 @@ impd_sys_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_system_interface_struct* system_interface);
|
ia_system_interface_struct* system_interface);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_loudness_norm_control_interface_read(ia_bit_buf_struct* it_bit_buff,
|
impd_loudness_norm_control_interface_read(
|
||||||
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_loudness_norm_ctrl_interface_struct* loudness_norm_ctrl_interface);
|
ia_loudness_norm_ctrl_interface_struct* loudness_norm_ctrl_interface);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_loudness_norm_param_interface_read(ia_bit_buf_struct* it_bit_buff,
|
impd_loudness_norm_param_interface_read(
|
||||||
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_loudness_norm_parameter_interface_struct* loudness_norm_param_interface);
|
ia_loudness_norm_parameter_interface_struct* loudness_norm_param_interface);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
|
|
@ -41,11 +44,13 @@ impd_drc_interface_read(ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_dyn_rng_ctrl_interface_struct* drc_ctrl_interface);
|
ia_dyn_rng_ctrl_interface_struct* drc_ctrl_interface);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_param_interface_read(ia_bit_buf_struct* it_bit_buff,
|
impd_drc_param_interface_read(
|
||||||
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_drc_parameter_interface_struct* drc_parameter_interface);
|
ia_drc_parameter_interface_struct* drc_parameter_interface);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_unidrc_interface_extension_read(ia_bit_buf_struct* it_bit_buff,
|
impd_unidrc_interface_extension_read(
|
||||||
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_drc_interface_struct* impd_drc_uni_interface,
|
ia_drc_interface_struct* impd_drc_uni_interface,
|
||||||
ia_drc_uni_interface_ext_struct* drc_uni_interface_ext);
|
ia_drc_uni_interface_ext_struct* drc_uni_interface_ext);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,23 +32,14 @@
|
||||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WORD32 impd_peak_limiter_init(ia_drc_peak_limiter_struct *peak_limiter,
|
WORD32 impd_peak_limiter_init(ia_drc_peak_limiter_struct *peak_limiter,
|
||||||
FLOAT32 attack_time,
|
FLOAT32 attack_time, FLOAT32 release_time,
|
||||||
FLOAT32 release_time,
|
FLOAT32 limit_threshold, UWORD32 num_channels,
|
||||||
FLOAT32 limit_threshold,
|
UWORD32 sample_rate, FLOAT32 *buffer) {
|
||||||
UWORD32 num_channels,
|
|
||||||
UWORD32 sample_rate,
|
|
||||||
FLOAT32 *buffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
|
|
||||||
UWORD32 attack;
|
UWORD32 attack;
|
||||||
attack = (UWORD32)(attack_time * sample_rate / 1000);
|
attack = (UWORD32)(attack_time * sample_rate / 1000);
|
||||||
|
|
||||||
if (attack < 1)
|
if (attack < 1) return 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
peak_limiter->max_buf = buffer;
|
peak_limiter->max_buf = buffer;
|
||||||
peak_limiter->delayed_input = buffer + attack * 4 + 32;
|
peak_limiter->delayed_input = buffer + attack * 4 + 32;
|
||||||
|
|
@ -58,7 +49,8 @@ WORD32 impd_peak_limiter_init( ia_drc_peak_limiter_struct *peak_limiter,
|
||||||
peak_limiter->release_time = release_time;
|
peak_limiter->release_time = release_time;
|
||||||
peak_limiter->attack_time_samples = attack;
|
peak_limiter->attack_time_samples = attack;
|
||||||
peak_limiter->attack_constant = (FLOAT32)pow(0.1, 1.0 / (attack + 1));
|
peak_limiter->attack_constant = (FLOAT32)pow(0.1, 1.0 / (attack + 1));
|
||||||
peak_limiter->release_constant = (FLOAT32)pow(0.1, 1.0 / (release_time * sample_rate / 1000 + 1));
|
peak_limiter->release_constant =
|
||||||
|
(FLOAT32)pow(0.1, 1.0 / (release_time * sample_rate / 1000 + 1));
|
||||||
peak_limiter->limit_threshold = limit_threshold;
|
peak_limiter->limit_threshold = limit_threshold;
|
||||||
peak_limiter->num_channels = num_channels;
|
peak_limiter->num_channels = num_channels;
|
||||||
peak_limiter->sample_rate = sample_rate;
|
peak_limiter->sample_rate = sample_rate;
|
||||||
|
|
@ -70,23 +62,24 @@ WORD32 impd_peak_limiter_init( ia_drc_peak_limiter_struct *peak_limiter,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32 impd_peak_limiter_reinit(ia_drc_peak_limiter_struct *peak_limiter)
|
WORD32 impd_peak_limiter_reinit(ia_drc_peak_limiter_struct *peak_limiter) {
|
||||||
{
|
if (peak_limiter) {
|
||||||
if (peak_limiter)
|
|
||||||
{
|
|
||||||
peak_limiter->delayed_input_index = 0;
|
peak_limiter->delayed_input_index = 0;
|
||||||
peak_limiter->pre_smoothed_gain = 1.0f;
|
peak_limiter->pre_smoothed_gain = 1.0f;
|
||||||
peak_limiter->gain_modified = 1.0f;
|
peak_limiter->gain_modified = 1.0f;
|
||||||
peak_limiter->min_gain = 1.0f;
|
peak_limiter->min_gain = 1.0f;
|
||||||
memset(peak_limiter->max_buf, 0, (peak_limiter->attack_time_samples + 1) * sizeof(FLOAT32) );
|
memset(peak_limiter->max_buf, 0,
|
||||||
memset(peak_limiter->delayed_input, 0, peak_limiter->attack_time_samples * peak_limiter->num_channels * sizeof(FLOAT32) );
|
(peak_limiter->attack_time_samples + 1) * sizeof(FLOAT32));
|
||||||
|
memset(peak_limiter->delayed_input, 0, peak_limiter->attack_time_samples *
|
||||||
|
peak_limiter->num_channels *
|
||||||
|
sizeof(FLOAT32));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter, FLOAT32 *samples, UWORD32 frame_len)
|
WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter,
|
||||||
{
|
FLOAT32 *samples, UWORD32 frame_len) {
|
||||||
UWORD32 i, j;
|
UWORD32 i, j;
|
||||||
FLOAT32 tmp, gain;
|
FLOAT32 tmp, gain;
|
||||||
FLOAT32 min_gain = 1;
|
FLOAT32 min_gain = 1;
|
||||||
|
|
@ -102,9 +95,6 @@ WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter, FLOAT32 *s
|
||||||
UWORD32 delayed_input_index = peak_limiter->delayed_input_index;
|
UWORD32 delayed_input_index = peak_limiter->delayed_input_index;
|
||||||
FLOAT64 pre_smoothed_gain = peak_limiter->pre_smoothed_gain;
|
FLOAT64 pre_smoothed_gain = peak_limiter->pre_smoothed_gain;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (peak_limiter->limiter_on || (FLOAT32)pre_smoothed_gain < 1.0f) {
|
if (peak_limiter->limiter_on || (FLOAT32)pre_smoothed_gain < 1.0f) {
|
||||||
for (i = 0; i < frame_len; i++) {
|
for (i = 0; i < frame_len; i++) {
|
||||||
tmp = 0.0f;
|
tmp = 0.0f;
|
||||||
|
|
@ -118,38 +108,41 @@ WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter, FLOAT32 *s
|
||||||
max_buf[0] = tmp;
|
max_buf[0] = tmp;
|
||||||
sectionMaximum = tmp;
|
sectionMaximum = tmp;
|
||||||
for (j = 1; j < (attack_time_samples + 1); j++) {
|
for (j = 1; j < (attack_time_samples + 1); j++) {
|
||||||
if (max_buf[j] > sectionMaximum)
|
if (max_buf[j] > sectionMaximum) sectionMaximum = max_buf[j];
|
||||||
sectionMaximum = max_buf[j];
|
|
||||||
}
|
}
|
||||||
maximum = sectionMaximum;
|
maximum = sectionMaximum;
|
||||||
|
|
||||||
if (maximum > limit_threshold) {
|
if (maximum > limit_threshold) {
|
||||||
gain = limit_threshold / maximum;
|
gain = limit_threshold / maximum;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
gain = 1;
|
gain = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gain < pre_smoothed_gain) {
|
if (gain < pre_smoothed_gain) {
|
||||||
gain_modified = min(gain_modified, (gain - 0.1f * (FLOAT32)pre_smoothed_gain) * 1.11111111f);
|
gain_modified =
|
||||||
}
|
min(gain_modified,
|
||||||
else {
|
(gain - 0.1f * (FLOAT32)pre_smoothed_gain) * 1.11111111f);
|
||||||
|
} else {
|
||||||
gain_modified = gain;
|
gain_modified = gain;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gain_modified < pre_smoothed_gain) {
|
if (gain_modified < pre_smoothed_gain) {
|
||||||
pre_smoothed_gain = attack_constant * (pre_smoothed_gain - gain_modified) + gain_modified;
|
pre_smoothed_gain =
|
||||||
|
attack_constant * (pre_smoothed_gain - gain_modified) +
|
||||||
|
gain_modified;
|
||||||
pre_smoothed_gain = max(pre_smoothed_gain, gain);
|
pre_smoothed_gain = max(pre_smoothed_gain, gain);
|
||||||
}
|
} else {
|
||||||
else {
|
pre_smoothed_gain =
|
||||||
pre_smoothed_gain = release_constant * (pre_smoothed_gain - gain_modified) + gain_modified;
|
release_constant * (pre_smoothed_gain - gain_modified) +
|
||||||
|
gain_modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
gain = (FLOAT32)pre_smoothed_gain;
|
gain = (FLOAT32)pre_smoothed_gain;
|
||||||
|
|
||||||
for (j = 0; j < num_channels; j++) {
|
for (j = 0; j < num_channels; j++) {
|
||||||
tmp = delayed_input[delayed_input_index * num_channels + j];
|
tmp = delayed_input[delayed_input_index * num_channels + j];
|
||||||
delayed_input[delayed_input_index * num_channels + j] = samples[i * num_channels + j];
|
delayed_input[delayed_input_index * num_channels + j] =
|
||||||
|
samples[i * num_channels + j];
|
||||||
|
|
||||||
tmp *= gain;
|
tmp *= gain;
|
||||||
if (tmp > limit_threshold)
|
if (tmp > limit_threshold)
|
||||||
|
|
@ -161,24 +154,21 @@ WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter, FLOAT32 *s
|
||||||
}
|
}
|
||||||
|
|
||||||
delayed_input_index++;
|
delayed_input_index++;
|
||||||
if (delayed_input_index >= attack_time_samples)
|
if (delayed_input_index >= attack_time_samples) delayed_input_index = 0;
|
||||||
delayed_input_index = 0;
|
|
||||||
|
|
||||||
if (gain < min_gain)
|
if (gain < min_gain) min_gain = gain;
|
||||||
min_gain = gain;
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
for (i = 0; i < frame_len; i++) {
|
for (i = 0; i < frame_len; i++) {
|
||||||
for (j = 0; j < num_channels; j++) {
|
for (j = 0; j < num_channels; j++) {
|
||||||
tmp = delayed_input[delayed_input_index * num_channels + j];
|
tmp = delayed_input[delayed_input_index * num_channels + j];
|
||||||
delayed_input[delayed_input_index * num_channels + j] = samples[i * num_channels + j];
|
delayed_input[delayed_input_index * num_channels + j] =
|
||||||
|
samples[i * num_channels + j];
|
||||||
samples[i * num_channels + j] = tmp;
|
samples[i * num_channels + j] = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
delayed_input_index++;
|
delayed_input_index++;
|
||||||
if (delayed_input_index >= attack_time_samples)
|
if (delayed_input_index >= attack_time_samples) delayed_input_index = 0;
|
||||||
delayed_input_index = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,5 +179,3 @@ WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter, FLOAT32 *s
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,9 @@
|
||||||
#ifndef IMPD_DRC_PEAK_LIMITER_H
|
#ifndef IMPD_DRC_PEAK_LIMITER_H
|
||||||
#define IMPD_DRC_PEAK_LIMITER_H
|
#define IMPD_DRC_PEAK_LIMITER_H
|
||||||
|
|
||||||
|
|
||||||
#define DEFAULT_ATTACK_TIME_MS (5.0f) /* default attack time in ms */
|
#define DEFAULT_ATTACK_TIME_MS (5.0f) /* default attack time in ms */
|
||||||
#define DEFAULT_RELEASE_TIME_MS (50.0f) /* default release time in ms */
|
#define DEFAULT_RELEASE_TIME_MS (50.0f) /* default release time in ms */
|
||||||
|
|
||||||
|
|
||||||
typedef struct ia_drc_peak_limiter_struct {
|
typedef struct ia_drc_peak_limiter_struct {
|
||||||
FLOAT32 attack_time;
|
FLOAT32 attack_time;
|
||||||
FLOAT32 release_time;
|
FLOAT32 release_time;
|
||||||
|
|
@ -45,13 +43,11 @@ typedef struct ia_drc_peak_limiter_struct {
|
||||||
} ia_drc_peak_limiter_struct;
|
} ia_drc_peak_limiter_struct;
|
||||||
|
|
||||||
WORD32 impd_peak_limiter_init(ia_drc_peak_limiter_struct *peak_limiter,
|
WORD32 impd_peak_limiter_init(ia_drc_peak_limiter_struct *peak_limiter,
|
||||||
FLOAT32 attack_time,
|
FLOAT32 attack_time, FLOAT32 release_time,
|
||||||
FLOAT32 release_time,
|
FLOAT32 limit_threshold, UWORD32 num_channels,
|
||||||
FLOAT32 limit_threshold,
|
UWORD32 sample_rate, FLOAT32 *buffer);
|
||||||
UWORD32 num_channels,
|
|
||||||
UWORD32 sample_rate,
|
|
||||||
FLOAT32 *buffer);
|
|
||||||
|
|
||||||
WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter, FLOAT32 *samples, UWORD32 frame_len);
|
WORD32 impd_limiter_process(ia_drc_peak_limiter_struct *peak_limiter,
|
||||||
|
FLOAT32 *samples, UWORD32 frame_len);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,9 @@
|
||||||
#ifndef IMPD_DRC_PEAK_LIMITER_STRUCT_H
|
#ifndef IMPD_DRC_PEAK_LIMITER_STRUCT_H
|
||||||
#define IMPD_DRC_PEAK_LIMITER_STRUCT_H
|
#define IMPD_DRC_PEAK_LIMITER_STRUCT_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define DEFAULT_ATTACK_TIME_MS (5.0f) /* default attack time in ms */
|
#define DEFAULT_ATTACK_TIME_MS (5.0f) /* default attack time in ms */
|
||||||
#define DEFAULT_RELEASE_TIME_MS (50.0f) /* default release time in ms */
|
#define DEFAULT_RELEASE_TIME_MS (50.0f) /* default release time in ms */
|
||||||
|
|
||||||
|
|
||||||
typedef struct ia_drc_peak_limiter_struct {
|
typedef struct ia_drc_peak_limiter_struct {
|
||||||
FLOAT32 attack_time;
|
FLOAT32 attack_time;
|
||||||
FLOAT32 release_time;
|
FLOAT32 release_time;
|
||||||
|
|
@ -46,5 +43,3 @@ typedef struct ia_drc_peak_limiter_struct {
|
||||||
} ia_drc_peak_limiter_struct;
|
} ia_drc_peak_limiter_struct;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,17 +31,14 @@
|
||||||
#include "impd_drc_gain_dec.h"
|
#include "impd_drc_gain_dec.h"
|
||||||
#include "impd_drc_process_audio.h"
|
#include "impd_drc_process_audio.h"
|
||||||
|
|
||||||
|
WORD32 impd_apply_gains_and_add(
|
||||||
WORD32 impd_apply_gains_and_add(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||||
const WORD32 drc_instructions_index,
|
const WORD32 drc_instructions_index,
|
||||||
ia_drc_params_struct* ia_drc_params_struct,
|
ia_drc_params_struct* ia_drc_params_struct,
|
||||||
ia_gain_buffer_struct* pstr_gain_buf,
|
ia_gain_buffer_struct* pstr_gain_buf,
|
||||||
shape_filter_block shape_filter_block[],
|
shape_filter_block shape_filter_block[], FLOAT32* deinterleaved_audio[],
|
||||||
FLOAT32* deinterleaved_audio[],
|
|
||||||
|
|
||||||
FLOAT32* channel_audio[],
|
FLOAT32* channel_audio[], WORD32 impd_apply_gains) {
|
||||||
WORD32 impd_apply_gains)
|
|
||||||
{
|
|
||||||
WORD32 c, b, g, i;
|
WORD32 c, b, g, i;
|
||||||
WORD32 offset = 0, signalIndex = 0;
|
WORD32 offset = 0, signalIndex = 0;
|
||||||
WORD32 gainIndexForGroup[CHANNEL_GROUP_COUNT_MAX];
|
WORD32 gainIndexForGroup[CHANNEL_GROUP_COUNT_MAX];
|
||||||
|
|
@ -50,93 +47,88 @@ WORD32 impd_apply_gains_and_add(ia_drc_instructions_struct* pstr_drc_instruction
|
||||||
FLOAT32 sum;
|
FLOAT32 sum;
|
||||||
FLOAT32 drc_gain_last, gainThr;
|
FLOAT32 drc_gain_last, gainThr;
|
||||||
WORD32 iEnd, iStart;
|
WORD32 iEnd, iStart;
|
||||||
ia_drc_instructions_struct* str_drc_instruction_str = &(pstr_drc_instruction_arr[drc_instructions_index]);
|
ia_drc_instructions_struct* str_drc_instruction_str =
|
||||||
|
&(pstr_drc_instruction_arr[drc_instructions_index]);
|
||||||
|
|
||||||
if (drc_instructions_index >= 0)
|
if (drc_instructions_index >= 0) {
|
||||||
{
|
str_drc_instruction_str =
|
||||||
str_drc_instruction_str = &(pstr_drc_instruction_arr[drc_instructions_index]);
|
&(pstr_drc_instruction_arr[drc_instructions_index]);
|
||||||
{
|
|
||||||
if (str_drc_instruction_str->drc_set_id > 0)
|
|
||||||
{
|
|
||||||
if (ia_drc_params_struct->delay_mode == DELAY_MODE_LOW_DELAY)
|
|
||||||
{
|
{
|
||||||
|
if (str_drc_instruction_str->drc_set_id > 0) {
|
||||||
|
if (ia_drc_params_struct->delay_mode == DELAY_MODE_LOW_DELAY) {
|
||||||
offset = ia_drc_params_struct->drc_frame_size;
|
offset = ia_drc_params_struct->drc_frame_size;
|
||||||
}
|
}
|
||||||
gainIndexForGroup[0] = 0;
|
gainIndexForGroup[0] = 0;
|
||||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups-1; g++)
|
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups - 1; g++) {
|
||||||
{
|
gainIndexForGroup[g + 1] =
|
||||||
gainIndexForGroup[g+1] = gainIndexForGroup[g] + str_drc_instruction_str->band_count_of_ch_group[g];
|
gainIndexForGroup[g] +
|
||||||
|
str_drc_instruction_str->band_count_of_ch_group[g];
|
||||||
}
|
}
|
||||||
signalIndexForChannel[0] = 0;
|
signalIndexForChannel[0] = 0;
|
||||||
for (c=0; c<str_drc_instruction_str->audio_num_chan-1; c++)
|
for (c = 0; c < str_drc_instruction_str->audio_num_chan - 1; c++) {
|
||||||
{
|
if (str_drc_instruction_str->channel_group_of_ch[c] >= 0) {
|
||||||
if (str_drc_instruction_str->channel_group_of_ch[c] >= 0)
|
signalIndexForChannel[c + 1] =
|
||||||
{
|
signalIndexForChannel[c] +
|
||||||
signalIndexForChannel[c+1] = signalIndexForChannel[c] + str_drc_instruction_str->band_count_of_ch_group[str_drc_instruction_str->channel_group_of_ch[c]];
|
str_drc_instruction_str->band_count_of_ch_group
|
||||||
}
|
[str_drc_instruction_str->channel_group_of_ch[c]];
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
signalIndexForChannel[c + 1] = signalIndexForChannel[c] + 1;
|
signalIndexForChannel[c + 1] = signalIndexForChannel[c] + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups; g++)
|
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups; g++) {
|
||||||
{
|
for (b = 0; b < str_drc_instruction_str->band_count_of_ch_group[g];
|
||||||
for (b=0; b<str_drc_instruction_str->band_count_of_ch_group[g]; b++)
|
b++) {
|
||||||
{
|
|
||||||
if (str_drc_instruction_str->ch_group_parametric_drc_flag[g] == 0) {
|
if (str_drc_instruction_str->ch_group_parametric_drc_flag[g] == 0) {
|
||||||
lpcm_gains = pstr_gain_buf->buf_interpolation[gainIndexForGroup[g]+b].lpcm_gains + MAX_SIGNAL_DELAY - ia_drc_params_struct->gain_delay_samples - ia_drc_params_struct->audio_delay_samples + offset;
|
lpcm_gains =
|
||||||
|
pstr_gain_buf->buf_interpolation[gainIndexForGroup[g] + b]
|
||||||
|
.lpcm_gains +
|
||||||
|
MAX_SIGNAL_DELAY - ia_drc_params_struct->gain_delay_samples -
|
||||||
|
ia_drc_params_struct->audio_delay_samples + offset;
|
||||||
} else {
|
} else {
|
||||||
lpcm_gains = pstr_gain_buf->buf_interpolation[gainIndexForGroup[g]+b].lpcm_gains + MAX_SIGNAL_DELAY + str_drc_instruction_str->parametric_drc_look_ahead_samples[g] - ia_drc_params_struct->audio_delay_samples;
|
lpcm_gains =
|
||||||
|
pstr_gain_buf->buf_interpolation[gainIndexForGroup[g] + b]
|
||||||
|
.lpcm_gains +
|
||||||
|
MAX_SIGNAL_DELAY +
|
||||||
|
str_drc_instruction_str
|
||||||
|
->parametric_drc_look_ahead_samples[g] -
|
||||||
|
ia_drc_params_struct->audio_delay_samples;
|
||||||
}
|
}
|
||||||
iEnd = 0;
|
iEnd = 0;
|
||||||
iStart = 0;
|
iStart = 0;
|
||||||
while (iEnd < ia_drc_params_struct->drc_frame_size)
|
while (iEnd < ia_drc_params_struct->drc_frame_size) {
|
||||||
{
|
|
||||||
if (shape_filter_block[g].shape_flter_block_flag) {
|
if (shape_filter_block[g].shape_flter_block_flag) {
|
||||||
drc_gain_last = shape_filter_block[g].drc_gain_last;
|
drc_gain_last = shape_filter_block[g].drc_gain_last;
|
||||||
gainThr = 0.0001f * drc_gain_last;
|
gainThr = 0.0001f * drc_gain_last;
|
||||||
while ((iEnd<ia_drc_params_struct->drc_frame_size) && (fabs(lpcm_gains[iEnd] - drc_gain_last) <= gainThr)) iEnd++;
|
while ((iEnd < ia_drc_params_struct->drc_frame_size) &&
|
||||||
}
|
(fabs(lpcm_gains[iEnd] - drc_gain_last) <= gainThr))
|
||||||
else
|
iEnd++;
|
||||||
{
|
} else {
|
||||||
iEnd = ia_drc_params_struct->drc_frame_size;
|
iEnd = ia_drc_params_struct->drc_frame_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (g == str_drc_instruction_str->channel_group_of_ch[c])
|
if (g == str_drc_instruction_str->channel_group_of_ch[c]) {
|
||||||
{
|
|
||||||
signalIndex = signalIndexForChannel[c] + b;
|
signalIndex = signalIndexForChannel[c] + b;
|
||||||
|
|
||||||
if (impd_apply_gains == 1) {
|
if (impd_apply_gains == 1) {
|
||||||
|
impd_shape_filt_block_time_process(
|
||||||
|
&shape_filter_block[g], &lpcm_gains[0], signalIndex,
|
||||||
|
&deinterleaved_audio[signalIndex][0], iStart, iEnd);
|
||||||
|
|
||||||
impd_shape_filt_block_time_process(&shape_filter_block[g],
|
} else {
|
||||||
&lpcm_gains[0],
|
|
||||||
signalIndex,
|
|
||||||
&deinterleaved_audio[signalIndex][0],
|
|
||||||
iStart,
|
|
||||||
iEnd);
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (i = iStart; i < iEnd; i++) {
|
for (i = iStart; i < iEnd; i++) {
|
||||||
deinterleaved_audio[signalIndex][i] = lpcm_gains[i];
|
deinterleaved_audio[signalIndex][i] = lpcm_gains[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if ((iEnd < ia_drc_params_struct->drc_frame_size) && (shape_filter_block[g].shape_flter_block_flag))
|
if ((iEnd < ia_drc_params_struct->drc_frame_size) &&
|
||||||
{
|
(shape_filter_block[g].shape_flter_block_flag)) {
|
||||||
impd_shape_filt_block_adapt(lpcm_gains[iEnd], &shape_filter_block[g]);
|
impd_shape_filt_block_adapt(lpcm_gains[iEnd],
|
||||||
|
&shape_filter_block[g]);
|
||||||
}
|
}
|
||||||
iStart = iEnd;
|
iStart = iEnd;
|
||||||
}
|
}
|
||||||
|
|
@ -148,72 +140,42 @@ WORD32 impd_apply_gains_and_add(ia_drc_instructions_struct* pstr_drc_instruction
|
||||||
|
|
||||||
signalIndex = 0;
|
signalIndex = 0;
|
||||||
|
|
||||||
if (str_drc_instruction_str->drc_set_id > 0)
|
if (str_drc_instruction_str->drc_set_id > 0) {
|
||||||
{
|
|
||||||
|
|
||||||
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
||||||
|
|
||||||
{
|
{
|
||||||
g = str_drc_instruction_str->channel_group_of_ch[c];
|
g = str_drc_instruction_str->channel_group_of_ch[c];
|
||||||
if (g>=0)
|
if (g >= 0) {
|
||||||
{
|
for (i = 0; i < ia_drc_params_struct->drc_frame_size; i++) {
|
||||||
for (i=0; i<ia_drc_params_struct->drc_frame_size; i++)
|
|
||||||
{
|
|
||||||
sum = 0.0f;
|
sum = 0.0f;
|
||||||
for (b=0; b<str_drc_instruction_str->band_count_of_ch_group[g]; b++)
|
for (b = 0; b < str_drc_instruction_str->band_count_of_ch_group[g];
|
||||||
{
|
b++) {
|
||||||
sum += deinterleaved_audio[signalIndex + b][i];
|
sum += deinterleaved_audio[signalIndex + b][i];
|
||||||
}
|
}
|
||||||
|
|
||||||
channel_audio[c][i] = sum;
|
channel_audio[c][i] = sum;
|
||||||
|
|
||||||
}
|
}
|
||||||
signalIndex += str_drc_instruction_str->band_count_of_ch_group[g];
|
signalIndex += str_drc_instruction_str->band_count_of_ch_group[g];
|
||||||
}
|
} else {
|
||||||
else
|
for (i = 0; i < ia_drc_params_struct->drc_frame_size; i++) {
|
||||||
{
|
|
||||||
for (i=0; i<ia_drc_params_struct->drc_frame_size; i++)
|
|
||||||
{
|
|
||||||
channel_audio[c][i] = deinterleaved_audio[signalIndex][i];
|
channel_audio[c][i] = deinterleaved_audio[signalIndex][i];
|
||||||
}
|
}
|
||||||
signalIndex++;
|
signalIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
||||||
|
|
||||||
{
|
{
|
||||||
for (i=0; i<ia_drc_params_struct->drc_frame_size; i++)
|
for (i = 0; i < ia_drc_params_struct->drc_frame_size; i++) {
|
||||||
{
|
|
||||||
channel_audio[c][i] = deinterleaved_audio[c][i];
|
channel_audio[c][i] = deinterleaved_audio[c][i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* subband-domain DRC: in-place application of DRC gains to audio frame */
|
/* subband-domain DRC: in-place application of DRC gains to audio frame */
|
||||||
WORD32
|
WORD32
|
||||||
impd_apply_gains_subband(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
impd_apply_gains_subband(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||||
|
|
@ -224,8 +186,7 @@ WORD32
|
||||||
FLOAT32* deinterleaved_audio_delayed_re[],
|
FLOAT32* deinterleaved_audio_delayed_re[],
|
||||||
FLOAT32* deinterleaved_audio_delayed_im[],
|
FLOAT32* deinterleaved_audio_delayed_im[],
|
||||||
FLOAT32* deinterleaved_audio_re[],
|
FLOAT32* deinterleaved_audio_re[],
|
||||||
FLOAT32* deinterleaved_audio_im[])
|
FLOAT32* deinterleaved_audio_im[]) {
|
||||||
{
|
|
||||||
WORD32 c, b, g, m, s;
|
WORD32 c, b, g, m, s;
|
||||||
WORD32 gainIndexForGroup[CHANNEL_GROUP_COUNT_MAX];
|
WORD32 gainIndexForGroup[CHANNEL_GROUP_COUNT_MAX];
|
||||||
FLOAT32* lpcm_gains;
|
FLOAT32* lpcm_gains;
|
||||||
|
|
@ -258,71 +219,128 @@ WORD32
|
||||||
}
|
}
|
||||||
drc_frame_sizeSb = ia_drc_params_struct->drc_frame_size / L;
|
drc_frame_sizeSb = ia_drc_params_struct->drc_frame_size / L;
|
||||||
|
|
||||||
if (drc_instructions_index >= 0)
|
if (drc_instructions_index >= 0) {
|
||||||
{
|
str_drc_instruction_str =
|
||||||
str_drc_instruction_str = &(pstr_drc_instruction_arr[drc_instructions_index]);
|
&(pstr_drc_instruction_arr[drc_instructions_index]);
|
||||||
{
|
|
||||||
if (str_drc_instruction_str->drc_set_id > 0)
|
|
||||||
{
|
|
||||||
if (ia_drc_params_struct->delay_mode == DELAY_MODE_LOW_DELAY)
|
|
||||||
{
|
{
|
||||||
|
if (str_drc_instruction_str->drc_set_id > 0) {
|
||||||
|
if (ia_drc_params_struct->delay_mode == DELAY_MODE_LOW_DELAY) {
|
||||||
offset = ia_drc_params_struct->drc_frame_size;
|
offset = ia_drc_params_struct->drc_frame_size;
|
||||||
}
|
}
|
||||||
gainIndexForGroup[0] = 0;
|
gainIndexForGroup[0] = 0;
|
||||||
for (g=0; g<str_drc_instruction_str->num_drc_ch_groups-1; g++)
|
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups - 1; g++) {
|
||||||
{
|
gainIndexForGroup[g + 1] =
|
||||||
gainIndexForGroup[g+1] = gainIndexForGroup[g] + str_drc_instruction_str->band_count_of_ch_group[g]; /* index of first gain sequence in channel group */
|
gainIndexForGroup[g] +
|
||||||
|
str_drc_instruction_str
|
||||||
|
->band_count_of_ch_group[g]; /* index of first gain sequence
|
||||||
|
in channel group */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
|
||||||
|
|
||||||
{
|
{
|
||||||
g = str_drc_instruction_str->channel_group_of_ch[c];
|
g = str_drc_instruction_str->channel_group_of_ch[c];
|
||||||
if (g>=0)
|
if (g >= 0) {
|
||||||
{
|
for (m = 0; m < drc_frame_sizeSb; m++) {
|
||||||
for (m=0; m<drc_frame_sizeSb; m++)
|
if (str_drc_instruction_str->band_count_of_ch_group[g] >
|
||||||
{
|
1) { /* multiband DRC */
|
||||||
if (str_drc_instruction_str->band_count_of_ch_group[g] > 1)
|
for (s = 0; s < nDecoderSubbands; s++) {
|
||||||
{ /* multiband DRC */
|
|
||||||
for (s=0; s<nDecoderSubbands; s++)
|
|
||||||
{
|
|
||||||
gainSb = 0.0f;
|
gainSb = 0.0f;
|
||||||
for (b=0; b<str_drc_instruction_str->band_count_of_ch_group[g]; b++)
|
for (b = 0;
|
||||||
{
|
b < str_drc_instruction_str->band_count_of_ch_group[g];
|
||||||
if (str_drc_instruction_str->ch_group_parametric_drc_flag[g] == 0) {
|
b++) {
|
||||||
lpcm_gains = pstr_gain_buf->buf_interpolation[gainIndexForGroup[g]+b].lpcm_gains + MAX_SIGNAL_DELAY - ia_drc_params_struct->gain_delay_samples - ia_drc_params_struct->audio_delay_samples + offset;
|
if (str_drc_instruction_str
|
||||||
|
->ch_group_parametric_drc_flag[g] == 0) {
|
||||||
|
lpcm_gains =
|
||||||
|
pstr_gain_buf
|
||||||
|
->buf_interpolation[gainIndexForGroup[g] + b]
|
||||||
|
.lpcm_gains +
|
||||||
|
MAX_SIGNAL_DELAY -
|
||||||
|
ia_drc_params_struct->gain_delay_samples -
|
||||||
|
ia_drc_params_struct->audio_delay_samples + offset;
|
||||||
} else {
|
} else {
|
||||||
lpcm_gains = pstr_gain_buf->buf_interpolation[gainIndexForGroup[g]+b].lpcm_gains + MAX_SIGNAL_DELAY + str_drc_instruction_str->parametric_drc_look_ahead_samples[g] - ia_drc_params_struct->audio_delay_samples + analysisDelay;
|
lpcm_gains =
|
||||||
|
pstr_gain_buf
|
||||||
|
->buf_interpolation[gainIndexForGroup[g] + b]
|
||||||
|
.lpcm_gains +
|
||||||
|
MAX_SIGNAL_DELAY +
|
||||||
|
str_drc_instruction_str
|
||||||
|
->parametric_drc_look_ahead_samples[g] -
|
||||||
|
ia_drc_params_struct->audio_delay_samples +
|
||||||
|
analysisDelay;
|
||||||
}
|
}
|
||||||
/* get gain for this timeslot by downsampling */
|
/* get gain for this timeslot by downsampling */
|
||||||
gainLr = lpcm_gains[(m * L + (L - 1) / 2)];
|
gainLr = lpcm_gains[(m * L + (L - 1) / 2)];
|
||||||
gainSb += pstr_overlap_params->str_group_overlap_params[g].str_band_overlap_params[b].overlap_weight[s] * gainLr;
|
gainSb += pstr_overlap_params->str_group_overlap_params[g]
|
||||||
|
.str_band_overlap_params[b]
|
||||||
|
.overlap_weight[s] *
|
||||||
|
gainLr;
|
||||||
}
|
}
|
||||||
deinterleaved_audio_re[signalIndex][m*nDecoderSubbands+s] = gainSb * deinterleaved_audio_delayed_re[signalIndex][m*nDecoderSubbands+s];
|
deinterleaved_audio_re[signalIndex][m * nDecoderSubbands +
|
||||||
if (ia_drc_params_struct->sub_band_domain_mode == SUBBAND_DOMAIN_MODE_STFT256) { /* For STFT filterbank, the real value of the nyquist band is stored at the imag value of the first band */
|
s] =
|
||||||
|
gainSb *
|
||||||
|
deinterleaved_audio_delayed_re[signalIndex]
|
||||||
|
[m * nDecoderSubbands + s];
|
||||||
|
if (ia_drc_params_struct->sub_band_domain_mode ==
|
||||||
|
SUBBAND_DOMAIN_MODE_STFT256) { /* For STFT filterbank, the
|
||||||
|
real value of the
|
||||||
|
nyquist band is stored
|
||||||
|
at the imag value of the
|
||||||
|
first band */
|
||||||
if (s != 0)
|
if (s != 0)
|
||||||
deinterleaved_audio_im[signalIndex][m*nDecoderSubbands+s] = gainSb * deinterleaved_audio_delayed_im[signalIndex][m*nDecoderSubbands+s];
|
deinterleaved_audio_im[signalIndex][m * nDecoderSubbands +
|
||||||
|
s] =
|
||||||
|
gainSb *
|
||||||
|
deinterleaved_audio_delayed_im[signalIndex]
|
||||||
|
[m * nDecoderSubbands +
|
||||||
|
s];
|
||||||
if (s == (nDecoderSubbands - 1))
|
if (s == (nDecoderSubbands - 1))
|
||||||
deinterleaved_audio_im[signalIndex][m*nDecoderSubbands+0] = gainSb * deinterleaved_audio_delayed_im[signalIndex][m*nDecoderSubbands+0];
|
deinterleaved_audio_im[signalIndex][m * nDecoderSubbands +
|
||||||
|
0] =
|
||||||
|
gainSb *
|
||||||
|
deinterleaved_audio_delayed_im[signalIndex]
|
||||||
|
[m * nDecoderSubbands +
|
||||||
|
0];
|
||||||
} else {
|
} else {
|
||||||
deinterleaved_audio_im[signalIndex][m*nDecoderSubbands+s] = gainSb * deinterleaved_audio_delayed_im[signalIndex][m*nDecoderSubbands+s];
|
deinterleaved_audio_im[signalIndex][m * nDecoderSubbands +
|
||||||
|
s] =
|
||||||
|
gainSb *
|
||||||
|
deinterleaved_audio_delayed_im[signalIndex]
|
||||||
|
[m * nDecoderSubbands +
|
||||||
|
s];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else { /* single-band DRC */
|
||||||
else
|
if (str_drc_instruction_str->ch_group_parametric_drc_flag[g] ==
|
||||||
{ /* single-band DRC */
|
0) {
|
||||||
if (str_drc_instruction_str->ch_group_parametric_drc_flag[g] == 0) {
|
lpcm_gains =
|
||||||
lpcm_gains = pstr_gain_buf->buf_interpolation[gainIndexForGroup[g]].lpcm_gains + MAX_SIGNAL_DELAY - ia_drc_params_struct->gain_delay_samples - ia_drc_params_struct->audio_delay_samples + offset;
|
pstr_gain_buf->buf_interpolation[gainIndexForGroup[g]]
|
||||||
|
.lpcm_gains +
|
||||||
|
MAX_SIGNAL_DELAY -
|
||||||
|
ia_drc_params_struct->gain_delay_samples -
|
||||||
|
ia_drc_params_struct->audio_delay_samples + offset;
|
||||||
} else {
|
} else {
|
||||||
lpcm_gains = pstr_gain_buf->buf_interpolation[gainIndexForGroup[g]].lpcm_gains + MAX_SIGNAL_DELAY + str_drc_instruction_str->parametric_drc_look_ahead_samples[g] - ia_drc_params_struct->audio_delay_samples + analysisDelay;
|
lpcm_gains =
|
||||||
|
pstr_gain_buf->buf_interpolation[gainIndexForGroup[g]]
|
||||||
|
.lpcm_gains +
|
||||||
|
MAX_SIGNAL_DELAY +
|
||||||
|
str_drc_instruction_str
|
||||||
|
->parametric_drc_look_ahead_samples[g] -
|
||||||
|
ia_drc_params_struct->audio_delay_samples + analysisDelay;
|
||||||
}
|
}
|
||||||
/* get gain for this timeslot by downsampling */
|
/* get gain for this timeslot by downsampling */
|
||||||
gainSb = lpcm_gains[(m * L + (L - 1) / 2)];
|
gainSb = lpcm_gains[(m * L + (L - 1) / 2)];
|
||||||
for (s=0; s<nDecoderSubbands; s++)
|
for (s = 0; s < nDecoderSubbands; s++) {
|
||||||
{
|
deinterleaved_audio_re[signalIndex][m * nDecoderSubbands +
|
||||||
deinterleaved_audio_re[signalIndex][m*nDecoderSubbands+s] = gainSb * deinterleaved_audio_delayed_re[signalIndex][m*nDecoderSubbands+s];
|
s] =
|
||||||
deinterleaved_audio_im[signalIndex][m*nDecoderSubbands+s] = gainSb * deinterleaved_audio_delayed_im[signalIndex][m*nDecoderSubbands+s];
|
gainSb *
|
||||||
|
deinterleaved_audio_delayed_re[signalIndex]
|
||||||
|
[m * nDecoderSubbands + s];
|
||||||
|
deinterleaved_audio_im[signalIndex][m * nDecoderSubbands +
|
||||||
|
s] =
|
||||||
|
gainSb *
|
||||||
|
deinterleaved_audio_delayed_im[signalIndex]
|
||||||
|
[m * nDecoderSubbands + s];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -342,8 +360,7 @@ impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||||
FLOAT32* audio_io_buf[],
|
FLOAT32* audio_io_buf[],
|
||||||
ia_audio_band_buffer_struct* audio_band_buffer,
|
ia_audio_band_buffer_struct* audio_band_buffer,
|
||||||
ia_filter_banks_struct* ia_filter_banks_struct,
|
ia_filter_banks_struct* ia_filter_banks_struct,
|
||||||
const WORD32 passThru)
|
const WORD32 passThru) {
|
||||||
{
|
|
||||||
WORD32 c, g, e, i, num_bands;
|
WORD32 c, g, e, i, num_bands;
|
||||||
// WORD32 err = 0;
|
// WORD32 err = 0;
|
||||||
FLOAT32* audio_in;
|
FLOAT32* audio_in;
|
||||||
|
|
@ -353,7 +370,8 @@ impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||||
WORD32 drc_frame_size = ia_drc_params_struct->drc_frame_size;
|
WORD32 drc_frame_size = ia_drc_params_struct->drc_frame_size;
|
||||||
|
|
||||||
if (drc_instructions_index >= 0) {
|
if (drc_instructions_index >= 0) {
|
||||||
str_drc_instruction_str = &(pstr_drc_instruction_arr[drc_instructions_index]);
|
str_drc_instruction_str =
|
||||||
|
&(pstr_drc_instruction_arr[drc_instructions_index]);
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -368,74 +386,61 @@ impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||||
audio_in = audio_io_buf[c];
|
audio_in = audio_io_buf[c];
|
||||||
|
|
||||||
audio_out = &(audio_band_buffer->non_interleaved_audio[e]);
|
audio_out = &(audio_band_buffer->non_interleaved_audio[e]);
|
||||||
if ((passThru == 0) && (drc_instructions_index >= 0))
|
if ((passThru == 0) && (drc_instructions_index >= 0)) {
|
||||||
{
|
if (str_drc_instruction_str->drc_set_id < 0) {
|
||||||
if (str_drc_instruction_str->drc_set_id < 0)
|
|
||||||
{
|
|
||||||
num_bands = 1;
|
num_bands = 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
g = str_drc_instruction_str->channel_group_of_ch[c];
|
g = str_drc_instruction_str->channel_group_of_ch[c];
|
||||||
if (g== -1)
|
if (g == -1) {
|
||||||
{
|
|
||||||
num_bands = 1;
|
num_bands = 1;
|
||||||
// if (ia_filter_banks_struct->str_drc_filter_bank != NULL)
|
// if (ia_filter_banks_struct->str_drc_filter_bank != NULL)
|
||||||
//{
|
//{
|
||||||
str_drc_filter_bank = &(ia_filter_banks_struct->str_drc_filter_bank[str_drc_instruction_str->num_drc_ch_groups]);
|
str_drc_filter_bank =
|
||||||
|
&(ia_filter_banks_struct->str_drc_filter_bank
|
||||||
|
[str_drc_instruction_str->num_drc_ch_groups]);
|
||||||
//}
|
//}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
num_bands = str_drc_instruction_str->band_count_of_ch_group[g];
|
num_bands = str_drc_instruction_str->band_count_of_ch_group[g];
|
||||||
// if (ia_filter_banks_struct->str_drc_filter_bank != NULL)
|
// if (ia_filter_banks_struct->str_drc_filter_bank != NULL)
|
||||||
//{
|
//{
|
||||||
str_drc_filter_bank = &(ia_filter_banks_struct->str_drc_filter_bank[g]);
|
str_drc_filter_bank =
|
||||||
|
&(ia_filter_banks_struct->str_drc_filter_bank[g]);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
// if (ia_filter_banks_struct->str_drc_filter_bank != NULL)
|
// if (ia_filter_banks_struct->str_drc_filter_bank != NULL)
|
||||||
//{
|
//{
|
||||||
// if (&str_drc_filter_bank->str_all_pass_cascade != NULL)
|
// if (&str_drc_filter_bank->str_all_pass_cascade != NULL)
|
||||||
//{
|
//{
|
||||||
impd_all_pass_cascade_process(&str_drc_filter_bank->str_all_pass_cascade, c, drc_frame_size, audio_in);
|
impd_all_pass_cascade_process(
|
||||||
|
&str_drc_filter_bank->str_all_pass_cascade, c, drc_frame_size,
|
||||||
|
audio_in);
|
||||||
//}
|
//}
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
num_bands = 1;
|
num_bands = 1;
|
||||||
}
|
}
|
||||||
switch (num_bands) {
|
switch (num_bands) {
|
||||||
case 1:
|
case 1:
|
||||||
for (i=0; i<drc_frame_size; i++)
|
for (i = 0; i < drc_frame_size; i++) {
|
||||||
{
|
|
||||||
audio_out[0][i] = audio_in[i];
|
audio_out[0][i] = audio_in[i];
|
||||||
}
|
}
|
||||||
e++;
|
e++;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
impd_two_band_filter_process(&str_drc_filter_bank->str_two_band_bank,
|
impd_two_band_filter_process(&str_drc_filter_bank->str_two_band_bank, c,
|
||||||
c,
|
drc_frame_size, audio_in, audio_out);
|
||||||
drc_frame_size,
|
|
||||||
audio_in,
|
|
||||||
audio_out);
|
|
||||||
e += 2;
|
e += 2;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
impd_three_band_filter_process(&str_drc_filter_bank->str_three_band_bank,
|
impd_three_band_filter_process(
|
||||||
c,
|
&str_drc_filter_bank->str_three_band_bank, c, drc_frame_size,
|
||||||
drc_frame_size,
|
audio_in, audio_out);
|
||||||
audio_in,
|
|
||||||
audio_out);
|
|
||||||
e += 3;
|
e += 3;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
impd_four_band_filter_process(&str_drc_filter_bank->str_four_band_bank,
|
impd_four_band_filter_process(&str_drc_filter_bank->str_four_band_bank,
|
||||||
c,
|
c, drc_frame_size, audio_in, audio_out);
|
||||||
drc_frame_size,
|
|
||||||
audio_in,
|
|
||||||
audio_out);
|
|
||||||
e += 4;
|
e += 4;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -447,18 +452,17 @@ impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_store_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
|
impd_store_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
|
||||||
ia_audio_in_out_buf* audio_io_buf_internal)
|
ia_audio_in_out_buf* audio_io_buf_internal) {
|
||||||
{
|
|
||||||
WORD32 i, j;
|
WORD32 i, j;
|
||||||
|
|
||||||
if (audio_io_buf_internal->audio_delay_samples) {
|
if (audio_io_buf_internal->audio_delay_samples) {
|
||||||
for (i = 0; i < audio_io_buf_internal->audio_num_chan; i++) {
|
for (i = 0; i < audio_io_buf_internal->audio_num_chan; i++) {
|
||||||
for (j = 0; j < audio_io_buf_internal->frame_size; j++) {
|
for (j = 0; j < audio_io_buf_internal->frame_size; j++) {
|
||||||
audio_io_buf_internal->audio_io_buffer_delayed[i][audio_io_buf_internal->audio_delay_samples+j] = audio_in_out_buf[i][j];
|
audio_io_buf_internal->audio_io_buffer_delayed
|
||||||
|
[i][audio_io_buf_internal->audio_delay_samples + j] =
|
||||||
|
audio_in_out_buf[i][j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -472,15 +476,22 @@ impd_store_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
|
||||||
WORD32
|
WORD32
|
||||||
impd_store_audio_io_buffer_freq(FLOAT32* audio_real_buff[],
|
impd_store_audio_io_buffer_freq(FLOAT32* audio_real_buff[],
|
||||||
FLOAT32* audio_imag_buff[],
|
FLOAT32* audio_imag_buff[],
|
||||||
ia_audio_in_out_buf* audio_io_buf_internal)
|
ia_audio_in_out_buf* audio_io_buf_internal) {
|
||||||
{
|
|
||||||
WORD32 i, j;
|
WORD32 i, j;
|
||||||
|
|
||||||
if (audio_io_buf_internal->audio_delay_sub_band_samples) {
|
if (audio_io_buf_internal->audio_delay_sub_band_samples) {
|
||||||
for (i = 0; i < audio_io_buf_internal->audio_num_chan; i++) {
|
for (i = 0; i < audio_io_buf_internal->audio_num_chan; i++) {
|
||||||
for (j=0; j<audio_io_buf_internal->audio_sub_band_frame_size*audio_io_buf_internal->audio_sub_band_count; j++) {
|
for (j = 0; j < audio_io_buf_internal->audio_sub_band_frame_size *
|
||||||
audio_io_buf_internal->audio_buffer_delayed_real[i][audio_io_buf_internal->audio_delay_sub_band_samples*audio_io_buf_internal->audio_sub_band_count+j] = audio_real_buff[i][j];
|
audio_io_buf_internal->audio_sub_band_count;
|
||||||
audio_io_buf_internal->audio_buffer_delayed_imag[i][audio_io_buf_internal->audio_delay_sub_band_samples*audio_io_buf_internal->audio_sub_band_count+j] = audio_imag_buff[i][j];
|
j++) {
|
||||||
|
audio_io_buf_internal->audio_buffer_delayed_real
|
||||||
|
[i][audio_io_buf_internal->audio_delay_sub_band_samples *
|
||||||
|
audio_io_buf_internal->audio_sub_band_count +
|
||||||
|
j] = audio_real_buff[i][j];
|
||||||
|
audio_io_buf_internal->audio_buffer_delayed_imag
|
||||||
|
[i][audio_io_buf_internal->audio_delay_sub_band_samples *
|
||||||
|
audio_io_buf_internal->audio_sub_band_count +
|
||||||
|
j] = audio_imag_buff[i][j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -495,14 +506,14 @@ impd_store_audio_io_buffer_freq(FLOAT32* audio_real_buff[],
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_retrieve_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
|
impd_retrieve_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
|
||||||
ia_audio_in_out_buf* audio_io_buf_internal)
|
ia_audio_in_out_buf* audio_io_buf_internal) {
|
||||||
{
|
|
||||||
WORD32 i, j;
|
WORD32 i, j;
|
||||||
|
|
||||||
if (audio_io_buf_internal->audio_delay_samples) {
|
if (audio_io_buf_internal->audio_delay_samples) {
|
||||||
for (i = 0; i < audio_io_buf_internal->audio_num_chan; i++) {
|
for (i = 0; i < audio_io_buf_internal->audio_num_chan; i++) {
|
||||||
for (j = 0; j < audio_io_buf_internal->frame_size; j++) {
|
for (j = 0; j < audio_io_buf_internal->frame_size; j++) {
|
||||||
audio_in_out_buf[i][j] = audio_io_buf_internal->audio_io_buffer_delayed[i][j];
|
audio_in_out_buf[i][j] =
|
||||||
|
audio_io_buf_internal->audio_io_buffer_delayed[i][j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -513,15 +524,20 @@ impd_retrieve_audio_io_buffer_time(FLOAT32* audio_in_out_buf[],
|
||||||
WORD32
|
WORD32
|
||||||
impd_retrieve_audio_buffer_freq(FLOAT32* audio_real_buff[],
|
impd_retrieve_audio_buffer_freq(FLOAT32* audio_real_buff[],
|
||||||
FLOAT32* audio_imag_buff[],
|
FLOAT32* audio_imag_buff[],
|
||||||
ia_audio_in_out_buf* audio_io_buf_internal)
|
ia_audio_in_out_buf* audio_io_buf_internal) {
|
||||||
{
|
|
||||||
WORD32 i, j;
|
WORD32 i, j;
|
||||||
|
|
||||||
if (audio_io_buf_internal->audio_delay_sub_band_samples) {
|
if (audio_io_buf_internal->audio_delay_sub_band_samples) {
|
||||||
for (i = 0; i < audio_io_buf_internal->audio_num_chan; i++) {
|
for (i = 0; i < audio_io_buf_internal->audio_num_chan; i++) {
|
||||||
for (j=0; j<audio_io_buf_internal->audio_sub_band_frame_size*audio_io_buf_internal->audio_sub_band_count; j++) {
|
for (j = 0; j < audio_io_buf_internal->audio_sub_band_frame_size *
|
||||||
audio_real_buff[i][j] = audio_io_buf_internal->audio_buffer_delayed_real[i][audio_io_buf_internal->audio_sub_band_count+j];
|
audio_io_buf_internal->audio_sub_band_count;
|
||||||
audio_imag_buff[i][j] = audio_io_buf_internal->audio_buffer_delayed_imag[i][audio_io_buf_internal->audio_sub_band_count+j];
|
j++) {
|
||||||
|
audio_real_buff[i][j] =
|
||||||
|
audio_io_buf_internal->audio_buffer_delayed_real
|
||||||
|
[i][audio_io_buf_internal->audio_sub_band_count + j];
|
||||||
|
audio_imag_buff[i][j] =
|
||||||
|
audio_io_buf_internal->audio_buffer_delayed_imag
|
||||||
|
[i][audio_io_buf_internal->audio_sub_band_count + j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -530,12 +546,15 @@ impd_retrieve_audio_buffer_freq(FLOAT32* audio_real_buff[],
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_advance_audio_io_buffer_time(ia_audio_in_out_buf* audio_io_buf_internal)
|
impd_advance_audio_io_buffer_time(ia_audio_in_out_buf* audio_io_buf_internal) {
|
||||||
{
|
|
||||||
WORD32 i;
|
WORD32 i;
|
||||||
if (audio_io_buf_internal->audio_delay_samples) {
|
if (audio_io_buf_internal->audio_delay_samples) {
|
||||||
for (i = 0; i < audio_io_buf_internal->audio_num_chan; i++) {
|
for (i = 0; i < audio_io_buf_internal->audio_num_chan; i++) {
|
||||||
memmove(audio_io_buf_internal->audio_io_buffer_delayed[i], &audio_io_buf_internal->audio_io_buffer_delayed[i][audio_io_buf_internal->frame_size],sizeof(FLOAT32) * audio_io_buf_internal->audio_delay_samples);
|
memmove(
|
||||||
|
audio_io_buf_internal->audio_io_buffer_delayed[i],
|
||||||
|
&audio_io_buf_internal
|
||||||
|
->audio_io_buffer_delayed[i][audio_io_buf_internal->frame_size],
|
||||||
|
sizeof(FLOAT32) * audio_io_buf_internal->audio_delay_samples);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -543,15 +562,25 @@ impd_advance_audio_io_buffer_time(ia_audio_in_out_buf* audio_io_buf_internal)
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_advance_audio_buff_freq(ia_audio_in_out_buf* audio_io_buf_internal)
|
impd_advance_audio_buff_freq(ia_audio_in_out_buf* audio_io_buf_internal) {
|
||||||
{
|
|
||||||
WORD32 i;
|
WORD32 i;
|
||||||
if (audio_io_buf_internal->audio_delay_sub_band_samples) {
|
if (audio_io_buf_internal->audio_delay_sub_band_samples) {
|
||||||
for (i = 0; i < audio_io_buf_internal->audio_num_chan; i++) {
|
for (i = 0; i < audio_io_buf_internal->audio_num_chan; i++) {
|
||||||
memmove(audio_io_buf_internal->audio_buffer_delayed_real[i], &audio_io_buf_internal->audio_buffer_delayed_real[i][audio_io_buf_internal->audio_sub_band_frame_size * audio_io_buf_internal->audio_sub_band_count],sizeof(FLOAT32) * audio_io_buf_internal->audio_delay_sub_band_samples * audio_io_buf_internal->audio_sub_band_count);
|
memmove(audio_io_buf_internal->audio_buffer_delayed_real[i],
|
||||||
memmove(audio_io_buf_internal->audio_buffer_delayed_imag[i], &audio_io_buf_internal->audio_buffer_delayed_imag[i][audio_io_buf_internal->audio_sub_band_frame_size * audio_io_buf_internal->audio_sub_band_count],sizeof(FLOAT32) * audio_io_buf_internal->audio_delay_sub_band_samples * audio_io_buf_internal->audio_sub_band_count);
|
&audio_io_buf_internal->audio_buffer_delayed_real
|
||||||
|
[i][audio_io_buf_internal->audio_sub_band_frame_size *
|
||||||
|
audio_io_buf_internal->audio_sub_band_count],
|
||||||
|
sizeof(FLOAT32) *
|
||||||
|
audio_io_buf_internal->audio_delay_sub_band_samples *
|
||||||
|
audio_io_buf_internal->audio_sub_band_count);
|
||||||
|
memmove(audio_io_buf_internal->audio_buffer_delayed_imag[i],
|
||||||
|
&audio_io_buf_internal->audio_buffer_delayed_imag
|
||||||
|
[i][audio_io_buf_internal->audio_sub_band_frame_size *
|
||||||
|
audio_io_buf_internal->audio_sub_band_count],
|
||||||
|
sizeof(FLOAT32) *
|
||||||
|
audio_io_buf_internal->audio_delay_sub_band_samples *
|
||||||
|
audio_io_buf_internal->audio_sub_band_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,7 @@
|
||||||
#define IMPD_DRC_PROCESS_AUDIO_H
|
#define IMPD_DRC_PROCESS_AUDIO_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -46,7 +45,6 @@ typedef struct {
|
||||||
FLOAT32** audio_imag_buff;
|
FLOAT32** audio_imag_buff;
|
||||||
} ia_audio_in_out_buf;
|
} ia_audio_in_out_buf;
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_apply_gains_subband(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
impd_apply_gains_subband(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||||
const WORD32 drc_instructions_index,
|
const WORD32 drc_instructions_index,
|
||||||
|
|
@ -58,7 +56,6 @@ impd_apply_gains_subband(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||||
FLOAT32* deinterleaved_audio_re[],
|
FLOAT32* deinterleaved_audio_re[],
|
||||||
FLOAT32* deinterleaved_audio_im[]);
|
FLOAT32* deinterleaved_audio_im[]);
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||||
const WORD32 drc_instructions_index,
|
const WORD32 drc_instructions_index,
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,10 @@
|
||||||
#ifndef IMPD_DRC_QMF_FILTER_H
|
#ifndef IMPD_DRC_QMF_FILTER_H
|
||||||
#define IMPD_DRC_QMF_FILTER_H
|
#define IMPD_DRC_QMF_FILTER_H
|
||||||
|
|
||||||
|
|
||||||
#define QMF_NUM_FILT_BANDS 64
|
#define QMF_NUM_FILT_BANDS 64
|
||||||
#define QMF_FILT_RESOLUTION 64
|
#define QMF_FILT_RESOLUTION 64
|
||||||
|
|
||||||
|
typedef struct ia_drc_qmf_filt_struct {
|
||||||
typedef struct ia_drc_qmf_filt_struct
|
|
||||||
{
|
|
||||||
|
|
||||||
FLOAT64* ana_buff;
|
FLOAT64* ana_buff;
|
||||||
FLOAT64* syn_buff;
|
FLOAT64* syn_buff;
|
||||||
FLOAT64 ana_tab_real[QMF_NUM_FILT_BANDS][2 * QMF_NUM_FILT_BANDS];
|
FLOAT64 ana_tab_real[QMF_NUM_FILT_BANDS][2 * QMF_NUM_FILT_BANDS];
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -27,9 +27,11 @@
|
||||||
|
|
||||||
extern const FLOAT32 samp_rate_tbl[13][12];
|
extern const FLOAT32 samp_rate_tbl[13][12];
|
||||||
|
|
||||||
extern const ia_delta_gain_code_table_struct ia_drc_gain_tbls_prof_0_1[NUM_GAIN_TBL_PROF_0_1_ENTRIES];
|
extern const ia_delta_gain_code_table_struct
|
||||||
|
ia_drc_gain_tbls_prof_0_1[NUM_GAIN_TBL_PROF_0_1_ENTRIES];
|
||||||
|
|
||||||
extern const ia_delta_gain_code_table_struct ia_drc_gain_tbls_prof_2[NUM_GAIN_TBL_PROF_2_ENTRIES];
|
extern const ia_delta_gain_code_table_struct
|
||||||
|
ia_drc_gain_tbls_prof_2[NUM_GAIN_TBL_PROF_2_ENTRIES];
|
||||||
|
|
||||||
extern const FLOAT32 channel_weight[];
|
extern const FLOAT32 channel_weight[];
|
||||||
|
|
||||||
|
|
@ -54,14 +56,14 @@ extern const FLOAT32 shape_filt_hf_radius_tbl[];
|
||||||
|
|
||||||
extern const FLOAT32 shape_filt_cutoff_freq_norm_hf_tbl[];
|
extern const FLOAT32 shape_filt_cutoff_freq_norm_hf_tbl[];
|
||||||
|
|
||||||
extern const ia_cicp_sigmoid_characteristic_param_struct pstr_cicp_sigmoid_characteristic_param[];
|
extern const ia_cicp_sigmoid_characteristic_param_struct
|
||||||
|
pstr_cicp_sigmoid_characteristic_param[];
|
||||||
|
|
||||||
|
extern const ia_slope_code_table_struct
|
||||||
extern const ia_slope_code_table_struct slope_code_tbl_entries_by_size[NUM_SLOPE_TBL_ENTRIES];
|
slope_code_tbl_entries_by_size[NUM_SLOPE_TBL_ENTRIES];
|
||||||
|
|
||||||
extern const FLOAT32 dwnmix_coeff[];
|
extern const FLOAT32 dwnmix_coeff[];
|
||||||
|
|
||||||
|
|
||||||
extern const FLOAT32 dwnmix_coeff_lfe[];
|
extern const FLOAT32 dwnmix_coeff_lfe[];
|
||||||
|
|
||||||
extern WORD32 drc_characteristic_order_default[][3];
|
extern WORD32 drc_characteristic_order_default[][3];
|
||||||
|
|
@ -89,7 +91,6 @@ typedef struct {
|
||||||
WORD32 requested_target_ch_count;
|
WORD32 requested_target_ch_count;
|
||||||
} ia_loc_sys_interface_struct;
|
} ia_loc_sys_interface_struct;
|
||||||
|
|
||||||
|
|
||||||
extern const ia_loc_sys_interface_struct loc_sys_interface[];
|
extern const ia_loc_sys_interface_struct loc_sys_interface[];
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -97,7 +98,8 @@ typedef struct {
|
||||||
FLOAT32 target_loudness;
|
FLOAT32 target_loudness;
|
||||||
} ia_loc_loudness_norm_ctrl_interface_struct;
|
} ia_loc_loudness_norm_ctrl_interface_struct;
|
||||||
|
|
||||||
extern const ia_loc_loudness_norm_ctrl_interface_struct loc_loudness_norm_ctrl_interface[];
|
extern const ia_loc_loudness_norm_ctrl_interface_struct
|
||||||
|
loc_loudness_norm_ctrl_interface[];
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WORD32 album_mode;
|
WORD32 album_mode;
|
||||||
|
|
@ -112,7 +114,8 @@ typedef struct {
|
||||||
FLOAT32 output_peak_level_max;
|
FLOAT32 output_peak_level_max;
|
||||||
} ia_loc_loudness_norm_param_interface_struct;
|
} ia_loc_loudness_norm_param_interface_struct;
|
||||||
|
|
||||||
extern const ia_loc_loudness_norm_param_interface_struct loc_loudness_norm_param_interface[];
|
extern const ia_loc_loudness_norm_param_interface_struct
|
||||||
|
loc_loudness_norm_param_interface[];
|
||||||
|
|
||||||
#define MAX_NUM_DRC_FEATURE_REQUESTS_LOCAL 3
|
#define MAX_NUM_DRC_FEATURE_REQUESTS_LOCAL 3
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -136,7 +139,8 @@ typedef struct {
|
||||||
WORD32 requested_drc_effect_type[MAX_NUM_DRC_EFFECT_TYPE_REQUESTS_LOCAL];
|
WORD32 requested_drc_effect_type[MAX_NUM_DRC_EFFECT_TYPE_REQUESTS_LOCAL];
|
||||||
} ia_loc_requested_drc_effect_struct;
|
} ia_loc_requested_drc_effect_struct;
|
||||||
|
|
||||||
extern const ia_loc_requested_drc_effect_struct loc_requested_drc_effect_type_str[];
|
extern const ia_loc_requested_drc_effect_struct
|
||||||
|
loc_requested_drc_effect_type_str[];
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
FLOAT32 compress;
|
FLOAT32 compress;
|
||||||
|
|
@ -144,7 +148,8 @@ typedef struct {
|
||||||
WORD32 drc_characteristic_target;
|
WORD32 drc_characteristic_target;
|
||||||
} ia_loc_drc_parameter_interface_struct;
|
} ia_loc_drc_parameter_interface_struct;
|
||||||
|
|
||||||
extern const ia_loc_drc_parameter_interface_struct loc_drc_parameter_interface[];
|
extern const ia_loc_drc_parameter_interface_struct
|
||||||
|
loc_drc_parameter_interface[];
|
||||||
|
|
||||||
extern FLOAT32 f_bands_nrm_QMF71[71];
|
extern FLOAT32 f_bands_nrm_QMF71[71];
|
||||||
extern FLOAT32 f_bands_nrm_QMF64[64];
|
extern FLOAT32 f_bands_nrm_QMF64[64];
|
||||||
|
|
@ -152,5 +157,6 @@ extern FLOAT32 f_bands_nrm_STFT256[257];
|
||||||
|
|
||||||
FLOAT64 qmf_filter_coeff[640];
|
FLOAT64 qmf_filter_coeff[640];
|
||||||
|
|
||||||
extern const ia_filter_bank_params_struct normal_cross_freq[FILTER_BANK_PARAMETER_COUNT];
|
extern const ia_filter_bank_params_struct
|
||||||
|
normal_cross_freq[FILTER_BANK_PARAMETER_COUNT];
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
#define SELECTION_FLAG_DRC_TARGET_LOUDNESS_MATCH (1 << 0)
|
#define SELECTION_FLAG_DRC_TARGET_LOUDNESS_MATCH (1 << 0)
|
||||||
#define SELECTION_FLAG_EXPLICIT_PEAK_INFO_PRESENT (1 << 1)
|
#define SELECTION_FLAG_EXPLICIT_PEAK_INFO_PRESENT (1 << 1)
|
||||||
|
|
||||||
|
|
@ -39,9 +38,9 @@ typedef struct {
|
||||||
WORD32 selection_flags;
|
WORD32 selection_flags;
|
||||||
} ia_selection_candidate_info_struct;
|
} ia_selection_candidate_info_struct;
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_validate_requested_drc_feature(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct);
|
impd_validate_requested_drc_feature(
|
||||||
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_map_requested_effect_bit_idx(WORD32 requested_effect_type,
|
impd_map_requested_effect_bit_idx(WORD32 requested_effect_type,
|
||||||
|
|
@ -61,7 +60,8 @@ WORD32
|
||||||
impd_get_dependent_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
impd_get_dependent_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_get_dependent_drc_instructions(const ia_drc_config* drc_config,
|
impd_get_dependent_drc_instructions(
|
||||||
|
const ia_drc_config* drc_config,
|
||||||
const ia_drc_instructions_struct* str_drc_instruction_str,
|
const ia_drc_instructions_struct* str_drc_instruction_str,
|
||||||
ia_drc_instructions_struct** ppstr_drc_instructions_dependent);
|
ia_drc_instructions_struct** ppstr_drc_instructions_dependent);
|
||||||
|
|
||||||
|
|
@ -89,52 +89,51 @@ impd_get_selected_loud_eq_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||||
WORD32 loudEqSetIdSelected);
|
WORD32 loudEqSetIdSelected);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_select_drcs_without_compr_effects (ia_drc_config* pstr_drc_config,
|
impd_select_drcs_without_compr_effects(
|
||||||
WORD32* match_found_flag,
|
ia_drc_config* pstr_drc_config, WORD32* match_found_flag,
|
||||||
WORD32* selection_candidate_count,
|
WORD32* selection_candidate_count,
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_match_effect_type_attempt(ia_drc_config* pstr_drc_config,
|
impd_match_effect_type_attempt(
|
||||||
WORD32 requested_effect_type,
|
ia_drc_config* pstr_drc_config, WORD32 requested_effect_type,
|
||||||
WORD32 stateRequested,
|
WORD32 stateRequested, WORD32* match_found_flag,
|
||||||
WORD32* match_found_flag,
|
|
||||||
WORD32* selection_candidate_count,
|
WORD32* selection_candidate_count,
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_match_effect_types(ia_drc_config* pstr_drc_config,
|
impd_match_effect_types(
|
||||||
WORD32 total_effect_type_requested,
|
ia_drc_config* pstr_drc_config, WORD32 total_effect_type_requested,
|
||||||
WORD32 desired_effect_type_requested,
|
WORD32 desired_effect_type_requested, WORD32* requested_effect_type,
|
||||||
WORD32* requested_effect_type,
|
|
||||||
WORD32* selection_candidate_count,
|
WORD32* selection_candidate_count,
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||||
|
|
||||||
WORD32 impd_match_dynamic_range(ia_drc_config* pstr_drc_config,
|
WORD32 impd_match_dynamic_range(
|
||||||
|
ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||||
WORD32 num_drc_requests,
|
WORD32 num_drc_requests, WORD32* selection_candidate_count,
|
||||||
WORD32* selection_candidate_count,
|
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_match_drc_characteristic_attempt(ia_drc_config* pstr_drc_config,
|
impd_match_drc_characteristic_attempt(
|
||||||
WORD32 requested_drc_characteristic,
|
ia_drc_config* pstr_drc_config, WORD32 requested_drc_characteristic,
|
||||||
WORD32* match_found_flag,
|
WORD32* match_found_flag, WORD32* selection_candidate_count,
|
||||||
WORD32* selection_candidate_count,
|
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_match_drc_characteristic(ia_drc_config* pstr_drc_config,
|
impd_match_drc_characteristic(
|
||||||
WORD32 requested_drc_characteristic,
|
ia_drc_config* pstr_drc_config, WORD32 requested_drc_characteristic,
|
||||||
WORD32* selection_candidate_count,
|
WORD32* selection_candidate_count,
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||||
|
|
||||||
VOID impd_select_drc_coeff3(ia_drc_config* drc_config,
|
VOID impd_select_drc_coeff3(
|
||||||
|
ia_drc_config* drc_config,
|
||||||
ia_uni_drc_coeffs_struct** str_p_loc_drc_coefficients_uni_drc);
|
ia_uni_drc_coeffs_struct** str_p_loc_drc_coefficients_uni_drc);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_set_preselection(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
impd_drc_set_preselection(
|
||||||
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
WORD32 restrict_to_drc_with_album_loudness,
|
WORD32 restrict_to_drc_with_album_loudness,
|
||||||
|
|
@ -142,41 +141,37 @@ impd_drc_set_preselection(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_param
|
||||||
WORD32* selection_candidate_count,
|
WORD32* selection_candidate_count,
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||||
|
|
||||||
WORD32 impd_drc_set_final_selection(ia_drc_config* pstr_drc_config,
|
WORD32 impd_drc_set_final_selection(
|
||||||
|
ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||||
WORD32* selection_candidate_count,
|
WORD32* selection_candidate_count,
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info
|
|
||||||
, WORD32* eq_set_id_valid_flag
|
|
||||||
);
|
|
||||||
|
|
||||||
WORD32 impd_match_eq_set_purpose(ia_drc_config* drc_config,
|
|
||||||
WORD32 eq_set_purpose_requested,
|
|
||||||
WORD32* eq_set_id_valid_flag,
|
|
||||||
WORD32* selection_candidate_count,
|
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info,
|
ia_selection_candidate_info_struct* selection_candidate_info,
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info_step_2
|
WORD32* eq_set_id_valid_flag);
|
||||||
);
|
|
||||||
|
WORD32 impd_match_eq_set_purpose(
|
||||||
|
ia_drc_config* drc_config, WORD32 eq_set_purpose_requested,
|
||||||
|
WORD32* eq_set_id_valid_flag, WORD32* selection_candidate_count,
|
||||||
|
ia_selection_candidate_info_struct* selection_candidate_info,
|
||||||
|
ia_selection_candidate_info_struct* selection_candidate_info_step_2);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_select_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
impd_select_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||||
WORD32* drc_set_id_selected
|
WORD32* drc_set_id_selected, WORD32* eq_set_id_selected,
|
||||||
, WORD32* eq_set_id_selected
|
WORD32* loud_eq_id_sel);
|
||||||
, WORD32* loud_eq_id_sel
|
|
||||||
);
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_sel_proc_init_dflt(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
impd_drc_sel_proc_init_dflt(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_sel_proc_init_sel_proc_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
impd_drc_sel_proc_init_sel_proc_params(
|
||||||
|
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct);
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_sel_proc_init_interface_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
impd_drc_sel_proc_init_interface_params(
|
||||||
|
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||||
ia_drc_interface_struct* pstr_drc_interface);
|
ia_drc_interface_struct* pstr_drc_interface);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -20,7 +20,6 @@
|
||||||
#ifndef IMPD_DRC_SECLECTION_PROCESS_H
|
#ifndef IMPD_DRC_SECLECTION_PROCESS_H
|
||||||
#define IMPD_DRC_SECLECTION_PROCESS_H
|
#define IMPD_DRC_SECLECTION_PROCESS_H
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
@ -40,9 +39,7 @@ extern "C" {
|
||||||
#define MATCH_DYNAMIC_RANGE 1
|
#define MATCH_DYNAMIC_RANGE 1
|
||||||
#define MATCH_DRC_CHARACTERISTIC 2
|
#define MATCH_DRC_CHARACTERISTIC 2
|
||||||
|
|
||||||
|
typedef struct ia_drc_sel_proc_params_struct {
|
||||||
typedef struct ia_drc_sel_proc_params_struct
|
|
||||||
{
|
|
||||||
WORD32 base_channel_count;
|
WORD32 base_channel_count;
|
||||||
WORD32 base_layout;
|
WORD32 base_layout;
|
||||||
WORD32 target_config_request_type;
|
WORD32 target_config_request_type;
|
||||||
|
|
@ -71,7 +68,8 @@ typedef struct ia_drc_sel_proc_params_struct
|
||||||
WORD32 drc_feature_req_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
WORD32 drc_feature_req_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
WORD32 requested_num_drc_effects[MAX_NUM_DRC_FEATURE_REQUESTS];
|
WORD32 requested_num_drc_effects[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
WORD32 desired_num_drc_effects_of_requested[MAX_NUM_DRC_FEATURE_REQUESTS];
|
WORD32 desired_num_drc_effects_of_requested[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
WORD32 requested_drc_effect_type[MAX_NUM_DRC_FEATURE_REQUESTS][MAX_NUM_DRC_EFFECT_TYPE_REQUESTS];
|
WORD32 requested_drc_effect_type[MAX_NUM_DRC_FEATURE_REQUESTS]
|
||||||
|
[MAX_NUM_DRC_EFFECT_TYPE_REQUESTS];
|
||||||
WORD32 requested_dyn_range_measur_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
WORD32 requested_dyn_range_measur_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
WORD32 requested_dyn_range_range_flag[MAX_NUM_DRC_FEATURE_REQUESTS];
|
WORD32 requested_dyn_range_range_flag[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
FLOAT32 requested_dyn_range_value[MAX_NUM_DRC_FEATURE_REQUESTS];
|
FLOAT32 requested_dyn_range_value[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
|
|
@ -79,7 +77,6 @@ typedef struct ia_drc_sel_proc_params_struct
|
||||||
FLOAT32 requested_dyn_range_max_val[MAX_NUM_DRC_FEATURE_REQUESTS];
|
FLOAT32 requested_dyn_range_max_val[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
WORD32 requested_drc_characteristic[MAX_NUM_DRC_FEATURE_REQUESTS];
|
WORD32 requested_drc_characteristic[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
|
|
||||||
|
|
||||||
WORD32 loudness_eq_request;
|
WORD32 loudness_eq_request;
|
||||||
FLOAT32 sensitivity;
|
FLOAT32 sensitivity;
|
||||||
FLOAT32 playback_gain;
|
FLOAT32 playback_gain;
|
||||||
|
|
@ -90,9 +87,7 @@ typedef struct ia_drc_sel_proc_params_struct
|
||||||
WORD32 drc_characteristic_target;
|
WORD32 drc_characteristic_target;
|
||||||
} ia_drc_sel_proc_params_struct;
|
} ia_drc_sel_proc_params_struct;
|
||||||
|
|
||||||
typedef struct ia_drc_sel_pro_struct
|
typedef struct ia_drc_sel_pro_struct {
|
||||||
{
|
|
||||||
|
|
||||||
WORD32 first_frame;
|
WORD32 first_frame;
|
||||||
WORD32 drc_config_flag;
|
WORD32 drc_config_flag;
|
||||||
WORD32 loudness_info_set_flag;
|
WORD32 loudness_info_set_flag;
|
||||||
|
|
@ -122,56 +117,48 @@ typedef struct ia_drc_sel_pro_struct
|
||||||
|
|
||||||
} ia_drc_sel_pro_struct;
|
} ia_drc_sel_pro_struct;
|
||||||
|
|
||||||
WORD32 impd_map_target_config_req_downmix_id(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
WORD32 impd_map_target_config_req_downmix_id(
|
||||||
|
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||||
ia_drc_config* pstr_drc_config);
|
ia_drc_config* pstr_drc_config);
|
||||||
|
|
||||||
VOID impd_sel_downmix_matrix(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
VOID impd_sel_downmix_matrix(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||||
ia_drc_config* pstr_drc_config);
|
ia_drc_config* pstr_drc_config);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_find_drc_instructions_uni_drc(ia_drc_config* drc_config,
|
impd_find_drc_instructions_uni_drc(
|
||||||
WORD32 drc_set_id_requested,
|
ia_drc_config* drc_config, WORD32 drc_set_id_requested,
|
||||||
ia_drc_instructions_struct** str_drc_instruction_str);
|
ia_drc_instructions_struct** str_drc_instruction_str);
|
||||||
WORD32
|
WORD32
|
||||||
impd_find_eq_instructions(ia_drc_config* drc_config,
|
impd_find_eq_instructions(ia_drc_config* drc_config, WORD32 eq_set_id_requested,
|
||||||
WORD32 eq_set_id_requested,
|
|
||||||
ia_eq_instructions_struct** str_eq_instructions);
|
ia_eq_instructions_struct** str_eq_instructions);
|
||||||
WORD32
|
WORD32
|
||||||
impd_find_downmix(ia_drc_config* drc_config,
|
impd_find_downmix(ia_drc_config* drc_config, WORD32 requested_dwnmix_id,
|
||||||
WORD32 requested_dwnmix_id,
|
|
||||||
ia_downmix_instructions_struct** dwnmix_instructions);
|
ia_downmix_instructions_struct** dwnmix_instructions);
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_find_eq_set_no_compression(ia_drc_config* pstr_drc_config,
|
impd_find_eq_set_no_compression(ia_drc_config* pstr_drc_config,
|
||||||
WORD32 requested_dwnmix_id,
|
WORD32 requested_dwnmix_id,
|
||||||
WORD32* no_compression_eq_cnt,
|
WORD32* no_compression_eq_cnt,
|
||||||
WORD32* no_compression_eq_id);
|
WORD32* no_compression_eq_id);
|
||||||
WORD32
|
WORD32
|
||||||
impd_match_eq_set(ia_drc_config* drc_config,
|
impd_match_eq_set(ia_drc_config* drc_config, WORD32 downmix_id,
|
||||||
WORD32 downmix_id,
|
WORD32 drc_set_id, WORD32* eq_set_id_valid_flag,
|
||||||
WORD32 drc_set_id,
|
WORD32* matching_eq_set_cnt, WORD32* matching_eq_set_idx);
|
||||||
WORD32* eq_set_id_valid_flag,
|
|
||||||
WORD32* matching_eq_set_cnt,
|
|
||||||
WORD32* matching_eq_set_idx);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_select_loud_eq(ia_drc_config* pstr_drc_config,
|
impd_select_loud_eq(ia_drc_config* pstr_drc_config, WORD32 requested_dwnmix_id,
|
||||||
WORD32 requested_dwnmix_id,
|
WORD32 drc_set_id_requested, WORD32 eq_set_id_requested,
|
||||||
WORD32 drc_set_id_requested,
|
|
||||||
WORD32 eq_set_id_requested,
|
|
||||||
WORD32* loud_eq_id_selected);
|
WORD32* loud_eq_id_selected);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_uni_selction_proc_init(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
impd_drc_uni_selction_proc_init(
|
||||||
|
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||||
ia_drc_interface_struct* pstr_drc_interface,
|
ia_drc_interface_struct* pstr_drc_interface, WORD32 sub_band_domain_mode);
|
||||||
WORD32 sub_band_domain_mode);
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_uni_sel_proc_process(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
impd_drc_uni_sel_proc_process(
|
||||||
|
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
ia_drc_sel_proc_output_struct* hia_drc_sel_proc_output_struct);
|
ia_drc_sel_proc_output_struct* hia_drc_sel_proc_output_struct);
|
||||||
|
|
@ -181,8 +168,6 @@ impd_find_loud_eq_instructions_idx_for_id(ia_drc_config* drc_config,
|
||||||
WORD32 loud_eq_set_id_requested,
|
WORD32 loud_eq_set_id_requested,
|
||||||
WORD32* instructions_idx);
|
WORD32* instructions_idx);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -27,37 +27,44 @@
|
||||||
#include "impd_drc_interface.h"
|
#include "impd_drc_interface.h"
|
||||||
#include "impd_drc_selection_process.h"
|
#include "impd_drc_selection_process.h"
|
||||||
|
|
||||||
WORD32 impd_drc_sel_proc_init_dflt(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc)
|
WORD32 impd_drc_sel_proc_init_dflt(
|
||||||
{
|
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc) {
|
||||||
if (pstr_drc_uni_sel_proc != NULL) {
|
if (pstr_drc_uni_sel_proc != NULL) {
|
||||||
|
|
||||||
pstr_drc_uni_sel_proc->first_frame = 0;
|
pstr_drc_uni_sel_proc->first_frame = 0;
|
||||||
|
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.base_channel_count = -1;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.base_channel_count = -1;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.base_layout = -1;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.base_layout = -1;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_config_request_type = 0;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_config_request_type =
|
||||||
|
0;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_downmix_id_requests = 0;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_downmix_id_requests = 0;
|
||||||
|
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.album_mode = 0;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.album_mode = 0;
|
||||||
|
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.peak_limiter = 0;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.peak_limiter = 0;
|
||||||
|
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_normalization_on = 0;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_normalization_on =
|
||||||
|
0;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_loudness = -24.0f;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_loudness = -24.0f;
|
||||||
|
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_deviation_max = LOUDNESS_DEVIATION_MAX_DEFAULT;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_deviation_max =
|
||||||
|
LOUDNESS_DEVIATION_MAX_DEFAULT;
|
||||||
|
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_method = USER_METHOD_DEFINITION_DEFAULT;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_method =
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_system = USER_MEASUREMENT_SYSTEM_DEFAULT;
|
USER_METHOD_DEFINITION_DEFAULT;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_pre_proc = USER_LOUDNESS_PREPROCESSING_DEFAULT;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_system =
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.device_cut_off_frequency = 500;
|
USER_MEASUREMENT_SYSTEM_DEFAULT;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_norm_gain_db_max = LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_norm_gain_modification_db = 0.0f;
|
.loudness_measurement_pre_proc = USER_LOUDNESS_PREPROCESSING_DEFAULT;
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.device_cut_off_frequency =
|
||||||
|
500;
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_norm_gain_db_max =
|
||||||
|
LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT;
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.loudness_norm_gain_modification_db = 0.0f;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.output_peak_level_max = 0.0f;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.output_peak_level_max = 0.0f;
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.peak_limiter == 1) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.peak_limiter == 1) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.output_peak_level_max =
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.output_peak_level_max = 6.0f;
|
6.0f;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.dynamic_range_control_on = 1;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.dynamic_range_control_on = 1;
|
||||||
|
|
@ -66,11 +73,15 @@ WORD32 impd_drc_sel_proc_init_dflt(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc)
|
||||||
|
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.boost = 1.f;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.boost = 1.f;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.compress = 1.f;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.compress = 1.f;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.drc_characteristic_target = 0;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.drc_characteristic_target =
|
||||||
|
0;
|
||||||
|
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_eq_request = LOUD_EQ_REQUEST_OFF;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_eq_request =
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.eq_set_purpose_request = EQ_PURPOSE_EQ_OFF;
|
LOUD_EQ_REQUEST_OFF;
|
||||||
pstr_drc_uni_sel_proc->compl_level_supported_total = COMPLEXITY_LEVEL_SUPPORTED_TOTAL;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.eq_set_purpose_request =
|
||||||
|
EQ_PURPOSE_EQ_OFF;
|
||||||
|
pstr_drc_uni_sel_proc->compl_level_supported_total =
|
||||||
|
COMPLEXITY_LEVEL_SUPPORTED_TOTAL;
|
||||||
|
|
||||||
pstr_drc_uni_sel_proc->drc_inst_index_sel = -1;
|
pstr_drc_uni_sel_proc->drc_inst_index_sel = -1;
|
||||||
pstr_drc_uni_sel_proc->drc_coef_index_sel = -1;
|
pstr_drc_uni_sel_proc->drc_coef_index_sel = -1;
|
||||||
|
|
@ -80,8 +91,10 @@ WORD32 impd_drc_sel_proc_init_dflt(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc)
|
||||||
pstr_drc_uni_sel_proc->drc_instructions_index[2] = -1;
|
pstr_drc_uni_sel_proc->drc_instructions_index[2] = -1;
|
||||||
pstr_drc_uni_sel_proc->drc_instructions_index[3] = -1;
|
pstr_drc_uni_sel_proc->drc_instructions_index[3] = -1;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.output_peak_level_db = 0;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.output_peak_level_db = 0;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.loudness_normalization_gain_db = 0;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.output_loudness = UNDEFINED_LOUDNESS_VALUE;
|
.loudness_normalization_gain_db = 0;
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.output_loudness =
|
||||||
|
UNDEFINED_LOUDNESS_VALUE;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.num_sel_drc_sets = 0;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.num_sel_drc_sets = 0;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.active_downmix_id = 0;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.active_downmix_id = 0;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.base_channel_count = 0;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_output.base_channel_count = 0;
|
||||||
|
|
@ -98,15 +111,16 @@ WORD32 impd_drc_sel_proc_init_dflt(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_sel_proc_init_sel_proc_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
impd_drc_sel_proc_init_sel_proc_params(
|
||||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct)
|
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||||
{
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct) {
|
||||||
|
if (pstr_drc_uni_sel_proc != NULL &&
|
||||||
if (pstr_drc_uni_sel_proc != NULL && pstr_drc_sel_proc_params_struct != NULL) {
|
pstr_drc_sel_proc_params_struct != NULL) {
|
||||||
|
if (memcmp(&pstr_drc_uni_sel_proc->uni_drc_sel_proc_params,
|
||||||
if ( memcmp ( &pstr_drc_uni_sel_proc->uni_drc_sel_proc_params, pstr_drc_sel_proc_params_struct, sizeof(ia_drc_sel_proc_params_struct) ))
|
pstr_drc_sel_proc_params_struct,
|
||||||
{
|
sizeof(ia_drc_sel_proc_params_struct))) {
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params = *pstr_drc_sel_proc_params_struct;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params =
|
||||||
|
*pstr_drc_sel_proc_params_struct;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -114,178 +128,343 @@ impd_drc_sel_proc_init_sel_proc_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_p
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_sel_proc_init_interface_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
impd_drc_sel_proc_init_interface_params(
|
||||||
ia_drc_interface_struct* pstr_drc_interface)
|
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||||
{
|
ia_drc_interface_struct* pstr_drc_interface) {
|
||||||
WORD32 i, j;
|
WORD32 i, j;
|
||||||
|
|
||||||
if (pstr_drc_uni_sel_proc != NULL && pstr_drc_interface != NULL) {
|
if (pstr_drc_uni_sel_proc != NULL && pstr_drc_interface != NULL) {
|
||||||
|
|
||||||
if (pstr_drc_interface->system_interface_flag) {
|
if (pstr_drc_interface->system_interface_flag) {
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_config_request_type != pstr_drc_interface->system_interface.target_config_request_type) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_config_request_type = pstr_drc_interface->system_interface.target_config_request_type;
|
.target_config_request_type !=
|
||||||
|
pstr_drc_interface->system_interface.target_config_request_type) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.target_config_request_type =
|
||||||
|
pstr_drc_interface->system_interface.target_config_request_type;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
switch (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_config_request_type) {
|
switch (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.target_config_request_type) {
|
||||||
case 0:
|
case 0:
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_downmix_id_requests != pstr_drc_interface->system_interface.num_downmix_id_requests) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_downmix_id_requests = pstr_drc_interface->system_interface.num_downmix_id_requests;
|
.num_downmix_id_requests !=
|
||||||
|
pstr_drc_interface->system_interface.num_downmix_id_requests) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.num_downmix_id_requests =
|
||||||
|
pstr_drc_interface->system_interface.num_downmix_id_requests;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
for (i=0; i<pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_downmix_id_requests; i++) {
|
for (i = 0; i < pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dwnmix_id[i] != pstr_drc_interface->system_interface.requested_dwnmix_id[i]) {
|
.num_downmix_id_requests;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dwnmix_id[i] = pstr_drc_interface->system_interface.requested_dwnmix_id[i];
|
i++) {
|
||||||
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.requested_dwnmix_id[i] !=
|
||||||
|
pstr_drc_interface->system_interface.requested_dwnmix_id[i]) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.requested_dwnmix_id[i] =
|
||||||
|
pstr_drc_interface->system_interface.requested_dwnmix_id[i];
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_target_layout != pstr_drc_interface->system_interface.requested_target_layout) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_target_layout = pstr_drc_interface->system_interface.requested_target_layout;
|
.requested_target_layout !=
|
||||||
|
pstr_drc_interface->system_interface.requested_target_layout) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.requested_target_layout =
|
||||||
|
pstr_drc_interface->system_interface.requested_target_layout;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_target_ch_count != pstr_drc_interface->system_interface.requested_target_ch_count) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_target_ch_count = pstr_drc_interface->system_interface.requested_target_ch_count;
|
.requested_target_ch_count !=
|
||||||
|
pstr_drc_interface->system_interface.requested_target_ch_count) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.requested_target_ch_count =
|
||||||
|
pstr_drc_interface->system_interface.requested_target_ch_count;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pstr_drc_interface->loudness_norm_ctrl_interface_flag) {
|
if (pstr_drc_interface->loudness_norm_ctrl_interface_flag) {
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_normalization_on != pstr_drc_interface->loudness_norm_ctrl_interface.loudness_normalization_on) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_normalization_on = pstr_drc_interface->loudness_norm_ctrl_interface.loudness_normalization_on;
|
.loudness_normalization_on !=
|
||||||
|
pstr_drc_interface->loudness_norm_ctrl_interface
|
||||||
|
.loudness_normalization_on) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.loudness_normalization_on =
|
||||||
|
pstr_drc_interface->loudness_norm_ctrl_interface
|
||||||
|
.loudness_normalization_on;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_normalization_on) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_loudness != pstr_drc_interface->loudness_norm_ctrl_interface.target_loudness) {
|
.loudness_normalization_on) {
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_loudness = pstr_drc_interface->loudness_norm_ctrl_interface.target_loudness;
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_loudness !=
|
||||||
|
pstr_drc_interface->loudness_norm_ctrl_interface.target_loudness) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.target_loudness =
|
||||||
|
pstr_drc_interface->loudness_norm_ctrl_interface.target_loudness;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pstr_drc_interface->loudness_norm_parameter_interface_flag) {
|
if (pstr_drc_interface->loudness_norm_parameter_interface_flag) {
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.album_mode != pstr_drc_interface->loudness_norm_param_interface.album_mode) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.album_mode !=
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.album_mode = pstr_drc_interface->loudness_norm_param_interface.album_mode;
|
pstr_drc_interface->loudness_norm_param_interface.album_mode) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.album_mode =
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface.album_mode;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.peak_limiter != pstr_drc_interface->loudness_norm_param_interface.peak_limiter) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.peak_limiter !=
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.peak_limiter = pstr_drc_interface->loudness_norm_param_interface.peak_limiter;
|
pstr_drc_interface->loudness_norm_param_interface.peak_limiter) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.peak_limiter =
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface.peak_limiter;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
if (pstr_drc_interface->loudness_norm_param_interface.change_loudness_deviation_max) {
|
if (pstr_drc_interface->loudness_norm_param_interface
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_deviation_max != pstr_drc_interface->loudness_norm_param_interface.loudness_deviation_max) {
|
.change_loudness_deviation_max) {
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_deviation_max = pstr_drc_interface->loudness_norm_param_interface.loudness_deviation_max;
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.loudness_deviation_max !=
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.loudness_deviation_max) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.loudness_deviation_max =
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.loudness_deviation_max;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pstr_drc_interface->loudness_norm_param_interface.change_loudness_measur_method) {
|
if (pstr_drc_interface->loudness_norm_param_interface
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_method != pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_method) {
|
.change_loudness_measur_method) {
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_method = pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_method;
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.loudness_measurement_method !=
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.loudness_measurement_method) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.loudness_measurement_method =
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.loudness_measurement_method;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pstr_drc_interface->loudness_norm_param_interface.change_loudness_measur_pre_proc) {
|
if (pstr_drc_interface->loudness_norm_param_interface
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_pre_proc != pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_pre_proc) {
|
.change_loudness_measur_pre_proc) {
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_pre_proc = pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_pre_proc;
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.loudness_measurement_pre_proc !=
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.loudness_measurement_pre_proc) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.loudness_measurement_pre_proc =
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.loudness_measurement_pre_proc;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pstr_drc_interface->loudness_norm_param_interface.change_loudness_measur_system) {
|
if (pstr_drc_interface->loudness_norm_param_interface
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_system != pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_system) {
|
.change_loudness_measur_system) {
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_measurement_system = pstr_drc_interface->loudness_norm_param_interface.loudness_measurement_system;
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.loudness_measurement_system !=
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.loudness_measurement_system) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.loudness_measurement_system =
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.loudness_measurement_system;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pstr_drc_interface->loudness_norm_param_interface.change_device_cut_off_freq) {
|
if (pstr_drc_interface->loudness_norm_param_interface
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.device_cut_off_frequency != pstr_drc_interface->loudness_norm_param_interface.device_cut_off_frequency) {
|
.change_device_cut_off_freq) {
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.device_cut_off_frequency = pstr_drc_interface->loudness_norm_param_interface.device_cut_off_frequency;
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.device_cut_off_frequency !=
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.device_cut_off_frequency) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.device_cut_off_frequency =
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.device_cut_off_frequency;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pstr_drc_interface->loudness_norm_param_interface.change_loudness_norm_gain_db_max) {
|
if (pstr_drc_interface->loudness_norm_param_interface
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_norm_gain_db_max != pstr_drc_interface->loudness_norm_param_interface.loudness_norm_gain_db_max) {
|
.change_loudness_norm_gain_db_max) {
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_norm_gain_db_max = pstr_drc_interface->loudness_norm_param_interface.loudness_norm_gain_db_max;
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.loudness_norm_gain_db_max !=
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.loudness_norm_gain_db_max) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.loudness_norm_gain_db_max =
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.loudness_norm_gain_db_max;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pstr_drc_interface->loudness_norm_param_interface.change_loudness_norm_gain_modification_db ) {
|
if (pstr_drc_interface->loudness_norm_param_interface
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_norm_gain_modification_db != pstr_drc_interface->loudness_norm_param_interface.loudness_norm_gain_modification_db) {
|
.change_loudness_norm_gain_modification_db) {
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_norm_gain_modification_db = pstr_drc_interface->loudness_norm_param_interface.loudness_norm_gain_modification_db;
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.loudness_norm_gain_modification_db !=
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.loudness_norm_gain_modification_db) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.loudness_norm_gain_modification_db =
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.loudness_norm_gain_modification_db;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pstr_drc_interface->loudness_norm_param_interface.change_output_peak_level_max) {
|
if (pstr_drc_interface->loudness_norm_param_interface
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.output_peak_level_max != pstr_drc_interface->loudness_norm_param_interface.output_peak_level_max) {
|
.change_output_peak_level_max) {
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.output_peak_level_max = pstr_drc_interface->loudness_norm_param_interface.output_peak_level_max;
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.output_peak_level_max !=
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.output_peak_level_max) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.output_peak_level_max =
|
||||||
|
pstr_drc_interface->loudness_norm_param_interface
|
||||||
|
.output_peak_level_max;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pstr_drc_interface->drc_interface_flag) {
|
if (pstr_drc_interface->drc_interface_flag) {
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.dynamic_range_control_on != pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.dynamic_range_control_on = pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on;
|
.dynamic_range_control_on !=
|
||||||
|
pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.dynamic_range_control_on =
|
||||||
|
pstr_drc_interface->drc_ctrl_interface.dynamic_range_control_on;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
if (!pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.dynamic_range_control_on) {
|
if (!pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_drc_feature_requests = 0;
|
.dynamic_range_control_on) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.num_drc_feature_requests = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.dynamic_range_control_on) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_drc_feature_requests != pstr_drc_interface->drc_ctrl_interface.num_drc_feature_requests) {
|
.dynamic_range_control_on) {
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_drc_feature_requests = pstr_drc_interface->drc_ctrl_interface.num_drc_feature_requests;
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.num_drc_feature_requests !=
|
||||||
|
pstr_drc_interface->drc_ctrl_interface.num_drc_feature_requests) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.num_drc_feature_requests =
|
||||||
|
pstr_drc_interface->drc_ctrl_interface.num_drc_feature_requests;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
for (i=0; i<pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.num_drc_feature_requests; i++) {
|
for (i = 0; i < pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.drc_feature_req_type[i] != pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[i]) {
|
.num_drc_feature_requests;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.drc_feature_req_type[i] = pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[i];
|
i++) {
|
||||||
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.drc_feature_req_type[i] !=
|
||||||
|
pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[i]) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.drc_feature_req_type[i] =
|
||||||
|
pstr_drc_interface->drc_ctrl_interface.drc_feature_req_type[i];
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
switch (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.drc_feature_req_type[i]) {
|
switch (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.drc_feature_req_type[i]) {
|
||||||
case 0:
|
case 0:
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_num_drc_effects[i] != pstr_drc_interface->drc_ctrl_interface.requested_num_drc_effects[i]) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_num_drc_effects[i] = pstr_drc_interface->drc_ctrl_interface.requested_num_drc_effects[i];
|
.requested_num_drc_effects[i] !=
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_num_drc_effects[i]) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.requested_num_drc_effects[i] =
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_num_drc_effects[i];
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.desired_num_drc_effects_of_requested[i] != pstr_drc_interface->drc_ctrl_interface.desired_num_drc_effects_of_requested[i]) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.desired_num_drc_effects_of_requested[i] = pstr_drc_interface->drc_ctrl_interface.desired_num_drc_effects_of_requested[i];
|
.desired_num_drc_effects_of_requested[i] !=
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.desired_num_drc_effects_of_requested[i]) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.desired_num_drc_effects_of_requested[i] =
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.desired_num_drc_effects_of_requested[i];
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
for (j=0; j<pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_num_drc_effects[i]; j++) {
|
for (j = 0; j < pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_drc_effect_type[i][j] != pstr_drc_interface->drc_ctrl_interface.requested_drc_effect_type[i][j]) {
|
.requested_num_drc_effects[i];
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_drc_effect_type[i][j] = pstr_drc_interface->drc_ctrl_interface.requested_drc_effect_type[i][j];
|
j++) {
|
||||||
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.requested_drc_effect_type[i][j] !=
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_drc_effect_type[i][j]) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.requested_drc_effect_type[i][j] =
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_drc_effect_type[i][j];
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_measur_type[i] != pstr_drc_interface->drc_ctrl_interface.requested_dyn_rng_measurement_type[i]) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_measur_type[i] = pstr_drc_interface->drc_ctrl_interface.requested_dyn_rng_measurement_type[i];
|
.requested_dyn_range_measur_type[i] !=
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_dyn_rng_measurement_type[i]) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.requested_dyn_range_measur_type[i] =
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_dyn_rng_measurement_type[i];
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_range_flag[i] != pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_is_single_val_flag[i]) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_range_flag[i] = pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_is_single_val_flag[i];
|
.requested_dyn_range_range_flag[i] !=
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_dyn_range_is_single_val_flag[i]) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.requested_dyn_range_range_flag[i] =
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_dyn_range_is_single_val_flag[i];
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_range_flag[i] == 0) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_value[i] != pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_value[i]) {
|
.requested_dyn_range_range_flag[i] == 0) {
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_value[i] = pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_value[i];
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.requested_dyn_range_value[i] !=
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_dyn_range_value[i]) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.requested_dyn_range_value[i] =
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_dyn_range_value[i];
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_min_val[i] != pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_min_val[i]) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_min_val[i] = pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_min_val[i];
|
.requested_dyn_range_min_val[i] !=
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_dyn_range_min_val[i]) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.requested_dyn_range_min_val[i] =
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_dyn_range_min_val[i];
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_max_val[i] != pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_max_val[i]) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_dyn_range_max_val[i] = pstr_drc_interface->drc_ctrl_interface.requested_dyn_range_max_val[i];
|
.requested_dyn_range_max_val[i] !=
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_dyn_range_max_val[i]) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.requested_dyn_range_max_val[i] =
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_dyn_range_max_val[i];
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_drc_characteristic[i] != pstr_drc_interface->drc_ctrl_interface.requested_drc_characteristic[i]) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.requested_drc_characteristic[i] = pstr_drc_interface->drc_ctrl_interface.requested_drc_characteristic[i];
|
.requested_drc_characteristic[i] !=
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_drc_characteristic[i]) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.requested_drc_characteristic[i] =
|
||||||
|
pstr_drc_interface->drc_ctrl_interface
|
||||||
|
.requested_drc_characteristic[i];
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -295,42 +474,57 @@ impd_drc_sel_proc_init_interface_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_
|
||||||
}
|
}
|
||||||
if (pstr_drc_interface->drc_parameter_interface_flag) {
|
if (pstr_drc_interface->drc_parameter_interface_flag) {
|
||||||
if (pstr_drc_interface->drc_parameter_interface.change_compress) {
|
if (pstr_drc_interface->drc_parameter_interface.change_compress) {
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.compress != pstr_drc_interface->drc_parameter_interface.compress) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.compress !=
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.compress = pstr_drc_interface->drc_parameter_interface.compress;
|
pstr_drc_interface->drc_parameter_interface.compress) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.compress =
|
||||||
|
pstr_drc_interface->drc_parameter_interface.compress;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pstr_drc_interface->drc_parameter_interface.change_boost) {
|
if (pstr_drc_interface->drc_parameter_interface.change_boost) {
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.boost != pstr_drc_interface->drc_parameter_interface.boost) {
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.boost !=
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.boost = pstr_drc_interface->drc_parameter_interface.boost;
|
pstr_drc_interface->drc_parameter_interface.boost) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.boost =
|
||||||
|
pstr_drc_interface->drc_parameter_interface.boost;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pstr_drc_interface->drc_parameter_interface.change_drc_characteristic_target) {
|
if (pstr_drc_interface->drc_parameter_interface
|
||||||
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.drc_characteristic_target != pstr_drc_interface->drc_parameter_interface.drc_characteristic_target) {
|
.change_drc_characteristic_target) {
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.drc_characteristic_target = pstr_drc_interface->drc_parameter_interface.drc_characteristic_target;
|
if (pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.drc_characteristic_target !=
|
||||||
|
pstr_drc_interface->drc_parameter_interface
|
||||||
|
.drc_characteristic_target) {
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params
|
||||||
|
.drc_characteristic_target =
|
||||||
|
pstr_drc_interface->drc_parameter_interface
|
||||||
|
.drc_characteristic_target;
|
||||||
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
pstr_drc_uni_sel_proc->sel_proc_request_flag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pstr_drc_interface->drc_uni_interface_ext_flag) {
|
if (pstr_drc_interface->drc_uni_interface_ext_flag) {
|
||||||
ia_drc_uni_interface_ext_struct* drc_uni_interface_ext = &pstr_drc_interface->drc_uni_interface_ext;
|
ia_drc_uni_interface_ext_struct* drc_uni_interface_ext =
|
||||||
|
&pstr_drc_interface->drc_uni_interface_ext;
|
||||||
if (drc_uni_interface_ext->loudness_eq_parameter_interface_flag) {
|
if (drc_uni_interface_ext->loudness_eq_parameter_interface_flag) {
|
||||||
ia_loudness_eq_parameter_interface_struct* loudness_eq_parameter_interface = &drc_uni_interface_ext->loudness_eq_parameter_interface;
|
ia_loudness_eq_parameter_interface_struct*
|
||||||
|
loudness_eq_parameter_interface =
|
||||||
|
&drc_uni_interface_ext->loudness_eq_parameter_interface;
|
||||||
if (loudness_eq_parameter_interface->loudness_eq_request_flag) {
|
if (loudness_eq_parameter_interface->loudness_eq_request_flag) {
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_eq_request = loudness_eq_parameter_interface->loudness_eq_request;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.loudness_eq_request =
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.sensitivity = loudness_eq_parameter_interface->sensitivity;
|
loudness_eq_parameter_interface->loudness_eq_request;
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.playback_gain = loudness_eq_parameter_interface->playback_gain;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.sensitivity =
|
||||||
|
loudness_eq_parameter_interface->sensitivity;
|
||||||
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.playback_gain =
|
||||||
|
loudness_eq_parameter_interface->playback_gain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (drc_uni_interface_ext->eq_ctrl_interface_flag) {
|
if (drc_uni_interface_ext->eq_ctrl_interface_flag) {
|
||||||
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.eq_set_purpose_request = drc_uni_interface_ext->eq_ctrl_interface.eq_set_purpose_request;
|
pstr_drc_uni_sel_proc->uni_drc_sel_proc_params.eq_set_purpose_request =
|
||||||
|
drc_uni_interface_ext->eq_ctrl_interface.eq_set_purpose_request;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,76 +38,76 @@
|
||||||
#include "impd_drc_rom.h"
|
#include "impd_drc_rom.h"
|
||||||
|
|
||||||
WORD32 impd_shape_filt_block_adapt(const FLOAT32 drc_gain,
|
WORD32 impd_shape_filt_block_adapt(const FLOAT32 drc_gain,
|
||||||
shape_filter_block* shape_filter_block)
|
shape_filter_block* shape_filter_block) {
|
||||||
{
|
|
||||||
// WORD32 err = 0;
|
// WORD32 err = 0;
|
||||||
WORD32 i;
|
WORD32 i;
|
||||||
FLOAT32 warpedGain, x1, y1;
|
FLOAT32 warpedGain, x1, y1;
|
||||||
shape_filter_block->drc_gain_last = drc_gain;
|
shape_filter_block->drc_gain_last = drc_gain;
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
|
|
||||||
if (shape_filter_block->shape_filter[i].type == SHAPE_FILTER_TYPE_OFF)
|
if (shape_filter_block->shape_filter[i].type == SHAPE_FILTER_TYPE_OFF)
|
||||||
continue;
|
continue;
|
||||||
else if(shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_LF_CUT||shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_HF_CUT)
|
else if (shape_filter_block->shape_filter[i].type ==
|
||||||
{
|
SHAPE_FILTER_TYPE_LF_CUT ||
|
||||||
|
shape_filter_block->shape_filter[i].type ==
|
||||||
|
SHAPE_FILTER_TYPE_HF_CUT) {
|
||||||
if (drc_gain < 1.0f)
|
if (drc_gain < 1.0f)
|
||||||
warpedGain = -1.0f;
|
warpedGain = -1.0f;
|
||||||
else
|
else
|
||||||
warpedGain = (drc_gain - 1.0f) / (drc_gain - 1.0f + shape_filter_block->shape_filter[i].gain_offset);
|
warpedGain =
|
||||||
|
(drc_gain - 1.0f) /
|
||||||
|
(drc_gain - 1.0f + shape_filter_block->shape_filter[i].gain_offset);
|
||||||
x1 = shape_filter_block->shape_filter[i].a1;
|
x1 = shape_filter_block->shape_filter[i].a1;
|
||||||
}
|
} else if (shape_filter_block->shape_filter[i].type ==
|
||||||
else if(shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_LF_BOOST||shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_HF_BOOST)
|
SHAPE_FILTER_TYPE_LF_BOOST ||
|
||||||
{
|
shape_filter_block->shape_filter[i].type ==
|
||||||
|
SHAPE_FILTER_TYPE_HF_BOOST) {
|
||||||
if (drc_gain >= 1.0f)
|
if (drc_gain >= 1.0f)
|
||||||
warpedGain = -1.0f;
|
warpedGain = -1.0f;
|
||||||
else
|
else
|
||||||
warpedGain = (1.0f - drc_gain) / (1.0f + drc_gain * (shape_filter_block->shape_filter[i].gain_offset - 1.0f));
|
warpedGain =
|
||||||
|
(1.0f - drc_gain) /
|
||||||
|
(1.0f +
|
||||||
|
drc_gain *
|
||||||
|
(shape_filter_block->shape_filter[i].gain_offset - 1.0f));
|
||||||
x1 = shape_filter_block->shape_filter[i].b1;
|
x1 = shape_filter_block->shape_filter[i].b1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (warpedGain <= 0.0f)
|
if (warpedGain <= 0.0f) {
|
||||||
{
|
|
||||||
y1 = x1;
|
y1 = x1;
|
||||||
}
|
} else if (warpedGain <
|
||||||
else if (warpedGain < shape_filter_block->shape_filter[i].warped_gain_max) {
|
shape_filter_block->shape_filter[i].warped_gain_max) {
|
||||||
y1 = x1 + shape_filter_block->shape_filter[i].factor * warpedGain;
|
y1 = x1 + shape_filter_block->shape_filter[i].factor * warpedGain;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
y1 = shape_filter_block->shape_filter[i].y1_bound;
|
y1 = shape_filter_block->shape_filter[i].y1_bound;
|
||||||
}
|
}
|
||||||
if(shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_LF_CUT)
|
if (shape_filter_block->shape_filter[i].type == SHAPE_FILTER_TYPE_LF_CUT) {
|
||||||
{
|
|
||||||
shape_filter_block->shape_filter[i].b1 = y1;
|
shape_filter_block->shape_filter[i].b1 = y1;
|
||||||
}
|
} else if (shape_filter_block->shape_filter[i].type ==
|
||||||
else if(shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_HF_CUT)
|
SHAPE_FILTER_TYPE_HF_CUT) {
|
||||||
{
|
shape_filter_block->shape_filter[i].g_norm =
|
||||||
shape_filter_block->shape_filter[i].g_norm = shape_filter_block->shape_filter[i].coeff_sum / (shape_filter_block->shape_filter[i].partial_coeff_sum + y1);
|
shape_filter_block->shape_filter[i].coeff_sum /
|
||||||
|
(shape_filter_block->shape_filter[i].partial_coeff_sum + y1);
|
||||||
shape_filter_block->shape_filter[i].b1 = y1;
|
shape_filter_block->shape_filter[i].b1 = y1;
|
||||||
}
|
} else if (shape_filter_block->shape_filter[i].type ==
|
||||||
else if(shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_HF_BOOST)
|
SHAPE_FILTER_TYPE_HF_BOOST) {
|
||||||
{
|
shape_filter_block->shape_filter[i].g_norm =
|
||||||
shape_filter_block->shape_filter[i].g_norm = (shape_filter_block->shape_filter[i].partial_coeff_sum + y1) / shape_filter_block->shape_filter[i].coeff_sum;
|
(shape_filter_block->shape_filter[i].partial_coeff_sum + y1) /
|
||||||
|
shape_filter_block->shape_filter[i].coeff_sum;
|
||||||
|
shape_filter_block->shape_filter[i].a1 = y1;
|
||||||
|
} else if (shape_filter_block->shape_filter[i].type ==
|
||||||
|
SHAPE_FILTER_TYPE_LF_BOOST) {
|
||||||
shape_filter_block->shape_filter[i].a1 = y1;
|
shape_filter_block->shape_filter[i].a1 = y1;
|
||||||
}
|
}
|
||||||
else if(shape_filter_block->shape_filter[i].type==SHAPE_FILTER_TYPE_LF_BOOST)
|
|
||||||
{
|
|
||||||
shape_filter_block->shape_filter[i].a1 = y1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32 resetshape_flter_block(shape_filter_block* shape_filter_block)
|
WORD32 resetshape_flter_block(shape_filter_block* shape_filter_block) {
|
||||||
{
|
|
||||||
WORD32 i, c;
|
WORD32 i, c;
|
||||||
shape_filter_block->drc_gain_last = -1.0f;
|
shape_filter_block->drc_gain_last = -1.0f;
|
||||||
impd_shape_filt_block_adapt(1.0f, shape_filter_block);
|
impd_shape_filt_block_adapt(1.0f, shape_filter_block);
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
for (c=0; c<MAX_CHANNEL_COUNT; c++)
|
for (c = 0; c < MAX_CHANNEL_COUNT; c++) {
|
||||||
{
|
|
||||||
shape_filter_block->shape_filter[i].audio_in_state_1[c] = 0.0f;
|
shape_filter_block->shape_filter[i].audio_in_state_1[c] = 0.0f;
|
||||||
shape_filter_block->shape_filter[i].audio_in_state_2[c] = 0.0f;
|
shape_filter_block->shape_filter[i].audio_in_state_2[c] = 0.0f;
|
||||||
shape_filter_block->shape_filter[i].audio_out_state_1[c] = 0.0f;
|
shape_filter_block->shape_filter[i].audio_out_state_1[c] = 0.0f;
|
||||||
|
|
@ -117,88 +117,120 @@ WORD32 resetshape_flter_block(shape_filter_block* shape_filter_block)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WORD32 impd_shape_filt_block_init(
|
||||||
WORD32 impd_shape_filt_block_init(ia_shape_filter_block_params_struct* shape_flter_block_params,
|
ia_shape_filter_block_params_struct* shape_flter_block_params,
|
||||||
shape_filter_block* shape_filter_block)
|
shape_filter_block* shape_filter_block) {
|
||||||
{
|
|
||||||
// WORD32 err = 0;
|
// WORD32 err = 0;
|
||||||
FLOAT32 x1;
|
FLOAT32 x1;
|
||||||
FLOAT32 x2 = 0.0f;
|
FLOAT32 x2 = 0.0f;
|
||||||
FLOAT32 radius;
|
FLOAT32 radius;
|
||||||
if (shape_flter_block_params->lf_cut_filter_present) {
|
if (shape_flter_block_params->lf_cut_filter_present) {
|
||||||
|
ia_shape_filter_params_struct* params =
|
||||||
ia_shape_filter_params_struct* params = &shape_flter_block_params->str_lf_cut_params;
|
&shape_flter_block_params->str_lf_cut_params;
|
||||||
shape_filter_block->shape_filter[0].type = SHAPE_FILTER_TYPE_LF_CUT;
|
shape_filter_block->shape_filter[0].type = SHAPE_FILTER_TYPE_LF_CUT;
|
||||||
shape_filter_block->shape_filter[0].gain_offset = shape_filt_lf_gain_offset_tbl[params->corner_freq_index][params->filter_strength_index];
|
shape_filter_block->shape_filter[0].gain_offset =
|
||||||
shape_filter_block->shape_filter[0].y1_bound = shape_filt_lf_y1_bound_tbl[params->corner_freq_index][params->filter_strength_index];
|
shape_filt_lf_gain_offset_tbl[params->corner_freq_index]
|
||||||
|
[params->filter_strength_index];
|
||||||
|
shape_filter_block->shape_filter[0].y1_bound =
|
||||||
|
shape_filt_lf_y1_bound_tbl[params->corner_freq_index]
|
||||||
|
[params->filter_strength_index];
|
||||||
x1 = -shape_filt_lf_radius_tbl[params->corner_freq_index];
|
x1 = -shape_filt_lf_radius_tbl[params->corner_freq_index];
|
||||||
shape_filter_block->shape_filter[0].warped_gain_max = SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE / (SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE + shape_filter_block->shape_filter[0].gain_offset);
|
shape_filter_block->shape_filter[0].warped_gain_max =
|
||||||
shape_filter_block->shape_filter[0].factor = (shape_filter_block->shape_filter[0].y1_bound - x1) / shape_filter_block->shape_filter[0].warped_gain_max;
|
SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE /
|
||||||
|
(SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE +
|
||||||
|
shape_filter_block->shape_filter[0].gain_offset);
|
||||||
|
shape_filter_block->shape_filter[0].factor =
|
||||||
|
(shape_filter_block->shape_filter[0].y1_bound - x1) /
|
||||||
|
shape_filter_block->shape_filter[0].warped_gain_max;
|
||||||
shape_filter_block->shape_filter[0].a1 = x1;
|
shape_filter_block->shape_filter[0].a1 = x1;
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
shape_filter_block->shape_filter[0].type = SHAPE_FILTER_TYPE_OFF;
|
shape_filter_block->shape_filter[0].type = SHAPE_FILTER_TYPE_OFF;
|
||||||
}
|
}
|
||||||
if (shape_flter_block_params->lf_boost_filter_present) {
|
if (shape_flter_block_params->lf_boost_filter_present) {
|
||||||
|
ia_shape_filter_params_struct* params =
|
||||||
ia_shape_filter_params_struct* params = &shape_flter_block_params->str_lf_boost_params;
|
&shape_flter_block_params->str_lf_boost_params;
|
||||||
shape_filter_block->shape_filter[1].type = SHAPE_FILTER_TYPE_LF_BOOST;
|
shape_filter_block->shape_filter[1].type = SHAPE_FILTER_TYPE_LF_BOOST;
|
||||||
shape_filter_block->shape_filter[1].gain_offset = shape_filt_lf_gain_offset_tbl[params->corner_freq_index][params->filter_strength_index];
|
shape_filter_block->shape_filter[1].gain_offset =
|
||||||
shape_filter_block->shape_filter[1].y1_bound = shape_filt_lf_y1_bound_tbl[params->corner_freq_index][params->filter_strength_index];
|
shape_filt_lf_gain_offset_tbl[params->corner_freq_index]
|
||||||
|
[params->filter_strength_index];
|
||||||
|
shape_filter_block->shape_filter[1].y1_bound =
|
||||||
|
shape_filt_lf_y1_bound_tbl[params->corner_freq_index]
|
||||||
|
[params->filter_strength_index];
|
||||||
x1 = -shape_filt_lf_radius_tbl[params->corner_freq_index];
|
x1 = -shape_filt_lf_radius_tbl[params->corner_freq_index];
|
||||||
shape_filter_block->shape_filter[1].warped_gain_max = SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE / (SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE + shape_filter_block->shape_filter[1].gain_offset);
|
shape_filter_block->shape_filter[1].warped_gain_max =
|
||||||
shape_filter_block->shape_filter[1].factor = (shape_filter_block->shape_filter[1].y1_bound - x1) / shape_filter_block->shape_filter[1].warped_gain_max;
|
SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE /
|
||||||
|
(SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE +
|
||||||
|
shape_filter_block->shape_filter[1].gain_offset);
|
||||||
|
shape_filter_block->shape_filter[1].factor =
|
||||||
|
(shape_filter_block->shape_filter[1].y1_bound - x1) /
|
||||||
|
shape_filter_block->shape_filter[1].warped_gain_max;
|
||||||
shape_filter_block->shape_filter[1].b1 = x1;
|
shape_filter_block->shape_filter[1].b1 = x1;
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
shape_filter_block->shape_filter[1].type = SHAPE_FILTER_TYPE_OFF;
|
shape_filter_block->shape_filter[1].type = SHAPE_FILTER_TYPE_OFF;
|
||||||
}
|
}
|
||||||
if (shape_flter_block_params->hf_cut_filter_present) {
|
if (shape_flter_block_params->hf_cut_filter_present) {
|
||||||
|
ia_shape_filter_params_struct* params =
|
||||||
ia_shape_filter_params_struct* params = &shape_flter_block_params->str_hfCutParams;
|
&shape_flter_block_params->str_hfCutParams;
|
||||||
shape_filter_block->shape_filter[2].type = SHAPE_FILTER_TYPE_HF_CUT;
|
shape_filter_block->shape_filter[2].type = SHAPE_FILTER_TYPE_HF_CUT;
|
||||||
shape_filter_block->shape_filter[2].gain_offset = shape_filt_hf_gain_offset_tbl[params->corner_freq_index][params->filter_strength_index];
|
shape_filter_block->shape_filter[2].gain_offset =
|
||||||
shape_filter_block->shape_filter[2].y1_bound = shape_filt_hf_y1_bound_tbl[params->corner_freq_index][params->filter_strength_index];
|
shape_filt_hf_gain_offset_tbl[params->corner_freq_index]
|
||||||
|
[params->filter_strength_index];
|
||||||
|
shape_filter_block->shape_filter[2].y1_bound =
|
||||||
|
shape_filt_hf_y1_bound_tbl[params->corner_freq_index]
|
||||||
|
[params->filter_strength_index];
|
||||||
radius = shape_filt_hf_radius_tbl[params->corner_freq_index];
|
radius = shape_filt_hf_radius_tbl[params->corner_freq_index];
|
||||||
x1 = (FLOAT32)(- 2.0f * radius * cos(2.0f * M_PI * shape_filt_cutoff_freq_norm_hf_tbl[params->corner_freq_index]));
|
x1 = (FLOAT32)(
|
||||||
|
-2.0f * radius *
|
||||||
|
cos(2.0f * M_PI *
|
||||||
|
shape_filt_cutoff_freq_norm_hf_tbl[params->corner_freq_index]));
|
||||||
x2 = radius * radius;
|
x2 = radius * radius;
|
||||||
shape_filter_block->shape_filter[2].warped_gain_max = SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE / (SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE + shape_filter_block->shape_filter[2].gain_offset);
|
shape_filter_block->shape_filter[2].warped_gain_max =
|
||||||
shape_filter_block->shape_filter[2].factor = (shape_filter_block->shape_filter[2].y1_bound - x1) / shape_filter_block->shape_filter[2].warped_gain_max;
|
SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE /
|
||||||
|
(SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE +
|
||||||
|
shape_filter_block->shape_filter[2].gain_offset);
|
||||||
|
shape_filter_block->shape_filter[2].factor =
|
||||||
|
(shape_filter_block->shape_filter[2].y1_bound - x1) /
|
||||||
|
shape_filter_block->shape_filter[2].warped_gain_max;
|
||||||
shape_filter_block->shape_filter[2].coeff_sum = 1.0f + x1 + x2;
|
shape_filter_block->shape_filter[2].coeff_sum = 1.0f + x1 + x2;
|
||||||
shape_filter_block->shape_filter[2].partial_coeff_sum = 1.0f + x2;
|
shape_filter_block->shape_filter[2].partial_coeff_sum = 1.0f + x2;
|
||||||
shape_filter_block->shape_filter[2].a1 = x1;
|
shape_filter_block->shape_filter[2].a1 = x1;
|
||||||
shape_filter_block->shape_filter[2].a2 = x2;
|
shape_filter_block->shape_filter[2].a2 = x2;
|
||||||
shape_filter_block->shape_filter[2].b2 = x2;
|
shape_filter_block->shape_filter[2].b2 = x2;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
shape_filter_block->shape_filter[2].type = SHAPE_FILTER_TYPE_OFF;
|
shape_filter_block->shape_filter[2].type = SHAPE_FILTER_TYPE_OFF;
|
||||||
}
|
}
|
||||||
if (shape_flter_block_params->hf_boost_filter_present) {
|
if (shape_flter_block_params->hf_boost_filter_present) {
|
||||||
|
ia_shape_filter_params_struct* params =
|
||||||
ia_shape_filter_params_struct* params = &shape_flter_block_params->str_hf_boost_params;
|
&shape_flter_block_params->str_hf_boost_params;
|
||||||
shape_filter_block->shape_filter[3].type = SHAPE_FILTER_TYPE_HF_BOOST;
|
shape_filter_block->shape_filter[3].type = SHAPE_FILTER_TYPE_HF_BOOST;
|
||||||
shape_filter_block->shape_filter[3].gain_offset = shape_filt_hf_gain_offset_tbl[params->corner_freq_index][params->filter_strength_index];
|
shape_filter_block->shape_filter[3].gain_offset =
|
||||||
shape_filter_block->shape_filter[3].y1_bound = shape_filt_hf_y1_bound_tbl[params->corner_freq_index][params->filter_strength_index];
|
shape_filt_hf_gain_offset_tbl[params->corner_freq_index]
|
||||||
|
[params->filter_strength_index];
|
||||||
|
shape_filter_block->shape_filter[3].y1_bound =
|
||||||
|
shape_filt_hf_y1_bound_tbl[params->corner_freq_index]
|
||||||
|
[params->filter_strength_index];
|
||||||
radius = shape_filt_hf_radius_tbl[params->corner_freq_index];
|
radius = shape_filt_hf_radius_tbl[params->corner_freq_index];
|
||||||
x1 = (FLOAT32)(- 2.0f * radius * cos(2.0f * M_PI * shape_filt_cutoff_freq_norm_hf_tbl[params->corner_freq_index]));
|
x1 = (FLOAT32)(
|
||||||
|
-2.0f * radius *
|
||||||
|
cos(2.0f * M_PI *
|
||||||
|
shape_filt_cutoff_freq_norm_hf_tbl[params->corner_freq_index]));
|
||||||
x2 = radius * radius;
|
x2 = radius * radius;
|
||||||
shape_filter_block->shape_filter[3].warped_gain_max = SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE / (SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE + shape_filter_block->shape_filter[3].gain_offset);
|
shape_filter_block->shape_filter[3].warped_gain_max =
|
||||||
shape_filter_block->shape_filter[3].factor = (shape_filter_block->shape_filter[3].y1_bound - x1) / shape_filter_block->shape_filter[3].warped_gain_max;
|
SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE /
|
||||||
|
(SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE +
|
||||||
|
shape_filter_block->shape_filter[3].gain_offset);
|
||||||
|
shape_filter_block->shape_filter[3].factor =
|
||||||
|
(shape_filter_block->shape_filter[3].y1_bound - x1) /
|
||||||
|
shape_filter_block->shape_filter[3].warped_gain_max;
|
||||||
shape_filter_block->shape_filter[3].coeff_sum = 1.0f + x1 + x2;
|
shape_filter_block->shape_filter[3].coeff_sum = 1.0f + x1 + x2;
|
||||||
shape_filter_block->shape_filter[3].partial_coeff_sum = 1.0f + x2;
|
shape_filter_block->shape_filter[3].partial_coeff_sum = 1.0f + x2;
|
||||||
shape_filter_block->shape_filter[3].b1 = x1;
|
shape_filter_block->shape_filter[3].b1 = x1;
|
||||||
shape_filter_block->shape_filter[3].b2 = x2;
|
shape_filter_block->shape_filter[3].b2 = x2;
|
||||||
shape_filter_block->shape_filter[3].a2 = x2;
|
shape_filter_block->shape_filter[3].a2 = x2;
|
||||||
|
|
||||||
|
} else {
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
shape_filter_block->shape_filter[3].type = SHAPE_FILTER_TYPE_OFF;
|
shape_filter_block->shape_filter[3].type = SHAPE_FILTER_TYPE_OFF;
|
||||||
}
|
}
|
||||||
resetshape_flter_block(shape_filter_block);
|
resetshape_flter_block(shape_filter_block);
|
||||||
|
|
@ -206,59 +238,69 @@ WORD32 impd_shape_filt_block_init(ia_shape_filter_block_params_struct* shape_flt
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WORD32 impd_shape_filt_block_time_process(
|
||||||
|
shape_filter_block* shape_filter_block, FLOAT32* drc_gain,
|
||||||
WORD32 impd_shape_filt_block_time_process(shape_filter_block* shape_filter_block,
|
const WORD32 channel, FLOAT32* audio_in, WORD32 start, WORD32 end) {
|
||||||
FLOAT32* drc_gain,
|
|
||||||
const WORD32 channel,
|
|
||||||
FLOAT32 *audio_in,
|
|
||||||
WORD32 start,
|
|
||||||
WORD32 end)
|
|
||||||
{
|
|
||||||
WORD32 i, j, err = 0;
|
WORD32 i, j, err = 0;
|
||||||
FLOAT32 audio_out;
|
FLOAT32 audio_out;
|
||||||
|
|
||||||
if (shape_filter_block->shape_flter_block_flag) {
|
if (shape_filter_block->shape_flter_block_flag) {
|
||||||
for (i=start; i<end; i++)
|
for (i = start; i < end; i++) {
|
||||||
{
|
|
||||||
FLOAT32 tmp = audio_in[i];
|
FLOAT32 tmp = audio_in[i];
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
if(shape_filter_block->shape_filter[j].type==SHAPE_FILTER_TYPE_LF_CUT||shape_filter_block->shape_filter[j].type==SHAPE_FILTER_TYPE_LF_BOOST){
|
if (shape_filter_block->shape_filter[j].type ==
|
||||||
|
SHAPE_FILTER_TYPE_LF_CUT ||
|
||||||
audio_out = tmp + shape_filter_block->shape_filter[j].b1 * shape_filter_block->shape_filter[j].audio_in_state_1[channel]
|
shape_filter_block->shape_filter[j].type ==
|
||||||
- shape_filter_block->shape_filter[j].a1 * shape_filter_block->shape_filter[j].audio_out_state_1[channel];
|
SHAPE_FILTER_TYPE_LF_BOOST) {
|
||||||
|
audio_out = tmp +
|
||||||
|
shape_filter_block->shape_filter[j].b1 *
|
||||||
|
shape_filter_block->shape_filter[j]
|
||||||
|
.audio_in_state_1[channel] -
|
||||||
|
shape_filter_block->shape_filter[j].a1 *
|
||||||
|
shape_filter_block->shape_filter[j]
|
||||||
|
.audio_out_state_1[channel];
|
||||||
shape_filter_block->shape_filter[j].audio_in_state_1[channel] = tmp;
|
shape_filter_block->shape_filter[j].audio_in_state_1[channel] = tmp;
|
||||||
shape_filter_block->shape_filter[j].audio_out_state_1[channel] = audio_out;
|
shape_filter_block->shape_filter[j].audio_out_state_1[channel] =
|
||||||
|
audio_out;
|
||||||
|
|
||||||
}
|
} else if (shape_filter_block->shape_filter[j].type ==
|
||||||
else if(shape_filter_block->shape_filter[j].type==SHAPE_FILTER_TYPE_HF_CUT||shape_filter_block->shape_filter[j].type==SHAPE_FILTER_TYPE_HF_BOOST){
|
SHAPE_FILTER_TYPE_HF_CUT ||
|
||||||
|
shape_filter_block->shape_filter[j].type ==
|
||||||
audio_out = shape_filter_block->shape_filter[j].g_norm * tmp + shape_filter_block->shape_filter[j].b1 * shape_filter_block->shape_filter[j].audio_in_state_1[channel]
|
SHAPE_FILTER_TYPE_HF_BOOST) {
|
||||||
+ shape_filter_block->shape_filter[j].b2 * shape_filter_block->shape_filter[j].audio_in_state_2[channel]
|
audio_out = shape_filter_block->shape_filter[j].g_norm * tmp +
|
||||||
- shape_filter_block->shape_filter[j].a1 * shape_filter_block->shape_filter[j].audio_out_state_1[channel]
|
shape_filter_block->shape_filter[j].b1 *
|
||||||
- shape_filter_block->shape_filter[j].a2 * shape_filter_block->shape_filter[j].audio_out_state_2[channel];
|
shape_filter_block->shape_filter[j]
|
||||||
shape_filter_block->shape_filter[j].audio_in_state_2[channel] = shape_filter_block->shape_filter[j].audio_in_state_1[channel];
|
.audio_in_state_1[channel] +
|
||||||
shape_filter_block->shape_filter[j].audio_in_state_1[channel] = shape_filter_block->shape_filter[j].g_norm * tmp;
|
shape_filter_block->shape_filter[j].b2 *
|
||||||
shape_filter_block->shape_filter[j].audio_out_state_2[channel] = shape_filter_block->shape_filter[j].audio_out_state_1[channel];
|
shape_filter_block->shape_filter[j]
|
||||||
shape_filter_block->shape_filter[j].audio_out_state_1[channel] = audio_out;
|
.audio_in_state_2[channel] -
|
||||||
}
|
shape_filter_block->shape_filter[j].a1 *
|
||||||
else
|
shape_filter_block->shape_filter[j]
|
||||||
{
|
.audio_out_state_1[channel] -
|
||||||
|
shape_filter_block->shape_filter[j].a2 *
|
||||||
|
shape_filter_block->shape_filter[j]
|
||||||
|
.audio_out_state_2[channel];
|
||||||
|
shape_filter_block->shape_filter[j].audio_in_state_2[channel] =
|
||||||
|
shape_filter_block->shape_filter[j].audio_in_state_1[channel];
|
||||||
|
shape_filter_block->shape_filter[j].audio_in_state_1[channel] =
|
||||||
|
shape_filter_block->shape_filter[j].g_norm * tmp;
|
||||||
|
shape_filter_block->shape_filter[j].audio_out_state_2[channel] =
|
||||||
|
shape_filter_block->shape_filter[j].audio_out_state_1[channel];
|
||||||
|
shape_filter_block->shape_filter[j].audio_out_state_1[channel] =
|
||||||
|
audio_out;
|
||||||
|
} else {
|
||||||
audio_out = tmp;
|
audio_out = tmp;
|
||||||
}
|
}
|
||||||
tmp = audio_out;
|
tmp = audio_out;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
audio_in[i] = audio_out * drc_gain[i];
|
audio_in[i] = audio_out * drc_gain[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
for (i = start; i < end; i++) {
|
for (i = start; i < end; i++) {
|
||||||
audio_in[i] = audio_in[i] * drc_gain[i];
|
audio_in[i] = audio_in[i] * drc_gain[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -20,10 +20,8 @@
|
||||||
#ifndef IMPD_DRC_STURCT_H
|
#ifndef IMPD_DRC_STURCT_H
|
||||||
#define IMPD_DRC_STURCT_H
|
#define IMPD_DRC_STURCT_H
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define METHOD_DEFINITION_UNKNOWN_OTHER 0
|
#define METHOD_DEFINITION_UNKNOWN_OTHER 0
|
||||||
|
|
@ -42,7 +40,8 @@ extern "C"
|
||||||
#define MEASUREMENT_SYSTEM_BS_1770_4 2
|
#define MEASUREMENT_SYSTEM_BS_1770_4 2
|
||||||
#define MEASUREMENT_SYSTEM_BS_1770_3 MEASUREMENT_SYSTEM_BS_1770_4
|
#define MEASUREMENT_SYSTEM_BS_1770_3 MEASUREMENT_SYSTEM_BS_1770_4
|
||||||
#define MEASUREMENT_SYSTEM_BS_1770_4_PRE_PROCESSING 3
|
#define MEASUREMENT_SYSTEM_BS_1770_4_PRE_PROCESSING 3
|
||||||
#define MEASUREMENT_SYSTEM_BS_1770_3_PRE_PROCESSING MEASUREMENT_SYSTEM_BS_1770_4_PRE_PROCESSING
|
#define MEASUREMENT_SYSTEM_BS_1770_3_PRE_PROCESSING \
|
||||||
|
MEASUREMENT_SYSTEM_BS_1770_4_PRE_PROCESSING
|
||||||
#define MEASUREMENT_SYSTEM_USER 4
|
#define MEASUREMENT_SYSTEM_USER 4
|
||||||
#define MEASUREMENT_SYSTEM_EXPERT_PANEL 5
|
#define MEASUREMENT_SYSTEM_EXPERT_PANEL 5
|
||||||
#define MEASUREMENT_SYSTEM_BS_1771_1 6
|
#define MEASUREMENT_SYSTEM_BS_1771_1 6
|
||||||
|
|
@ -219,7 +218,8 @@ typedef struct {
|
||||||
WORD32 parametric_drc_preset_id;
|
WORD32 parametric_drc_preset_id;
|
||||||
WORD32 parametric_drc_type;
|
WORD32 parametric_drc_type;
|
||||||
WORD32 len_bit_size;
|
WORD32 len_bit_size;
|
||||||
ia_parametric_drc_type_feed_forward_struct str_parametric_drc_type_feed_forward;
|
ia_parametric_drc_type_feed_forward_struct
|
||||||
|
str_parametric_drc_type_feed_forward;
|
||||||
ia_parametric_drc_lim_struct parametric_drc_lim;
|
ia_parametric_drc_lim_struct parametric_drc_lim;
|
||||||
|
|
||||||
WORD32 drc_characteristic;
|
WORD32 drc_characteristic;
|
||||||
|
|
@ -246,7 +246,8 @@ typedef struct {
|
||||||
WORD32 parametric_drc_delay_max;
|
WORD32 parametric_drc_delay_max;
|
||||||
WORD32 reset_parametric_drc;
|
WORD32 reset_parametric_drc;
|
||||||
WORD32 parametric_drc_gain_set_count;
|
WORD32 parametric_drc_gain_set_count;
|
||||||
ia_parametric_drc_gain_set_params_struct str_parametric_drc_gain_set_params[SEQUENCE_COUNT_MAX];
|
ia_parametric_drc_gain_set_params_struct
|
||||||
|
str_parametric_drc_gain_set_params[SEQUENCE_COUNT_MAX];
|
||||||
} ia_drc_coeff_parametric_drc_struct;
|
} ia_drc_coeff_parametric_drc_struct;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -352,13 +353,16 @@ typedef struct {
|
||||||
ia_gain_set_params_struct gain_set_params[GAIN_SET_COUNT_MAX];
|
ia_gain_set_params_struct gain_set_params[GAIN_SET_COUNT_MAX];
|
||||||
WORD32 drc_characteristic_left_present;
|
WORD32 drc_characteristic_left_present;
|
||||||
WORD32 characteristic_left_count;
|
WORD32 characteristic_left_count;
|
||||||
ia_split_drc_characteristic_struct str_split_characteristic_left [SPLIT_CHARACTERISTIC_COUNT_MAX];
|
ia_split_drc_characteristic_struct
|
||||||
|
str_split_characteristic_left[SPLIT_CHARACTERISTIC_COUNT_MAX];
|
||||||
WORD32 drc_characteristic_right_present;
|
WORD32 drc_characteristic_right_present;
|
||||||
WORD32 characteristic_right_count;
|
WORD32 characteristic_right_count;
|
||||||
ia_split_drc_characteristic_struct str_split_characteristic_right[SPLIT_CHARACTERISTIC_COUNT_MAX];
|
ia_split_drc_characteristic_struct
|
||||||
|
str_split_characteristic_right[SPLIT_CHARACTERISTIC_COUNT_MAX];
|
||||||
WORD32 shape_filters_present;
|
WORD32 shape_filters_present;
|
||||||
WORD32 shape_num_filter;
|
WORD32 shape_num_filter;
|
||||||
ia_shape_filter_block_params_struct str_shape_filter_block_params[SHAPE_FILTER_COUNT_MAX+1];
|
ia_shape_filter_block_params_struct
|
||||||
|
str_shape_filter_block_params[SHAPE_FILTER_COUNT_MAX + 1];
|
||||||
WORD32 gain_sequence_count;
|
WORD32 gain_sequence_count;
|
||||||
WORD32 gain_set_params_index_for_gain_sequence[SEQUENCE_COUNT_MAX];
|
WORD32 gain_set_params_index_for_gain_sequence[SEQUENCE_COUNT_MAX];
|
||||||
WORD32 gain_set_count_plus;
|
WORD32 gain_set_count_plus;
|
||||||
|
|
@ -392,8 +396,10 @@ typedef struct {
|
||||||
WORD32 no_independent_use;
|
WORD32 no_independent_use;
|
||||||
WORD32 drc_set_effect;
|
WORD32 drc_set_effect;
|
||||||
WORD32 gain_set_index[MAX_CHANNEL_COUNT];
|
WORD32 gain_set_index[MAX_CHANNEL_COUNT];
|
||||||
ia_gain_modifiers_struct str_gain_modifiers_of_ch_group[CHANNEL_GROUP_COUNT_MAX];
|
ia_gain_modifiers_struct
|
||||||
ia_ducking_modifiers_struct str_ducking_modifiers_for_channel[MAX_CHANNEL_COUNT];
|
str_gain_modifiers_of_ch_group[CHANNEL_GROUP_COUNT_MAX];
|
||||||
|
ia_ducking_modifiers_struct
|
||||||
|
str_ducking_modifiers_for_channel[MAX_CHANNEL_COUNT];
|
||||||
WORD32 limiter_peak_target_present;
|
WORD32 limiter_peak_target_present;
|
||||||
FLOAT32 limiter_peak_target;
|
FLOAT32 limiter_peak_target;
|
||||||
WORD32 drc_set_target_loudness_present;
|
WORD32 drc_set_target_loudness_present;
|
||||||
|
|
@ -408,7 +414,8 @@ typedef struct {
|
||||||
WORD32 gain_interpolation_type_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
|
WORD32 gain_interpolation_type_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
|
||||||
WORD32 time_delta_min_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
|
WORD32 time_delta_min_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
|
||||||
WORD32 time_alignment_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
|
WORD32 time_alignment_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
|
||||||
ia_ducking_modifiers_struct str_ducking_modifiers_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
|
ia_ducking_modifiers_struct
|
||||||
|
str_ducking_modifiers_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
|
||||||
WORD32 channel_group_of_ch[MAX_CHANNEL_COUNT];
|
WORD32 channel_group_of_ch[MAX_CHANNEL_COUNT];
|
||||||
WORD32 num_chan_per_ch_group[CHANNEL_GROUP_COUNT_MAX];
|
WORD32 num_chan_per_ch_group[CHANNEL_GROUP_COUNT_MAX];
|
||||||
WORD32 gain_element_count;
|
WORD32 gain_element_count;
|
||||||
|
|
@ -515,8 +522,10 @@ typedef struct {
|
||||||
WORD32 eq_subband_gain_representation;
|
WORD32 eq_subband_gain_representation;
|
||||||
WORD32 eq_subband_gain_format;
|
WORD32 eq_subband_gain_format;
|
||||||
WORD32 eq_subband_gain_count;
|
WORD32 eq_subband_gain_count;
|
||||||
ia_eq_subband_gain_spline_struct str_eq_subband_gain_spline [UNIQUE_SUBBAND_GAIN_COUNT_MAX];
|
ia_eq_subband_gain_spline_struct
|
||||||
ia_eq_subband_gain_vector str_eq_subband_gain_vector [UNIQUE_SUBBAND_GAIN_COUNT_MAX];
|
str_eq_subband_gain_spline[UNIQUE_SUBBAND_GAIN_COUNT_MAX];
|
||||||
|
ia_eq_subband_gain_vector
|
||||||
|
str_eq_subband_gain_vector[UNIQUE_SUBBAND_GAIN_COUNT_MAX];
|
||||||
} ia_eq_coeff_struct;
|
} ia_eq_coeff_struct;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -529,7 +538,8 @@ typedef struct {
|
||||||
FLOAT32 eq_cascade_gain[EQ_CHANNEL_GROUP_COUNT_MAX];
|
FLOAT32 eq_cascade_gain[EQ_CHANNEL_GROUP_COUNT_MAX];
|
||||||
ia_filter_block_refs_struct str_filter_block_refs[EQ_CHANNEL_GROUP_COUNT_MAX];
|
ia_filter_block_refs_struct str_filter_block_refs[EQ_CHANNEL_GROUP_COUNT_MAX];
|
||||||
WORD32 eq_phase_alignment_present;
|
WORD32 eq_phase_alignment_present;
|
||||||
WORD32 eq_phase_alignment [EQ_CHANNEL_GROUP_COUNT_MAX][EQ_CHANNEL_GROUP_COUNT_MAX];
|
WORD32 eq_phase_alignment[EQ_CHANNEL_GROUP_COUNT_MAX]
|
||||||
|
[EQ_CHANNEL_GROUP_COUNT_MAX];
|
||||||
} ia_td_filter_cascade_struct;
|
} ia_td_filter_cascade_struct;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -562,11 +572,13 @@ typedef struct {
|
||||||
WORD32 parametric_drc_present;
|
WORD32 parametric_drc_present;
|
||||||
ia_drc_coeff_parametric_drc_struct str_drc_coeff_param_drc;
|
ia_drc_coeff_parametric_drc_struct str_drc_coeff_param_drc;
|
||||||
WORD32 parametric_drc_instructions_count;
|
WORD32 parametric_drc_instructions_count;
|
||||||
ia_parametric_drc_instructions_struct str_parametric_drc_instructions[PARAM_DRC_INSTRUCTIONS_COUNT_MAX];
|
ia_parametric_drc_instructions_struct
|
||||||
|
str_parametric_drc_instructions[PARAM_DRC_INSTRUCTIONS_COUNT_MAX];
|
||||||
WORD32 drc_extension_v1_present;
|
WORD32 drc_extension_v1_present;
|
||||||
WORD32 loud_eq_instructions_flag;
|
WORD32 loud_eq_instructions_flag;
|
||||||
WORD32 loud_eq_instructions_count;
|
WORD32 loud_eq_instructions_count;
|
||||||
ia_loud_eq_instructions_struct loud_eq_instructions [LOUD_EQ_INSTRUCTIONS_COUNT_MAX];
|
ia_loud_eq_instructions_struct
|
||||||
|
loud_eq_instructions[LOUD_EQ_INSTRUCTIONS_COUNT_MAX];
|
||||||
WORD32 eq_flag;
|
WORD32 eq_flag;
|
||||||
ia_eq_coeff_struct str_eq_coeff;
|
ia_eq_coeff_struct str_eq_coeff;
|
||||||
WORD32 eq_instructions_count;
|
WORD32 eq_instructions_count;
|
||||||
|
|
@ -586,12 +598,17 @@ typedef struct ia_drc_config{
|
||||||
WORD32 drc_config_ext_present;
|
WORD32 drc_config_ext_present;
|
||||||
WORD32 apply_drc;
|
WORD32 apply_drc;
|
||||||
ia_drc_config_ext str_drc_config_ext;
|
ia_drc_config_ext str_drc_config_ext;
|
||||||
ia_drc_coefficients_basic_struct str_drc_coefficients_basic[DRC_COEFF_COUNT_MAX];
|
ia_drc_coefficients_basic_struct
|
||||||
ia_drc_instructions_basic_struct str_drc_instructions_basic[DRC_INSTRUCTIONS_COUNT_MAX];
|
str_drc_coefficients_basic[DRC_COEFF_COUNT_MAX];
|
||||||
ia_uni_drc_coeffs_struct str_p_loc_drc_coefficients_uni_drc[DRC_COEFF_COUNT_MAX];
|
ia_drc_instructions_basic_struct
|
||||||
ia_drc_instructions_struct str_drc_instruction_str[DRC_INSTRUCTIONS_COUNT_MAX];
|
str_drc_instructions_basic[DRC_INSTRUCTIONS_COUNT_MAX];
|
||||||
|
ia_uni_drc_coeffs_struct
|
||||||
|
str_p_loc_drc_coefficients_uni_drc[DRC_COEFF_COUNT_MAX];
|
||||||
|
ia_drc_instructions_struct
|
||||||
|
str_drc_instruction_str[DRC_INSTRUCTIONS_COUNT_MAX];
|
||||||
ia_channel_layout_struct channel_layout;
|
ia_channel_layout_struct channel_layout;
|
||||||
ia_downmix_instructions_struct dwnmix_instructions[DOWNMIX_INSTRUCTION_COUNT_MAX];
|
ia_downmix_instructions_struct
|
||||||
|
dwnmix_instructions[DOWNMIX_INSTRUCTION_COUNT_MAX];
|
||||||
} ia_drc_config;
|
} ia_drc_config;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -645,15 +662,12 @@ typedef struct {
|
||||||
WORD32 lfe_channel_map[MAX_CHANNEL_COUNT];
|
WORD32 lfe_channel_map[MAX_CHANNEL_COUNT];
|
||||||
} ia_drc_params_bs_dec_struct;
|
} ia_drc_params_bs_dec_struct;
|
||||||
|
|
||||||
typedef struct ia_drc_bits_dec_struct
|
typedef struct ia_drc_bits_dec_struct {
|
||||||
{
|
|
||||||
|
|
||||||
ia_tables_struct tables_default;
|
ia_tables_struct tables_default;
|
||||||
ia_drc_params_bs_dec_struct ia_drc_params_struct;
|
ia_drc_params_bs_dec_struct ia_drc_params_struct;
|
||||||
|
|
||||||
} ia_drc_bits_dec_struct;
|
} ia_drc_bits_dec_struct;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -28,47 +28,39 @@
|
||||||
#include "impd_drc_rom.h"
|
#include "impd_drc_rom.h"
|
||||||
|
|
||||||
WORD32 impd_init_tbls(const WORD32 num_gain_max_values,
|
WORD32 impd_init_tbls(const WORD32 num_gain_max_values,
|
||||||
ia_tables_struct* str_tables)
|
ia_tables_struct* str_tables) {
|
||||||
{
|
|
||||||
impd_gen_delta_time_code_tbl(num_gain_max_values,
|
impd_gen_delta_time_code_tbl(num_gain_max_values,
|
||||||
str_tables->delta_time_code_table);
|
str_tables->delta_time_code_table);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void impd_get_slope_code_tbl_and_size(ia_slope_code_table_struct const** slope_code_tbl_entry,
|
void impd_get_slope_code_tbl_and_size(
|
||||||
WORD32* num_slope_code_tbl_entries)
|
ia_slope_code_table_struct const** slope_code_tbl_entry,
|
||||||
{
|
WORD32* num_slope_code_tbl_entries) {
|
||||||
*slope_code_tbl_entry = &(slopeCodeTableEntryBySize[0]);
|
*slope_code_tbl_entry = &(slopeCodeTableEntryBySize[0]);
|
||||||
*num_slope_code_tbl_entries = kNumSlopeValuesTable;
|
*num_slope_code_tbl_entries = kNumSlopeValuesTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void impd_get_delta_gain_code_tbl(
|
||||||
void
|
const WORD32 gain_coding_profile,
|
||||||
impd_get_delta_gain_code_tbl(const WORD32 gain_coding_profile,
|
|
||||||
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
||||||
WORD32 *num_entries)
|
WORD32* num_entries) {
|
||||||
{
|
if (gain_coding_profile == GAIN_CODING_PROFILE_CLIPPING) {
|
||||||
if (gain_coding_profile==GAIN_CODING_PROFILE_CLIPPING)
|
|
||||||
{
|
|
||||||
*delta_time_code_tbl = deltaGainCodeTableProfile2BySize;
|
*delta_time_code_tbl = deltaGainCodeTableProfile2BySize;
|
||||||
*num_entries = kNumDeltaGainValuesTableProfile2;
|
*num_entries = kNumDeltaGainValuesTableProfile2;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
*delta_time_code_tbl = deltaGainCodeTableBySize;
|
*delta_time_code_tbl = deltaGainCodeTableBySize;
|
||||||
*num_entries = kNumDeltaGainValuesTable;
|
*num_entries = kNumDeltaGainValuesTable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void impd_gen_delta_time_code_tbl(
|
||||||
impd_gen_delta_time_code_tbl (const WORD32 num_gain_max_values,
|
const WORD32 num_gain_max_values,
|
||||||
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item)
|
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item) {
|
||||||
{
|
|
||||||
WORD32 n, k;
|
WORD32 n, k;
|
||||||
|
|
||||||
WORD32 Z = 1;
|
WORD32 Z = 1;
|
||||||
while((1<<Z)<2*num_gain_max_values)
|
while ((1 << Z) < 2 * num_gain_max_values) {
|
||||||
{
|
|
||||||
Z++;
|
Z++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,42 +71,32 @@ impd_gen_delta_time_code_tbl (const WORD32 num_gain_max_values,
|
||||||
delta_time_code_tbl_item[1].size = 2;
|
delta_time_code_tbl_item[1].size = 2;
|
||||||
delta_time_code_tbl_item[1].code = 0x0;
|
delta_time_code_tbl_item[1].code = 0x0;
|
||||||
delta_time_code_tbl_item[1].value = 1;
|
delta_time_code_tbl_item[1].value = 1;
|
||||||
for (n=0; n<4; n++)
|
for (n = 0; n < 4; n++) {
|
||||||
{
|
|
||||||
delta_time_code_tbl_item[n + 2].size = 4;
|
delta_time_code_tbl_item[n + 2].size = 4;
|
||||||
delta_time_code_tbl_item[n + 2].code = 0x4 + n;
|
delta_time_code_tbl_item[n + 2].code = 0x4 + n;
|
||||||
delta_time_code_tbl_item[n + 2].value = n + 2;
|
delta_time_code_tbl_item[n + 2].value = n + 2;
|
||||||
}
|
}
|
||||||
for (n=0; n<8; n++)
|
for (n = 0; n < 8; n++) {
|
||||||
{
|
|
||||||
delta_time_code_tbl_item[n + 6].size = 5;
|
delta_time_code_tbl_item[n + 6].size = 5;
|
||||||
delta_time_code_tbl_item[n + 6].code = 0x10 + n;
|
delta_time_code_tbl_item[n + 6].code = 0x10 + n;
|
||||||
delta_time_code_tbl_item[n + 6].value = n + 6;
|
delta_time_code_tbl_item[n + 6].value = n + 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
k = 2 * num_gain_max_values - 14 + 1;
|
k = 2 * num_gain_max_values - 14 + 1;
|
||||||
for (n=0; n<k; n++)
|
for (n = 0; n < k; n++) {
|
||||||
{
|
|
||||||
delta_time_code_tbl_item[n + 14].size = 2 + Z;
|
delta_time_code_tbl_item[n + 14].size = 2 + Z;
|
||||||
delta_time_code_tbl_item[n + 14].code = (0x3 << Z) + n;
|
delta_time_code_tbl_item[n + 14].code = (0x3 << Z) + n;
|
||||||
delta_time_code_tbl_item[n + 14].value = n + 14;
|
delta_time_code_tbl_item[n + 14].value = n + 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_get_delta_tmin (const WORD32 sampling_rate)
|
impd_get_delta_tmin(const WORD32 sampling_rate) {
|
||||||
{
|
|
||||||
WORD32 lowerBound = (WORD32)(0.5f + 0.0005f * sampling_rate);
|
WORD32 lowerBound = (WORD32)(0.5f + 0.0005f * sampling_rate);
|
||||||
WORD32 result = 1;
|
WORD32 result = 1;
|
||||||
if (sampling_rate < 1000)
|
if (sampling_rate < 1000) {
|
||||||
{
|
|
||||||
return (UNEXPECTED_ERROR);
|
return (UNEXPECTED_ERROR);
|
||||||
}
|
}
|
||||||
while (result <= lowerBound) result = result << 1;
|
while (result <= lowerBound) result = result << 1;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@
|
||||||
#ifndef IMPD_DRC_TABLES_H
|
#ifndef IMPD_DRC_TABLES_H
|
||||||
#define IMPD_DRC_TABLES_H
|
#define IMPD_DRC_TABLES_H
|
||||||
|
|
||||||
const ia_filter_bank_params_struct normal_cross_freq[FILTER_BANK_PARAMETER_COUNT] = {
|
const ia_filter_bank_params_struct
|
||||||
|
normal_cross_freq[FILTER_BANK_PARAMETER_COUNT] = {
|
||||||
{2.0f / 1024.0f, 0.0000373252f, 0.9913600345f},
|
{2.0f / 1024.0f, 0.0000373252f, 0.9913600345f},
|
||||||
{3.0f / 1024.0f, 0.0000836207f, 0.9870680830f},
|
{3.0f / 1024.0f, 0.0000836207f, 0.9870680830f},
|
||||||
{4.0f / 1024.0f, 0.0001480220f, 0.9827947083f},
|
{4.0f / 1024.0f, 0.0001480220f, 0.9827947083f},
|
||||||
|
|
|
||||||
|
|
@ -20,45 +20,32 @@
|
||||||
#ifndef IMPD_DRC_UNI_BITSTREAM_DEC_API_H
|
#ifndef IMPD_DRC_UNI_BITSTREAM_DEC_API_H
|
||||||
#define IMPD_DRC_UNI_BITSTREAM_DEC_API_H
|
#define IMPD_DRC_UNI_BITSTREAM_DEC_API_H
|
||||||
|
|
||||||
|
WORD32 impd_init_drc_bitstream_dec(
|
||||||
WORD32 impd_init_drc_bitstream_dec(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct, WORD32 sample_rate,
|
||||||
WORD32 sample_rate,
|
WORD32 frame_size, WORD32 delay_mode, WORD32 lfe_channel_map_count,
|
||||||
WORD32 frame_size,
|
|
||||||
WORD32 delay_mode,
|
|
||||||
WORD32 lfe_channel_map_count,
|
|
||||||
WORD32* lfe_channel_map);
|
WORD32* lfe_channel_map);
|
||||||
|
|
||||||
WORD32 impd_process_drc_bitstream_dec(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
WORD32 impd_process_drc_bitstream_dec(
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_bit_buf_struct* it_bit_buff, ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
UWORD8* bitstream_config,
|
UWORD8* bitstream_config, WORD32 num_bytes, WORD32 num_bits_offset,
|
||||||
WORD32 num_bytes,
|
|
||||||
WORD32 num_bits_offset,
|
|
||||||
WORD32* num_bits_read);
|
WORD32* num_bits_read);
|
||||||
|
|
||||||
WORD32 impd_process_drc_bitstream_dec_config(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
WORD32 impd_process_drc_bitstream_dec_config(
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_bit_buf_struct* it_bit_buff, ia_drc_config* pstr_drc_config,
|
||||||
UWORD8* bitstream_config,
|
UWORD8* bitstream_config, WORD32 num_bytes);
|
||||||
WORD32 num_bytes);
|
|
||||||
|
|
||||||
WORD32 impd_process_drc_bitstream_dec_gain(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
WORD32 impd_process_drc_bitstream_dec_gain(
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_bit_buf_struct* it_bit_buff, ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_gain_struct* pstr_drc_gain,
|
ia_drc_gain_struct* pstr_drc_gain, UWORD8* bitstream_gain, WORD32 num_bytes,
|
||||||
UWORD8* bitstream_gain,
|
WORD32 num_bits_offset, WORD32* num_bits_read);
|
||||||
WORD32 num_bytes,
|
|
||||||
WORD32 num_bits_offset,
|
|
||||||
WORD32* num_bits_read);
|
|
||||||
|
|
||||||
WORD32 impd_process_drc_bitstream_dec_loudness_info_set(ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
WORD32 impd_process_drc_bitstream_dec_loudness_info_set(
|
||||||
|
ia_drc_bits_dec_struct* p_uni_drc_bs_dec_struct,
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
UWORD8* bitstream_loudness,
|
UWORD8* bitstream_loudness, WORD32 num_bytes_loudness);
|
||||||
WORD32 num_bytes_loudness
|
|
||||||
);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,7 @@
|
||||||
#define IMPD_DRC_UNI_COMMON_H
|
#define IMPD_DRC_UNI_COMMON_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define AMD1_SYNTAX 0
|
#define AMD1_SYNTAX 0
|
||||||
|
|
@ -62,7 +61,6 @@ extern "C"
|
||||||
#define DOWNMIX_ID_COUNT_MAX 8
|
#define DOWNMIX_ID_COUNT_MAX 8
|
||||||
#define MAX_SIGNAL_DELAY 4500
|
#define MAX_SIGNAL_DELAY 4500
|
||||||
|
|
||||||
|
|
||||||
#define DELAY_MODE_REGULAR_DELAY 0
|
#define DELAY_MODE_REGULAR_DELAY 0
|
||||||
#define DELAY_MODE_LOW_DELAY 1
|
#define DELAY_MODE_LOW_DELAY 1
|
||||||
#define DELAY_MODE_DEFAULT DELAY_MODE_REGULAR_DELAY
|
#define DELAY_MODE_DEFAULT DELAY_MODE_REGULAR_DELAY
|
||||||
|
|
@ -121,9 +119,6 @@ extern "C"
|
||||||
#define UNIDRCCONFEXT_TERM 0x0
|
#define UNIDRCCONFEXT_TERM 0x0
|
||||||
#define UNIDRCINTERFACEEXT_TERM 0x0
|
#define UNIDRCINTERFACEEXT_TERM 0x0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define MAXPACKETLOSSTIME 2.5f
|
#define MAXPACKETLOSSTIME 2.5f
|
||||||
|
|
||||||
#define SLOPE_FACTOR_DB_TO_LINEAR 0.1151f
|
#define SLOPE_FACTOR_DB_TO_LINEAR 0.1151f
|
||||||
|
|
@ -139,8 +134,7 @@ extern "C"
|
||||||
#define bool WORD32
|
#define bool WORD32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct ia_drc_sel_proc_output_struct
|
typedef struct ia_drc_sel_proc_output_struct {
|
||||||
{
|
|
||||||
FLOAT32 output_peak_level_db;
|
FLOAT32 output_peak_level_db;
|
||||||
FLOAT32 loudness_normalization_gain_db;
|
FLOAT32 loudness_normalization_gain_db;
|
||||||
FLOAT32 output_loudness;
|
FLOAT32 output_loudness;
|
||||||
|
|
@ -160,7 +154,6 @@ typedef struct ia_drc_sel_proc_output_struct
|
||||||
FLOAT32 compress;
|
FLOAT32 compress;
|
||||||
WORD32 drc_characteristic_target;
|
WORD32 drc_characteristic_target;
|
||||||
|
|
||||||
|
|
||||||
} ia_drc_sel_proc_output_struct;
|
} ia_drc_sel_proc_output_struct;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -21,22 +21,18 @@
|
||||||
#define IMPD_DRC_UNI_DEC_H
|
#define IMPD_DRC_UNI_DEC_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WORD32 impd_select_drc_coefficients(ia_drc_config* drc_config,
|
WORD32 impd_select_drc_coefficients(
|
||||||
ia_uni_drc_coeffs_struct** drc_coefficients_drc,
|
ia_drc_config* drc_config, ia_uni_drc_coeffs_struct** drc_coefficients_drc,
|
||||||
WORD32* drc_coefficients_selected);
|
WORD32* drc_coefficients_selected);
|
||||||
|
|
||||||
WORD32 impd_init_selected_drc_set(ia_drc_config* drc_config,
|
WORD32 impd_init_selected_drc_set(
|
||||||
ia_drc_params_struct* ia_drc_params_struct,
|
ia_drc_config* drc_config, ia_drc_params_struct* ia_drc_params_struct,
|
||||||
WORD32 audio_num_chan,
|
WORD32 audio_num_chan, WORD32 drc_set_id_selected,
|
||||||
WORD32 drc_set_id_selected,
|
WORD32 downmix_id_selected, ia_filter_banks_struct* ia_filter_banks_struct,
|
||||||
WORD32 downmix_id_selected,
|
ia_overlap_params_struct* pstr_overlap_params);
|
||||||
ia_filter_banks_struct* ia_filter_banks_struct,
|
|
||||||
ia_overlap_params_struct* pstr_overlap_params
|
|
||||||
);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,7 @@
|
||||||
#define EQ_FILTER_DOMAIN_SUBBAND (1 << 1)
|
#define EQ_FILTER_DOMAIN_SUBBAND (1 << 1)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,8 @@
|
||||||
#ifndef IMPD_DRC_UNI_GAIN_DEC_H
|
#ifndef IMPD_DRC_UNI_GAIN_DEC_H
|
||||||
#define IMPD_DRC_UNI_GAIN_DEC_H
|
#define IMPD_DRC_UNI_GAIN_DEC_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -63,7 +58,6 @@ typedef struct {
|
||||||
FLOAT32 boost;
|
FLOAT32 boost;
|
||||||
} ia_interp_params_struct;
|
} ia_interp_params_struct;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WORD32 drc_instructions_index;
|
WORD32 drc_instructions_index;
|
||||||
WORD32 drc_coeff_idx;
|
WORD32 drc_coeff_idx;
|
||||||
|
|
@ -86,50 +80,34 @@ typedef struct {
|
||||||
} ia_drc_params_struct;
|
} ia_drc_params_struct;
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_gain_buf_init(WORD32 index,
|
impd_gain_buf_init(WORD32 index, WORD32 gain_element_count,
|
||||||
WORD32 gain_element_count,
|
WORD32 drc_frame_size, ia_gain_buffer_struct* pstr_gain_buf);
|
||||||
WORD32 drc_frame_size,
|
|
||||||
ia_gain_buffer_struct* pstr_gain_buf);
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_advance_buf(WORD32 drc_frame_size,
|
impd_advance_buf(WORD32 drc_frame_size, ia_gain_buffer_struct* pstr_gain_buf);
|
||||||
ia_gain_buffer_struct* pstr_gain_buf);
|
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_map_gain (
|
impd_map_gain(FLOAT32 gain_in_db, FLOAT32* gain_out_db);
|
||||||
FLOAT32 gain_in_db,
|
|
||||||
FLOAT32* gain_out_db);
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_conv_to_linear_domain(ia_interp_params_struct* interp_params_str,
|
impd_conv_to_linear_domain(ia_interp_params_struct* interp_params_str,
|
||||||
WORD32 drc_band,
|
WORD32 drc_band, FLOAT32 loc_db_gain,
|
||||||
FLOAT32 loc_db_gain,
|
|
||||||
FLOAT32 in_param_db_slope,
|
FLOAT32 in_param_db_slope,
|
||||||
FLOAT32* out_param_lin_gain,
|
FLOAT32* out_param_lin_gain,
|
||||||
FLOAT32* out_param_lin_slope);
|
FLOAT32* out_param_lin_slope);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
|
impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
|
||||||
WORD32 drc_band,
|
WORD32 drc_band, WORD32 gain_step_tdomain,
|
||||||
WORD32 gain_step_tdomain,
|
FLOAT32 gain0, FLOAT32 gain1, FLOAT32 slope0,
|
||||||
FLOAT32 gain0,
|
FLOAT32 slope1, FLOAT32* result);
|
||||||
FLOAT32 gain1,
|
|
||||||
FLOAT32 slope0,
|
|
||||||
FLOAT32 slope1,
|
|
||||||
FLOAT32* result);
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_concatenate_segments(WORD32 drc_frame_size,
|
impd_concatenate_segments(WORD32 drc_frame_size, WORD32 drc_band,
|
||||||
WORD32 drc_band,
|
|
||||||
ia_interp_params_struct* interp_params_str,
|
ia_interp_params_struct* interp_params_str,
|
||||||
ia_spline_nodes_struct* str_spline_nodes,
|
ia_spline_nodes_struct* str_spline_nodes,
|
||||||
ia_interp_buf_struct* buf_interpolation);
|
ia_interp_buf_struct* buf_interpolation);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
#ifndef IMPD_DRC_UNI_INTERFACE_H
|
#ifndef IMPD_DRC_UNI_INTERFACE_H
|
||||||
#define IMPD_DRC_UNI_INTERFACE_H
|
#define IMPD_DRC_UNI_INTERFACE_H
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WORD32 ext_size_bits;
|
WORD32 ext_size_bits;
|
||||||
WORD32 ext_bit_size;
|
WORD32 ext_bit_size;
|
||||||
|
|
@ -47,7 +46,8 @@ typedef struct {
|
||||||
WORD32 drc_feature_req_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
WORD32 drc_feature_req_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
WORD32 requested_num_drc_effects[MAX_NUM_DRC_FEATURE_REQUESTS];
|
WORD32 requested_num_drc_effects[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
WORD32 desired_num_drc_effects_of_requested[MAX_NUM_DRC_FEATURE_REQUESTS];
|
WORD32 desired_num_drc_effects_of_requested[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
WORD32 requested_drc_effect_type[MAX_NUM_DRC_FEATURE_REQUESTS][MAX_NUM_DRC_EFFECT_TYPE_REQUESTS];
|
WORD32 requested_drc_effect_type[MAX_NUM_DRC_FEATURE_REQUESTS]
|
||||||
|
[MAX_NUM_DRC_EFFECT_TYPE_REQUESTS];
|
||||||
WORD32 requested_dyn_rng_measurement_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
WORD32 requested_dyn_rng_measurement_type[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
WORD32 requested_dyn_range_is_single_val_flag[MAX_NUM_DRC_FEATURE_REQUESTS];
|
WORD32 requested_dyn_range_is_single_val_flag[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
FLOAT32 requested_dyn_range_value[MAX_NUM_DRC_FEATURE_REQUESTS];
|
FLOAT32 requested_dyn_range_value[MAX_NUM_DRC_FEATURE_REQUESTS];
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,8 @@
|
||||||
#ifndef IMPD_DRC_UNI_LOUD_EQ_H
|
#ifndef IMPD_DRC_UNI_LOUD_EQ_H
|
||||||
#define IMPD_DRC_UNI_LOUD_EQ_H
|
#define IMPD_DRC_UNI_LOUD_EQ_H
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,11 @@
|
||||||
#ifndef IMPD_DRC_UNI_MULTI_BAND_H
|
#ifndef IMPD_DRC_UNI_MULTI_BAND_H
|
||||||
#define IMPD_DRC_UNI_MULTI_BAND_H
|
#define IMPD_DRC_UNI_MULTI_BAND_H
|
||||||
|
|
||||||
#define DRC_SUBBAND_COUNT_WITH_AUDIO_CODEC_FILTERBANK_MAX FILTER_BANK_PARAMETER_COUNT
|
#define DRC_SUBBAND_COUNT_WITH_AUDIO_CODEC_FILTERBANK_MAX \
|
||||||
|
FILTER_BANK_PARAMETER_COUNT
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -36,35 +36,29 @@ typedef struct {
|
||||||
} ia_group_overlap_params_struct;
|
} ia_group_overlap_params_struct;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ia_group_overlap_params_struct str_group_overlap_params[CHANNEL_GROUP_COUNT_MAX];
|
ia_group_overlap_params_struct
|
||||||
|
str_group_overlap_params[CHANNEL_GROUP_COUNT_MAX];
|
||||||
} ia_overlap_params_struct;
|
} ia_overlap_params_struct;
|
||||||
|
|
||||||
|
WORD32
|
||||||
|
impd_fcenter_norm_sb_init(WORD32 num_subbands, FLOAT32* fcenter_norm_subband);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_fcenter_norm_sb_init(WORD32 num_subbands,
|
impd_generate_slope(WORD32 num_subbands, FLOAT32* fcenter_norm_subband,
|
||||||
FLOAT32* fcenter_norm_subband);
|
FLOAT32 fcross_norm_lo, FLOAT32 fcross_norm_hi,
|
||||||
|
|
||||||
WORD32
|
|
||||||
impd_generate_slope (WORD32 num_subbands,
|
|
||||||
FLOAT32* fcenter_norm_subband,
|
|
||||||
FLOAT32 fcross_norm_lo,
|
|
||||||
FLOAT32 fcross_norm_hi,
|
|
||||||
FLOAT32* response);
|
FLOAT32* response);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_generate_overlap_weights (WORD32 num_drc_bands,
|
impd_generate_overlap_weights(
|
||||||
WORD32 drc_band_type,
|
WORD32 num_drc_bands, WORD32 drc_band_type,
|
||||||
ia_gain_params_struct* gain_params,
|
ia_gain_params_struct* gain_params, WORD32 dec_subband_count,
|
||||||
WORD32 dec_subband_count,
|
|
||||||
ia_group_overlap_params_struct* pstr_group_overlap_params);
|
ia_group_overlap_params_struct* pstr_group_overlap_params);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_init_overlap_weight ( ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
impd_init_overlap_weight(
|
||||||
|
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc,
|
||||||
ia_drc_instructions_struct* str_drc_instruction_str,
|
ia_drc_instructions_struct* str_drc_instruction_str,
|
||||||
WORD32 sub_band_domain_mode,
|
WORD32 sub_band_domain_mode, ia_overlap_params_struct* pstr_overlap_params);
|
||||||
ia_overlap_params_struct* pstr_overlap_params);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,69 +26,62 @@ impd_dec_ducking_scaling(ia_bit_buf_struct* it_bit_buff,
|
||||||
FLOAT32* ducking_scaling);
|
FLOAT32* ducking_scaling);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_loudness_info(ia_bit_buf_struct* it_bit_buff,
|
impd_parse_loudness_info(ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
||||||
WORD32 version,
|
|
||||||
ia_loudness_info_struct* loudness_info);
|
ia_loudness_info_struct* loudness_info);
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_loudness_info_set_ext(ia_bit_buf_struct* it_bit_buff,
|
impd_parse_loudness_info_set_ext(
|
||||||
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_drc_loudness_info_set_struct* loudness_info_set);
|
ia_drc_loudness_info_set_struct* loudness_info_set);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_sel_drc_coeff(ia_drc_config* drc_config,
|
impd_sel_drc_coeff(
|
||||||
WORD32 location,
|
ia_drc_config* drc_config, WORD32 location,
|
||||||
ia_uni_drc_coeffs_struct** str_p_loc_drc_coefficients_uni_drc);
|
ia_uni_drc_coeffs_struct** str_p_loc_drc_coefficients_uni_drc);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_parse_instructions_basic(ia_bit_buf_struct* it_bit_buff,
|
impd_drc_parse_instructions_basic(
|
||||||
ia_drc_config* drc_config,
|
ia_bit_buf_struct* it_bit_buff, ia_drc_config* drc_config,
|
||||||
ia_drc_instructions_basic_struct* str_drc_instructions_basic);
|
ia_drc_instructions_basic_struct* str_drc_instructions_basic);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_drc_instructions_uni_drc(ia_bit_buf_struct* it_bit_buff,
|
impd_parse_drc_instructions_uni_drc(
|
||||||
WORD32 version,
|
ia_bit_buf_struct* it_bit_buff, WORD32 version, ia_drc_config* drc_config,
|
||||||
ia_drc_config* drc_config,
|
|
||||||
ia_channel_layout_struct* channel_layout,
|
ia_channel_layout_struct* channel_layout,
|
||||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||||
ia_drc_instructions_struct* str_drc_instruction_str);
|
ia_drc_instructions_struct* str_drc_instruction_str);
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_gain_set_params(ia_bit_buf_struct* it_bit_buff,
|
impd_parse_gain_set_params(ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
||||||
WORD32 version,
|
|
||||||
WORD32* gain_seq_idx,
|
WORD32* gain_seq_idx,
|
||||||
ia_gain_set_params_struct* gain_set_params);
|
ia_gain_set_params_struct* gain_set_params);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_parse_coeff(ia_bit_buf_struct* it_bit_buff,
|
impd_drc_parse_coeff(
|
||||||
WORD32 version,
|
ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
||||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||||
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc);
|
ia_uni_drc_coeffs_struct* str_p_loc_drc_coefficients_uni_drc);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_dwnmix_instructions(ia_bit_buf_struct* it_bit_buff,
|
impd_parse_dwnmix_instructions(
|
||||||
WORD32 version,
|
ia_bit_buf_struct* it_bit_buff, WORD32 version,
|
||||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||||
ia_channel_layout_struct* channel_layout,
|
ia_channel_layout_struct* channel_layout,
|
||||||
ia_downmix_instructions_struct* dwnmix_instructions);
|
ia_downmix_instructions_struct* dwnmix_instructions);
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_drc_config(
|
impd_parse_drc_config(ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
|
||||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||||
ia_drc_config* drc_config
|
ia_drc_config* drc_config);
|
||||||
);
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_loudness_info_set(ia_bit_buf_struct* it_bit_buff,
|
impd_parse_loudness_info_set(
|
||||||
|
ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
ia_drc_params_bs_dec_struct* ia_drc_params_struct,
|
||||||
ia_drc_loudness_info_set_struct* loudness_info_set);
|
ia_drc_loudness_info_set_struct* loudness_info_set);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parse_drc_gain_sequence(
|
impd_parse_drc_gain_sequence(ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
|
||||||
ia_drc_bits_dec_struct* pstr_drc_uni_bs_dec,
|
ia_drc_bits_dec_struct* pstr_drc_uni_bs_dec,
|
||||||
ia_gain_set_params_struct* gain_set_params,
|
ia_gain_set_params_struct* gain_set_params,
|
||||||
ia_drc_gain_sequence_struct* drc_gain_sequence);
|
ia_drc_gain_sequence_struct* drc_gain_sequence);
|
||||||
|
|
@ -97,11 +90,9 @@ WORD32
|
||||||
impd_parse_uni_drc_gain_ext(ia_bit_buf_struct* it_bit_buff,
|
impd_parse_uni_drc_gain_ext(ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_uni_drc_gain_ext_struct* uni_drc_gain_ext);
|
ia_uni_drc_gain_ext_struct* uni_drc_gain_ext);
|
||||||
|
|
||||||
WORD32 impd_drc_uni_gain_read(
|
WORD32 impd_drc_uni_gain_read(ia_bit_buf_struct* it_bit_buff,
|
||||||
ia_bit_buf_struct* it_bit_buff,
|
|
||||||
ia_drc_bits_dec_struct* pstr_drc_uni_bs_dec,
|
ia_drc_bits_dec_struct* pstr_drc_uni_bs_dec,
|
||||||
ia_drc_config* drc_config,
|
ia_drc_config* drc_config,
|
||||||
ia_drc_gain_struct* pstr_uni_drc_gain);
|
ia_drc_gain_struct* pstr_uni_drc_gain);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,7 @@
|
||||||
#define IMPD_DRC_UNI_PROCESS_AUDIO_H
|
#define IMPD_DRC_UNI_PROCESS_AUDIO_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -31,8 +30,6 @@ typedef struct {
|
||||||
FLOAT32** non_interleaved_audio;
|
FLOAT32** non_interleaved_audio;
|
||||||
} ia_audio_band_buffer_struct;
|
} ia_audio_band_buffer_struct;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_apply_gains_subband(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
impd_apply_gains_subband(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||||
const WORD32 drc_instructions_index,
|
const WORD32 drc_instructions_index,
|
||||||
|
|
@ -42,7 +39,6 @@ impd_apply_gains_subband(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||||
FLOAT32* deinterleaved_audio_re[],
|
FLOAT32* deinterleaved_audio_re[],
|
||||||
FLOAT32* deinterleaved_audio_im[]);
|
FLOAT32* deinterleaved_audio_im[]);
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||||
const WORD32 drc_instructions_index,
|
const WORD32 drc_instructions_index,
|
||||||
|
|
@ -52,7 +48,6 @@ impd_filter_banks_process(ia_drc_instructions_struct* pstr_drc_instruction_arr,
|
||||||
ia_filter_banks_struct* ia_filter_banks_struct,
|
ia_filter_banks_struct* ia_filter_banks_struct,
|
||||||
const WORD32 passThru);
|
const WORD32 passThru);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
#define SELECTION_FLAG_DRC_TARGET_LOUDNESS_MATCH (1 << 0)
|
#define SELECTION_FLAG_DRC_TARGET_LOUDNESS_MATCH (1 << 0)
|
||||||
#define SELECTION_FLAG_EXPLICIT_PEAK_INFO_PRESENT (1 << 1)
|
#define SELECTION_FLAG_EXPLICIT_PEAK_INFO_PRESENT (1 << 1)
|
||||||
|
|
||||||
|
|
@ -39,9 +38,9 @@ typedef struct {
|
||||||
WORD32 selection_flags;
|
WORD32 selection_flags;
|
||||||
} ia_selection_candidate_info_struct;
|
} ia_selection_candidate_info_struct;
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_validate_requested_drc_feature(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct);
|
impd_validate_requested_drc_feature(
|
||||||
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_map_requested_effect_bit_idx(WORD32 requested_effect_type,
|
impd_map_requested_effect_bit_idx(WORD32 requested_effect_type,
|
||||||
|
|
@ -61,82 +60,78 @@ WORD32
|
||||||
impd_get_dependent_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
impd_get_dependent_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_get_dependent_drc_instructions(const ia_drc_config* drc_config,
|
impd_get_dependent_drc_instructions(
|
||||||
|
const ia_drc_config* drc_config,
|
||||||
const ia_drc_instructions_struct* str_drc_instruction_str,
|
const ia_drc_instructions_struct* str_drc_instruction_str,
|
||||||
ia_drc_instructions_struct** ppstr_drc_instructions_dependent);
|
ia_drc_instructions_struct** ppstr_drc_instructions_dependent);
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_select_drcs_without_compr_effects (ia_drc_config* pstr_drc_config,
|
impd_select_drcs_without_compr_effects(
|
||||||
WORD32* match_found_flag,
|
ia_drc_config* pstr_drc_config, WORD32* match_found_flag,
|
||||||
WORD32* selection_candidate_count,
|
WORD32* selection_candidate_count,
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_match_effect_type_attempt(ia_drc_config* pstr_drc_config,
|
impd_match_effect_type_attempt(
|
||||||
WORD32 requested_effect_type,
|
ia_drc_config* pstr_drc_config, WORD32 requested_effect_type,
|
||||||
WORD32 stateRequested,
|
WORD32 stateRequested, WORD32* match_found_flag,
|
||||||
WORD32* match_found_flag,
|
|
||||||
WORD32* selection_candidate_count,
|
WORD32* selection_candidate_count,
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_match_effect_types(ia_drc_config* pstr_drc_config,
|
impd_match_effect_types(
|
||||||
WORD32 total_effect_type_requested,
|
ia_drc_config* pstr_drc_config, WORD32 total_effect_type_requested,
|
||||||
WORD32 desired_effect_type_requested,
|
WORD32 desired_effect_type_requested, WORD32* requested_effect_type,
|
||||||
WORD32* requested_effect_type,
|
|
||||||
WORD32* selection_candidate_count,
|
WORD32* selection_candidate_count,
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||||
|
|
||||||
WORD32 impd_match_dynamic_range(ia_drc_config* pstr_drc_config,
|
WORD32 impd_match_dynamic_range(
|
||||||
|
ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||||
WORD32 num_drc_requests,
|
WORD32 num_drc_requests, WORD32* selection_candidate_count,
|
||||||
WORD32* selection_candidate_count,
|
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_match_drc_characteristic_attempt(ia_drc_config* pstr_drc_config,
|
impd_match_drc_characteristic_attempt(
|
||||||
WORD32 requested_drc_characteristic,
|
ia_drc_config* pstr_drc_config, WORD32 requested_drc_characteristic,
|
||||||
WORD32* match_found_flag,
|
WORD32* match_found_flag, WORD32* selection_candidate_count,
|
||||||
WORD32* selection_candidate_count,
|
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_match_drc_characteristic(ia_drc_config* pstr_drc_config,
|
impd_match_drc_characteristic(
|
||||||
WORD32 requested_drc_characteristic,
|
ia_drc_config* pstr_drc_config, WORD32 requested_drc_characteristic,
|
||||||
WORD32* selection_candidate_count,
|
WORD32* selection_candidate_count,
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||||
|
|
||||||
VOID impd_select_drc_coeff3(ia_drc_config* drc_config,
|
VOID impd_select_drc_coeff3(
|
||||||
|
ia_drc_config* drc_config,
|
||||||
ia_uni_drc_coeffs_struct** str_p_loc_drc_coefficients_uni_drc);
|
ia_uni_drc_coeffs_struct** str_p_loc_drc_coefficients_uni_drc);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_set_preselection(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
impd_drc_set_preselection(
|
||||||
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||||
ia_drc_config* pstr_drc_config,
|
ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
WORD32 restrict_to_drc_with_album_loudness,
|
WORD32 restrict_to_drc_with_album_loudness,
|
||||||
WORD32* selection_candidate_count,
|
WORD32* selection_candidate_count,
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info);
|
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||||
|
|
||||||
WORD32 impd_drc_set_final_selection(ia_drc_config* pstr_drc_config,
|
WORD32 impd_drc_set_final_selection(
|
||||||
|
ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||||
WORD32* selection_candidate_count,
|
WORD32* selection_candidate_count,
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info
|
ia_selection_candidate_info_struct* selection_candidate_info);
|
||||||
);
|
|
||||||
|
|
||||||
WORD32 impd_match_eq_set_purpose(ia_drc_config* drc_config,
|
WORD32 impd_match_eq_set_purpose(
|
||||||
WORD32 eq_set_purpose_requested,
|
ia_drc_config* drc_config, WORD32 eq_set_purpose_requested,
|
||||||
WORD32* eq_set_id_valid_flag,
|
WORD32* eq_set_id_valid_flag, WORD32* selection_candidate_count,
|
||||||
WORD32* selection_candidate_count,
|
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info,
|
ia_selection_candidate_info_struct* selection_candidate_info,
|
||||||
ia_selection_candidate_info_struct* selection_candidate_info_step_2
|
ia_selection_candidate_info_struct* selection_candidate_info_step_2);
|
||||||
);
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_select_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
impd_select_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||||
WORD32* drc_set_id_selected
|
WORD32* drc_set_id_selected);
|
||||||
);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,13 @@ WORD32
|
||||||
impd_drc_sel_proc_init_dflt(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
impd_drc_sel_proc_init_dflt(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_sel_proc_init_sel_proc_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
impd_drc_sel_proc_init_sel_proc_params(
|
||||||
|
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||||
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct);
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_drc_sel_proc_init_interface_params(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
impd_drc_sel_proc_init_interface_params(
|
||||||
|
ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
|
||||||
ia_drc_interface_struct* pstr_drc_interface);
|
ia_drc_interface_struct* pstr_drc_interface);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,13 @@ impd_signal_peak_level_info(ia_drc_config* pstr_drc_config,
|
||||||
const WORD32 album_mode,
|
const WORD32 album_mode,
|
||||||
const WORD32 num_compression_eq_count,
|
const WORD32 num_compression_eq_count,
|
||||||
const WORD32* num_compression_eq_id,
|
const WORD32* num_compression_eq_id,
|
||||||
WORD32* peak_info_count,
|
WORD32* peak_info_count, WORD32 eq_set_id[],
|
||||||
WORD32 eq_set_id[],
|
|
||||||
FLOAT32 signal_peak_level[],
|
FLOAT32 signal_peak_level[],
|
||||||
WORD32 explicit_peak_information_present[]);
|
WORD32 explicit_peak_information_present[]);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_extract_loudness_peak_to_average_info(ia_loudness_info_struct* loudness_info,
|
impd_extract_loudness_peak_to_average_info(
|
||||||
|
ia_loudness_info_struct* loudness_info,
|
||||||
const WORD32 dyn_range_measurement_type,
|
const WORD32 dyn_range_measurement_type,
|
||||||
WORD32* loudness_peak_2_avg_value_present,
|
WORD32* loudness_peak_2_avg_value_present,
|
||||||
FLOAT32* loudness_peak_2_avg_value);
|
FLOAT32* loudness_peak_2_avg_value);
|
||||||
|
|
@ -48,40 +48,33 @@ impd_overall_loudness_present(const ia_loudness_info_struct* loudness_info,
|
||||||
WORD32* loudness_info_present);
|
WORD32* loudness_info_present);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_find_overall_loudness_info(ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
impd_find_overall_loudness_info(
|
||||||
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
const WORD32 requested_dwnmix_id,
|
const WORD32 requested_dwnmix_id, const WORD32 drc_set_id_requested,
|
||||||
const WORD32 drc_set_id_requested,
|
WORD32* overall_loudness_info_present, WORD32* loudness_info_count,
|
||||||
WORD32* overall_loudness_info_present,
|
|
||||||
WORD32* loudness_info_count,
|
|
||||||
ia_loudness_info_struct* loudness_info[]);
|
ia_loudness_info_struct* loudness_info[]);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_high_pass_loudness_adjust_info(const ia_loudness_info_struct* loudness_info,
|
impd_high_pass_loudness_adjust_info(
|
||||||
WORD32* loudness_hp_adjust_present,
|
const ia_loudness_info_struct* loudness_info,
|
||||||
FLOAT32* loudness_hp_adjust);
|
WORD32* loudness_hp_adjust_present, FLOAT32* loudness_hp_adjust);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_find_high_pass_loudness_adjust(
|
impd_find_high_pass_loudness_adjust(
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
const WORD32 requested_dwnmix_id,
|
const WORD32 requested_dwnmix_id, const WORD32 drc_set_id_requested,
|
||||||
const WORD32 drc_set_id_requested,
|
const WORD32 album_mode, const FLOAT32 device_cutoff_freq,
|
||||||
const WORD32 album_mode,
|
WORD32* loudness_hp_adjust_present, FLOAT32* loudness_hp_adjust);
|
||||||
const FLOAT32 device_cutoff_freq,
|
|
||||||
WORD32* loudness_hp_adjust_present,
|
|
||||||
FLOAT32* loudness_hp_adjust);
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_init_loudness_control (ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
impd_init_loudness_control(
|
||||||
|
ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
const WORD32 requested_dwnmix_id,
|
const WORD32 requested_dwnmix_id, const WORD32 drc_set_id_requested,
|
||||||
const WORD32 drc_set_id_requested,
|
const WORD32 num_compression_eq_count, const WORD32* num_compression_eq_id,
|
||||||
const WORD32 num_compression_eq_count,
|
WORD32* loudness_info_count, WORD32 eq_set_id[],
|
||||||
const WORD32* num_compression_eq_id,
|
FLOAT32 loudness_normalization_gain_db[], FLOAT32 loudness[]);
|
||||||
WORD32* loudness_info_count,
|
|
||||||
WORD32 eq_set_id[],
|
|
||||||
FLOAT32 loudness_normalization_gain_db[],
|
|
||||||
FLOAT32 loudness[]);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,4 @@
|
||||||
#ifndef IMPD_DRC_UNI_SHAPE_FILTER_H
|
#ifndef IMPD_DRC_UNI_SHAPE_FILTER_H
|
||||||
#define IMPD_DRC_UNI_SHAPE_FILTER_H
|
#define IMPD_DRC_UNI_SHAPE_FILTER_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,7 @@
|
||||||
#define IMPD_DRC_UNI_TABLES_H
|
#define IMPD_DRC_UNI_TABLES_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX (512 + 14)
|
#define N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX (512 + 14)
|
||||||
|
|
@ -47,7 +46,8 @@ typedef struct {
|
||||||
} ia_delta_gain_code_table_struct;
|
} ia_delta_gain_code_table_struct;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ia_delta_time_code_table_entry_struct delta_time_code_table[N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX];
|
ia_delta_time_code_table_entry_struct
|
||||||
|
delta_time_code_table[N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX];
|
||||||
} ia_tables_struct;
|
} ia_tables_struct;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -67,20 +67,19 @@ typedef struct {
|
||||||
} ia_cicp_node_characteristic_param;
|
} ia_cicp_node_characteristic_param;
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_init_tbls(const WORD32 num_gain_max_values,
|
impd_init_tbls(const WORD32 num_gain_max_values, ia_tables_struct* str_tables);
|
||||||
ia_tables_struct* str_tables);
|
|
||||||
|
|
||||||
void
|
void impd_gen_delta_time_code_tbl(
|
||||||
impd_gen_delta_time_code_tbl (const WORD32 num_gain_max_values,
|
const WORD32 num_gain_max_values,
|
||||||
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item);
|
ia_delta_time_code_table_entry_struct* delta_time_code_tbl_item);
|
||||||
|
|
||||||
void
|
void impd_get_delta_gain_code_tbl(
|
||||||
impd_get_delta_gain_code_tbl(const WORD32 gain_coding_profile,
|
const WORD32 gain_coding_profile,
|
||||||
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
ia_delta_gain_code_table_struct const** delta_time_code_tbl,
|
||||||
WORD32* num_entries);
|
WORD32* num_entries);
|
||||||
|
|
||||||
void
|
void impd_get_slope_code_tbl_and_size(
|
||||||
impd_get_slope_code_tbl_and_size(ia_slope_code_table_struct const** slope_code_tbl_entry,
|
ia_slope_code_table_struct const** slope_code_tbl_entry,
|
||||||
WORD32* num_slope_code_tbl_entries);
|
WORD32* num_slope_code_tbl_entries);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,7 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Type definitions */
|
/* Type definitions */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
pWORD8 pb_module_name;
|
pWORD8 pb_module_name;
|
||||||
pWORD8 ppb_class_names[16];
|
pWORD8 ppb_class_names[16];
|
||||||
WORD8 **ppppb_error_msg_pointers[2][16];
|
WORD8 **ppppb_error_msg_pointers[2][16];
|
||||||
|
|
@ -84,11 +83,9 @@ IA_ERRORCODE ia_error_handler(ia_error_info_struct *p_mod_err_info,
|
||||||
/* the following macro does a line job of returning back to the parent */
|
/* the following macro does a line job of returning back to the parent */
|
||||||
/* in case a fatal error occurs after calling the errorhandler */
|
/* in case a fatal error occurs after calling the errorhandler */
|
||||||
#define _IA_HANDLE_ERROR(p_mod_err_info, context, e) \
|
#define _IA_HANDLE_ERROR(p_mod_err_info, context, e) \
|
||||||
if((e) != IA_NO_ERROR) \
|
if ((e) != IA_NO_ERROR) { \
|
||||||
{ \
|
|
||||||
ia_error_handler((p_mod_err_info), (context), (e)); \
|
ia_error_handler((p_mod_err_info), (context), (e)); \
|
||||||
if((e) & IA_FATAL_ERROR) \
|
if ((e)&IA_FATAL_ERROR) return (e); \
|
||||||
return (e); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,7 @@
|
||||||
/* Type definitions */
|
/* Type definitions */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* standard memory table descriptor for libraries */
|
/* standard memory table descriptor for libraries */
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
UWORD32 ui_size; /* size of the memory in bytes */
|
UWORD32 ui_size; /* size of the memory in bytes */
|
||||||
UWORD32 ui_alignment; /* alignment in bytes */
|
UWORD32 ui_alignment; /* alignment in bytes */
|
||||||
UWORD32 ui_type; /* type of memory */
|
UWORD32 ui_type; /* type of memory */
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,8 @@
|
||||||
#ifndef IMPD_PARAMETRIC_DRC_DEC_H
|
#ifndef IMPD_PARAMETRIC_DRC_DEC_H
|
||||||
#define IMPD_PARAMETRIC_DRC_DEC_H
|
#define IMPD_PARAMETRIC_DRC_DEC_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct ia_2nd_order_filt_coeff_struct_t {
|
typedef struct ia_2nd_order_filt_coeff_struct_t {
|
||||||
|
|
@ -37,7 +34,6 @@ typedef struct ia_2nd_order_filt_state_struct_t {
|
||||||
} ia_2nd_order_filt_state_struct;
|
} ia_2nd_order_filt_state_struct;
|
||||||
|
|
||||||
typedef struct ia_parametric_drc_type_ff_params_struct_t {
|
typedef struct ia_parametric_drc_type_ff_params_struct_t {
|
||||||
|
|
||||||
WORD32 audio_num_chan;
|
WORD32 audio_num_chan;
|
||||||
WORD32 frame_size;
|
WORD32 frame_size;
|
||||||
WORD32 sub_band_domain_mode;
|
WORD32 sub_band_domain_mode;
|
||||||
|
|
@ -78,7 +74,6 @@ typedef struct ia_parametric_drc_type_ff_params_struct_t {
|
||||||
} ia_parametric_drc_type_ff_params_struct;
|
} ia_parametric_drc_type_ff_params_struct;
|
||||||
|
|
||||||
typedef struct ia_parametric_drc_type_lim_params_struct_t {
|
typedef struct ia_parametric_drc_type_lim_params_struct_t {
|
||||||
|
|
||||||
WORD32 audio_num_chan;
|
WORD32 audio_num_chan;
|
||||||
WORD32 frame_size;
|
WORD32 frame_size;
|
||||||
FLOAT32 level_estim_ch_weight[MAX_CHANNEL_COUNT];
|
FLOAT32 level_estim_ch_weight[MAX_CHANNEL_COUNT];
|
||||||
|
|
@ -130,21 +125,21 @@ typedef struct ia_parametric_drc_params_struct_t {
|
||||||
WORD32 dwnmix_id_from_drc_instructions[PARAM_DRC_INSTANCE_COUNT_MAX];
|
WORD32 dwnmix_id_from_drc_instructions[PARAM_DRC_INSTANCE_COUNT_MAX];
|
||||||
WORD32 channel_map[PARAM_DRC_INSTANCE_COUNT_MAX][MAX_CHANNEL_COUNT];
|
WORD32 channel_map[PARAM_DRC_INSTANCE_COUNT_MAX][MAX_CHANNEL_COUNT];
|
||||||
|
|
||||||
ia_parametric_drc_instance_params_struct str_parametric_drc_instance_params[PARAM_DRC_INSTANCE_COUNT_MAX];
|
ia_parametric_drc_instance_params_struct
|
||||||
|
str_parametric_drc_instance_params[PARAM_DRC_INSTANCE_COUNT_MAX];
|
||||||
|
|
||||||
} ia_parametric_drc_params_struct;
|
} ia_parametric_drc_params_struct;
|
||||||
|
|
||||||
WORD32 impd_init_parametric_drc( WORD32 drc_frame_size,
|
WORD32 impd_init_parametric_drc(
|
||||||
WORD32 sampling_rate,
|
WORD32 drc_frame_size, WORD32 sampling_rate, WORD32 sub_band_domain_mode,
|
||||||
WORD32 sub_band_domain_mode,
|
|
||||||
ia_parametric_drc_params_struct* pstr_parametric_drc_params);
|
ia_parametric_drc_params_struct* pstr_parametric_drc_params);
|
||||||
|
|
||||||
WORD32 impd_init_parametric_drc_after_config(ia_drc_config* pstr_drc_config,
|
WORD32 impd_init_parametric_drc_after_config(
|
||||||
|
ia_drc_config* pstr_drc_config,
|
||||||
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
ia_drc_loudness_info_set_struct* pstr_loudness_info,
|
||||||
ia_parametric_drc_params_struct* pstr_parametric_drc_params,
|
ia_parametric_drc_params_struct* pstr_parametric_drc_params,
|
||||||
pVOID* mem_ptr);
|
pVOID* mem_ptr);
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_init_lvl_est_filt_time(WORD32 level_estim_k_weighting_type,
|
impd_init_lvl_est_filt_time(WORD32 level_estim_k_weighting_type,
|
||||||
WORD32 sampling_rate,
|
WORD32 sampling_rate,
|
||||||
|
|
@ -152,47 +147,46 @@ impd_init_lvl_est_filt_time( WORD32 level_estim_k_weighting_type,
|
||||||
ia_2nd_order_filt_coeff_struct* rlb_filt_coeff);
|
ia_2nd_order_filt_coeff_struct* rlb_filt_coeff);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_init_lvl_est_filt_subband( WORD32 level_estim_k_weighting_type,
|
impd_init_lvl_est_filt_subband(
|
||||||
WORD32 sampling_rate,
|
WORD32 level_estim_k_weighting_type, WORD32 sampling_rate,
|
||||||
WORD32 sub_band_domain_mode,
|
WORD32 sub_band_domain_mode, WORD32 sub_band_count,
|
||||||
WORD32 sub_band_count,
|
WORD32 sub_band_compensation_type, FLOAT32* weighting_filt,
|
||||||
WORD32 sub_band_compensation_type,
|
|
||||||
FLOAT32 *weighting_filt,
|
|
||||||
ia_2nd_order_filt_coeff_struct* filt_coeff_subband);
|
ia_2nd_order_filt_coeff_struct* filt_coeff_subband);
|
||||||
|
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parametric_ffwd_type_drc_reset(ia_parametric_drc_type_ff_params_struct* pstr_parametric_ffwd_type_drc_params);
|
impd_parametric_ffwd_type_drc_reset(ia_parametric_drc_type_ff_params_struct*
|
||||||
|
pstr_parametric_ffwd_type_drc_params);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parametric_lim_type_drc_reset(WORD32 instance_idx,
|
impd_parametric_lim_type_drc_reset(WORD32 instance_idx,
|
||||||
ia_parametric_drc_type_lim_params_struct* pstr_parametric_lim_type_drc_params);
|
ia_parametric_drc_type_lim_params_struct*
|
||||||
|
pstr_parametric_lim_type_drc_params);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parametric_drc_instance_process (FLOAT32* audio_in_out_buf[],
|
impd_parametric_drc_instance_process(
|
||||||
FLOAT32* audio_real_buff[],
|
FLOAT32* audio_in_out_buf[], FLOAT32* audio_real_buff[],
|
||||||
FLOAT32* audio_imag_buff[],
|
FLOAT32* audio_imag_buff[],
|
||||||
ia_parametric_drc_params_struct* pstr_parametric_drc_params,
|
ia_parametric_drc_params_struct* pstr_parametric_drc_params,
|
||||||
ia_parametric_drc_instance_params_struct* pstr_parametric_drc_instance_params);
|
ia_parametric_drc_instance_params_struct*
|
||||||
|
pstr_parametric_drc_instance_params);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parametric_ffwd_type_drc_process(FLOAT32* audio_in_out_buf[],
|
impd_parametric_ffwd_type_drc_process(FLOAT32* audio_in_out_buf[],
|
||||||
FLOAT32* audio_real_buff[],
|
FLOAT32* audio_real_buff[],
|
||||||
FLOAT32* audio_imag_buff[],
|
FLOAT32* audio_imag_buff[],
|
||||||
WORD32 nodeIdx,
|
WORD32 nodeIdx,
|
||||||
ia_parametric_drc_type_ff_params_struct* pstr_parametric_ffwd_type_drc_params,
|
ia_parametric_drc_type_ff_params_struct*
|
||||||
|
pstr_parametric_ffwd_type_drc_params,
|
||||||
ia_spline_nodes_struct* str_spline_nodes);
|
ia_spline_nodes_struct* str_spline_nodes);
|
||||||
|
|
||||||
WORD32
|
WORD32
|
||||||
impd_parametric_lim_type_drc_process(FLOAT32* audio_in_out_buf[],
|
impd_parametric_lim_type_drc_process(FLOAT32* audio_in_out_buf[],
|
||||||
FLOAT32 loudness_normalization_gain_db,
|
FLOAT32 loudness_normalization_gain_db,
|
||||||
ia_parametric_drc_type_lim_params_struct* pstr_parametric_lim_type_drc_params,
|
ia_parametric_drc_type_lim_params_struct*
|
||||||
|
pstr_parametric_lim_type_drc_params,
|
||||||
FLOAT32* lpcm_gains);
|
FLOAT32* lpcm_gains);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,6 @@ typedef unsigned long long * pUWORD64;/* puh pUWORD64 puh_count 8 */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef float FLOAT32; /* f FLOAT32 f_count 4 */
|
typedef float FLOAT32; /* f FLOAT32 f_count 4 */
|
||||||
typedef float* pFLOAT32; /* pf pFLOAT32 pf_count 4 */
|
typedef float* pFLOAT32; /* pf pFLOAT32 pf_count 4 */
|
||||||
typedef double FLOAT64; /* d UFLOAT64 d_count 8 */
|
typedef double FLOAT64; /* d UFLOAT64 d_count 8 */
|
||||||
|
|
@ -111,4 +110,3 @@ typedef ULOOPIDX ULOOPINDEX;/* ulp SLOOPIDX ulp_index */
|
||||||
#define PLATFORM_INLINE __inline
|
#define PLATFORM_INLINE __inline
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -723,8 +723,8 @@ VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states,
|
||||||
filter_states[3 * M] = 0;
|
filter_states[3 * M] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID ixheaacd_inv_emodulation(
|
VOID ixheaacd_inv_emodulation(WORD32 *qmf_real,
|
||||||
WORD32 *qmf_real, ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
ia_sbr_qmf_filter_bank_struct *syn_qmf,
|
||||||
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
|
||||||
if (syn_qmf->no_channels == 64)
|
if (syn_qmf->no_channels == 64)
|
||||||
ixheaacd_cos_sin_mod(qmf_real, syn_qmf, qmf_dec_tables_ptr->w_32,
|
ixheaacd_cos_sin_mod(qmf_real, syn_qmf, qmf_dec_tables_ptr->w_32,
|
||||||
|
|
|
||||||
|
|
@ -256,8 +256,10 @@ VOID ixheaacd_tns_ar_filter_fixed_dec(WORD32 *spectrum, WORD32 size, WORD32 inc,
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID ixheaacd_tns_ar_filter_fixed_non_neon_armv7(WORD32 *spectrum, WORD32 size,
|
VOID ixheaacd_tns_ar_filter_fixed_non_neon_armv7(WORD32 *spectrum, WORD32 size,
|
||||||
WORD32 inc, WORD32 *lpc, WORD32 order,
|
WORD32 inc, WORD32 *lpc,
|
||||||
WORD32 shift_value, WORD scale_spec) {
|
WORD32 order,
|
||||||
|
WORD32 shift_value,
|
||||||
|
WORD scale_spec) {
|
||||||
WORD32 i, j;
|
WORD32 i, j;
|
||||||
WORD32 y, state[MAX_ORDER + 1];
|
WORD32 y, state[MAX_ORDER + 1];
|
||||||
WORD32 acc;
|
WORD32 acc;
|
||||||
|
|
|
||||||
|
|
@ -647,8 +647,7 @@ WORD32 ixheaacd_aacdec_decodeframe(
|
||||||
it_bit_buff, ptr_ics_info, object_type,
|
it_bit_buff, ptr_ics_info, object_type,
|
||||||
aac_dec_handle->samples_per_frame, LEFT);
|
aac_dec_handle->samples_per_frame, LEFT);
|
||||||
|
|
||||||
if(temp!=0)
|
if (temp != 0) {
|
||||||
{
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -706,8 +705,9 @@ WORD32 ixheaacd_aacdec_decodeframe(
|
||||||
ixheaacd_extension_payload(it_bit_buff, cnt_bits);
|
ixheaacd_extension_payload(it_bit_buff, cnt_bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((object_type == AOT_ER_AAC_ELD) || (object_type == AOT_ER_AAC_LD))
|
if (((object_type == AOT_ER_AAC_ELD) ||
|
||||||
&& (p_obj_exhaacplus_dec->aac_config.ld_decoder != 1)) {
|
(object_type == AOT_ER_AAC_LD)) &&
|
||||||
|
(p_obj_exhaacplus_dec->aac_config.ld_decoder != 1)) {
|
||||||
if (it_bit_buff->cnt_bits) {
|
if (it_bit_buff->cnt_bits) {
|
||||||
WORD32 alignment = it_bit_buff->bit_pos & 0x07;
|
WORD32 alignment = it_bit_buff->bit_pos & 0x07;
|
||||||
it_bit_buff->cnt_bits = (it_bit_buff->cnt_bits + alignment) & 7;
|
it_bit_buff->cnt_bits = (it_bit_buff->cnt_bits + alignment) & 7;
|
||||||
|
|
|
||||||
|
|
@ -506,8 +506,7 @@ WORD32 ixheaacd_acelp_alias_cnx(ia_usac_data_struct *usac_data,
|
||||||
ixheaacd_preemphsis_tool_float(code, TILT_CODE, LEN_SUBFR, tmp);
|
ixheaacd_preemphsis_tool_float(code, TILT_CODE, LEN_SUBFR, tmp);
|
||||||
i = pitch_lag;
|
i = pitch_lag;
|
||||||
if (pitch_lag_frac > 2) i++;
|
if (pitch_lag_frac > 2) i++;
|
||||||
if(i >= 0)
|
if (i >= 0) ixheaacd_acelp_pitch_sharpening(code, i);
|
||||||
ixheaacd_acelp_pitch_sharpening(code, i);
|
|
||||||
|
|
||||||
index = pstr_td_frame_data->gains[k * 4 + subfr_nb];
|
index = pstr_td_frame_data->gains[k * 4 + subfr_nb];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,8 @@ IA_ERRORCODE ixheaacd_dec_mem_api(
|
||||||
UWORD32 *meminfo =
|
UWORD32 *meminfo =
|
||||||
(UWORD32 *)p_obj_exhaacplus_dec->p_mem_info_aac + i_idx;
|
(UWORD32 *)p_obj_exhaacplus_dec->p_mem_info_aac + i_idx;
|
||||||
UWORD32 pers_size = meminfo[0];
|
UWORD32 pers_size = meminfo[0];
|
||||||
p_temp = p_temp + pers_size - (sizeof(ia_dec_data_struct) +
|
p_temp = p_temp + pers_size -
|
||||||
|
(sizeof(ia_dec_data_struct) +
|
||||||
sizeof(ia_audio_specific_config_struct) + (8300));
|
sizeof(ia_audio_specific_config_struct) + (8300));
|
||||||
p_obj_exhaacplus_dec->p_state_aac = pv_value;
|
p_obj_exhaacplus_dec->p_state_aac = pv_value;
|
||||||
|
|
||||||
|
|
@ -153,8 +154,9 @@ IA_ERRORCODE ixheaacd_dec_mem_api(
|
||||||
p_obj_exhaacplus_dec->p_state_aac->pstr_dec_data = p_temp;
|
p_obj_exhaacplus_dec->p_state_aac->pstr_dec_data = p_temp;
|
||||||
p_obj_exhaacplus_dec->p_state_aac->ia_audio_specific_config =
|
p_obj_exhaacplus_dec->p_state_aac->ia_audio_specific_config =
|
||||||
p_temp + sizeof(ia_dec_data_struct);
|
p_temp + sizeof(ia_dec_data_struct);
|
||||||
p_obj_exhaacplus_dec->p_state_aac->header_ptr = p_temp + sizeof(ia_dec_data_struct)
|
p_obj_exhaacplus_dec->p_state_aac->header_ptr =
|
||||||
+ sizeof(ia_audio_specific_config_struct);
|
p_temp + sizeof(ia_dec_data_struct) +
|
||||||
|
sizeof(ia_audio_specific_config_struct);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -673,8 +675,7 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IA_ENHAACPLUS_DEC_DRC_TARGET_LOUDNESS: {
|
case IA_ENHAACPLUS_DEC_DRC_TARGET_LOUDNESS: {
|
||||||
if(*pui_value_signed>=0)
|
if (*pui_value_signed >= 0) {
|
||||||
{
|
|
||||||
p_obj_exhaacplus_dec->aac_config.ui_loud_norm_flag = 1;
|
p_obj_exhaacplus_dec->aac_config.ui_loud_norm_flag = 1;
|
||||||
}
|
}
|
||||||
*pui_value_signed = -(*pui_value_signed >> 2);
|
*pui_value_signed = -(*pui_value_signed >> 2);
|
||||||
|
|
@ -682,7 +683,8 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
|
||||||
p_obj_exhaacplus_dec->aac_config.ui_target_loudness = 0;
|
p_obj_exhaacplus_dec->aac_config.ui_target_loudness = 0;
|
||||||
return (IA_ENHAACPLUS_DEC_CONFIG_NONFATAL_INVALID_TARGET_LOUDNESS);
|
return (IA_ENHAACPLUS_DEC_CONFIG_NONFATAL_INVALID_TARGET_LOUDNESS);
|
||||||
}
|
}
|
||||||
p_obj_exhaacplus_dec->aac_config.ui_target_loudness = *pui_value_signed;
|
p_obj_exhaacplus_dec->aac_config.ui_target_loudness =
|
||||||
|
*pui_value_signed;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: { return IA_ENHAACPLUS_DEC_API_FATAL_INVALID_CONFIG_PARAM; }
|
default: { return IA_ENHAACPLUS_DEC_API_FATAL_INVALID_CONFIG_PARAM; }
|
||||||
|
|
@ -697,8 +699,7 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
|
||||||
|
|
||||||
if (i_idx >= 0 && i_idx <= 8) {
|
if (i_idx >= 0 && i_idx <= 8) {
|
||||||
*pui_value = pvalue[i_idx];
|
*pui_value = pvalue[i_idx];
|
||||||
}
|
} else if (IA_ENHAACPLUS_DEC_CONFIG_EXT_ELE_PTR == i_idx) {
|
||||||
else if (IA_ENHAACPLUS_DEC_CONFIG_EXT_ELE_PTR == i_idx) {
|
|
||||||
ia_audio_specific_config_struct *ptr_audio_specific_config =
|
ia_audio_specific_config_struct *ptr_audio_specific_config =
|
||||||
((ia_audio_specific_config_struct *)
|
((ia_audio_specific_config_struct *)
|
||||||
p_obj_exhaacplus_dec->p_state_aac->ia_audio_specific_config);
|
p_obj_exhaacplus_dec->p_state_aac->ia_audio_specific_config);
|
||||||
|
|
@ -767,8 +768,7 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
|
||||||
p_obj_exhaacplus_dec->p_state_aac->ia_audio_specific_config);
|
p_obj_exhaacplus_dec->p_state_aac->ia_audio_specific_config);
|
||||||
*pp_value = ptr_audio_specific_config->str_usac_config
|
*pp_value = ptr_audio_specific_config->str_usac_config
|
||||||
.str_usac_dec_config.usac_ext_gain_payload_buf;
|
.str_usac_dec_config.usac_ext_gain_payload_buf;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return IA_ENHAACPLUS_DEC_API_FATAL_INVALID_CONFIG_PARAM;
|
return IA_ENHAACPLUS_DEC_API_FATAL_INVALID_CONFIG_PARAM;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -910,17 +910,18 @@ IA_ERRORCODE ixheaacd_decoder_flush_api(
|
||||||
sizeof(ia_aac_dec_state_struct));
|
sizeof(ia_aac_dec_state_struct));
|
||||||
{
|
{
|
||||||
pUWORD8 p_temp = (pUWORD8)p_obj_exhaacplus_dec->p_state_aac;
|
pUWORD8 p_temp = (pUWORD8)p_obj_exhaacplus_dec->p_state_aac;
|
||||||
UWORD32 *meminfo =
|
UWORD32 *meminfo = (UWORD32 *)p_obj_exhaacplus_dec->p_mem_info_aac;
|
||||||
(UWORD32 *)p_obj_exhaacplus_dec->p_mem_info_aac;
|
|
||||||
UWORD32 pers_size = meminfo[0];
|
UWORD32 pers_size = meminfo[0];
|
||||||
p_temp = p_temp + pers_size - (sizeof(ia_dec_data_struct) +
|
p_temp = p_temp + pers_size -
|
||||||
|
(sizeof(ia_dec_data_struct) +
|
||||||
sizeof(ia_audio_specific_config_struct) + (8300));
|
sizeof(ia_audio_specific_config_struct) + (8300));
|
||||||
|
|
||||||
p_obj_exhaacplus_dec->p_state_aac->pstr_dec_data = p_temp;
|
p_obj_exhaacplus_dec->p_state_aac->pstr_dec_data = p_temp;
|
||||||
p_obj_exhaacplus_dec->p_state_aac->ia_audio_specific_config =
|
p_obj_exhaacplus_dec->p_state_aac->ia_audio_specific_config =
|
||||||
p_temp + sizeof(ia_dec_data_struct);
|
p_temp + sizeof(ia_dec_data_struct);
|
||||||
p_obj_exhaacplus_dec->p_state_aac->header_ptr = p_temp + sizeof(ia_dec_data_struct)
|
p_obj_exhaacplus_dec->p_state_aac->header_ptr =
|
||||||
+ sizeof(ia_audio_specific_config_struct);
|
p_temp + sizeof(ia_dec_data_struct) +
|
||||||
|
sizeof(ia_audio_specific_config_struct);
|
||||||
}
|
}
|
||||||
memset(&(p_obj_exhaacplus_dec->aac_config), 0,
|
memset(&(p_obj_exhaacplus_dec->aac_config), 0,
|
||||||
sizeof(ia_aac_dec_config_struct));
|
sizeof(ia_aac_dec_config_struct));
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@
|
||||||
|
|
||||||
#include "ixheaacd_error_codes.h"
|
#include "ixheaacd_error_codes.h"
|
||||||
|
|
||||||
|
|
||||||
#define ARITH_ESCAPE 16
|
#define ARITH_ESCAPE 16
|
||||||
|
|
||||||
UWORD16 ixheaacd_ari_cf_r[3][4] = {
|
UWORD16 ixheaacd_ari_cf_r[3][4] = {
|
||||||
|
|
@ -1673,8 +1672,6 @@ VOID ixheaacd_copy_to_bitbuff(ia_bit_buf_struct *it_bit_buff_src,
|
||||||
it_bit_buff_dst->size = it_bit_buff_src->size;
|
it_bit_buff_dst->size = it_bit_buff_src->size;
|
||||||
|
|
||||||
it_bit_buff_dst->max_size = it_bit_buff_src->max_size;
|
it_bit_buff_dst->max_size = it_bit_buff_src->max_size;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static WORD32 ixheaacd_arith_get_context(WORD8 *c_prev, WORD8 *c_pres,
|
static WORD32 ixheaacd_arith_get_context(WORD8 *c_prev, WORD8 *c_pres,
|
||||||
|
|
@ -1826,8 +1823,7 @@ WORD32 ixheaacd_arth_decoding_level2(ia_bit_buf_struct *it_bit_buff,
|
||||||
pki = ixheaacd_arith_get_pk(s1 + ixheaacd_esc_nb_offset[esc_nb]);
|
pki = ixheaacd_arith_get_pk(s1 + ixheaacd_esc_nb_offset[esc_nb]);
|
||||||
bit_count = ixheaacd_arith_decode(&it_bit_buff_temp, bit_count, &m, &as,
|
bit_count = ixheaacd_arith_decode(&it_bit_buff_temp, bit_count, &m, &as,
|
||||||
ixheaacd_ari_cf_m[pki], 17);
|
ixheaacd_ari_cf_m[pki], 17);
|
||||||
if(bit_count == -1)
|
if (bit_count == -1) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1861,17 +1857,14 @@ WORD32 ixheaacd_arth_decoding_level2(ia_bit_buf_struct *it_bit_buff,
|
||||||
WORD32 lsbidx = (a == 0) ? 1 : ((b == 0) ? 0 : 2);
|
WORD32 lsbidx = (a == 0) ? 1 : ((b == 0) ? 0 : 2);
|
||||||
bit_count = ixheaacd_arith_decode(&it_bit_buff_temp, bit_count, &m, &as,
|
bit_count = ixheaacd_arith_decode(&it_bit_buff_temp, bit_count, &m, &as,
|
||||||
ixheaacd_ari_cf_r[lsbidx], 4);
|
ixheaacd_ari_cf_r[lsbidx], 4);
|
||||||
if(bit_count == -1)
|
if (bit_count == -1) {
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
a = (a << 1) | (m & 1);
|
a = (a << 1) | (m & 1);
|
||||||
b = (b << 1) | ((m >> 1) & 1);
|
b = (b << 1) | ((m >> 1) & 1);
|
||||||
}
|
}
|
||||||
if((a > (8183)) || (b > (8183)))
|
if ((a > (8183)) || (b > (8183))) return -1;
|
||||||
return -1;
|
if ((a < (-8183)) || (b < (-8183))) return -1;
|
||||||
if((a < (-8183)) || (b < (-8183)))
|
|
||||||
return -1;
|
|
||||||
quant[2 * i + 0] = a;
|
quant[2 * i + 0] = a;
|
||||||
quant[2 * i + 1] = b;
|
quant[2 * i + 1] = b;
|
||||||
temp = a + b + 1;
|
temp = a + b + 1;
|
||||||
|
|
@ -1910,10 +1903,8 @@ WORD32 ixheaacd_arth_decoding_level2(ia_bit_buf_struct *it_bit_buff,
|
||||||
m = (m << 1) * temp1;
|
m = (m << 1) * temp1;
|
||||||
temp1 = m - (temp1);
|
temp1 = m - (temp1);
|
||||||
}
|
}
|
||||||
if((temp0 > (8183)) || (temp1 > (8183)))
|
if ((temp0 > (8183)) || (temp1 > (8183))) return -1;
|
||||||
return -1;
|
if ((temp0 < (-8183)) || (temp1 < (-8183))) return -1;
|
||||||
if((temp0 < (-8183)) || (temp1 < (-8183)))
|
|
||||||
return -1;
|
|
||||||
*quant++ = temp0;
|
*quant++ = temp0;
|
||||||
*quant++ = temp1;
|
*quant++ = temp1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -319,13 +319,9 @@ static PLATFORM_INLINE WORD32 ixheaacd_negate32(WORD32 a) {
|
||||||
static PLATFORM_INLINE WORD32 ixheaacd_negate32_sat(WORD32 a) {
|
static PLATFORM_INLINE WORD32 ixheaacd_negate32_sat(WORD32 a) {
|
||||||
WORD32 neg_val;
|
WORD32 neg_val;
|
||||||
|
|
||||||
|
if (a == MIN_32) {
|
||||||
if (a == MIN_32)
|
|
||||||
{
|
|
||||||
neg_val = MAX_32;
|
neg_val = MAX_32;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
neg_val = -a;
|
neg_val = -a;
|
||||||
}
|
}
|
||||||
return neg_val;
|
return neg_val;
|
||||||
|
|
|
||||||
|
|
@ -340,8 +340,7 @@ static PLATFORM_INLINE WORD64 ixheaacd_add64_sat(WORD64 a, WORD64 b) {
|
||||||
WORD64 result, comp;
|
WORD64 result, comp;
|
||||||
result = (a < 0) ? MIN_64 : MAX_64;
|
result = (a < 0) ? MIN_64 : MAX_64;
|
||||||
comp = result - a;
|
comp = result - a;
|
||||||
if ((a < 0) == (b > comp))
|
if ((a < 0) == (b > comp)) result = a + b;
|
||||||
result = a + b;
|
|
||||||
|
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1199,7 +1199,6 @@ VOID ixheaacd_process_single_scf(WORD32 scale_factor, WORD32 *x_invquant,
|
||||||
object_type = 0;
|
object_type = 0;
|
||||||
aac_sf_data_resil_flag = 0;
|
aac_sf_data_resil_flag = 0;
|
||||||
|
|
||||||
|
|
||||||
if (scale_factor < 24) {
|
if (scale_factor < 24) {
|
||||||
for (j = width; j > 0; j--) {
|
for (j = width; j > 0; j--) {
|
||||||
*x_invquant++ = 0;
|
*x_invquant++ = 0;
|
||||||
|
|
|
||||||
|
|
@ -213,8 +213,8 @@ static WORD16 ixheaacd_read_block_data(
|
||||||
if (error_code) {
|
if (error_code) {
|
||||||
return error_code;
|
return error_code;
|
||||||
}
|
}
|
||||||
if (aac_sf_data_resil_flag && ((object_type == AOT_ER_AAC_ELD)
|
if (aac_sf_data_resil_flag &&
|
||||||
|| (object_type == AOT_ER_AAC_LD)))
|
((object_type == AOT_ER_AAC_ELD) || (object_type == AOT_ER_AAC_LD)))
|
||||||
ixheaacd_rvlc_read(it_bit_buff, ptr_aac_dec_channel_info);
|
ixheaacd_rvlc_read(it_bit_buff, ptr_aac_dec_channel_info);
|
||||||
else
|
else
|
||||||
ixheaacd_read_scale_factor_data(it_bit_buff, ptr_aac_dec_channel_info,
|
ixheaacd_read_scale_factor_data(it_bit_buff, ptr_aac_dec_channel_info,
|
||||||
|
|
@ -296,8 +296,7 @@ static WORD16 ixheaacd_read_block_data(
|
||||||
}
|
}
|
||||||
|
|
||||||
WORD16 ixheaacd_ltp_decode(ia_bit_buf_struct *it_bit_buff,
|
WORD16 ixheaacd_ltp_decode(ia_bit_buf_struct *it_bit_buff,
|
||||||
ia_ics_info_struct *ptr_ics_info,
|
ia_ics_info_struct *ptr_ics_info, WORD32 object_type,
|
||||||
WORD32 object_type,
|
|
||||||
WORD32 frame_size, WORD32 ch) {
|
WORD32 frame_size, WORD32 ch) {
|
||||||
WORD32 retval = AAC_DEC_OK;
|
WORD32 retval = AAC_DEC_OK;
|
||||||
|
|
||||||
|
|
@ -329,8 +328,7 @@ WORD16 ixheaacd_ltp_decode(ia_bit_buf_struct *it_bit_buff,
|
||||||
WORD16 ixheaacd_ics_read(ia_bit_buf_struct *it_bit_buff,
|
WORD16 ixheaacd_ics_read(ia_bit_buf_struct *it_bit_buff,
|
||||||
ia_ics_info_struct *ptr_ics_info,
|
ia_ics_info_struct *ptr_ics_info,
|
||||||
WORD8 num_swb_window[2], WORD32 object_type,
|
WORD8 num_swb_window[2], WORD32 object_type,
|
||||||
WORD32 common_window,
|
WORD32 common_window, WORD32 frame_size) {
|
||||||
WORD32 frame_size) {
|
|
||||||
WORD i;
|
WORD i;
|
||||||
WORD mask;
|
WORD mask;
|
||||||
WORD value = 0;
|
WORD value = 0;
|
||||||
|
|
@ -510,12 +508,11 @@ WORD16 ixheaacd_individual_ch_stream(
|
||||||
if ((object_type == AOT_ER_AAC_LD) &&
|
if ((object_type == AOT_ER_AAC_LD) &&
|
||||||
(aac_dec_handle->pstr_aac_dec_ch_info[LEFT]->common_window) &&
|
(aac_dec_handle->pstr_aac_dec_ch_info[LEFT]->common_window) &&
|
||||||
(ele_type == ID_CPE)) {
|
(ele_type == ID_CPE)) {
|
||||||
WORD16 temp = ixheaacd_ltp_decode(
|
WORD16 temp =
|
||||||
it_bit_buff, ptr_ics_info, object_type,
|
ixheaacd_ltp_decode(it_bit_buff, ptr_ics_info, object_type,
|
||||||
aac_dec_handle->samples_per_frame, 1);
|
aac_dec_handle->samples_per_frame, 1);
|
||||||
|
|
||||||
if(temp!=0)
|
if (temp != 0) {
|
||||||
{
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
aac_dec_handle->pstr_aac_dec_ch_info[ch + 1]->str_ics_info.ltp.lag =
|
aac_dec_handle->pstr_aac_dec_ch_info[ch + 1]->str_ics_info.ltp.lag =
|
||||||
|
|
|
||||||
|
|
@ -330,12 +330,10 @@ typedef struct {
|
||||||
WORD16 ixheaacd_ics_read(ia_bit_buf_struct *it_bit_buff,
|
WORD16 ixheaacd_ics_read(ia_bit_buf_struct *it_bit_buff,
|
||||||
ia_ics_info_struct *ptr_ics_info,
|
ia_ics_info_struct *ptr_ics_info,
|
||||||
WORD8 num_swb_window[2], WORD32 object_type,
|
WORD8 num_swb_window[2], WORD32 object_type,
|
||||||
WORD32 common_window,
|
WORD32 common_window, WORD32 frame_size);
|
||||||
WORD32 frame_size);
|
|
||||||
|
|
||||||
WORD16 ixheaacd_ltp_decode(ia_bit_buf_struct *it_bit_buff,
|
WORD16 ixheaacd_ltp_decode(ia_bit_buf_struct *it_bit_buff,
|
||||||
ia_ics_info_struct *ptr_ics_info,
|
ia_ics_info_struct *ptr_ics_info, WORD32 object_type,
|
||||||
WORD32 object_type,
|
|
||||||
WORD32 frame_size, WORD32 ch);
|
WORD32 frame_size, WORD32 ch);
|
||||||
|
|
||||||
#endif /* #ifndef IXHEAACD_CHANNELINFO_H */
|
#endif /* #ifndef IXHEAACD_CHANNELINFO_H */
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,6 @@ ia_bit_buf_struct *ixheaacd_create_bit_buf(ia_bit_buf_struct *it_bit_buff,
|
||||||
|
|
||||||
it_bit_buff->max_size = it_bit_buff->size;
|
it_bit_buff->max_size = it_bit_buff->size;
|
||||||
|
|
||||||
|
|
||||||
ixheaacd_adts_crc_open(it_bit_buff->pstr_adts_crc_info);
|
ixheaacd_adts_crc_open(it_bit_buff->pstr_adts_crc_info);
|
||||||
|
|
||||||
return it_bit_buff;
|
return it_bit_buff;
|
||||||
|
|
|
||||||
|
|
@ -624,7 +624,8 @@ UWORD32 ixheaacd_sbr_ratio(UWORD32 core_sbr_frame_len_idx);
|
||||||
|
|
||||||
UWORD32 ixheaacd_sbr_params(UWORD32 core_sbr_frame_len_idx,
|
UWORD32 ixheaacd_sbr_params(UWORD32 core_sbr_frame_len_idx,
|
||||||
WORD32 *output_frame_length, WORD32 *block_size,
|
WORD32 *output_frame_length, WORD32 *block_size,
|
||||||
WORD32 *output_samples,WORD32 *sampling_freq, UWORD32* sample_freq_indx);
|
WORD32 *output_samples, WORD32 *sampling_freq,
|
||||||
|
UWORD32 *sample_freq_indx);
|
||||||
|
|
||||||
WORD32 ixheaacd_config(ia_bit_buf_struct *bit_buff,
|
WORD32 ixheaacd_config(ia_bit_buf_struct *bit_buff,
|
||||||
ia_usac_config_struct *pstr_usac_conf, UINT32 *chan);
|
ia_usac_config_struct *pstr_usac_conf, UINT32 *chan);
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,6 @@ WORD32 ixheaacd_decode_init(
|
||||||
&aac_dec_handle->pstr_aac_tables->pstr_block_tables
|
&aac_dec_handle->pstr_aac_tables->pstr_block_tables
|
||||||
->tns_max_bands_tbl_usac;
|
->tns_max_bands_tbl_usac;
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < 11; i++) {
|
for (i = 0; i < 11; i++) {
|
||||||
if (ixheaacd_sampling_boundaries[i] <= sample_rate) break;
|
if (ixheaacd_sampling_boundaries[i] <= sample_rate) break;
|
||||||
}
|
}
|
||||||
|
|
@ -257,7 +256,9 @@ WORD32 ixheaacd_decode_init(
|
||||||
usac_data->pstr_usac_winmap[3] = &usac_data->str_only_long_info;
|
usac_data->pstr_usac_winmap[3] = &usac_data->str_only_long_info;
|
||||||
usac_data->pstr_usac_winmap[4] = &usac_data->str_only_long_info;
|
usac_data->pstr_usac_winmap[4] = &usac_data->str_only_long_info;
|
||||||
|
|
||||||
if((usac_data->ccfl != 480) && (usac_data->ccfl != 512) && (usac_data->ccfl != 768) && (usac_data->ccfl != 960) &&(usac_data->ccfl != 1024))
|
if ((usac_data->ccfl != 480) && (usac_data->ccfl != 512) &&
|
||||||
|
(usac_data->ccfl != 768) && (usac_data->ccfl != 960) &&
|
||||||
|
(usac_data->ccfl != 1024))
|
||||||
return -1;
|
return -1;
|
||||||
ixheaacd_info_init(&ixheaacd_samp_rate_info[usac_data->sampling_rate_idx],
|
ixheaacd_info_init(&ixheaacd_samp_rate_info[usac_data->sampling_rate_idx],
|
||||||
usac_data->ccfl, usac_data->pstr_usac_winmap[0],
|
usac_data->ccfl, usac_data->pstr_usac_winmap[0],
|
||||||
|
|
@ -323,8 +324,8 @@ WORD32 ixheaacd_decode_init(
|
||||||
.str_usac_element_config[ele_id]
|
.str_usac_element_config[ele_id]
|
||||||
.str_usac_mps212_config);
|
.str_usac_mps212_config);
|
||||||
|
|
||||||
ixheaacd_mps_create(&aac_dec_handle->mps_dec_handle,
|
ixheaacd_mps_create(&aac_dec_handle->mps_dec_handle, bs_frame_length,
|
||||||
bs_frame_length, bs_residual_coding, ptr_usac_mps212_config);
|
bs_residual_coding, ptr_usac_mps212_config);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -371,7 +372,8 @@ WORD32 ixheaacd_dec_data_init(VOID *handle,
|
||||||
&pstr_frame_data->str_layer.sample_rate_layer,
|
&pstr_frame_data->str_layer.sample_rate_layer,
|
||||||
&layer_config->samp_frequency_index);
|
&layer_config->samp_frequency_index);
|
||||||
|
|
||||||
pstr_stream_config->sampling_frequency = pstr_frame_data->str_layer.sample_rate_layer;
|
pstr_stream_config->sampling_frequency =
|
||||||
|
pstr_frame_data->str_layer.sample_rate_layer;
|
||||||
pstr_stream_config->samp_frequency_index = layer_config->samp_frequency_index;
|
pstr_stream_config->samp_frequency_index = layer_config->samp_frequency_index;
|
||||||
|
|
||||||
num_elements = ptr_usac_config->str_usac_dec_config.num_elements;
|
num_elements = ptr_usac_config->str_usac_dec_config.num_elements;
|
||||||
|
|
@ -400,8 +402,6 @@ WORD32 ixheaacd_dec_data_init(VOID *handle,
|
||||||
|
|
||||||
num_out_chan = ptr_usac_config->num_out_channels;
|
num_out_chan = ptr_usac_config->num_out_channels;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (usac_data->ccfl == 768)
|
if (usac_data->ccfl == 768)
|
||||||
pstr_frame_data->str_layer.sample_rate_layer =
|
pstr_frame_data->str_layer.sample_rate_layer =
|
||||||
4 * pstr_frame_data->str_layer.sample_rate_layer / 3;
|
4 * pstr_frame_data->str_layer.sample_rate_layer / 3;
|
||||||
|
|
@ -595,11 +595,11 @@ WORD32 ixheaacd_decode_create(ia_exhaacplus_dec_api_struct *handle,
|
||||||
memset(&usac_def_header, 0, sizeof(ia_sbr_header_data_struct));
|
memset(&usac_def_header, 0, sizeof(ia_sbr_header_data_struct));
|
||||||
|
|
||||||
for (elem_idx = 0; elem_idx < num_ele; elem_idx++) {
|
for (elem_idx = 0; elem_idx < num_ele; elem_idx++) {
|
||||||
|
|
||||||
UWORD32 usac_ele_type =
|
UWORD32 usac_ele_type =
|
||||||
ptr_usac_config->str_usac_dec_config.usac_element_type[elem_idx];
|
ptr_usac_config->str_usac_dec_config.usac_element_type[elem_idx];
|
||||||
ia_usac_dec_element_config_struct *ptr_usac_ele_config =
|
ia_usac_dec_element_config_struct *ptr_usac_ele_config =
|
||||||
&ptr_usac_config->str_usac_dec_config.str_usac_element_config[elem_idx];
|
&ptr_usac_config->str_usac_dec_config
|
||||||
|
.str_usac_element_config[elem_idx];
|
||||||
|
|
||||||
ia_usac_dec_sbr_config_struct *ptr_usac_sbr_config =
|
ia_usac_dec_sbr_config_struct *ptr_usac_sbr_config =
|
||||||
&(ptr_usac_dec_config->str_usac_element_config[elem_idx]
|
&(ptr_usac_dec_config->str_usac_element_config[elem_idx]
|
||||||
|
|
@ -611,15 +611,9 @@ WORD32 ixheaacd_decode_create(ia_exhaacplus_dec_api_struct *handle,
|
||||||
harmonic_sbr[elem_idx] =
|
harmonic_sbr[elem_idx] =
|
||||||
(ptr_usac_sbr_config != NULL) ? ptr_usac_sbr_config->harmonic_sbr : 0;
|
(ptr_usac_sbr_config != NULL) ? ptr_usac_sbr_config->harmonic_sbr : 0;
|
||||||
|
|
||||||
if (ptr_usac_sbr_config->bs_inter_tes)
|
if (ptr_usac_sbr_config->bs_inter_tes) inter_test_flag = 1;
|
||||||
inter_test_flag = 1;
|
if (ptr_usac_sbr_config->bs_pvc) bs_pvc_flag = 1;
|
||||||
if (ptr_usac_sbr_config->bs_pvc)
|
if (ptr_usac_sbr_config->harmonic_sbr) harmonic_Sbr_flag = 1;
|
||||||
bs_pvc_flag = 1;
|
|
||||||
if (ptr_usac_sbr_config->harmonic_sbr)
|
|
||||||
harmonic_Sbr_flag = 1;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ((usac_ele_type != ID_USAC_LFE) && (usac_ele_type != ID_USAC_EXT)) {
|
if ((usac_ele_type != ID_USAC_LFE) && (usac_ele_type != ID_USAC_EXT)) {
|
||||||
ia_usac_dec_sbr_config_struct *ptr_usac_sbr_config =
|
ia_usac_dec_sbr_config_struct *ptr_usac_sbr_config =
|
||||||
|
|
@ -634,16 +628,12 @@ WORD32 ixheaacd_decode_create(ia_exhaacplus_dec_api_struct *handle,
|
||||||
usac_def_header.freq_scale = ptr_usac_sbr_config->dflt_freq_scale;
|
usac_def_header.freq_scale = ptr_usac_sbr_config->dflt_freq_scale;
|
||||||
usac_def_header.alter_scale = ptr_usac_sbr_config->dflt_alter_scale;
|
usac_def_header.alter_scale = ptr_usac_sbr_config->dflt_alter_scale;
|
||||||
usac_def_header.noise_bands = ptr_usac_sbr_config->dflt_noise_bands;
|
usac_def_header.noise_bands = ptr_usac_sbr_config->dflt_noise_bands;
|
||||||
usac_def_header.limiter_bands =
|
usac_def_header.limiter_bands = ptr_usac_sbr_config->dflt_limiter_bands;
|
||||||
ptr_usac_sbr_config->dflt_limiter_bands;
|
usac_def_header.limiter_gains = ptr_usac_sbr_config->dflt_limiter_gains;
|
||||||
usac_def_header.limiter_gains =
|
usac_def_header.interpol_freq = ptr_usac_sbr_config->dflt_interpol_freq;
|
||||||
ptr_usac_sbr_config->dflt_limiter_gains;
|
|
||||||
usac_def_header.interpol_freq =
|
|
||||||
ptr_usac_sbr_config->dflt_interpol_freq;
|
|
||||||
usac_def_header.smoothing_mode =
|
usac_def_header.smoothing_mode =
|
||||||
ptr_usac_sbr_config->dflt_smoothing_mode;
|
ptr_usac_sbr_config->dflt_smoothing_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pstr_dec_data->str_usac_data.down_samp_sbr = 0;
|
pstr_dec_data->str_usac_data.down_samp_sbr = 0;
|
||||||
|
|
@ -664,7 +654,6 @@ WORD32 ixheaacd_decode_create(ia_exhaacplus_dec_api_struct *handle,
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
void *sbr_persistent_mem_v = aac_dec_handle->sbr_persistent_mem_u;
|
void *sbr_persistent_mem_v = aac_dec_handle->sbr_persistent_mem_u;
|
||||||
|
|
||||||
pstr_dec_data->str_usac_data.pstr_esbr_dec = ixheaacd_init_sbr(
|
pstr_dec_data->str_usac_data.pstr_esbr_dec = ixheaacd_init_sbr(
|
||||||
|
|
|
||||||
|
|
@ -125,9 +125,12 @@ VOID ixheaacd_samples_sat(WORD8 *outbuffer, WORD32 num_samples_out,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* audio pre roll frame parsing*/
|
/* audio pre roll frame parsing*/
|
||||||
static WORD32 ixheaacd_audio_preroll_parsing(ia_dec_data_struct *pstr_dec_data, UWORD8 *conf_buf,WORD32 *preroll_units, WORD32 *preroll_frame_offset)
|
static WORD32 ixheaacd_audio_preroll_parsing(ia_dec_data_struct *pstr_dec_data,
|
||||||
{
|
UWORD8 *conf_buf,
|
||||||
ia_bit_buf_struct *temp_buff = (ia_bit_buf_struct *)&(pstr_dec_data->dec_bit_buf);
|
WORD32 *preroll_units,
|
||||||
|
WORD32 *preroll_frame_offset) {
|
||||||
|
ia_bit_buf_struct *temp_buff =
|
||||||
|
(ia_bit_buf_struct *)&(pstr_dec_data->dec_bit_buf);
|
||||||
WORD32 independency_flag = 0;
|
WORD32 independency_flag = 0;
|
||||||
WORD32 ext_ele_present = 0;
|
WORD32 ext_ele_present = 0;
|
||||||
WORD32 ext_ele_use_dflt_len = 0;
|
WORD32 ext_ele_use_dflt_len = 0;
|
||||||
|
|
@ -138,23 +141,22 @@ static WORD32 ixheaacd_audio_preroll_parsing(ia_dec_data_struct *pstr_dec_data,
|
||||||
WORD32 num_pre_roll_frames = 0;
|
WORD32 num_pre_roll_frames = 0;
|
||||||
|
|
||||||
WORD32 frame_idx = 0;
|
WORD32 frame_idx = 0;
|
||||||
WORD32 frame_len[18] = { 0 }; // max of escapedValue(2, 4, 0) i.e. 2^2 -1 + 2^4 -1;
|
WORD32 frame_len[18] = {
|
||||||
|
0}; // max of escapedValue(2, 4, 0) i.e. 2^2 -1 + 2^4 -1;
|
||||||
WORD32 temp = 0;
|
WORD32 temp = 0;
|
||||||
|
|
||||||
WORD32 config_len = 0;
|
WORD32 config_len = 0;
|
||||||
WORD32 loop;
|
WORD32 loop;
|
||||||
|
|
||||||
if (pstr_dec_data->str_frame_data.str_audio_specific_config.str_usac_config.str_usac_dec_config.usac_element_type[0] == ID_USAC_EXT)
|
if (pstr_dec_data->str_frame_data.str_audio_specific_config.str_usac_config
|
||||||
{
|
.str_usac_dec_config.usac_element_type[0] == ID_USAC_EXT) {
|
||||||
temp = ixheaacd_show_bits_buf(temp_buff, 3);
|
temp = ixheaacd_show_bits_buf(temp_buff, 3);
|
||||||
independency_flag = (temp >> 2) & 0x1;
|
independency_flag = (temp >> 2) & 0x1;
|
||||||
ext_ele_present = (temp >> 1) & 0x1;
|
ext_ele_present = (temp >> 1) & 0x1;
|
||||||
|
|
||||||
if (ext_ele_present)
|
if (ext_ele_present) {
|
||||||
{
|
|
||||||
ext_ele_use_dflt_len = temp & 0x1; // ixheaacd_read_bit(&temp_buff, 1);
|
ext_ele_use_dflt_len = temp & 0x1; // ixheaacd_read_bit(&temp_buff, 1);
|
||||||
if (ext_ele_use_dflt_len != 0)
|
if (ext_ele_use_dflt_len != 0) return 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
un_used_val = ixheaacd_read_bits_buf(temp_buff, 3);
|
un_used_val = ixheaacd_read_bits_buf(temp_buff, 3);
|
||||||
|
|
||||||
|
|
@ -163,18 +165,17 @@ static WORD32 ixheaacd_audio_preroll_parsing(ia_dec_data_struct *pstr_dec_data,
|
||||||
if (ext_ele_payload_len == 255) {
|
if (ext_ele_payload_len == 255) {
|
||||||
WORD32 val_add = 0;
|
WORD32 val_add = 0;
|
||||||
val_add = ixheaacd_read_bits_buf(temp_buff, 16);
|
val_add = ixheaacd_read_bits_buf(temp_buff, 16);
|
||||||
ext_ele_payload_len = (UWORD32)((WORD32)ext_ele_payload_len + val_add - 2);
|
ext_ele_payload_len =
|
||||||
|
(UWORD32)((WORD32)ext_ele_payload_len + val_add - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// escapedValue(4, 4, 8);
|
// escapedValue(4, 4, 8);
|
||||||
config_len = ixheaacd_read_bits_buf(temp_buff, 4);
|
config_len = ixheaacd_read_bits_buf(temp_buff, 4);
|
||||||
if (config_len == 15)
|
if (config_len == 15) {
|
||||||
{
|
|
||||||
WORD32 val_add = 0;
|
WORD32 val_add = 0;
|
||||||
val_add = ixheaacd_read_bits_buf(temp_buff, 4);
|
val_add = ixheaacd_read_bits_buf(temp_buff, 4);
|
||||||
config_len += val_add;
|
config_len += val_add;
|
||||||
if (val_add == 15)
|
if (val_add == 15) {
|
||||||
{
|
|
||||||
WORD32 val_add1 = 0;
|
WORD32 val_add1 = 0;
|
||||||
val_add1 = ixheaacd_read_bits_buf(temp_buff, 8);
|
val_add1 = ixheaacd_read_bits_buf(temp_buff, 8);
|
||||||
config_len += val_add1;
|
config_len += val_add1;
|
||||||
|
|
@ -184,30 +185,27 @@ static WORD32 ixheaacd_audio_preroll_parsing(ia_dec_data_struct *pstr_dec_data,
|
||||||
for (loop = 0; loop < config_len; loop++)
|
for (loop = 0; loop < config_len; loop++)
|
||||||
conf_buf[loop] = ixheaacd_read_bits_buf(temp_buff, 8);
|
conf_buf[loop] = ixheaacd_read_bits_buf(temp_buff, 8);
|
||||||
|
|
||||||
|
|
||||||
apply_crossfade = ixheaacd_read_bits_buf(temp_buff, 1);
|
apply_crossfade = ixheaacd_read_bits_buf(temp_buff, 1);
|
||||||
un_used_val = ixheaacd_read_bits_buf(temp_buff, 1); // reserverd
|
un_used_val = ixheaacd_read_bits_buf(temp_buff, 1); // reserverd
|
||||||
|
|
||||||
// escapedValue(2, 4, 0);
|
// escapedValue(2, 4, 0);
|
||||||
num_pre_roll_frames = ixheaacd_read_bits_buf(temp_buff, 2);
|
num_pre_roll_frames = ixheaacd_read_bits_buf(temp_buff, 2);
|
||||||
if (num_pre_roll_frames == 3)
|
if (num_pre_roll_frames == 3) {
|
||||||
{
|
|
||||||
WORD32 val_add = 0;
|
WORD32 val_add = 0;
|
||||||
val_add = ixheaacd_read_bits_buf(temp_buff, 4);
|
val_add = ixheaacd_read_bits_buf(temp_buff, 4);
|
||||||
num_pre_roll_frames += val_add;
|
num_pre_roll_frames += val_add;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (frame_idx = 0; frame_idx < num_pre_roll_frames; frame_idx++)
|
for (frame_idx = 0; frame_idx < num_pre_roll_frames; frame_idx++) {
|
||||||
{
|
|
||||||
WORD32 au_len = 0; // escapedValued(16,16,0)
|
WORD32 au_len = 0; // escapedValued(16,16,0)
|
||||||
au_len = ixheaacd_read_bits_buf(temp_buff, 16);
|
au_len = ixheaacd_read_bits_buf(temp_buff, 16);
|
||||||
if (au_len == 65535)
|
if (au_len == 65535) {
|
||||||
{
|
|
||||||
WORD32 val_add = ixheaacd_read_bits_buf(temp_buff, 16);
|
WORD32 val_add = ixheaacd_read_bits_buf(temp_buff, 16);
|
||||||
au_len += val_add;
|
au_len += val_add;
|
||||||
}
|
}
|
||||||
preroll_frame_offset[frame_idx] = temp_buff->size - temp_buff->cnt_bits;
|
preroll_frame_offset[frame_idx] = temp_buff->size - temp_buff->cnt_bits;
|
||||||
frame_len[frame_idx] = (8 * au_len) + (temp_buff->size - temp_buff->cnt_bits);
|
frame_len[frame_idx] =
|
||||||
|
(8 * au_len) + (temp_buff->size - temp_buff->cnt_bits);
|
||||||
temp_buff->ptr_read_next += au_len;
|
temp_buff->ptr_read_next += au_len;
|
||||||
temp_buff->cnt_bits -= au_len * 8;
|
temp_buff->cnt_bits -= au_len * 8;
|
||||||
}
|
}
|
||||||
|
|
@ -232,14 +230,14 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
|
||||||
WORD32 suitable_tracks = 1;
|
WORD32 suitable_tracks = 1;
|
||||||
WORD32 num_samples_out;
|
WORD32 num_samples_out;
|
||||||
ia_dec_data_struct *pstr_dec_data;
|
ia_dec_data_struct *pstr_dec_data;
|
||||||
UWORD8 config[285]; //max of escapedValue(4, 4, 8) i.e. 2^4 -1 + 2^4 -1 + 2^8 -1;
|
UWORD8 config[285]; // max of escapedValue(4, 4, 8) i.e. 2^4 -1 + 2^4 -1 +
|
||||||
|
// 2^8 -1;
|
||||||
WORD32 config_len;
|
WORD32 config_len;
|
||||||
WORD32 delay;
|
WORD32 delay;
|
||||||
WORD preroll_frame_offset[4] = {0};
|
WORD preroll_frame_offset[4] = {0};
|
||||||
WORD preroll_units = -1;
|
WORD preroll_units = -1;
|
||||||
WORD32 access_units = 0;
|
WORD32 access_units = 0;
|
||||||
|
|
||||||
|
|
||||||
if (frames_done == 0) {
|
if (frames_done == 0) {
|
||||||
if ((pstr_audio_specific_config->channel_configuration > 2) ||
|
if ((pstr_audio_specific_config->channel_configuration > 2) ||
|
||||||
(pstr_audio_specific_config->channel_configuration == 0)) {
|
(pstr_audio_specific_config->channel_configuration == 0)) {
|
||||||
|
|
@ -268,7 +266,8 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
|
||||||
delay = ixheaacd_decode_create(
|
delay = ixheaacd_decode_create(
|
||||||
handle, pstr_dec_data,
|
handle, pstr_dec_data,
|
||||||
pstr_dec_data->str_frame_data.scal_out_select + 1);
|
pstr_dec_data->str_frame_data.scal_out_select + 1);
|
||||||
pstr_dec_data->dec_bit_buf.max_size = handle->p_mem_info_aac[IA_MEMTYPE_INPUT].ui_size;
|
pstr_dec_data->dec_bit_buf.max_size =
|
||||||
|
handle->p_mem_info_aac[IA_MEMTYPE_INPUT].ui_size;
|
||||||
if (delay == -1) return -1;
|
if (delay == -1) return -1;
|
||||||
*num_channel_out = pstr_dec_data->str_frame_data.scal_out_num_channels;
|
*num_channel_out = pstr_dec_data->str_frame_data.scal_out_num_channels;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -288,19 +287,19 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
|
||||||
/* audio pre roll frame parsing*/
|
/* audio pre roll frame parsing*/
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
config_len = 0;
|
config_len = 0;
|
||||||
if(access_units==0&&pstr_audio_specific_config->str_usac_config.str_usac_dec_config.preroll_flag)
|
if (access_units == 0 &&
|
||||||
{
|
pstr_audio_specific_config->str_usac_config.str_usac_dec_config
|
||||||
config_len = ixheaacd_audio_preroll_parsing(pstr_dec_data,&config[0],&preroll_units,&preroll_frame_offset[0]);
|
.preroll_flag) {
|
||||||
|
config_len = ixheaacd_audio_preroll_parsing(pstr_dec_data, &config[0],
|
||||||
|
&preroll_units,
|
||||||
|
&preroll_frame_offset[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_len != 0)
|
if (config_len != 0) {
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
/* updating the config parameters*/
|
/* updating the config parameters*/
|
||||||
ia_bit_buf_struct *config_bit_buf = (ia_bit_buf_struct *)malloc(sizeof(ia_bit_buf_struct));
|
ia_bit_buf_struct *config_bit_buf =
|
||||||
|
(ia_bit_buf_struct *)malloc(sizeof(ia_bit_buf_struct));
|
||||||
|
|
||||||
config_bit_buf->ptr_bit_buf_base = config;
|
config_bit_buf->ptr_bit_buf_base = config;
|
||||||
config_bit_buf->size = config_len << 3;
|
config_bit_buf->size = config_len << 3;
|
||||||
|
|
@ -309,29 +308,25 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
|
||||||
config_bit_buf->bit_pos = 7;
|
config_bit_buf->bit_pos = 7;
|
||||||
config_bit_buf->cnt_bits = config_bit_buf->size;
|
config_bit_buf->cnt_bits = config_bit_buf->size;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
suitable_tracks =
|
suitable_tracks =
|
||||||
ixheaacd_frm_data_init(pstr_audio_specific_config, pstr_dec_data);
|
ixheaacd_frm_data_init(pstr_audio_specific_config, pstr_dec_data);
|
||||||
|
|
||||||
if (suitable_tracks <= 0)
|
if (suitable_tracks <= 0) return -1;
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* call codec re-configure*/
|
/* call codec re-configure*/
|
||||||
err = ixheaacd_config(config_bit_buf, &(pstr_dec_data->str_frame_data.str_audio_specific_config.str_usac_config),&(pstr_audio_specific_config->channel_configuration)/*&pstr_audio_specific_config->str_usac_config*/);
|
err = ixheaacd_config(
|
||||||
|
config_bit_buf, &(pstr_dec_data->str_frame_data
|
||||||
|
.str_audio_specific_config.str_usac_config),
|
||||||
|
&(pstr_audio_specific_config
|
||||||
|
->channel_configuration) /*&pstr_audio_specific_config->str_usac_config*/);
|
||||||
free(config_bit_buf);
|
free(config_bit_buf);
|
||||||
if (err != 0) return -1;
|
if (err != 0) return -1;
|
||||||
|
|
||||||
|
|
||||||
delay = ixheaacd_decode_create(
|
delay = ixheaacd_decode_create(
|
||||||
handle, pstr_dec_data,
|
handle, pstr_dec_data,
|
||||||
pstr_dec_data->str_frame_data.scal_out_select + 1);
|
pstr_dec_data->str_frame_data.scal_out_select + 1);
|
||||||
if (delay == -1) return -1;
|
if (delay == -1) return -1;
|
||||||
*num_channel_out = pstr_dec_data->str_frame_data.scal_out_num_channels;
|
*num_channel_out = pstr_dec_data->str_frame_data.scal_out_num_channels;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pstr_dec_data->dec_bit_buf.ptr_bit_buf_base = (UWORD8 *)inbuffer;
|
pstr_dec_data->dec_bit_buf.ptr_bit_buf_base = (UWORD8 *)inbuffer;
|
||||||
|
|
@ -344,18 +339,21 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
|
||||||
|
|
||||||
pstr_dec_data->str_usac_data.usac_flag = aac_dec_handle->usac_flag;
|
pstr_dec_data->str_usac_data.usac_flag = aac_dec_handle->usac_flag;
|
||||||
|
|
||||||
|
if (preroll_frame_offset[access_units]) {
|
||||||
if(preroll_frame_offset[access_units])
|
pstr_dec_data->dec_bit_buf.cnt_bits =
|
||||||
{
|
pstr_dec_data->dec_bit_buf.size -
|
||||||
pstr_dec_data->dec_bit_buf.cnt_bits=pstr_dec_data->dec_bit_buf.size - preroll_frame_offset[access_units];
|
preroll_frame_offset[access_units];
|
||||||
pstr_dec_data->dec_bit_buf.bit_pos=7-preroll_frame_offset[access_units]%8;
|
pstr_dec_data->dec_bit_buf.bit_pos =
|
||||||
pstr_dec_data->dec_bit_buf.ptr_read_next=pstr_dec_data->dec_bit_buf.ptr_read_next+(preroll_frame_offset[access_units]/8);
|
7 - preroll_frame_offset[access_units] % 8;
|
||||||
|
pstr_dec_data->dec_bit_buf.ptr_read_next =
|
||||||
|
pstr_dec_data->dec_bit_buf.ptr_read_next +
|
||||||
|
(preroll_frame_offset[access_units] / 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// temp_read=ixheaacd_show_bits_buf(pstr_dec_data->dec_bit_buf,preroll_frame_offset[access_unit]);
|
// temp_read=ixheaacd_show_bits_buf(pstr_dec_data->dec_bit_buf,preroll_frame_offset[access_unit]);
|
||||||
|
|
||||||
err = ixheaacd_usac_process(pstr_dec_data, num_channel_out, aac_dec_handle);
|
err =
|
||||||
|
ixheaacd_usac_process(pstr_dec_data, num_channel_out, aac_dec_handle);
|
||||||
|
|
||||||
switch (pstr_dec_data->str_usac_data.sbr_ratio_idx) {
|
switch (pstr_dec_data->str_usac_data.sbr_ratio_idx) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
@ -386,13 +384,13 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
|
||||||
.usac_ext_gain_payload_len =
|
.usac_ext_gain_payload_len =
|
||||||
pstr_dec_data->str_frame_data.str_audio_specific_config
|
pstr_dec_data->str_frame_data.str_audio_specific_config
|
||||||
.str_usac_config.str_usac_dec_config.usac_ext_gain_payload_len;
|
.str_usac_config.str_usac_dec_config.usac_ext_gain_payload_len;
|
||||||
memcpy(
|
memcpy(pstr_audio_specific_config->str_usac_config.str_usac_dec_config
|
||||||
pstr_audio_specific_config->str_usac_config.str_usac_dec_config
|
|
||||||
.usac_ext_gain_payload_buf,
|
.usac_ext_gain_payload_buf,
|
||||||
pstr_dec_data->str_frame_data.str_audio_specific_config
|
pstr_dec_data->str_frame_data.str_audio_specific_config
|
||||||
.str_usac_config.str_usac_dec_config.usac_ext_gain_payload_buf,
|
.str_usac_config.str_usac_dec_config.usac_ext_gain_payload_buf,
|
||||||
pstr_dec_data->str_frame_data.str_audio_specific_config
|
pstr_dec_data->str_frame_data.str_audio_specific_config
|
||||||
.str_usac_config.str_usac_dec_config.usac_ext_gain_payload_len *
|
.str_usac_config.str_usac_dec_config
|
||||||
|
.usac_ext_gain_payload_len *
|
||||||
sizeof(WORD8));
|
sizeof(WORD8));
|
||||||
|
|
||||||
access_units++;
|
access_units++;
|
||||||
|
|
|
||||||
|
|
@ -1008,18 +1008,13 @@ VOID ixheaacd_drc_apply(ia_drc_dec_struct *pstr_drc_dec,
|
||||||
(num_qmf_sub_sample - alpha_val) *
|
(num_qmf_sub_sample - alpha_val) *
|
||||||
(WORD64)prev_frame_drc_sbr_factors[i];
|
(WORD64)prev_frame_drc_sbr_factors[i];
|
||||||
|
|
||||||
if (frame_size == 512)
|
if (frame_size == 512) {
|
||||||
{
|
|
||||||
drc_sbr_factors[num_qmf_sub_sample + j][i] =
|
drc_sbr_factors[num_qmf_sub_sample + j][i] =
|
||||||
(WORD32)(temp_drc >> 4);
|
(WORD32)(temp_drc >> 4);
|
||||||
}
|
} else if (frame_size == 480) {
|
||||||
else if (frame_size == 480)
|
|
||||||
{
|
|
||||||
drc_sbr_factors[num_qmf_sub_sample + j][i] =
|
drc_sbr_factors[num_qmf_sub_sample + j][i] =
|
||||||
ixheaacd_div_by_15(temp_drc);
|
ixheaacd_div_by_15(temp_drc);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
drc_sbr_factors[num_qmf_sub_sample + j][i] =
|
drc_sbr_factors[num_qmf_sub_sample + j][i] =
|
||||||
(WORD32)(temp_drc >> 5);
|
(WORD32)(temp_drc >> 5);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue