Update Boost and attenuation values for MPEG-D DRC

Extend API Support to change MPEG-D DRC values for boost
and attenuation from plugin.

Bug: 175435457
Test: atest CtsMediaTestCases:DecoderTest
Test: atest CtsMediaTestCases:DecoderTestAacDrc
Test: atest CtsMediaTestCases:DecoderTestXheAac
Test: atest CtsMediaTestCases:DecoderTestAacFormat
Test: atest CtsMediaV2TestCases:CodecDecoderTest
This commit is contained in:
Sachin 2020-10-29 06:55:59 +05:30 • committed by Annsha Merlin Joseph
parent ebe61f8ba1
commit a281ecf0cd
6 changed files with 28 additions and 13 deletions

View file

@ -19,7 +19,6 @@
*/
#include <string.h>
#include <stdlib.h>
#include "impd_type_def.h"
#include "impd_error_standards.h"
#include "impd_apicmd_standards.h"
@ -109,6 +108,7 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
pWORD8 pb_value = pv_value;
SIZE_T *ps_value = pv_value;
pWORD32 pi_value = pv_value;
float *pf_value = pv_value;
switch (i_cmd) {
case IA_API_CMD_GET_MEM_INFO_SIZE:
@ -349,6 +349,14 @@ IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
p_obj_drc->str_config.album_mode = *pus_value;
break;
}
case IA_DRC_DEC_CONFIG_DRC_BOOST: {
p_obj_drc->str_config.boost = (*pf_value);
break;
}
case IA_DRC_DEC_CONFIG_DRC_COMPRESS: {
p_obj_drc->str_config.compress = (*pf_value);
break;
}
default: { return -1; }
}
break;

View file

@ -56,6 +56,8 @@ typedef struct ia_drc_config_struct {
WORD32 target_loudness;
WORD32 loud_norm_flag;
WORD32 album_mode;
FLOAT32 boost;
FLOAT32 compress;
} ia_drc_config_struct;

View file

@ -42,4 +42,6 @@
#define IA_DRC_DEC_CONFIG_DRC_TARGET_LOUDNESS 0x0012
#define IA_DRC_DEC_CONFIG_DRC_LOUD_NORM 0x0013
#define IA_DRC_DEC_CONFIG_DRC_ALBUM_MODE 0x0014
#define IA_DRC_DEC_CONFIG_DRC_BOOST 0x0015
#define IA_DRC_DEC_CONFIG_DRC_COMPRESS 0x0016
#endif

View file

@ -59,7 +59,8 @@ impd_drc_dec_interface_process(ia_bit_buf_struct *it_bit_buff,
WORD32
impd_drc_dec_interface_add_effect_type(
ia_drc_interface_struct *pstr_drc_interface, WORD32 drc_effect_type,
WORD32 target_loudness, WORD32 loud_norm, WORD32 album_mode);
WORD32 target_loudness, WORD32 loud_norm, WORD32 album_mode, FLOAT32 boost,
FLOAT32 compress);
#define BITSTREAM_FILE_FORMAT_SPLIT 1
#define LIM_DEFAULT_THRESHOLD (0.89125094f)
@ -412,7 +413,8 @@ IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc) {
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.target_loudness,
p_obj_drc->str_config.loud_norm_flag, p_obj_drc->str_config.album_mode);
p_obj_drc->str_config.loud_norm_flag, p_obj_drc->str_config.album_mode,
p_obj_drc->str_config.boost, p_obj_drc->str_config.compress);
if (err_code != IA_NO_ERROR) return err_code;

View file

@ -23,7 +23,6 @@
#include <assert.h>
#include <string.h>
#include "impd_type_def.h"
#include "impd_drc_bitbuffer.h"
#include "impd_drc_common.h"
#include "impd_drc_interface.h"
@ -32,7 +31,8 @@
WORD32
impd_drc_dec_interface_add_effect_type(
ia_drc_interface_struct* pstr_drc_interface, WORD32 drc_effect_type,
WORD32 target_loudness, WORD32 loud_norm, WORD32 album_mode) {
WORD32 target_loudness, WORD32 loud_norm, WORD32 album_mode, FLOAT32 boost,
FLOAT32 compress) {
WORD32 err = 0;
WORD32 i = 0;
@ -138,8 +138,8 @@ impd_drc_dec_interface_add_effect_type(
pstr_drc_interface->drc_parameter_interface_flag = 1;
pstr_drc_interface->drc_parameter_interface.change_compress = 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.boost = 1.0f;
pstr_drc_interface->drc_parameter_interface.compress = compress;
pstr_drc_interface->drc_parameter_interface.boost = boost;
pstr_drc_interface->drc_parameter_interface
.change_drc_characteristic_target = 1;
pstr_drc_interface->drc_parameter_interface.drc_characteristic_target = 0;

View file

@ -319,6 +319,7 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
pWORD32 pui_value_signed = pv_value;
pWORD8 pb_value = pv_value;
pVOID *pp_value = (pVOID *)pv_value;
float *pf_value = pv_value;
if ((i_cmd != IA_API_CMD_GET_API_SIZE) &&
(i_cmd != IA_API_CMD_GET_LIB_ID_STRINGS)) {
@ -559,23 +560,23 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_enhaacplus_dec_obj, WORD32 i_cmd,
}
case IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_CUT: {
p_obj_exhaacplus_dec->aac_config.ui_drc_set = 1;
if (*pui_value > 127) {
if (*pf_value > 1) {
p_obj_exhaacplus_dec->aac_config.ui_drc_cut = 0;
return (IA_ENHAACPLUS_DEC_CONFIG_NONFATAL_INVALID_DRC_CUT);
}
p_obj_exhaacplus_dec->aac_config.ui_drc_cut =
(WORD32)((*pui_value / 127.0) * 100);
(WORD32)((*pf_value) * 100);
break;
}
case IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_BOOST: {
p_obj_exhaacplus_dec->aac_config.ui_drc_set = 1;
if (*pui_value > 127) {
if (*pf_value > 1) {
p_obj_exhaacplus_dec->aac_config.ui_drc_boost = 0;
return (IA_ENHAACPLUS_DEC_CONFIG_NONFATAL_INVALID_DRC_BOOST);
}
p_obj_exhaacplus_dec->aac_config.ui_drc_boost =
(WORD32)((*pui_value / 127.0) * 100);
(WORD32)((*pf_value) * 100);
break;
}
@ -2615,8 +2616,8 @@ IA_ERRORCODE ixheaacd_dec_execute(
time_data, channel, p_obj_exhaacplus_dec->aac_config.ui_max_channels,
p_state_enhaacplus_dec->audio_object_type);
if(p_state_enhaacplus_dec->ch_config == 2 && channel == 1)
return IA_ENHAACPLUS_DEC_EXE_NONFATAL_DECODE_FRAME_ERROR;
if (p_state_enhaacplus_dec->ch_config == 2 && channel == 1)
return IA_ENHAACPLUS_DEC_EXE_NONFATAL_DECODE_FRAME_ERROR;
error_code = ixheaacd_aacdec_decodeframe(
p_obj_exhaacplus_dec, &aac_scratch_struct, actual_out_buffer,