mirror of
https://github.com/ittiam-systems/libxaac.git
synced 2026-04-02 20:30:47 +07:00
Enhancements to the uniDRCv1 user configuration through DRC (#101)
Significance: ============== - Enhanced the support to uniDRCv1 user configuration through DRC configuration param file Testing: ========= - smoke-tested on x86, x86_64, Mac, armv7, armv8 and MSVS Co-authored-by: Akshay Ragir <100833@ittiam.com>
This commit is contained in:
parent
388435c8f8
commit
fb6a68848a
6 changed files with 266 additions and 126 deletions
|
|
@ -91,10 +91,14 @@ IA_ERRORCODE impd_drc_validate_config_params(ia_drc_input_config *pstr_inp_confi
|
|||
#ifdef LOUDNESS_LEVELING_SUPPORT
|
||||
if (pstr_uni_drc_config->str_drc_instructions_uni_drc[i].drc_set_effect &
|
||||
EFFECT_BIT_DUCK_SELF) {
|
||||
IMPD_DRC_BOUND_CHECK(pstr_uni_drc_config->str_drc_instructions_uni_drc[i].leveling_present,
|
||||
0, 1);
|
||||
IMPD_DRC_BOUND_CHECK(
|
||||
pstr_uni_drc_config->str_drc_instructions_uni_drc[i].ducking_only_set_present, 0, 1);
|
||||
if (pstr_uni_drc_config->str_drc_instructions_uni_drc[i].leveling_present != 0 &&
|
||||
pstr_uni_drc_config->str_drc_instructions_uni_drc[i].leveling_present != 1) {
|
||||
pstr_uni_drc_config->str_drc_instructions_uni_drc[i].leveling_present = 0;
|
||||
}
|
||||
if (pstr_uni_drc_config->str_drc_instructions_uni_drc[i].ducking_only_set_present != 0 &&
|
||||
pstr_uni_drc_config->str_drc_instructions_uni_drc[i].ducking_only_set_present != 1) {
|
||||
pstr_uni_drc_config->str_drc_instructions_uni_drc[i].ducking_only_set_present = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -254,9 +258,30 @@ IA_ERRORCODE impd_drc_validate_config_params(ia_drc_input_config *pstr_inp_confi
|
|||
}
|
||||
}
|
||||
|
||||
if (pstr_uni_drc_config->uni_drc_config_ext_present != 0 &&
|
||||
pstr_uni_drc_config->uni_drc_config_ext_present != 1) {
|
||||
pstr_uni_drc_config->uni_drc_config_ext_present = 0;
|
||||
}
|
||||
|
||||
if (pstr_uni_drc_config->uni_drc_config_ext_present &&
|
||||
(pstr_uni_drc_config->drc_instructions_uni_drc_count > 0 ||
|
||||
pstr_uni_drc_config->drc_coefficients_uni_drc_count > 0)) {
|
||||
memset(pstr_uni_drc_config->str_drc_instructions_uni_drc, 0,
|
||||
sizeof(pstr_uni_drc_config->str_drc_instructions_uni_drc[0]) *
|
||||
pstr_uni_drc_config->drc_instructions_uni_drc_count);
|
||||
memset(pstr_uni_drc_config->str_drc_coefficients_uni_drc, 0,
|
||||
sizeof(pstr_uni_drc_config->str_drc_coefficients_uni_drc[0]) *
|
||||
pstr_uni_drc_config->drc_coefficients_uni_drc_count);
|
||||
pstr_uni_drc_config->drc_instructions_uni_drc_count = 0;
|
||||
pstr_uni_drc_config->drc_coefficients_uni_drc_count = 0;
|
||||
}
|
||||
if (pstr_uni_drc_config->uni_drc_config_ext_present) {
|
||||
ia_drc_uni_drc_config_ext_struct *pstr_uni_drc_config_ext =
|
||||
&pstr_uni_drc_config->str_uni_drc_config_ext;
|
||||
if (pstr_uni_drc_config_ext->downmix_instructions_v1_present != 0 &&
|
||||
pstr_uni_drc_config_ext->downmix_instructions_v1_present != 1) {
|
||||
pstr_uni_drc_config_ext->downmix_instructions_v1_present = 0;
|
||||
}
|
||||
if (pstr_uni_drc_config_ext->downmix_instructions_v1_present) {
|
||||
IMPD_DRC_BOUND_CHECK(pstr_uni_drc_config_ext->downmix_instructions_v1_count, 0,
|
||||
DOWNMIX_INSTRUCTIONS_COUNT_MAX);
|
||||
|
|
@ -270,6 +295,10 @@ IA_ERRORCODE impd_drc_validate_config_params(ia_drc_input_config *pstr_inp_confi
|
|||
}
|
||||
}
|
||||
|
||||
if (pstr_uni_drc_config_ext->drc_coeffs_and_instructions_uni_drc_v1_present != 0 &&
|
||||
pstr_uni_drc_config_ext->drc_coeffs_and_instructions_uni_drc_v1_present != 1) {
|
||||
pstr_uni_drc_config_ext->drc_coeffs_and_instructions_uni_drc_v1_present = 0;
|
||||
}
|
||||
if (pstr_uni_drc_config_ext->drc_coeffs_and_instructions_uni_drc_v1_present) {
|
||||
IMPD_DRC_BOUND_CHECK(pstr_uni_drc_config_ext->drc_coefficients_uni_drc_v1_count, 0,
|
||||
DRC_COEFFICIENTS_UNIDRC_V1_COUNT_MAX);
|
||||
|
|
@ -407,17 +436,27 @@ IA_ERRORCODE impd_drc_validate_config_params(ia_drc_input_config *pstr_inp_confi
|
|||
#ifdef LOUDNESS_LEVELING_SUPPORT
|
||||
if (pstr_uni_drc_config_ext->str_drc_instructions_uni_drc_v1[i].drc_set_effect &
|
||||
EFFECT_BIT_DUCK_SELF) {
|
||||
IMPD_DRC_BOUND_CHECK(
|
||||
pstr_uni_drc_config_ext->str_drc_instructions_uni_drc_v1[i].leveling_present, 0, 1);
|
||||
IMPD_DRC_BOUND_CHECK(pstr_uni_drc_config_ext->str_drc_instructions_uni_drc_v1[i]
|
||||
.ducking_only_set_present,
|
||||
0, 1);
|
||||
if (pstr_uni_drc_config_ext->str_drc_instructions_uni_drc_v1[i].leveling_present != 0 &&
|
||||
pstr_uni_drc_config_ext->str_drc_instructions_uni_drc_v1[i].leveling_present != 1) {
|
||||
pstr_uni_drc_config_ext->str_drc_instructions_uni_drc_v1[i].leveling_present = 0;
|
||||
}
|
||||
if (pstr_uni_drc_config_ext->str_drc_instructions_uni_drc_v1[i]
|
||||
.ducking_only_set_present != 0 &&
|
||||
pstr_uni_drc_config_ext->str_drc_instructions_uni_drc_v1[i]
|
||||
.ducking_only_set_present != 1) {
|
||||
pstr_uni_drc_config_ext->str_drc_instructions_uni_drc_v1[i].ducking_only_set_present =
|
||||
0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pstr_enc_loudness_info_set->loudness_info_set_ext_present != 0 &&
|
||||
pstr_enc_loudness_info_set->loudness_info_set_ext_present != 1) {
|
||||
pstr_enc_loudness_info_set->loudness_info_set_ext_present = 0;
|
||||
}
|
||||
if (pstr_enc_loudness_info_set->loudness_info_set_ext_present) {
|
||||
ia_drc_loudness_info_set_ext_eq_struct *pstr_enc_loudness_info_set_ext =
|
||||
&pstr_enc_loudness_info_set->str_loudness_info_set_extension.str_loudness_info_set_ext_eq;
|
||||
|
|
@ -509,24 +548,23 @@ static IA_ERRORCODE impd_drc_validate_drc_instructions(
|
|||
LOOPIDX i, j;
|
||||
WORD32 profile_found = FALSE;
|
||||
|
||||
for (i = 0; i < pstr_uni_drc_config->drc_instructions_uni_drc_count; i++) {
|
||||
profile_found = FALSE;
|
||||
for (j = 0; j < pstr_uni_drc_config->drc_coefficients_uni_drc_count; j++) {
|
||||
if (pstr_uni_drc_config->str_drc_coefficients_uni_drc[j].drc_location == 1) {
|
||||
profile_found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pstr_uni_drc_config->uni_drc_config_ext_present &&
|
||||
pstr_uni_drc_config->str_uni_drc_config_ext.parametric_drc_present &&
|
||||
pstr_uni_drc_config->str_uni_drc_config_ext.str_drc_coeff_parametric_drc.drc_location ==
|
||||
1) {
|
||||
for (j = 0; j < pstr_uni_drc_config->drc_coefficients_uni_drc_count; j++) {
|
||||
if (pstr_uni_drc_config->str_drc_coefficients_uni_drc[j].drc_location == 1) {
|
||||
profile_found = TRUE;
|
||||
break;
|
||||
}
|
||||
if (profile_found == FALSE) {
|
||||
return IA_EXHEAACE_CONFIG_FATAL_DRC_INVALID_CONFIG;
|
||||
}
|
||||
}
|
||||
if (pstr_uni_drc_config->uni_drc_config_ext_present &&
|
||||
pstr_uni_drc_config->str_uni_drc_config_ext.parametric_drc_present &&
|
||||
pstr_uni_drc_config->str_uni_drc_config_ext.str_drc_coeff_parametric_drc.drc_location ==
|
||||
1) {
|
||||
profile_found = TRUE;
|
||||
}
|
||||
if ((pstr_uni_drc_config->uni_drc_config_ext_present == 0) && profile_found == FALSE) {
|
||||
return IA_EXHEAACE_CONFIG_FATAL_DRC_INVALID_CONFIG;
|
||||
}
|
||||
#ifdef LOUDNESS_LEVELING_SUPPORT
|
||||
for (i = 0; i < pstr_uni_drc_config->drc_instructions_uni_drc_count; i++) {
|
||||
if (pstr_uni_drc_config->str_drc_instructions_uni_drc[i].drc_set_effect &
|
||||
EFFECT_BIT_DUCK_SELF) {
|
||||
if (pstr_uni_drc_config->str_drc_instructions_uni_drc[i].leveling_present &&
|
||||
|
|
@ -549,12 +587,28 @@ static IA_ERRORCODE impd_drc_validate_drc_instructions(
|
|||
pstr_uni_drc_config->str_drc_instructions_uni_drc[i].ducking_only_set_present = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef LOUDNESS_LEVELING_SUPPORT
|
||||
#endif
|
||||
|
||||
if (pstr_uni_drc_config->uni_drc_config_ext_present) {
|
||||
ia_drc_uni_drc_config_ext_struct *pstr_uni_drc_config_ext =
|
||||
&pstr_uni_drc_config->str_uni_drc_config_ext;
|
||||
profile_found = FALSE;
|
||||
for (j = 0; j < pstr_uni_drc_config_ext->drc_coefficients_uni_drc_v1_count; j++) {
|
||||
if (pstr_uni_drc_config_ext->str_drc_coefficients_uni_drc_v1[j].drc_location == 1) {
|
||||
profile_found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pstr_uni_drc_config->str_uni_drc_config_ext.parametric_drc_present &&
|
||||
pstr_uni_drc_config->str_uni_drc_config_ext.str_drc_coeff_parametric_drc.drc_location ==
|
||||
1) {
|
||||
profile_found = TRUE;
|
||||
}
|
||||
if (profile_found == FALSE) {
|
||||
return IA_EXHEAACE_CONFIG_FATAL_DRC_INVALID_CONFIG;
|
||||
}
|
||||
#ifdef LOUDNESS_LEVELING_SUPPORT
|
||||
for (i = 0; i < pstr_uni_drc_config_ext->drc_instructions_uni_drc_v1_count; i++) {
|
||||
if (pstr_uni_drc_config_ext->str_drc_instructions_uni_drc_v1[i].drc_set_effect &
|
||||
EFFECT_BIT_DUCK_SELF) {
|
||||
|
|
@ -585,8 +639,9 @@ static IA_ERRORCODE impd_drc_validate_drc_instructions(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return IA_NO_ERROR;
|
||||
}
|
||||
|
||||
|
|
@ -635,6 +690,34 @@ IA_ERRORCODE impd_drc_enc_init(VOID *pstr_drc_state, VOID *ptr_drc_scratch,
|
|||
pstr_drc_state_local->str_enc_gain_extension = pstr_inp_config->str_enc_gain_extension;
|
||||
pstr_drc_state_local->str_gain_enc.str_uni_drc_config = pstr_inp_config->str_uni_drc_config;
|
||||
|
||||
pstr_drc_state_local->str_enc_params.gain_sequence_present = FALSE;
|
||||
for (WORD16 k = 0; k < pstr_drc_state_local->str_uni_drc_config.drc_coefficients_uni_drc_count;
|
||||
k++) {
|
||||
if ((pstr_drc_state_local->str_uni_drc_config.str_drc_coefficients_uni_drc[k].drc_location ==
|
||||
1) &&
|
||||
(pstr_drc_state_local->str_uni_drc_config.str_drc_coefficients_uni_drc[k].gain_set_count >
|
||||
0)) {
|
||||
pstr_drc_state_local->str_enc_params.gain_sequence_present = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pstr_drc_state_local->str_enc_params.gain_sequence_present == FALSE) {
|
||||
for (WORD16 k = 0; k < pstr_drc_state_local->str_uni_drc_config.str_uni_drc_config_ext
|
||||
.drc_coefficients_uni_drc_v1_count;
|
||||
k++) {
|
||||
if ((pstr_drc_state_local->str_uni_drc_config.str_uni_drc_config_ext
|
||||
.str_drc_coefficients_uni_drc_v1[k]
|
||||
.drc_location == 1) &&
|
||||
(pstr_drc_state_local->str_uni_drc_config.str_uni_drc_config_ext
|
||||
.str_drc_coefficients_uni_drc_v1[k]
|
||||
.gain_set_count > 0)) {
|
||||
pstr_drc_state_local->str_enc_params.gain_sequence_present = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err_code = impd_drc_write_uni_drc_config(pstr_drc_state_local, &bit_count, 1);
|
||||
if (err_code & IA_FATAL_ERROR) {
|
||||
return err_code;
|
||||
|
|
@ -686,6 +769,15 @@ IA_ERRORCODE impd_drc_enc(VOID *pstr_drc_state, FLOAT32 **pptr_input, UWORD32 in
|
|||
ia_drc_compand_struct *pstr_drc_compand;
|
||||
ia_drc_stft_gain_calc_struct *pstr_drc_stft_gain_calc;
|
||||
IA_ERRORCODE err_code = IA_NO_ERROR;
|
||||
ia_drc_coefficients_uni_drc_struct *pstr_drc_coefficients_uni_drc;
|
||||
|
||||
if (pstr_uni_drc_config->str_uni_drc_config_ext.drc_coefficients_uni_drc_v1_count > 0) {
|
||||
pstr_drc_coefficients_uni_drc =
|
||||
&pstr_uni_drc_config->str_uni_drc_config_ext.str_drc_coefficients_uni_drc_v1[0];
|
||||
} else {
|
||||
pstr_drc_coefficients_uni_drc = &pstr_uni_drc_config->str_drc_coefficients_uni_drc[0];
|
||||
}
|
||||
|
||||
if (pstr_drc_state_local->str_enc_params.gain_sequence_present) {
|
||||
for (i = 0; i < MAX_DRC_COEFF_COUNT; i++) {
|
||||
for (j = 0; j < GAIN_SET_COUNT_MAX; j++) {
|
||||
|
|
@ -704,17 +796,12 @@ IA_ERRORCODE impd_drc_enc(VOID *pstr_drc_state, FLOAT32 **pptr_input, UWORD32 in
|
|||
is_fft_ready[pstr_drc_stft_gain_calc->ch_idx] = 1;
|
||||
}
|
||||
|
||||
for (k = 0; k < pstr_uni_drc_config->str_drc_coefficients_uni_drc[i]
|
||||
.str_gain_set_params[j]
|
||||
.band_count;
|
||||
for (k = 0; k < pstr_drc_coefficients_uni_drc[i].str_gain_set_params[j].band_count;
|
||||
k++) {
|
||||
if (k == pstr_uni_drc_config->str_drc_coefficients_uni_drc[i]
|
||||
.str_gain_set_params[j]
|
||||
.band_count -
|
||||
1) {
|
||||
if (k == pstr_drc_coefficients_uni_drc[i].str_gain_set_params[j].band_count - 1) {
|
||||
stop_sub_band_index = STFT256_HOP_SIZE - 1;
|
||||
} else {
|
||||
stop_sub_band_index = pstr_uni_drc_config->str_drc_coefficients_uni_drc[i]
|
||||
stop_sub_band_index = pstr_drc_coefficients_uni_drc[i]
|
||||
.str_gain_set_params[j]
|
||||
.gain_params[k + 1]
|
||||
.start_sub_band_index -
|
||||
|
|
@ -723,7 +810,7 @@ IA_ERRORCODE impd_drc_enc(VOID *pstr_drc_state, FLOAT32 **pptr_input, UWORD32 in
|
|||
|
||||
impd_drc_stft_drc_gain_calc_process(
|
||||
pstr_gain_enc, i, j, k,
|
||||
pstr_uni_drc_config->str_drc_coefficients_uni_drc[i]
|
||||
pstr_drc_coefficients_uni_drc[i]
|
||||
.str_gain_set_params[j]
|
||||
.gain_params[k]
|
||||
.start_sub_band_index,
|
||||
|
|
@ -738,9 +825,7 @@ IA_ERRORCODE impd_drc_enc(VOID *pstr_drc_state, FLOAT32 **pptr_input, UWORD32 in
|
|||
pstr_drc_state_local->gain_buffer[band_count]);
|
||||
}
|
||||
|
||||
band_count += pstr_uni_drc_config->str_drc_coefficients_uni_drc[i]
|
||||
.str_gain_set_params[j]
|
||||
.band_count;
|
||||
band_count += pstr_drc_coefficients_uni_drc[i].str_gain_set_params[j].band_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,6 @@ IA_ERRORCODE impd_drc_gain_enc_init(ia_drc_gain_enc_struct *pstr_gain_enc,
|
|||
IA_ERRORCODE err_code = IA_NO_ERROR;
|
||||
LOOPIDX i, j, k, l, m, ch;
|
||||
WORD32 num_gain_values_max;
|
||||
WORD32 params_found;
|
||||
UWORD8 found_ch_idx;
|
||||
UWORD32 ch_idx;
|
||||
|
||||
|
|
@ -104,12 +103,12 @@ IA_ERRORCODE impd_drc_gain_enc_init(ia_drc_gain_enc_struct *pstr_gain_enc,
|
|||
all_band_gain_count += pstr_drc_coefficients_uni_drc->str_gain_set_params[i].band_count;
|
||||
}
|
||||
pstr_gain_enc->n_sequences = all_band_gain_count;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for (i = 0; i < pstr_uni_drc_config_ext->drc_coefficients_uni_drc_v1_count; i++) {
|
||||
WORD32 all_band_gain_count = 0;
|
||||
for (j = 0; j < pstr_drc_coefficients_uni_drc_v1[i].gain_set_count; j++) {
|
||||
all_band_gain_count += pstr_drc_coefficients_uni_drc_v1[i].str_gain_set_params[j].band_count;
|
||||
all_band_gain_count +=
|
||||
pstr_drc_coefficients_uni_drc_v1[i].str_gain_set_params[j].band_count;
|
||||
}
|
||||
pstr_drc_coefficients_uni_drc_v1[i].gain_sequence_count = all_band_gain_count;
|
||||
pstr_gain_enc->n_sequences += all_band_gain_count;
|
||||
|
|
@ -228,29 +227,70 @@ IA_ERRORCODE impd_drc_gain_enc_init(ia_drc_gain_enc_struct *pstr_gain_enc,
|
|||
}
|
||||
}
|
||||
}
|
||||
if (pstr_uni_drc_config_ext->drc_coefficients_uni_drc_v1_count > 0) {
|
||||
for (i = 0; i < pstr_gain_enc->n_sequences; i++) {
|
||||
params_found = 0;
|
||||
k = 0;
|
||||
for (i = 0; i < pstr_uni_drc_config_ext->drc_coefficients_uni_drc_v1_count; i++) {
|
||||
pstr_drc_coefficients_uni_drc_v1 =
|
||||
&pstr_uni_drc_config_ext->str_drc_coefficients_uni_drc_v1[i];
|
||||
for (j = 0; j < pstr_drc_coefficients_uni_drc_v1->gain_set_count; j++) {
|
||||
ch_idx = 0;
|
||||
found_ch_idx = 0;
|
||||
ia_drc_gain_set_params_struct *pstr_gain_set_params =
|
||||
&pstr_drc_coefficients_uni_drc_v1->str_gain_set_params[j];
|
||||
|
||||
for (j = 0; j < pstr_drc_coefficients_uni_drc_v1->gain_set_count; j++) {
|
||||
for (l = 0; l < pstr_drc_coefficients_uni_drc_v1->str_gain_set_params[j].band_count;
|
||||
l++) {
|
||||
if (i == pstr_drc_coefficients_uni_drc_v1->str_gain_set_params[j]
|
||||
.gain_params[l]
|
||||
.gain_sequence_index) {
|
||||
pstr_gain_enc->str_drc_gain_seq_buf[i].str_drc_group.n_gain_values = 1;
|
||||
pstr_gain_enc->str_drc_gain_seq_buf[i].str_gain_set_params =
|
||||
pstr_drc_coefficients_uni_drc_v1->str_gain_set_params[j];
|
||||
params_found = 1;
|
||||
}
|
||||
if (params_found == 1) {
|
||||
break;
|
||||
for (m = 0; m < pstr_uni_drc_config_ext->drc_instructions_uni_drc_v1_count; m++) {
|
||||
if (pstr_uni_drc_config_ext->str_drc_instructions_uni_drc_v1[m].drc_location ==
|
||||
pstr_drc_coefficients_uni_drc_v1->drc_location) {
|
||||
for (ch = 0; ch < MAX_CHANNEL_COUNT; ch++) {
|
||||
if (pstr_uni_drc_config_ext->str_drc_instructions_uni_drc_v1[m].gain_set_index[ch] ==
|
||||
j) {
|
||||
ch_idx = ch;
|
||||
found_ch_idx = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (params_found == 1) {
|
||||
if (found_ch_idx) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ch_idx >= (UWORD32)pstr_gain_enc->base_ch_count) {
|
||||
return IA_EXHEAACE_INIT_FATAL_DRC_INVALID_CHANNEL_INDEX;
|
||||
}
|
||||
|
||||
if (pstr_gain_set_params->band_count > 1) {
|
||||
impd_drc_util_stft_read_gain_config(pstr_gain_enc->str_drc_stft_gain_handle[i][j],
|
||||
pstr_gain_set_params->band_count,
|
||||
pstr_gain_set_params);
|
||||
|
||||
for (l = 0; l < pstr_gain_set_params->band_count; l++) {
|
||||
err_code = impd_drc_stft_drc_gain_calc_init(pstr_gain_enc, i, j, l);
|
||||
if (err_code) {
|
||||
return err_code;
|
||||
}
|
||||
pstr_gain_enc->str_drc_stft_gain_handle[i][j][l].ch_idx = ch_idx;
|
||||
pstr_gain_enc->str_drc_stft_gain_handle[i][j][l].is_valid = 1;
|
||||
}
|
||||
} else if (pstr_gain_set_params->band_count == 1) {
|
||||
impd_drc_util_td_read_gain_config(&pstr_gain_enc->str_drc_compand[i][j],
|
||||
pstr_gain_set_params);
|
||||
|
||||
pstr_gain_enc->str_drc_compand[i][j].initial_volume = 0.0f;
|
||||
|
||||
err_code = impd_drc_td_drc_gain_calc_init(pstr_gain_enc, i, j);
|
||||
if (err_code) {
|
||||
return err_code;
|
||||
}
|
||||
pstr_gain_enc->str_drc_compand[i][j].ch_idx = ch_idx;
|
||||
pstr_gain_enc->str_drc_compand[i][j].is_valid = 1;
|
||||
}
|
||||
|
||||
for (l = 0; l < pstr_gain_set_params->band_count; l++) {
|
||||
pstr_gain_enc->str_drc_gain_seq_buf[k].str_drc_group.n_gain_values = 1;
|
||||
pstr_gain_enc->str_drc_gain_seq_buf[k].str_gain_set_params =
|
||||
pstr_drc_coefficients_uni_drc_v1->str_gain_set_params[j];
|
||||
k++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ static VOID ixheaace_read_drc_config_params(
|
|||
pstr_enc_loudness_info_set->loudness_info_set_ext_present = fuzzed_data->ConsumeBool();
|
||||
pstr_enc_gain_extension->uni_drc_gain_ext_present = fuzzed_data->ConsumeBool();
|
||||
|
||||
if (pstr_uni_drc_config->uni_drc_config_ext_present) {
|
||||
if (pstr_uni_drc_config->uni_drc_config_ext_present == 1) {
|
||||
#ifdef LOUDNESS_LEVELING_SUPPORT
|
||||
pstr_uni_drc_config->str_uni_drc_config_ext.uni_drc_config_ext_type[config_extension_count] =
|
||||
UNIDRC_CONF_EXT_V1;
|
||||
|
|
@ -324,7 +324,7 @@ static VOID ixheaace_read_drc_config_params(
|
|||
#endif
|
||||
pstr_uni_drc_config->str_uni_drc_config_ext.downmix_instructions_v1_present =
|
||||
fuzzed_data->ConsumeBool();
|
||||
if (pstr_uni_drc_config->str_uni_drc_config_ext.downmix_instructions_v1_present) {
|
||||
if (pstr_uni_drc_config->str_uni_drc_config_ext.downmix_instructions_v1_present == 1) {
|
||||
/*********** str_downmix_instructions_v1 *************/
|
||||
|
||||
pstr_uni_drc_config->str_uni_drc_config_ext.downmix_instructions_v1_count =
|
||||
|
|
@ -353,7 +353,7 @@ static VOID ixheaace_read_drc_config_params(
|
|||
pstr_uni_drc_config->str_uni_drc_config_ext.drc_coeffs_and_instructions_uni_drc_v1_present =
|
||||
fuzzed_data->ConsumeBool();
|
||||
if (pstr_uni_drc_config->str_uni_drc_config_ext
|
||||
.drc_coeffs_and_instructions_uni_drc_v1_present) {
|
||||
.drc_coeffs_and_instructions_uni_drc_v1_present == 1) {
|
||||
/*********** str_drc_coefficients_uni_drc_v1 *************/
|
||||
|
||||
pstr_uni_drc_config->str_uni_drc_config_ext.drc_coefficients_uni_drc_v1_count =
|
||||
|
|
@ -531,7 +531,7 @@ static VOID ixheaace_read_drc_config_params(
|
|||
#endif
|
||||
}
|
||||
|
||||
if (pstr_enc_loudness_info_set->loudness_info_set_ext_present) {
|
||||
if (pstr_enc_loudness_info_set->loudness_info_set_ext_present == 1) {
|
||||
ia_drc_loudness_info_set_ext_eq_struct *pstr_loudness_info_set_ext_eq =
|
||||
&pstr_enc_loudness_info_set->str_loudness_info_set_extension.str_loudness_info_set_ext_eq;
|
||||
|
||||
|
|
@ -549,13 +549,14 @@ static VOID ixheaace_read_drc_config_params(
|
|||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1_album[n].sample_peak_level_present =
|
||||
fuzzed_data->ConsumeBool();
|
||||
if (pstr_loudness_info_set_ext_eq->str_loudness_info_v1_album[n]
|
||||
.sample_peak_level_present) {
|
||||
.sample_peak_level_present == 1) {
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1_album[n].sample_peak_level =
|
||||
fuzzed_data->ConsumeFloatingPoint<FLOAT32>();
|
||||
}
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1_album[n].true_peak_level_present =
|
||||
fuzzed_data->ConsumeBool();
|
||||
if (pstr_loudness_info_set_ext_eq->str_loudness_info_v1_album[n].true_peak_level_present) {
|
||||
if (pstr_loudness_info_set_ext_eq->str_loudness_info_v1_album[n].true_peak_level_present ==
|
||||
1) {
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1_album[n].true_peak_level =
|
||||
fuzzed_data->ConsumeFloatingPoint<FLOAT32>();
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1_album[n]
|
||||
|
|
@ -593,13 +594,13 @@ static VOID ixheaace_read_drc_config_params(
|
|||
fuzzed_data->ConsumeIntegral<WORD8>();
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n].sample_peak_level_present =
|
||||
fuzzed_data->ConsumeBool();
|
||||
if (pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n].sample_peak_level_present) {
|
||||
if (pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n].sample_peak_level_present == 1) {
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n].sample_peak_level =
|
||||
fuzzed_data->ConsumeFloatingPoint<FLOAT32>();
|
||||
}
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n].true_peak_level_present =
|
||||
fuzzed_data->ConsumeBool();
|
||||
if (pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n].true_peak_level_present) {
|
||||
if (pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n].true_peak_level_present == 1) {
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n].true_peak_level =
|
||||
fuzzed_data->ConsumeFloatingPoint<FLOAT32>();
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n]
|
||||
|
|
|
|||
|
|
@ -7,17 +7,27 @@
|
|||
drc_instructions_uni_drc_count:0
|
||||
#####str_drc_coefficients_uni_drc#####
|
||||
drc_coefficients_uni_drc_count:0
|
||||
|
||||
########### uniDRCv1 configuration ###########
|
||||
uni_drc_config_ext_present:1
|
||||
|
||||
#####str_downmix_instructions_v1#####
|
||||
downmix_instructions_v1_present:1
|
||||
|
||||
downmix_instructions_v1_count:1
|
||||
#n=0
|
||||
target_layout:1
|
||||
#s=0
|
||||
downmix_coeff:0.70794578438
|
||||
#end downmix coeeficients
|
||||
|
||||
######## str_drc_coefficients_uni_drc_v1 & str_drc_instructions_uni_drc_v1 ########
|
||||
drc_coeffs_and_instructions_uni_drc_v1_present:1
|
||||
|
||||
#####str_drc_coefficients_uni_drc_v1#####
|
||||
drc_coefficients_uni_drc_count_v1:1
|
||||
#n=0
|
||||
gain_set_count:1
|
||||
gain_set_count:3
|
||||
#s=0
|
||||
band_count:1
|
||||
#gain parameters m=0
|
||||
|
|
@ -32,6 +42,31 @@ width:0.01
|
|||
attack:2.0
|
||||
decay:5.0
|
||||
#end gain parameters
|
||||
#s=1
|
||||
band_count:1
|
||||
#gain parameters m=0
|
||||
nb_points:2
|
||||
x:-50.0
|
||||
y:-50.0
|
||||
x:0.0
|
||||
y:-10.0
|
||||
width:0.01
|
||||
attack:2.0
|
||||
decay:5.0
|
||||
#s=2
|
||||
band_count:1
|
||||
#gain parameters m=0
|
||||
nb_points:3
|
||||
x:-60.0
|
||||
y:-60.0
|
||||
x:-20.0
|
||||
y:-15.0
|
||||
x:0.0
|
||||
y:-5.0
|
||||
width:0.01
|
||||
attack:2.0
|
||||
decay:5.0
|
||||
#end gain parameters
|
||||
#####str_drc_instructions_uni_drc_v1#####
|
||||
drc_instructions_uni_drc_count_v1:3
|
||||
#n=0
|
||||
|
|
@ -51,14 +86,14 @@ num_drc_channel_groups:1
|
|||
downmix_id:0
|
||||
drc_set_effect:0x800
|
||||
gain_set_channels:8
|
||||
gain_set_index:0
|
||||
gain_set_index:0
|
||||
gain_set_index:0
|
||||
gain_set_index:0
|
||||
gain_set_index:0
|
||||
gain_set_index:0
|
||||
gain_set_index:0
|
||||
gain_set_index:0
|
||||
gain_set_index:1
|
||||
gain_set_index:1
|
||||
gain_set_index:1
|
||||
gain_set_index:1
|
||||
gain_set_index:1
|
||||
gain_set_index:1
|
||||
gain_set_index:1
|
||||
gain_set_index:1
|
||||
num_drc_channel_groups:1
|
||||
#leveling present flag
|
||||
leveling_present:1
|
||||
|
|
@ -68,17 +103,18 @@ ducking_only_set_present:1
|
|||
downmix_id:0
|
||||
drc_set_effect:0x0800
|
||||
gain_set_channels:8
|
||||
gain_set_index:0
|
||||
gain_set_index:0
|
||||
gain_set_index:0
|
||||
gain_set_index:0
|
||||
gain_set_index:0
|
||||
gain_set_index:0
|
||||
gain_set_index:0
|
||||
gain_set_index:0
|
||||
gain_set_index:2
|
||||
gain_set_index:2
|
||||
gain_set_index:2
|
||||
gain_set_index:2
|
||||
gain_set_index:2
|
||||
gain_set_index:2
|
||||
gain_set_index:2
|
||||
gain_set_index:2
|
||||
num_drc_channel_groups:1
|
||||
leveling_present:0
|
||||
ducking_only_set_present:0
|
||||
########### end of uniDRCv1 configuration ###########
|
||||
|
||||
#loudness info parameters
|
||||
loudness_info_count:1
|
||||
|
|
|
|||
|
|
@ -255,8 +255,8 @@ VOID ixheaace_read_drc_config_params(FILE *fp, ia_drc_enc_params_struct *pstr_en
|
|||
|
||||
pstr_uni_drc_config->drc_description_basic_present = 0;
|
||||
|
||||
pstr_uni_drc_config->uni_drc_config_ext_present = 1;
|
||||
if (pstr_uni_drc_config->uni_drc_config_ext_present) {
|
||||
pstr_uni_drc_config->uni_drc_config_ext_present = impd_drc_get_integer_value(fp);
|
||||
if (pstr_uni_drc_config->uni_drc_config_ext_present == 1) {
|
||||
#ifdef LOUDNESS_LEVELING_SUPPORT
|
||||
pstr_uni_drc_config->str_uni_drc_config_ext.uni_drc_config_ext_type[config_extension_count] =
|
||||
UNIDRC_CONF_EXT_V1;
|
||||
|
|
@ -265,8 +265,9 @@ VOID ixheaace_read_drc_config_params(FILE *fp, ia_drc_enc_params_struct *pstr_en
|
|||
pstr_uni_drc_config->str_uni_drc_config_ext.uni_drc_config_ext_type[0] = UNIDRC_CONF_EXT_V1;
|
||||
#endif
|
||||
|
||||
pstr_uni_drc_config->str_uni_drc_config_ext.downmix_instructions_v1_present = 1;
|
||||
if (pstr_uni_drc_config->str_uni_drc_config_ext.downmix_instructions_v1_present) {
|
||||
pstr_uni_drc_config->str_uni_drc_config_ext.downmix_instructions_v1_present =
|
||||
impd_drc_get_integer_value(fp);
|
||||
if (pstr_uni_drc_config->str_uni_drc_config_ext.downmix_instructions_v1_present == 1) {
|
||||
|
||||
/*********** str_downmix_instructions_v1 *************/
|
||||
pstr_uni_drc_config->str_uni_drc_config_ext.downmix_instructions_v1_count = impd_drc_get_integer_value(fp);
|
||||
|
|
@ -293,9 +294,10 @@ VOID ixheaace_read_drc_config_params(FILE *fp, ia_drc_enc_params_struct *pstr_en
|
|||
}
|
||||
}
|
||||
|
||||
pstr_uni_drc_config->str_uni_drc_config_ext.drc_coeffs_and_instructions_uni_drc_v1_present = 1;
|
||||
if (pstr_uni_drc_config->str_uni_drc_config_ext.drc_coeffs_and_instructions_uni_drc_v1_present) {
|
||||
|
||||
pstr_uni_drc_config->str_uni_drc_config_ext.drc_coeffs_and_instructions_uni_drc_v1_present =
|
||||
impd_drc_get_integer_value(fp);
|
||||
if (pstr_uni_drc_config->str_uni_drc_config_ext
|
||||
.drc_coeffs_and_instructions_uni_drc_v1_present == 1) {
|
||||
/*********** str_drc_coefficients_uni_drc_v1 *************/
|
||||
pstr_uni_drc_config->str_uni_drc_config_ext.drc_coefficients_uni_drc_v1_count = impd_drc_get_integer_value(fp);
|
||||
|
||||
|
|
@ -545,7 +547,7 @@ VOID ixheaace_read_drc_config_params(FILE *fp, ia_drc_enc_params_struct *pstr_en
|
|||
|
||||
/********************* loudness info set extension *********************/
|
||||
pstr_enc_loudness_info_set->loudness_info_set_ext_present = impd_drc_get_integer_value(fp);
|
||||
if (pstr_enc_loudness_info_set->loudness_info_set_ext_present) {
|
||||
if (pstr_enc_loudness_info_set->loudness_info_set_ext_present == 1) {
|
||||
ia_drc_loudness_info_set_ext_eq_struct *pstr_loudness_info_set_ext_eq =
|
||||
&pstr_enc_loudness_info_set->str_loudness_info_set_extension.str_loudness_info_set_ext_eq;
|
||||
|
||||
|
|
@ -564,13 +566,14 @@ VOID ixheaace_read_drc_config_params(FILE *fp, ia_drc_enc_params_struct *pstr_en
|
|||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1_album[n].sample_peak_level_present =
|
||||
impd_drc_get_integer_value(fp);
|
||||
if (pstr_loudness_info_set_ext_eq->str_loudness_info_v1_album[n]
|
||||
.sample_peak_level_present) {
|
||||
.sample_peak_level_present == 1) {
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1_album[n].sample_peak_level =
|
||||
impd_drc_get_float_value(fp);
|
||||
}
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1_album[n].true_peak_level_present =
|
||||
impd_drc_get_integer_value(fp);
|
||||
if (pstr_loudness_info_set_ext_eq->str_loudness_info_v1_album[n].true_peak_level_present) {
|
||||
if (pstr_loudness_info_set_ext_eq->str_loudness_info_v1_album[n].true_peak_level_present ==
|
||||
1) {
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1_album[n].true_peak_level =
|
||||
impd_drc_get_float_value(fp);
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1_album[n]
|
||||
|
|
@ -613,13 +616,13 @@ VOID ixheaace_read_drc_config_params(FILE *fp, ia_drc_enc_params_struct *pstr_en
|
|||
impd_drc_get_integer_value(fp);
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n].sample_peak_level_present =
|
||||
impd_drc_get_integer_value(fp);
|
||||
if (pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n].sample_peak_level_present) {
|
||||
if (pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n].sample_peak_level_present == 1) {
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n].sample_peak_level =
|
||||
impd_drc_get_float_value(fp);
|
||||
}
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n].true_peak_level_present =
|
||||
impd_drc_get_integer_value(fp);
|
||||
if (pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n].true_peak_level_present) {
|
||||
if (pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n].true_peak_level_present == 1) {
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n].true_peak_level =
|
||||
impd_drc_get_float_value(fp);
|
||||
pstr_loudness_info_set_ext_eq->str_loudness_info_v1[n]
|
||||
|
|
|
|||
|
|
@ -1298,6 +1298,7 @@ IA_ERRORCODE ia_enhaacplus_enc_main_process(ixheaace_app_context *pstr_context,
|
|||
return -1;
|
||||
}
|
||||
ia_drc_input_config *pstr_drc_cfg = (ia_drc_input_config *)pstr_in_cfg->pv_drc_cfg;
|
||||
memset(pstr_drc_cfg, 0, sizeof(*pstr_drc_cfg));
|
||||
|
||||
/* Stack process struct initing */
|
||||
p_error_init = ia_enhaacplus_enc_error_handler_init;
|
||||
|
|
@ -1444,7 +1445,6 @@ IA_ERRORCODE ia_enhaacplus_enc_main_process(ixheaace_app_context *pstr_context,
|
|||
/* ******************************************************************/
|
||||
/* DRC */
|
||||
if (pstr_in_cfg->use_drc_element == 1 && pstr_in_cfg->aot == AOT_USAC) {
|
||||
LOOPIDX k;
|
||||
CHAR8 drc_config_file_name[IA_MAX_CMD_LINE_LENGTH];
|
||||
strcpy(drc_config_file_name, DRC_CONFIG_FILE);
|
||||
|
||||
|
|
@ -1462,34 +1462,6 @@ IA_ERRORCODE ia_enhaacplus_enc_main_process(ixheaace_app_context *pstr_context,
|
|||
&pstr_drc_cfg->str_enc_loudness_info_set, &pstr_drc_cfg->str_enc_gain_extension,
|
||||
pstr_in_cfg->i_channels);
|
||||
|
||||
pstr_drc_cfg->str_enc_params.gain_sequence_present = FALSE;
|
||||
for (k = 0; k < pstr_drc_cfg->str_uni_drc_config.drc_coefficients_uni_drc_count; k++) {
|
||||
if (pstr_drc_cfg->str_uni_drc_config.str_drc_coefficients_uni_drc[k].drc_location == 1) {
|
||||
if (pstr_drc_cfg->str_uni_drc_config.str_drc_coefficients_uni_drc[k].gain_set_count >
|
||||
0) {
|
||||
pstr_drc_cfg->str_enc_params.gain_sequence_present = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pstr_drc_cfg->str_enc_params.gain_sequence_present == FALSE) {
|
||||
for (k = 0; k < pstr_drc_cfg->str_uni_drc_config.str_uni_drc_config_ext
|
||||
.drc_coefficients_uni_drc_v1_count;
|
||||
k++) {
|
||||
if (pstr_drc_cfg->str_uni_drc_config.str_uni_drc_config_ext
|
||||
.str_drc_coefficients_uni_drc_v1[k]
|
||||
.drc_location == 1) {
|
||||
if (pstr_drc_cfg->str_uni_drc_config.str_uni_drc_config_ext
|
||||
.str_drc_coefficients_uni_drc_v1[k]
|
||||
.gain_sequence_count > 0) {
|
||||
pstr_drc_cfg->str_enc_params.gain_sequence_present = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pstr_drc_cfg_user =
|
||||
(ia_drc_input_config *)malloc_global(sizeof(ia_drc_input_config), DEFAULT_MEM_ALIGN_8);
|
||||
if (pstr_drc_cfg_user == NULL) {
|
||||
|
|
@ -1625,6 +1597,9 @@ IA_ERRORCODE ia_enhaacplus_enc_main_process(ixheaace_app_context *pstr_context,
|
|||
if (ia_stsz_size != NULL) {
|
||||
free_global(ia_stsz_size);
|
||||
}
|
||||
if (pf_drc_inp) {
|
||||
fclose(pf_drc_inp);
|
||||
}
|
||||
return IA_NO_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue