parent
a7019eafff
commit
1ce177ea0e
25 changed files with 339 additions and 265 deletions
|
|
@ -126,6 +126,18 @@ static IA_ERRORCODE impd_drc_validate_config_params(ia_drc_input_config *pstr_in
|
|||
.gain_params[k]
|
||||
.start_sub_band_index,
|
||||
0, STFT256_HOP_SIZE - 1);
|
||||
IMPD_DRC_BOUND_CHECK(pstr_uni_drc_config->str_drc_coefficients_uni_drc[i]
|
||||
.str_gain_set_params[j].gain_params[k].width,
|
||||
-MAX_FLT_VAL_DB, MAX_FLT_VAL_DB);
|
||||
for (WORD32 m = 0; m < pstr_uni_drc_config->str_drc_coefficients_uni_drc[i]
|
||||
.str_gain_set_params[j].gain_params[k].nb_points; m++) {
|
||||
IMPD_DRC_BOUND_CHECK(pstr_uni_drc_config->str_drc_coefficients_uni_drc[i]
|
||||
.str_gain_set_params[j].gain_params[k].gain_points[m].x,
|
||||
-MAX_FLT_VAL_DB, MAX_FLT_VAL_DB);
|
||||
IMPD_DRC_BOUND_CHECK(pstr_uni_drc_config->str_drc_coefficients_uni_drc[i]
|
||||
.str_gain_set_params[j].gain_params[k].gain_points[m].y,
|
||||
-MAX_FLT_VAL_DB, MAX_FLT_VAL_DB);
|
||||
}
|
||||
}
|
||||
for (k = 0; k <
|
||||
pstr_uni_drc_config->str_drc_coefficients_uni_drc[i].str_gain_set_params[j].band_count
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@
|
|||
#define MAX_METHOD_DEFINITION_TYPE (9)
|
||||
#define MIN_METHOD_VALUE (-116.0f)
|
||||
#define MAX_METHOD_VALUE (121.0f)
|
||||
#define MAX_FLT_VAL_DB (770.6367883810890080451095799195f)
|
||||
|
||||
typedef struct {
|
||||
WORD32 level_estim_k_weighting_type;
|
||||
|
|
|
|||
|
|
@ -1218,6 +1218,7 @@ IA_ERRORCODE ixheaace_usac_encode(FLOAT32 **ptr_input,
|
|||
return err;
|
||||
}
|
||||
num_bits += num_bits_ext_elem;
|
||||
ptr_usac_data->num_drc_bits = num_bits_ext_elem;
|
||||
#ifdef DRC_BITRATE_CONSIDERATION
|
||||
ptr_usac_data->drc_data_bit_cnt = num_bits_ext_elem;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ typedef struct {
|
|||
UWORD32 ext_elem_config_len[MAX_EXTENSION_PAYLOADS];
|
||||
iusace_scratch_mem str_scratch;
|
||||
WORD32 min_bits_needed;
|
||||
WORD32 num_drc_bits;
|
||||
} ia_usac_data_struct;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ VOID iaace_adj_thr_init(ia_adj_thr_state_struct *pstr_adj_thr_state, const FLOAT
|
|||
}
|
||||
FLOAT32 iaace_bits_to_pe(const FLOAT32 bits) { return (bits * 1.18f); }
|
||||
static VOID iaace_calc_sfb_pe_data(ia_qc_pe_data_struct *pstr_qc_pe_data,
|
||||
ixheaace_psy_out_channel *pstr_psy_out, WORD32 num_channels,
|
||||
ixheaace_psy_out_channel **pstr_psy_out, WORD32 num_channels,
|
||||
WORD32 chn) {
|
||||
WORD32 ch;
|
||||
WORD32 scf_band_grp;
|
||||
|
|
@ -148,11 +148,11 @@ static VOID iaace_calc_sfb_pe_data(ia_qc_pe_data_struct *pstr_qc_pe_data,
|
|||
pstr_qc_pe_data->num_active_lines = 0.0f;
|
||||
|
||||
for (ch = chn; ch < chn + num_channels; ch++) {
|
||||
sfb_count = pstr_psy_out[ch].sfb_count;
|
||||
scf_band_per_grp = pstr_psy_out[ch].sfb_per_group;
|
||||
max_sfb_per_grp = pstr_psy_out[ch].max_sfb_per_grp;
|
||||
ptr_sfb_energy = pstr_psy_out[ch].ptr_sfb_energy;
|
||||
ptr_sfb_thr = pstr_psy_out[ch].ptr_sfb_thr;
|
||||
sfb_count = pstr_psy_out[ch]->sfb_count;
|
||||
scf_band_per_grp = pstr_psy_out[ch]->sfb_per_group;
|
||||
max_sfb_per_grp = pstr_psy_out[ch]->max_sfb_per_grp;
|
||||
ptr_sfb_energy = pstr_psy_out[ch]->ptr_sfb_energy;
|
||||
ptr_sfb_thr = pstr_psy_out[ch]->ptr_sfb_thr;
|
||||
pstr_qc_pe_chan_data = &pstr_qc_pe_data->pe_ch_data[ch];
|
||||
pstr_qc_pe_chan_data->pe = 0;
|
||||
pstr_qc_pe_chan_data->num_active_lines = 0;
|
||||
|
|
@ -190,7 +190,7 @@ static VOID iaace_calc_sfb_pe_data(ia_qc_pe_data_struct *pstr_qc_pe_data,
|
|||
pstr_qc_pe_data->pe += pstr_qc_pe_chan_data->pe;
|
||||
pstr_qc_pe_data->const_part += pstr_qc_pe_chan_data->const_part;
|
||||
pstr_qc_pe_data->num_active_lines += pstr_qc_pe_chan_data->num_active_lines;
|
||||
pstr_psy_out[ch].pe = pstr_qc_pe_data->pe;
|
||||
pstr_psy_out[ch]->pe = pstr_qc_pe_data->pe;
|
||||
}
|
||||
}
|
||||
static FLOAT32 iaace_calc_bit_save(ia_bitres_param_struct *pstr_bitres_params, FLOAT32 fill_lvl) {
|
||||
|
|
@ -334,13 +334,13 @@ static VOID iaace_calc_pe_correction(FLOAT32 *ptr_correction_fac, const FLOAT32
|
|||
|
||||
static VOID iaace_calc_thr_exp(
|
||||
FLOAT32 thr_exp[IXHEAACE_MAX_CH_IN_BS_ELE][MAXIMUM_GROUPED_SCALE_FACTOR_BAND],
|
||||
ixheaace_psy_out_channel *pstr_psy_out, WORD32 num_chans, WORD32 chn) {
|
||||
ixheaace_psy_out_channel **pstr_psy_out, WORD32 num_chans, WORD32 chn) {
|
||||
WORD32 sfb, ch, scf_band_grp;
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out;
|
||||
FLOAT32 *ptr_scf_band_thr;
|
||||
FLOAT32 *ptr_thr_exp;
|
||||
for (ch = chn; ch < chn + num_chans; ch++) {
|
||||
pstr_psy_chan_out = &pstr_psy_out[ch];
|
||||
pstr_psy_chan_out = pstr_psy_out[ch];
|
||||
ptr_thr_exp = thr_exp[ch];
|
||||
for (scf_band_grp = 0; scf_band_grp < pstr_psy_chan_out->sfb_count;
|
||||
scf_band_grp += pstr_psy_chan_out->sfb_per_group) {
|
||||
|
|
@ -353,7 +353,7 @@ static VOID iaace_calc_thr_exp(
|
|||
}
|
||||
}
|
||||
|
||||
static VOID iaace_adapt_min_snr(ixheaace_psy_out_channel *pstr_psy_out,
|
||||
static VOID iaace_adapt_min_snr(ixheaace_psy_out_channel **pstr_psy_out,
|
||||
ia_min_snr_adapt_param_struct *pstr_min_snr_params,
|
||||
WORD32 num_chans, WORD32 chn) {
|
||||
WORD32 num_scf_band = 0, ch, scf_band_cnt, scf_band_offs, sfb;
|
||||
|
|
@ -361,7 +361,7 @@ static VOID iaace_adapt_min_snr(ixheaace_psy_out_channel *pstr_psy_out,
|
|||
WORD32 i;
|
||||
|
||||
for (ch = chn; ch < chn + num_chans; ch++) {
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out = &pstr_psy_out[ch];
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out = pstr_psy_out[ch];
|
||||
num_scf_band = 0;
|
||||
avg_energy = 0;
|
||||
scf_band_cnt = pstr_psy_chan_out->max_sfb_per_grp;
|
||||
|
|
@ -392,8 +392,9 @@ static VOID iaace_adapt_min_snr(ixheaace_psy_out_channel *pstr_psy_out,
|
|||
pstr_min_snr_params->red_offs + pstr_min_snr_params->red_ratio_fac * db_ratio;
|
||||
min_snr_red = MAX(min_snr_red, pstr_min_snr_params->max_red);
|
||||
pstr_psy_chan_out->sfb_min_snr[i] =
|
||||
(FLOAT32)pow(pstr_psy_out[ch].sfb_min_snr[i], min_snr_red);
|
||||
pstr_psy_chan_out->sfb_min_snr[i] = MIN(MIN_SNR_LIMIT, pstr_psy_out[ch].sfb_min_snr[i]);
|
||||
(FLOAT32)pow(pstr_psy_out[ch]->sfb_min_snr[i], min_snr_red);
|
||||
pstr_psy_chan_out->sfb_min_snr[i] =
|
||||
MIN(MIN_SNR_LIMIT, pstr_psy_out[ch]->sfb_min_snr[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -402,7 +403,7 @@ static VOID iaace_adapt_min_snr(ixheaace_psy_out_channel *pstr_psy_out,
|
|||
|
||||
static VOID iaace_init_avoid_hole_flag(
|
||||
WORD32 ah_flag[IXHEAACE_MAX_CH_IN_BS_ELE][MAXIMUM_GROUPED_SCALE_FACTOR_BAND],
|
||||
ixheaace_psy_out_channel *pstr_psy_out, ia_ah_param_struct *pstr_ah_param, WORD32 num_chans,
|
||||
ixheaace_psy_out_channel **pstr_psy_out, ia_ah_param_struct *pstr_ah_param, WORD32 num_chans,
|
||||
WORD32 chn, WORD32 aot) {
|
||||
WORD32 ch;
|
||||
FLOAT32 sfb_energy;
|
||||
|
|
@ -410,7 +411,7 @@ static VOID iaace_init_avoid_hole_flag(
|
|||
WORD32 scf_band_grp, scf_band_cnt, scf_band;
|
||||
FLOAT32 *ptr_scf_band_spread_energy, *ptr_scf_band_energy, *ptr_scf_band_min_snr;
|
||||
for (ch = chn; ch < chn + num_chans; ch++) {
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out = &pstr_psy_out[ch];
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out = pstr_psy_out[ch];
|
||||
|
||||
if (pstr_psy_chan_out->window_sequence != SHORT_WINDOW) {
|
||||
switch (aot) {
|
||||
|
|
@ -442,7 +443,7 @@ static VOID iaace_init_avoid_hole_flag(
|
|||
|
||||
if (pstr_ah_param->modify_min_snr) {
|
||||
for (ch = chn; ch < chn + num_chans; ch++) {
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out = &pstr_psy_out[ch];
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out = pstr_psy_out[ch];
|
||||
ptr_scf_band_energy = pstr_psy_chan_out->ptr_sfb_energy;
|
||||
|
||||
ptr_scf_band_min_snr = pstr_psy_chan_out->sfb_min_snr;
|
||||
|
|
@ -509,12 +510,12 @@ static VOID iaace_init_avoid_hole_flag(
|
|||
}
|
||||
|
||||
if (num_chans == 2) {
|
||||
ixheaace_psy_out_channel *pstr_psy_out_mid = &pstr_psy_out[chn];
|
||||
ixheaace_psy_out_channel *pstr_psy_out_side = &pstr_psy_out[chn + 1];
|
||||
ixheaace_psy_out_channel *pstr_psy_out_mid = pstr_psy_out[chn];
|
||||
ixheaace_psy_out_channel *pstr_psy_out_side = pstr_psy_out[chn + 1];
|
||||
WORD32 sfb;
|
||||
|
||||
for (sfb = 0; sfb < pstr_psy_out_mid->sfb_count; sfb++) {
|
||||
if (pstr_psy_out[chn].ms_used[sfb]) {
|
||||
if (pstr_psy_out[chn]->ms_used[sfb]) {
|
||||
FLOAT32 sfb_en_mid = pstr_psy_out_mid->ptr_sfb_energy[sfb];
|
||||
FLOAT32 sfb_en_side = pstr_psy_out_side->ptr_sfb_energy[sfb];
|
||||
FLOAT32 max_sfb_en = MAX(sfb_en_mid, sfb_en_side);
|
||||
|
|
@ -541,7 +542,7 @@ static VOID iaace_init_avoid_hole_flag(
|
|||
}
|
||||
|
||||
for (ch = chn; ch < chn + num_chans; ch++) {
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out = &pstr_psy_out[ch];
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out = pstr_psy_out[ch];
|
||||
for (scf_band_grp = 0; scf_band_grp < pstr_psy_chan_out->sfb_count;
|
||||
scf_band_grp += pstr_psy_chan_out->sfb_per_group) {
|
||||
for (scf_band = 0; scf_band < pstr_psy_chan_out->max_sfb_per_grp; scf_band++) {
|
||||
|
|
@ -563,7 +564,7 @@ static VOID iaace_init_avoid_hole_flag(
|
|||
}
|
||||
|
||||
static VOID iaace_reduce_thr(
|
||||
ixheaace_psy_out_channel *pstr_psy_out,
|
||||
ixheaace_psy_out_channel **pstr_psy_out,
|
||||
WORD32 ah_flag[IXHEAACE_MAX_CH_IN_BS_ELE][MAXIMUM_GROUPED_SCALE_FACTOR_BAND],
|
||||
FLOAT32 thr_exp[IXHEAACE_MAX_CH_IN_BS_ELE][MAXIMUM_GROUPED_SCALE_FACTOR_BAND],
|
||||
const FLOAT32 red_value, WORD32 num_channels, WORD32 chn) {
|
||||
|
|
@ -572,7 +573,7 @@ static VOID iaace_reduce_thr(
|
|||
FLOAT32 *ptr_sfb_energy_fix, *ptr_sfb_threshold_fix, *ptr_sfb_min_snr_fix, *ptr_thr_exp_fix;
|
||||
|
||||
for (ch = chn; ch < chn + num_channels; ch++) {
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out = &pstr_psy_out[ch];
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out = pstr_psy_out[ch];
|
||||
ptr_sfb_energy_fix = pstr_psy_chan_out->ptr_sfb_energy;
|
||||
ptr_sfb_threshold_fix = pstr_psy_chan_out->ptr_sfb_thr;
|
||||
ptr_sfb_min_snr_fix = pstr_psy_chan_out->sfb_min_snr;
|
||||
|
|
@ -603,14 +604,14 @@ static VOID iaace_calc_pe_no_active_holes(
|
|||
FLOAT32 *ptr_pe, FLOAT32 *ptr_const_part, FLOAT32 *ptr_num_active_lines,
|
||||
ia_qc_pe_data_struct *pstr_qs_pe_data,
|
||||
WORD32 ah_flag[IXHEAACE_MAX_CH_IN_BS_ELE][MAXIMUM_GROUPED_SCALE_FACTOR_BAND],
|
||||
ixheaace_psy_out_channel *pstr_psy_out, WORD32 num_channels, WORD32 chn) {
|
||||
ixheaace_psy_out_channel **pstr_psy_out, WORD32 num_channels, WORD32 chn) {
|
||||
WORD32 ch, sfb_group, sfb;
|
||||
*ptr_pe = 0.0f;
|
||||
*ptr_const_part = 0.0f;
|
||||
*ptr_num_active_lines = 0;
|
||||
|
||||
for (ch = chn; ch < chn + num_channels; ch++) {
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out = &pstr_psy_out[ch];
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out = pstr_psy_out[ch];
|
||||
ia_qc_pe_chan_data_struct *ptr_pe_chan_data = &pstr_qs_pe_data->pe_ch_data[ch];
|
||||
|
||||
for (sfb_group = 0; sfb_group < pstr_psy_chan_out->sfb_count;
|
||||
|
|
@ -627,7 +628,7 @@ static VOID iaace_calc_pe_no_active_holes(
|
|||
}
|
||||
|
||||
static VOID iaace_correct_thr(
|
||||
ixheaace_psy_out_channel *pstr_psy_out,
|
||||
ixheaace_psy_out_channel **pstr_psy_out,
|
||||
WORD32 ah_flag[IXHEAACE_MAX_CH_IN_BS_ELE][MAXIMUM_GROUPED_SCALE_FACTOR_BAND],
|
||||
ia_qc_pe_data_struct *pstr_qs_pe_data,
|
||||
FLOAT32 thr_exp[IXHEAACE_MAX_CH_IN_BS_ELE][MAXIMUM_GROUPED_SCALE_FACTOR_BAND],
|
||||
|
|
@ -644,7 +645,7 @@ static VOID iaace_correct_thr(
|
|||
ia_qc_pe_chan_data_struct *pstr_pe_chan_data = NULL;
|
||||
|
||||
for (ch = chn; ch < chn + num_channels; ch++) {
|
||||
pstr_psy_chan_out = &pstr_psy_out[ch];
|
||||
pstr_psy_chan_out = pstr_psy_out[ch];
|
||||
pstr_pe_chan_data = &pstr_qs_pe_data->pe_ch_data[ch];
|
||||
norm_factor[ch] = MIN_FLT_VAL;
|
||||
ptr_thr_exp = thr_exp[ch];
|
||||
|
|
@ -669,7 +670,7 @@ static VOID iaace_correct_thr(
|
|||
norm_factor[chn] = 1.0f / norm_factor[chn];
|
||||
|
||||
for (ch = chn; ch < chn + num_channels; ch++) {
|
||||
pstr_psy_chan_out = &pstr_psy_out[ch];
|
||||
pstr_psy_chan_out = pstr_psy_out[ch];
|
||||
pstr_pe_chan_data = &pstr_qs_pe_data->pe_ch_data[ch];
|
||||
ptr_sfb_energy = pstr_psy_chan_out->ptr_sfb_energy;
|
||||
ptr_sfb_thr = pstr_psy_chan_out->ptr_sfb_thr;
|
||||
|
|
@ -700,23 +701,23 @@ static VOID iaace_correct_thr(
|
|||
}
|
||||
|
||||
static VOID iaace_reduce_min_snr(
|
||||
ixheaace_psy_out_channel *pstr_psy_out, ia_qc_pe_data_struct *pstr_qs_pe_data,
|
||||
ixheaace_psy_out_channel **pstr_psy_out, ia_qc_pe_data_struct *pstr_qs_pe_data,
|
||||
WORD32 ah_flag[IXHEAACE_MAX_CH_IN_BS_ELE][MAXIMUM_GROUPED_SCALE_FACTOR_BAND],
|
||||
const FLOAT32 desired_pe, WORD32 num_channels, WORD32 chn) {
|
||||
WORD32 sfb, sfb_sub_win, ch;
|
||||
FLOAT32 delta_pe;
|
||||
|
||||
sfb_sub_win = pstr_psy_out[chn].max_sfb_per_grp;
|
||||
sfb_sub_win = pstr_psy_out[chn]->max_sfb_per_grp;
|
||||
|
||||
while (pstr_qs_pe_data->pe > desired_pe && sfb_sub_win > 0) {
|
||||
sfb_sub_win--;
|
||||
for (sfb = sfb_sub_win; sfb < pstr_psy_out[chn].sfb_count;
|
||||
sfb += pstr_psy_out[chn].sfb_per_group) {
|
||||
for (sfb = sfb_sub_win; sfb < pstr_psy_out[chn]->sfb_count;
|
||||
sfb += pstr_psy_out[chn]->sfb_per_group) {
|
||||
for (ch = chn; ch < chn + num_channels; ch++) {
|
||||
if (ah_flag[ch][sfb] != NO_AH && pstr_psy_out[ch].sfb_min_snr[sfb] < MIN_SNR_LIMIT) {
|
||||
pstr_psy_out[ch].sfb_min_snr[sfb] = MIN_SNR_LIMIT;
|
||||
pstr_psy_out[ch].ptr_sfb_thr[sfb] =
|
||||
pstr_psy_out[ch].ptr_sfb_energy[sfb] * pstr_psy_out[ch].sfb_min_snr[sfb];
|
||||
if (ah_flag[ch][sfb] != NO_AH && pstr_psy_out[ch]->sfb_min_snr[sfb] < MIN_SNR_LIMIT) {
|
||||
pstr_psy_out[ch]->sfb_min_snr[sfb] = MIN_SNR_LIMIT;
|
||||
pstr_psy_out[ch]->ptr_sfb_thr[sfb] =
|
||||
pstr_psy_out[ch]->ptr_sfb_energy[sfb] * pstr_psy_out[ch]->sfb_min_snr[sfb];
|
||||
delta_pe = pstr_qs_pe_data->pe_ch_data[ch].sfb_lines[sfb] * 1.5f -
|
||||
pstr_qs_pe_data->pe_ch_data[ch].sfb_pe[sfb];
|
||||
pstr_qs_pe_data->pe += delta_pe;
|
||||
|
|
@ -731,7 +732,7 @@ static VOID iaace_reduce_min_snr(
|
|||
}
|
||||
|
||||
static VOID iaace_allow_more_holes(
|
||||
ixheaace_psy_out_channel *pstr_psy_out, ia_qc_pe_data_struct *pstr_qs_pe_data,
|
||||
ixheaace_psy_out_channel **pstr_psy_out, ia_qc_pe_data_struct *pstr_qs_pe_data,
|
||||
WORD32 ah_flag[IXHEAACE_MAX_CH_IN_BS_ELE][MAXIMUM_GROUPED_SCALE_FACTOR_BAND],
|
||||
const ia_ah_param_struct *pstr_str_ah_param, const FLOAT32 desired_pe, WORD32 num_channels,
|
||||
WORD32 chn) {
|
||||
|
|
@ -739,12 +740,12 @@ static VOID iaace_allow_more_holes(
|
|||
FLOAT32 act_pe = pstr_qs_pe_data->pe;
|
||||
|
||||
if (num_channels == 2 &&
|
||||
pstr_psy_out[chn].window_sequence == pstr_psy_out[chn + 1].window_sequence) {
|
||||
ixheaace_psy_out_channel *pstr_psy_out_left = &pstr_psy_out[chn];
|
||||
ixheaace_psy_out_channel *pstr_psy_out_right = &pstr_psy_out[chn + 1];
|
||||
pstr_psy_out[chn]->window_sequence == pstr_psy_out[chn + 1]->window_sequence) {
|
||||
ixheaace_psy_out_channel *pstr_psy_out_left = pstr_psy_out[chn];
|
||||
ixheaace_psy_out_channel *pstr_psy_out_right = pstr_psy_out[chn + 1];
|
||||
|
||||
for (sfb = 0; sfb < pstr_psy_out_left->sfb_count; sfb++) {
|
||||
if (pstr_psy_out[chn].ms_used[sfb]) {
|
||||
if (pstr_psy_out[chn]->ms_used[sfb]) {
|
||||
if (ah_flag[chn + 1][sfb] != NO_AH &&
|
||||
0.4f * pstr_psy_out_left->sfb_min_snr[sfb] * pstr_psy_out_left->ptr_sfb_energy[sfb] >
|
||||
pstr_psy_out_right->ptr_sfb_energy[sfb]) {
|
||||
|
|
@ -780,7 +781,7 @@ static VOID iaace_allow_more_holes(
|
|||
WORD32 done;
|
||||
|
||||
for (ch = chn; ch < chn + num_channels; ch++) {
|
||||
if (pstr_psy_out[ch].window_sequence != SHORT_WINDOW) {
|
||||
if (pstr_psy_out[ch]->window_sequence != SHORT_WINDOW) {
|
||||
start_sfb[ch] = pstr_str_ah_param->start_sfb_long;
|
||||
} else {
|
||||
start_sfb[ch] = pstr_str_ah_param->start_sfb_short;
|
||||
|
|
@ -791,7 +792,7 @@ static VOID iaace_allow_more_holes(
|
|||
min_energy = MAX_FLT_VAL;
|
||||
ah_cnt = 0;
|
||||
for (ch = chn; ch < chn + num_channels; ch++) {
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out = &pstr_psy_out[ch];
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out = pstr_psy_out[ch];
|
||||
for (sfb = start_sfb[ch]; sfb < pstr_psy_chan_out->sfb_count; sfb++) {
|
||||
if ((ah_flag[ch][sfb] != NO_AH) &&
|
||||
(pstr_psy_chan_out->ptr_sfb_energy[sfb] > pstr_psy_chan_out->ptr_sfb_thr[sfb])) {
|
||||
|
|
@ -808,11 +809,11 @@ static VOID iaace_allow_more_holes(
|
|||
energy[en_idx] = min_energy * (FLOAT32)pow(average_energy / (min_energy + MIN_FLT_VAL),
|
||||
(2 * en_idx + 1) / 7.0f);
|
||||
}
|
||||
max_sfb = pstr_psy_out[chn].sfb_count - 1;
|
||||
max_sfb = pstr_psy_out[chn]->sfb_count - 1;
|
||||
min_sfb = start_sfb[chn];
|
||||
|
||||
if (num_channels == 2) {
|
||||
max_sfb = MAX(max_sfb, pstr_psy_out[chn + 1].sfb_count - 1);
|
||||
max_sfb = MAX(max_sfb, pstr_psy_out[chn + 1]->sfb_count - 1);
|
||||
|
||||
min_sfb = MIN(min_sfb, start_sfb[chn + 1]);
|
||||
}
|
||||
|
|
@ -822,7 +823,7 @@ static VOID iaace_allow_more_holes(
|
|||
done = 0;
|
||||
while (!done) {
|
||||
for (ch = chn; ch < chn + num_channels; ch++) {
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out = &pstr_psy_out[ch];
|
||||
ixheaace_psy_out_channel *pstr_psy_chan_out = pstr_psy_out[ch];
|
||||
if (sfb >= start_sfb[ch] && sfb < pstr_psy_chan_out->sfb_count) {
|
||||
if (ah_flag[ch][sfb] != NO_AH &&
|
||||
pstr_psy_chan_out->ptr_sfb_energy[sfb] < energy[en_idx]) {
|
||||
|
|
@ -850,7 +851,7 @@ static VOID iaace_allow_more_holes(
|
|||
}
|
||||
|
||||
static VOID iaace_adapt_thr_to_pe(
|
||||
ixheaace_psy_out_channel pstr_psy_out[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_psy_out_channel **pstr_psy_out,
|
||||
ia_qc_pe_data_struct *pstr_qs_pe_data, const FLOAT32 desired_pe,
|
||||
ia_ah_param_struct *pstr_ah_param, ia_min_snr_adapt_param_struct *pstr_msa_param,
|
||||
WORD32 num_channels, WORD32 chn, WORD32 aot) {
|
||||
|
|
@ -918,7 +919,7 @@ static VOID iaace_adapt_thr_to_pe(
|
|||
|
||||
VOID iaace_adjust_threshold(ia_adj_thr_state_struct *pstr_adj_thr_state,
|
||||
ia_adj_thr_elem_struct *pstr_adj_thr_elem,
|
||||
ixheaace_psy_out_channel pstr_psy_out[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_psy_out_channel **pstr_psy_out,
|
||||
FLOAT32 *ptr_ch_bit_dist, ixheaace_qc_out_element *pstr_qc_out_el,
|
||||
const WORD32 avg_bits, const WORD32 bitres_bits,
|
||||
const WORD32 max_bitres_bits, const WORD32 side_info_bits,
|
||||
|
|
@ -945,12 +946,12 @@ VOID iaace_adjust_threshold(ia_adj_thr_state_struct *pstr_adj_thr_state,
|
|||
|
||||
curr_win_sequence = LONG_WINDOW;
|
||||
if (num_channels == 2) {
|
||||
if ((pstr_psy_out[chn].window_sequence == SHORT_WINDOW) ||
|
||||
(pstr_psy_out[chn + 1].window_sequence == SHORT_WINDOW)) {
|
||||
if ((pstr_psy_out[chn]->window_sequence == SHORT_WINDOW) ||
|
||||
(pstr_psy_out[chn + 1]->window_sequence == SHORT_WINDOW)) {
|
||||
curr_win_sequence = SHORT_WINDOW;
|
||||
}
|
||||
} else {
|
||||
curr_win_sequence = pstr_psy_out[chn].window_sequence;
|
||||
curr_win_sequence = pstr_psy_out[chn]->window_sequence;
|
||||
}
|
||||
|
||||
bit_factor = iaace_bitres_calc_bitfac(
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ VOID iaace_adj_thr_init(ia_adj_thr_state_struct *pstr_adj_thr_state, const FLOAT
|
|||
|
||||
VOID iaace_adjust_threshold(ia_adj_thr_state_struct *pstr_adj_thr_state,
|
||||
ia_adj_thr_elem_struct *pstr_adj_thr_elem,
|
||||
ixheaace_psy_out_channel pstr_psy_out[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_psy_out_channel **pstr_psy_out,
|
||||
FLOAT32 *ptr_ch_bit_dist, ixheaace_qc_out_element *pstr_qc_out_el,
|
||||
const WORD32 avg_bits, const WORD32 bitres_bits,
|
||||
const WORD32 max_bitres_bits, const WORD32 side_info_bits,
|
||||
|
|
|
|||
|
|
@ -155,18 +155,23 @@ static VOID ixheaace_determine_bandwidth(const WORD32 proposed_bandwidth, const
|
|||
|
||||
WORD32 ia_enhaacplus_enc_aac_enc_pers_size(WORD32 num_aac_chan, WORD32 aot) {
|
||||
WORD32 num_bytes;
|
||||
num_bytes = sizeof(iexheaac_encoder_str);
|
||||
num_bytes += num_aac_chan * sizeof(ixheaace_psy_out_channel);
|
||||
num_bytes += num_aac_chan * sizeof(ixheaace_psy_data);
|
||||
num_bytes += num_aac_chan * sizeof(ixheaace_temporal_noise_shaping_data);
|
||||
num_bytes = IXHEAACE_GET_SIZE_ALIGNED(sizeof(iexheaac_encoder_str), BYTE_ALIGN_8);
|
||||
num_bytes += (num_aac_chan *
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(ixheaace_psy_out_channel), BYTE_ALIGN_8));
|
||||
num_bytes += (num_aac_chan *
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(ixheaace_psy_data), BYTE_ALIGN_8));
|
||||
num_bytes += (num_aac_chan *
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(ixheaace_temporal_noise_shaping_data), BYTE_ALIGN_8));
|
||||
if (aot == AOT_AAC_LC || aot == AOT_SBR || aot == AOT_PS) {
|
||||
num_bytes += num_aac_chan * BLK_SWITCH_OFFSET_LC_128 * sizeof(FLOAT32);
|
||||
num_bytes += (num_aac_chan *
|
||||
IXHEAACE_GET_SIZE_ALIGNED(BLK_SWITCH_OFFSET_LC_128 * sizeof(FLOAT32), BYTE_ALIGN_8));
|
||||
} else if (aot == AOT_AAC_LD || aot == AOT_AAC_ELD) {
|
||||
num_bytes += num_aac_chan * BLK_SWITCH_OFFSET_LD * sizeof(FLOAT32);
|
||||
num_bytes += (num_aac_chan *
|
||||
IXHEAACE_GET_SIZE_ALIGNED(BLK_SWITCH_OFFSET_LD * sizeof(FLOAT32), BYTE_ALIGN_8));
|
||||
}
|
||||
|
||||
num_bytes += num_aac_chan * sizeof(ixheaace_qc_out_channel);
|
||||
num_bytes = IXHEAACE_GET_SIZE_ALIGNED(num_bytes, BYTE_ALIGN_8);
|
||||
num_bytes += (num_aac_chan *
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(ixheaace_qc_out_channel), BYTE_ALIGN_8));
|
||||
return num_bytes;
|
||||
}
|
||||
|
||||
|
|
@ -219,25 +224,29 @@ VOID ia_enhaacplus_enc_init_aac_tabs(ixheaace_aac_tables *pstr_aac_tabs) {
|
|||
|
||||
static VOID ia_enhaacplus_enc_aac_set_persist_buf(WORD8 *ptr_base, WORD32 num_chan, WORD32 aot) {
|
||||
iexheaac_encoder_str *pstr_exheaac_encoder;
|
||||
WORD8 *ptr_curr_mem = (WORD8 *)((WORD8 *)ptr_base + sizeof(iexheaac_encoder_str));
|
||||
WORD8 *ptr_curr_mem = ptr_base +
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(iexheaac_encoder_str), BYTE_ALIGN_8);
|
||||
WORD32 i;
|
||||
|
||||
pstr_exheaac_encoder = (iexheaac_encoder_str *)ptr_base;
|
||||
|
||||
for (i = 0; i < num_chan; i++) {
|
||||
pstr_exheaac_encoder->psy_out.psy_out_ch[i] = (ixheaace_psy_out_channel *)(ptr_curr_mem);
|
||||
ptr_curr_mem = ptr_curr_mem + sizeof(ixheaace_psy_out_channel);
|
||||
ptr_curr_mem = ptr_curr_mem +
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(ixheaace_psy_out_channel), BYTE_ALIGN_8);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_chan; i++) {
|
||||
pstr_exheaac_encoder->psy_kernel.psy_data[i] = (ixheaace_psy_data *)(ptr_curr_mem);
|
||||
ptr_curr_mem = ptr_curr_mem + sizeof(ixheaace_psy_data);
|
||||
ptr_curr_mem = ptr_curr_mem +
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(ixheaace_psy_data), BYTE_ALIGN_8);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_chan; i++) {
|
||||
pstr_exheaac_encoder->psy_kernel.temporal_noise_shaping_data[i] =
|
||||
(ixheaace_temporal_noise_shaping_data *)(ptr_curr_mem);
|
||||
ptr_curr_mem = ptr_curr_mem + sizeof(ixheaace_temporal_noise_shaping_data);
|
||||
ptr_curr_mem = ptr_curr_mem +
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(ixheaace_temporal_noise_shaping_data), BYTE_ALIGN_8);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_chan; i++) {
|
||||
|
|
@ -247,21 +256,24 @@ static VOID ia_enhaacplus_enc_aac_set_persist_buf(WORD8 *ptr_base, WORD32 num_ch
|
|||
case AOT_PS:
|
||||
pstr_exheaac_encoder->psy_kernel.psy_data[i]->ptr_mdct_delay_buf =
|
||||
(FLOAT32 *)(ptr_curr_mem);
|
||||
ptr_curr_mem = ptr_curr_mem + sizeof(FLOAT32) * BLK_SWITCH_OFFSET_LC_128;
|
||||
ptr_curr_mem = ptr_curr_mem +
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(FLOAT32) * BLK_SWITCH_OFFSET_LC_128, BYTE_ALIGN_8);
|
||||
break;
|
||||
|
||||
case AOT_AAC_LD:
|
||||
case AOT_AAC_ELD:
|
||||
pstr_exheaac_encoder->psy_kernel.psy_data[i]->ptr_mdct_delay_buf =
|
||||
(FLOAT32 *)(ptr_curr_mem);
|
||||
ptr_curr_mem = ptr_curr_mem + sizeof(FLOAT32) * BLK_SWITCH_OFFSET_LD;
|
||||
ptr_curr_mem = ptr_curr_mem +
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(FLOAT32) * BLK_SWITCH_OFFSET_LD, BYTE_ALIGN_8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < num_chan; i++) {
|
||||
pstr_exheaac_encoder->qc_out.qc_channel[i] = (ixheaace_qc_out_channel *)(ptr_curr_mem);
|
||||
ptr_curr_mem = ptr_curr_mem + sizeof(ixheaace_qc_out_channel);
|
||||
ptr_curr_mem = ptr_curr_mem +
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(ixheaace_qc_out_channel), BYTE_ALIGN_8);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -136,11 +136,10 @@ IA_ERRORCODE ia_enhaacplus_enc_aac_core_encode(
|
|||
|
||||
err_code = ia_enhaacplus_enc_psy_main(
|
||||
time_sn_stride, pstr_element_info, ptr_time_signal, aot,
|
||||
pstr_aac_encoder->psy_kernel.psy_data[pstr_element_info->channel_index[0]],
|
||||
pstr_aac_encoder->psy_kernel
|
||||
.temporal_noise_shaping_data[pstr_element_info->channel_index[0]],
|
||||
pstr_aac_encoder->psy_kernel.psy_data,
|
||||
pstr_aac_encoder->psy_kernel.temporal_noise_shaping_data,
|
||||
&pstr_aac_encoder->psy_kernel.psy_conf_long, &pstr_aac_encoder->psy_kernel.psy_conf_short,
|
||||
pstr_aac_encoder->psy_out.psy_out_ch[pstr_element_info->channel_index[0]],
|
||||
pstr_aac_encoder->psy_out.psy_out_ch,
|
||||
&pstr_aac_encoder->psy_out.psy_out_element,
|
||||
pstr_aac_encoder->psy_kernel.p_scratch_tns_float,
|
||||
(FLOAT32 *)pstr_aac_encoder->pstr_aac_scratch->shared_buffer1,
|
||||
|
|
@ -155,23 +154,22 @@ IA_ERRORCODE ia_enhaacplus_enc_aac_core_encode(
|
|||
pstr_aac_encoder->config.core_sample_rate, flag_last_element, frame_len_long);
|
||||
|
||||
for (ch = 0; ch < pstr_element_info->n_channels_in_el; ch++) {
|
||||
pstr_aac_encoder->psy_out.psy_out_ch[pstr_element_info->channel_index[0]][ch].ms_digest =
|
||||
pstr_aac_encoder->psy_out.psy_out_ch[ch]->ms_digest =
|
||||
pstr_aac_encoder->psy_out.psy_out_element.tools_info.ms_digest;
|
||||
|
||||
memcpy(
|
||||
&pstr_aac_encoder->psy_out.psy_out_ch[pstr_element_info->channel_index[0]][ch].ms_used[0],
|
||||
&pstr_aac_encoder->psy_out.psy_out_ch[ch]->ms_used[0],
|
||||
&pstr_aac_encoder->psy_out.psy_out_element.tools_info.ms_mask[0],
|
||||
MAXIMUM_GROUPED_SCALE_FACTOR_BAND *
|
||||
sizeof(pstr_aac_encoder->psy_out.psy_out_ch[pstr_element_info->channel_index[0]][ch]
|
||||
.ms_used[0]));
|
||||
sizeof(pstr_aac_encoder->psy_out.psy_out_ch[ch]->ms_used[0]));
|
||||
}
|
||||
|
||||
err_code = ia_enhaacplus_enc_qc_main(
|
||||
&pstr_aac_encoder->qc_kernel, pstr_element_info->n_channels_in_el,
|
||||
&pstr_aac_encoder->qc_kernel.element_bits,
|
||||
pstr_aac_encoder->psy_out.psy_out_ch[pstr_element_info->channel_index[0]],
|
||||
pstr_aac_encoder->psy_out.psy_out_ch,
|
||||
&pstr_aac_encoder->psy_out.psy_out_element,
|
||||
pstr_aac_encoder->qc_out.qc_channel[pstr_element_info->channel_index[0]],
|
||||
pstr_aac_encoder->qc_out.qc_channel,
|
||||
&pstr_aac_encoder->qc_out.qc_element, MIN(anc_data_bytes_left, anc_data_bytes),
|
||||
pstr_aac_tabs, adts_flag, aot, stat_bits_flag, flag_last_element, frame_len_long,
|
||||
pstr_aac_encoder->pstr_aac_scratch->shared_buffer5, is_quant_spec_zero,
|
||||
|
|
@ -184,7 +182,7 @@ IA_ERRORCODE ia_enhaacplus_enc_aac_core_encode(
|
|||
if (pstr_element_info->el_type == ID_CPE) {
|
||||
if (!pstr_aac_encoder->config.num_stereo_preprocessing) {
|
||||
iaace_update_stereo_pre_process(
|
||||
pstr_aac_encoder->psy_out.psy_out_ch[pstr_element_info->channel_index[0]],
|
||||
pstr_aac_encoder->psy_out.psy_out_ch,
|
||||
&pstr_aac_encoder->qc_out.qc_element, &pstr_aac_encoder->str_stereo_pre_pro,
|
||||
pstr_aac_encoder->psy_out.psy_out_element.weight_ms_lr_pe_ratio);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ static WORD32 iusace_count_static_bits(ia_usac_data_struct *ptr_usac_data,
|
|||
stat_bits += ptr_usac_data->str_scratch.ptr_num_fac_bits[i];
|
||||
}
|
||||
|
||||
stat_bits += ptr_usac_data->num_sbr_bits;
|
||||
stat_bits += (ptr_usac_data->num_sbr_bits + ptr_usac_data->num_drc_bits);
|
||||
|
||||
return stat_bits;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,19 +45,19 @@
|
|||
#include "ixheaace_ms_stereo.h"
|
||||
#include "ixheaace_common_utils.h"
|
||||
|
||||
VOID iaace_ms_apply(ixheaace_psy_data *ptr_psy_data, FLOAT32 *ptr_spec_left,
|
||||
VOID iaace_ms_apply(ixheaace_psy_data **ptr_psy_data, FLOAT32 *ptr_spec_left,
|
||||
FLOAT32 *ptr_spec_right, WORD32 *ptr_ms_select, WORD32 *ptr_ms_used,
|
||||
const WORD32 sfb_count, const WORD32 sfb_per_group,
|
||||
const WORD32 max_sfb_per_grp, const WORD32 *ptr_sfb_offset,
|
||||
FLOAT32 *ptr_weight_ms_lr_pe_ratio) {
|
||||
FLOAT32 *ptr_sfb_enegry_left = ptr_psy_data[0].sfb_energy.long_nrg;
|
||||
FLOAT32 *ptr_sfb_energy_right = ptr_psy_data[1].sfb_energy.long_nrg;
|
||||
const FLOAT32 *ptr_sfb_energy_mid = ptr_psy_data[0].sfb_energy_ms.long_nrg;
|
||||
const FLOAT32 *ptr_sfb_energy_side = ptr_psy_data[1].sfb_energy_ms.long_nrg;
|
||||
FLOAT32 *ptr_sfb_thr_left = ptr_psy_data[0].sfb_threshold.long_nrg;
|
||||
FLOAT32 *ptr_sfb_thr_right = ptr_psy_data[1].sfb_threshold.long_nrg;
|
||||
FLOAT32 *ptr_sfb_spread_energy_left = ptr_psy_data[0].sfb_sreaded_energy.long_nrg;
|
||||
FLOAT32 *ptr_sfb_spread_energy_right = ptr_psy_data[1].sfb_sreaded_energy.long_nrg;
|
||||
FLOAT32 *ptr_sfb_enegry_left = ptr_psy_data[0]->sfb_energy.long_nrg;
|
||||
FLOAT32 *ptr_sfb_energy_right = ptr_psy_data[1]->sfb_energy.long_nrg;
|
||||
const FLOAT32 *ptr_sfb_energy_mid = ptr_psy_data[0]->sfb_energy_ms.long_nrg;
|
||||
const FLOAT32 *ptr_sfb_energy_side = ptr_psy_data[1]->sfb_energy_ms.long_nrg;
|
||||
FLOAT32 *ptr_sfb_thr_left = ptr_psy_data[0]->sfb_threshold.long_nrg;
|
||||
FLOAT32 *ptr_sfb_thr_right = ptr_psy_data[1]->sfb_threshold.long_nrg;
|
||||
FLOAT32 *ptr_sfb_spread_energy_left = ptr_psy_data[0]->sfb_sreaded_energy.long_nrg;
|
||||
FLOAT32 *ptr_sfb_spread_energy_right = ptr_psy_data[1]->sfb_sreaded_energy.long_nrg;
|
||||
WORD32 sfb, sfb_offsets, j;
|
||||
WORD32 grp = 0;
|
||||
WORD32 ms_counter = 0;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
VOID iaace_ms_apply(ixheaace_psy_data *ptr_psy_data, FLOAT32 *ptr_spec_left,
|
||||
VOID iaace_ms_apply(ixheaace_psy_data **ptr_psy_data, FLOAT32 *ptr_spec_left,
|
||||
FLOAT32 *ptr_spec_right, WORD32 *ptr_ms_select, WORD32 *ptr_ms_used,
|
||||
const WORD32 sfb_count,
|
||||
|
||||
|
|
|
|||
|
|
@ -174,17 +174,17 @@ IA_ERRORCODE ia_enhaacplus_enc_psy_main_init(ixheaace_psy_kernel *pstr_h_psy, WO
|
|||
}
|
||||
|
||||
static VOID ia_enhaacplus_enc_advance_psy_long_ms(
|
||||
ixheaace_psy_data psy_data[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_psy_data **psy_data,
|
||||
ixheaace_psy_configuration_long *pstr_psy_conf_long) {
|
||||
ia_enhaacplus_enc_calc_band_energy_ms(
|
||||
psy_data[0].ptr_spec_coeffs, psy_data[1].ptr_spec_coeffs, pstr_psy_conf_long->sfb_offsets,
|
||||
psy_data[0]->ptr_spec_coeffs, psy_data[1]->ptr_spec_coeffs, pstr_psy_conf_long->sfb_offsets,
|
||||
pstr_psy_conf_long->sfb_active, pstr_psy_conf_long->sfb_cnt,
|
||||
psy_data[0].sfb_energy_ms.long_nrg, &psy_data[0].sfb_energy_sum_ms.long_nrg,
|
||||
psy_data[1].sfb_energy_ms.long_nrg, &psy_data[1].sfb_energy_sum_ms.long_nrg);
|
||||
psy_data[0]->sfb_energy_ms.long_nrg, &psy_data[0]->sfb_energy_sum_ms.long_nrg,
|
||||
psy_data[1]->sfb_energy_ms.long_nrg, &psy_data[1]->sfb_energy_sum_ms.long_nrg);
|
||||
}
|
||||
|
||||
static VOID ia_enhaacplus_enc_advance_psy_short_ms(
|
||||
ixheaace_psy_data psy_data[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_psy_data **psy_data,
|
||||
ixheaace_psy_configuration_short *pstr_psy_conf_short, WORD32 ccfl) {
|
||||
WORD32 w;
|
||||
WORD32 frame_len_short = FRAME_LEN_SHORT_128;
|
||||
|
|
@ -196,11 +196,11 @@ static VOID ia_enhaacplus_enc_advance_psy_short_ms(
|
|||
WORD32 w_offset = w * frame_len_short;
|
||||
|
||||
ia_enhaacplus_enc_calc_band_energy_ms(
|
||||
psy_data[0].ptr_spec_coeffs + w_offset, psy_data[1].ptr_spec_coeffs + w_offset,
|
||||
psy_data[0]->ptr_spec_coeffs + w_offset, psy_data[1]->ptr_spec_coeffs + w_offset,
|
||||
pstr_psy_conf_short->sfb_offsets, pstr_psy_conf_short->sfb_active,
|
||||
pstr_psy_conf_short->sfb_cnt, psy_data[0].sfb_energy_ms.short_nrg[w],
|
||||
&psy_data[0].sfb_energy_sum_ms.short_nrg[w], psy_data[1].sfb_energy_ms.short_nrg[w],
|
||||
&psy_data[1].sfb_energy_sum_ms.short_nrg[w]);
|
||||
pstr_psy_conf_short->sfb_cnt, psy_data[0]->sfb_energy_ms.short_nrg[w],
|
||||
&psy_data[0]->sfb_energy_sum_ms.short_nrg[w], psy_data[1]->sfb_energy_ms.short_nrg[w],
|
||||
&psy_data[1]->sfb_energy_sum_ms.short_nrg[w]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -461,11 +461,11 @@ static IA_ERRORCODE ia_enhaacplus_enc_advance_psy_long(
|
|||
|
||||
IA_ERRORCODE ia_enhaacplus_enc_psy_main(
|
||||
WORD32 time_sn_stride, ixheaace_element_info *pstr_elem_info, const FLOAT32 *ptr_time_signal,
|
||||
WORD32 aot, ixheaace_psy_data psy_data[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_temporal_noise_shaping_data tns_data[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
WORD32 aot, ixheaace_psy_data **psy_data,
|
||||
ixheaace_temporal_noise_shaping_data **tns_data,
|
||||
ixheaace_psy_configuration_long *pstr_psy_conf_long,
|
||||
ixheaace_psy_configuration_short *pstr_psy_conf_short,
|
||||
ixheaace_psy_out_channel psy_out_ch[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_psy_out_channel **psy_out_ch,
|
||||
ixheaace_psy_out_element *pstr_psy_out_element, FLOAT32 *ptr_scratch_tns,
|
||||
FLOAT32 *ptr_shared_buffer1, WORD8 *ptr_shared_buffer5, ixheaace_aac_tables *pstr_aac_tables,
|
||||
WORD32 frame_len_long)
|
||||
|
|
@ -482,66 +482,71 @@ IA_ERRORCODE ia_enhaacplus_enc_psy_main(
|
|||
if (aot == AOT_AAC_LC || aot == AOT_SBR || aot == AOT_PS) {
|
||||
if (pstr_elem_info->el_type != ID_LFE) {
|
||||
for (ch = 0; ch < num_channels; ch++) {
|
||||
iaace_block_switching(&psy_data[ch].blk_switch_cntrl,
|
||||
iaace_block_switching(&psy_data[ch]->blk_switch_cntrl,
|
||||
ptr_time_signal + pstr_elem_info->channel_index[ch], frame_len_long,
|
||||
num_channels);
|
||||
}
|
||||
} else {
|
||||
psy_data[0].blk_switch_cntrl.win_seq = psy_data[1].blk_switch_cntrl.win_seq = LONG_WINDOW;
|
||||
for (ch = 0; ch < num_channels; ch++) {
|
||||
psy_data[ch]->blk_switch_cntrl.win_seq = LONG_WINDOW;
|
||||
}
|
||||
}
|
||||
|
||||
/* synch left and right block type */
|
||||
iaace_sync_block_switching(&psy_data[0].blk_switch_cntrl, &psy_data[1].blk_switch_cntrl,
|
||||
num_channels);
|
||||
if (num_channels == NUM_CHANS_MONO) {
|
||||
iaace_sync_block_switching(&psy_data[0]->blk_switch_cntrl, NULL, num_channels);
|
||||
}
|
||||
else {
|
||||
iaace_sync_block_switching(&psy_data[0]->blk_switch_cntrl, &psy_data[1]->blk_switch_cntrl,
|
||||
num_channels);
|
||||
}
|
||||
} else if (aot == AOT_AAC_LD || aot == AOT_AAC_ELD) {
|
||||
{ psy_data[0].blk_switch_cntrl.win_seq = psy_data[1].blk_switch_cntrl.win_seq = LONG_WINDOW; }
|
||||
|
||||
for (ch = 0; ch < num_channels; ch++) {
|
||||
psy_data[ch].blk_switch_cntrl.win_seq_ld = LONG_WINDOW;
|
||||
psy_data[ch].blk_switch_cntrl.next_win_seq_ld = LONG_WINDOW;
|
||||
psy_data[ch].blk_switch_cntrl.win_seq = LONG_WINDOW;
|
||||
psy_data[ch].blk_switch_cntrl.nxt_win_seq = LONG_WINDOW;
|
||||
psy_data[ch].blk_switch_cntrl.total_groups_cnt = 1;
|
||||
psy_data[ch]->blk_switch_cntrl.win_seq_ld = LONG_WINDOW;
|
||||
psy_data[ch]->blk_switch_cntrl.next_win_seq_ld = LONG_WINDOW;
|
||||
psy_data[ch]->blk_switch_cntrl.win_seq = LONG_WINDOW;
|
||||
psy_data[ch]->blk_switch_cntrl.nxt_win_seq = LONG_WINDOW;
|
||||
psy_data[ch]->blk_switch_cntrl.total_groups_cnt = 1;
|
||||
}
|
||||
}
|
||||
/* transform */
|
||||
for (ch = 0; ch < num_channels; ch++) {
|
||||
if (aot == AOT_AAC_LC || aot == AOT_SBR || aot == AOT_PS) {
|
||||
ixheaace_transform_real_lc_ld(
|
||||
psy_data[ch].ptr_mdct_delay_buf, ptr_time_signal + pstr_elem_info->channel_index[ch],
|
||||
time_sn_stride, psy_data[ch].ptr_spec_coeffs, psy_data[ch].blk_switch_cntrl.win_seq,
|
||||
psy_data[ch]->ptr_mdct_delay_buf, ptr_time_signal + pstr_elem_info->channel_index[ch],
|
||||
time_sn_stride, psy_data[ch]->ptr_spec_coeffs, psy_data[ch]->blk_switch_cntrl.win_seq,
|
||||
frame_len_long, ptr_shared_buffer5);
|
||||
} else if (aot == AOT_AAC_LD) {
|
||||
if (frame_len_long == FRAME_LEN_480) {
|
||||
ia_enhaacplus_enc_transform_real(
|
||||
psy_data[ch].ptr_mdct_delay_buf, ptr_time_signal + pstr_elem_info->channel_index[ch],
|
||||
time_sn_stride, psy_data[ch].ptr_spec_coeffs, pstr_aac_tables->pstr_mdct_tab,
|
||||
psy_data[ch]->ptr_mdct_delay_buf, ptr_time_signal + pstr_elem_info->channel_index[ch],
|
||||
time_sn_stride, psy_data[ch]->ptr_spec_coeffs, pstr_aac_tables->pstr_mdct_tab,
|
||||
ptr_scratch_tns, ptr_shared_buffer5, frame_len_long);
|
||||
} else {
|
||||
ixheaace_transform_real_lc_ld(
|
||||
psy_data[ch].ptr_mdct_delay_buf, ptr_time_signal + pstr_elem_info->channel_index[ch],
|
||||
time_sn_stride, psy_data[ch].ptr_spec_coeffs, psy_data[ch].blk_switch_cntrl.win_seq,
|
||||
psy_data[ch]->ptr_mdct_delay_buf, ptr_time_signal + pstr_elem_info->channel_index[ch],
|
||||
time_sn_stride, psy_data[ch]->ptr_spec_coeffs, psy_data[ch]->blk_switch_cntrl.win_seq,
|
||||
frame_len_long, ptr_shared_buffer5);
|
||||
}
|
||||
} else if (aot == AOT_AAC_ELD) {
|
||||
if (frame_len_long == FRAME_LEN_480) {
|
||||
ia_enhaacplus_enc_transform_real(
|
||||
psy_data[ch].ptr_mdct_delay_buf, ptr_time_signal + pstr_elem_info->channel_index[ch],
|
||||
time_sn_stride, psy_data[ch].ptr_spec_coeffs, pstr_aac_tables->pstr_mdct_tab,
|
||||
psy_data[ch]->ptr_mdct_delay_buf, ptr_time_signal + pstr_elem_info->channel_index[ch],
|
||||
time_sn_stride, psy_data[ch]->ptr_spec_coeffs, pstr_aac_tables->pstr_mdct_tab,
|
||||
ptr_scratch_tns, ptr_shared_buffer5, frame_len_long);
|
||||
} else {
|
||||
ia_enhaacplus_enc_transform_real_eld(
|
||||
psy_data[ch].ptr_mdct_delay_buf, ptr_time_signal + pstr_elem_info->channel_index[ch],
|
||||
time_sn_stride, psy_data[ch].ptr_spec_coeffs, ptr_shared_buffer5, frame_len_long);
|
||||
psy_data[ch]->ptr_mdct_delay_buf, ptr_time_signal + pstr_elem_info->channel_index[ch],
|
||||
time_sn_stride, psy_data[ch]->ptr_spec_coeffs, ptr_shared_buffer5, frame_len_long);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ch = 0; ch < num_channels; ch++) {
|
||||
if (psy_data[ch].blk_switch_cntrl.win_seq != SHORT_WINDOW) {
|
||||
if (psy_data[ch]->blk_switch_cntrl.win_seq != SHORT_WINDOW) {
|
||||
error_code = ia_enhaacplus_enc_advance_psy_long(
|
||||
&psy_data[ch], &tns_data[ch], pstr_psy_conf_long, &psy_out_ch[ch], ptr_scratch_tns,
|
||||
&tns_data[1 - ch], ch, aot, ptr_shared_buffer1, pstr_aac_tables, frame_len_long);
|
||||
psy_data[ch], tns_data[ch], pstr_psy_conf_long, psy_out_ch[ch], ptr_scratch_tns,
|
||||
tns_data[1 - ch], ch, aot, ptr_shared_buffer1, pstr_aac_tables, frame_len_long);
|
||||
|
||||
if (error_code != IA_NO_ERROR) {
|
||||
return error_code;
|
||||
|
|
@ -550,7 +555,7 @@ IA_ERRORCODE ia_enhaacplus_enc_psy_main(
|
|||
for (sfb = pstr_psy_conf_long->sfb_cnt - 1; sfb >= 0; sfb--) {
|
||||
for (line = pstr_psy_conf_long->sfb_offsets[sfb + 1] - 1;
|
||||
line >= pstr_psy_conf_long->sfb_offsets[sfb]; line--) {
|
||||
if (psy_data[ch].ptr_spec_coeffs[line] != 0) {
|
||||
if (psy_data[ch]->ptr_spec_coeffs[line] != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -567,8 +572,8 @@ IA_ERRORCODE ia_enhaacplus_enc_psy_main(
|
|||
}
|
||||
} else {
|
||||
error_code = ia_enhaacplus_enc_advance_psy_short(
|
||||
&psy_data[ch], &tns_data[ch], pstr_psy_conf_short, &psy_out_ch[ch], ptr_scratch_tns,
|
||||
&tns_data[1 - ch], ch, aot, ptr_shared_buffer1, pstr_aac_tables, frame_len_long / 8);
|
||||
psy_data[ch], tns_data[ch], pstr_psy_conf_short, psy_out_ch[ch], ptr_scratch_tns,
|
||||
tns_data[1 - ch], ch, aot, ptr_shared_buffer1, pstr_aac_tables, frame_len_long / 8);
|
||||
|
||||
if (error_code != IA_NO_ERROR) {
|
||||
return error_code;
|
||||
|
|
@ -584,15 +589,15 @@ IA_ERRORCODE ia_enhaacplus_enc_psy_main(
|
|||
/* Group short data (max_sfb for short blocks is determined here) */
|
||||
if (aot == AOT_AAC_LC || aot == AOT_SBR || aot == AOT_PS) {
|
||||
for (ch = 0; ch < num_channels; ch++) {
|
||||
if (psy_data[ch].blk_switch_cntrl.win_seq == SHORT_WINDOW) {
|
||||
iaace_group_short_data(psy_data[ch].ptr_spec_coeffs, ptr_scratch_tns,
|
||||
&psy_data[ch].sfb_threshold, &psy_data[ch].sfb_energy,
|
||||
&psy_data[ch].sfb_energy_ms, &psy_data[ch].sfb_sreaded_energy,
|
||||
if (psy_data[ch]->blk_switch_cntrl.win_seq == SHORT_WINDOW) {
|
||||
iaace_group_short_data(psy_data[ch]->ptr_spec_coeffs, ptr_scratch_tns,
|
||||
&psy_data[ch]->sfb_threshold, &psy_data[ch]->sfb_energy,
|
||||
&psy_data[ch]->sfb_energy_ms, &psy_data[ch]->sfb_sreaded_energy,
|
||||
pstr_psy_conf_short->sfb_cnt, pstr_psy_conf_short->sfb_offsets,
|
||||
pstr_psy_conf_short->sfb_min_snr, grouped_sfb_offset[ch],
|
||||
&max_sfb_per_grp[ch], grouped_sfb_min_snr[ch],
|
||||
psy_data[ch].blk_switch_cntrl.total_groups_cnt,
|
||||
psy_data[ch].blk_switch_cntrl.group_len, frame_len_long);
|
||||
psy_data[ch]->blk_switch_cntrl.total_groups_cnt,
|
||||
psy_data[ch]->blk_switch_cntrl.group_len, frame_len_long);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -604,17 +609,18 @@ IA_ERRORCODE ia_enhaacplus_enc_psy_main(
|
|||
|
||||
max_sfb_per_grp[0] = max_sfb_per_grp[1] = MAX(max_sfb_per_grp[0], max_sfb_per_grp[1]);
|
||||
|
||||
if (psy_data[0].blk_switch_cntrl.win_seq != SHORT_WINDOW) {
|
||||
if (psy_data[0]->blk_switch_cntrl.win_seq != SHORT_WINDOW) {
|
||||
iaace_ms_apply(
|
||||
psy_data, psy_data[0].ptr_spec_coeffs, psy_data[1].ptr_spec_coeffs,
|
||||
psy_data, psy_data[0]->ptr_spec_coeffs, psy_data[1]->ptr_spec_coeffs,
|
||||
&pstr_psy_out_element->tools_info.ms_digest, pstr_psy_out_element->tools_info.ms_mask,
|
||||
pstr_psy_conf_long->sfb_cnt, pstr_psy_conf_long->sfb_cnt, max_sfb_per_grp[0],
|
||||
pstr_psy_conf_long->sfb_offsets, &pstr_psy_out_element->weight_ms_lr_pe_ratio);
|
||||
} else {
|
||||
iaace_ms_apply(psy_data, psy_data[0].ptr_spec_coeffs, psy_data[1].ptr_spec_coeffs,
|
||||
iaace_ms_apply(psy_data, psy_data[0]->ptr_spec_coeffs, psy_data[1]->ptr_spec_coeffs,
|
||||
&pstr_psy_out_element->tools_info.ms_digest,
|
||||
pstr_psy_out_element->tools_info.ms_mask,
|
||||
psy_data[0].blk_switch_cntrl.total_groups_cnt * pstr_psy_conf_short->sfb_cnt,
|
||||
psy_data[0]->blk_switch_cntrl.total_groups_cnt *
|
||||
pstr_psy_conf_short->sfb_cnt,
|
||||
pstr_psy_conf_short->sfb_cnt, max_sfb_per_grp[0], grouped_sfb_offset[0],
|
||||
&pstr_psy_out_element->weight_ms_lr_pe_ratio);
|
||||
}
|
||||
|
|
@ -624,39 +630,41 @@ IA_ERRORCODE ia_enhaacplus_enc_psy_main(
|
|||
/* Build output */
|
||||
if (aot == AOT_AAC_LC || aot == AOT_SBR || aot == AOT_PS) {
|
||||
for (ch = 0; ch < num_channels; ch++) {
|
||||
if (psy_data[ch].blk_switch_cntrl.win_seq != SHORT_WINDOW) {
|
||||
if (psy_data[ch]->blk_switch_cntrl.win_seq != SHORT_WINDOW) {
|
||||
ia_enhaacplus_enc_build_interface(
|
||||
psy_data[ch].ptr_spec_coeffs, &psy_data[ch].sfb_threshold, &psy_data[ch].sfb_energy,
|
||||
&psy_data[ch].sfb_sreaded_energy, psy_data[ch].sfb_energy_sum,
|
||||
psy_data[ch].sfb_energy_sum_ms, psy_data[ch].blk_switch_cntrl.win_seq,
|
||||
psy_data[ch]->ptr_spec_coeffs, &psy_data[ch]->sfb_threshold,
|
||||
&psy_data[ch]->sfb_energy,
|
||||
&psy_data[ch]->sfb_sreaded_energy, psy_data[ch]->sfb_energy_sum,
|
||||
psy_data[ch]->sfb_energy_sum_ms, psy_data[ch]->blk_switch_cntrl.win_seq,
|
||||
ia_enhaacplus_enc_block_type_to_window_shape_lc[psy_data[ch]
|
||||
.blk_switch_cntrl.win_seq],
|
||||
->blk_switch_cntrl.win_seq],
|
||||
pstr_psy_conf_long->sfb_cnt, pstr_psy_conf_long->sfb_offsets, max_sfb_per_grp[ch],
|
||||
pstr_psy_conf_long->sfb_min_snr, psy_data[ch].blk_switch_cntrl.total_groups_cnt,
|
||||
psy_data[ch].blk_switch_cntrl.group_len, &psy_out_ch[ch]);
|
||||
pstr_psy_conf_long->sfb_min_snr, psy_data[ch]->blk_switch_cntrl.total_groups_cnt,
|
||||
psy_data[ch]->blk_switch_cntrl.group_len, psy_out_ch[ch]);
|
||||
} else {
|
||||
ia_enhaacplus_enc_build_interface(
|
||||
psy_data[ch].ptr_spec_coeffs, &psy_data[ch].sfb_threshold, &psy_data[ch].sfb_energy,
|
||||
&psy_data[ch].sfb_sreaded_energy, psy_data[ch].sfb_energy_sum,
|
||||
psy_data[ch].sfb_energy_sum_ms, SHORT_WINDOW, SINE_WINDOW,
|
||||
psy_data[ch].blk_switch_cntrl.total_groups_cnt * pstr_psy_conf_short->sfb_cnt,
|
||||
psy_data[ch]->ptr_spec_coeffs, &psy_data[ch]->sfb_threshold,
|
||||
&psy_data[ch]->sfb_energy,
|
||||
&psy_data[ch]->sfb_sreaded_energy, psy_data[ch]->sfb_energy_sum,
|
||||
psy_data[ch]->sfb_energy_sum_ms, SHORT_WINDOW, SINE_WINDOW,
|
||||
psy_data[ch]->blk_switch_cntrl.total_groups_cnt * pstr_psy_conf_short->sfb_cnt,
|
||||
grouped_sfb_offset[ch], max_sfb_per_grp[ch], grouped_sfb_min_snr[ch],
|
||||
psy_data[ch].blk_switch_cntrl.total_groups_cnt,
|
||||
psy_data[ch].blk_switch_cntrl.group_len, &psy_out_ch[ch]);
|
||||
psy_data[ch]->blk_switch_cntrl.total_groups_cnt,
|
||||
psy_data[ch]->blk_switch_cntrl.group_len, psy_out_ch[ch]);
|
||||
}
|
||||
}
|
||||
} else if (aot == AOT_AAC_LD || aot == AOT_AAC_ELD) {
|
||||
for (ch = 0; ch < num_channels; ch++) {
|
||||
ia_enhaacplus_enc_build_interface(
|
||||
psy_data[ch].ptr_spec_coeffs, &psy_data[ch].sfb_threshold, &psy_data[ch].sfb_energy,
|
||||
&psy_data[ch].sfb_sreaded_energy, psy_data[ch].sfb_energy_sum,
|
||||
psy_data[ch].sfb_energy_sum_ms, LONG_WINDOW,
|
||||
psy_data[ch]->ptr_spec_coeffs, &psy_data[ch]->sfb_threshold, &psy_data[ch]->sfb_energy,
|
||||
&psy_data[ch]->sfb_sreaded_energy, psy_data[ch]->sfb_energy_sum,
|
||||
psy_data[ch]->sfb_energy_sum_ms, LONG_WINDOW,
|
||||
ia_enhaacplus_enc_block_type_to_window_shape_ld[psy_data[ch]
|
||||
.blk_switch_cntrl.win_seq_ld],
|
||||
->blk_switch_cntrl.win_seq_ld],
|
||||
((aot == AOT_AAC_ELD) ? pstr_psy_conf_long->sfb_active : pstr_psy_conf_long->sfb_cnt),
|
||||
pstr_psy_conf_long->sfb_offsets, max_sfb_per_grp[ch], pstr_psy_conf_long->sfb_min_snr,
|
||||
psy_data[ch].blk_switch_cntrl.total_groups_cnt, psy_data[ch].blk_switch_cntrl.group_len,
|
||||
&psy_out_ch[ch]);
|
||||
psy_data[ch]->blk_switch_cntrl.total_groups_cnt,
|
||||
psy_data[ch]->blk_switch_cntrl.group_len, psy_out_ch[ch]);
|
||||
}
|
||||
}
|
||||
return error_code;
|
||||
|
|
|
|||
|
|
@ -39,11 +39,11 @@ IA_ERRORCODE ia_enhaacplus_enc_psy_main_init(ixheaace_psy_kernel *pstr_h_psy, WO
|
|||
IA_ERRORCODE ia_enhaacplus_enc_psy_main(
|
||||
WORD32 time_sn_stride, /* total number of channels */
|
||||
ixheaace_element_info *pstr_elem_info, const FLOAT32 *ptr_time_signal, WORD32 aot,
|
||||
ixheaace_psy_data psy_data[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_temporal_noise_shaping_data tns_data[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_psy_data **psy_data,
|
||||
ixheaace_temporal_noise_shaping_data **tns_data,
|
||||
ixheaace_psy_configuration_long *pstr_psy_conf_long,
|
||||
ixheaace_psy_configuration_short *pstr_psy_conf_short,
|
||||
ixheaace_psy_out_channel psy_out_ch[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_psy_out_channel **psy_out_ch,
|
||||
ixheaace_psy_out_element *pstr_psy_out_element, FLOAT32 *ptr_scratch_tns,
|
||||
FLOAT32 *ptr_shared_buffer1, WORD8 *ptr_shared_buffer5, ixheaace_aac_tables *pstr_aac_tables,
|
||||
WORD32 frame_len_long);
|
||||
|
|
|
|||
|
|
@ -66,12 +66,11 @@
|
|||
#include "ixheaace_qc_util.h"
|
||||
#include "ixheaace_common_utils.h"
|
||||
|
||||
#define OPT_QC_STACK
|
||||
IA_ERRORCODE ia_enhaacplus_enc_qc_main(
|
||||
ixheaace_qc_state *pstr_qc_state, WORD32 num_channels, ixheaace_element_bits *pstr_el_bits,
|
||||
ixheaace_psy_out_channel psy_out_ch[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_psy_out_channel **psy_out_ch,
|
||||
ixheaace_psy_out_element *pstr_psy_out_element,
|
||||
ixheaace_qc_out_channel pstr_qc_out_ch[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_qc_out_channel **pstr_qc_out_ch,
|
||||
ixheaace_qc_out_element *pstr_qc_out_element, WORD32 ancillary_data_bytes,
|
||||
ixheaace_aac_tables *pstr_aac_tables, WORD32 adts_flag, WORD32 aot, WORD32 stat_bits_flag,
|
||||
WORD32 flag_last_element, WORD32 frame_len_long, WORD8 *ptr_scratch,
|
||||
|
|
@ -112,7 +111,7 @@ IA_ERRORCODE ia_enhaacplus_enc_qc_main(
|
|||
|
||||
for (ch = 0; ch < num_channels; ch++) {
|
||||
iaace_calc_form_fac_per_chan(ptr_stack->sfb_form_fac[ch],
|
||||
ptr_stack->sfb_num_relevant_lines[ch], &psy_out_ch[ch],
|
||||
ptr_stack->sfb_num_relevant_lines[ch], psy_out_ch[ch],
|
||||
ptr_stack->sfb_ld_energy[ch]);
|
||||
}
|
||||
|
||||
|
|
@ -146,44 +145,46 @@ IA_ERRORCODE ia_enhaacplus_enc_qc_main(
|
|||
iterations = 0;
|
||||
gain = 0;
|
||||
for (spec_idx = 0; spec_idx < frame_len_long; spec_idx++) {
|
||||
ptr_stack->exp_spec[spec_idx] = (FLOAT32)psy_out_ch[ch].ptr_spec_coeffs[spec_idx];
|
||||
ptr_stack->mdct_spec_float[spec_idx] = (FLOAT32)psy_out_ch[ch].ptr_spec_coeffs[spec_idx];
|
||||
ptr_stack->exp_spec[spec_idx] = (FLOAT32)psy_out_ch[ch]->ptr_spec_coeffs[spec_idx];
|
||||
ptr_stack->mdct_spec_float[spec_idx] = (FLOAT32)psy_out_ch[ch]->ptr_spec_coeffs[spec_idx];
|
||||
}
|
||||
do {
|
||||
WORD32 max_val;
|
||||
constraints_fulfilled = 1;
|
||||
WORD32 quant_spec_is_zero = 1;
|
||||
if (iterations > 0) {
|
||||
for (sfb_offs = 0; sfb_offs < psy_out_ch[ch].sfb_count;
|
||||
sfb_offs += psy_out_ch[ch].sfb_per_group) {
|
||||
for (sfb = 0; sfb < psy_out_ch[ch].max_sfb_per_grp; sfb++) {
|
||||
WORD32 scalefactor = pstr_qc_out_ch[ch].scalefactor[sfb + sfb_offs];
|
||||
gain = MAX(gain, pstr_qc_out_ch[ch].global_gain - scalefactor);
|
||||
for (sfb_offs = 0; sfb_offs < psy_out_ch[ch]->sfb_count;
|
||||
sfb_offs += psy_out_ch[ch]->sfb_per_group) {
|
||||
for (sfb = 0; sfb < psy_out_ch[ch]->max_sfb_per_grp; sfb++) {
|
||||
WORD32 scalefactor = pstr_qc_out_ch[ch]->scalefactor[sfb + sfb_offs];
|
||||
gain = MAX(gain, pstr_qc_out_ch[ch]->global_gain - scalefactor);
|
||||
iaace_quantize_lines(
|
||||
pstr_qc_out_ch[ch].global_gain - scalefactor,
|
||||
psy_out_ch[ch].sfb_offsets[sfb_offs + sfb + 1] -
|
||||
psy_out_ch[ch].sfb_offsets[sfb_offs + sfb],
|
||||
ptr_stack->exp_spec + psy_out_ch[ch].sfb_offsets[sfb_offs + sfb],
|
||||
pstr_qc_out_ch[ch].quant_spec + psy_out_ch[ch].sfb_offsets[sfb_offs + sfb],
|
||||
ptr_stack->mdct_spec_float + psy_out_ch[ch].sfb_offsets[sfb_offs + sfb]);
|
||||
pstr_qc_out_ch[ch]->global_gain - scalefactor,
|
||||
psy_out_ch[ch]->sfb_offsets[sfb_offs + sfb + 1] -
|
||||
psy_out_ch[ch]->sfb_offsets[sfb_offs + sfb],
|
||||
ptr_stack->exp_spec + psy_out_ch[ch]->sfb_offsets[sfb_offs + sfb],
|
||||
pstr_qc_out_ch[ch]->quant_spec + psy_out_ch[ch]->sfb_offsets[sfb_offs + sfb],
|
||||
ptr_stack->mdct_spec_float + psy_out_ch[ch]->sfb_offsets[sfb_offs + sfb]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
max_val = iaace_calc_max_val_in_sfb(
|
||||
psy_out_ch[ch].sfb_count, psy_out_ch[ch].max_sfb_per_grp, psy_out_ch[ch].sfb_per_group,
|
||||
psy_out_ch[ch].sfb_offsets, pstr_qc_out_ch[ch].quant_spec,
|
||||
pstr_qc_out_ch[ch].max_val_in_sfb);
|
||||
psy_out_ch[ch]->sfb_count, psy_out_ch[ch]->max_sfb_per_grp,
|
||||
psy_out_ch[ch]->sfb_per_group,
|
||||
psy_out_ch[ch]->sfb_offsets, pstr_qc_out_ch[ch]->quant_spec,
|
||||
pstr_qc_out_ch[ch]->max_val_in_sfb);
|
||||
|
||||
if (max_val > MAXIMUM_QUANT) {
|
||||
constraints_fulfilled = 0;
|
||||
}
|
||||
|
||||
for (k = 0; ((k < psy_out_ch[ch].sfb_count) && (quant_spec_is_zero));
|
||||
k += psy_out_ch[ch].sfb_per_group) {
|
||||
for (i = 0; ((i < psy_out_ch[ch].max_sfb_per_grp) && (quant_spec_is_zero)); i++) {
|
||||
for (j = psy_out_ch[ch].sfb_offsets[i+k]; j < psy_out_ch[ch].sfb_offsets[i+k+1]; j++) {
|
||||
if (pstr_qc_out_ch[ch].quant_spec[j] != 0) {
|
||||
for (k = 0; ((k < psy_out_ch[ch]->sfb_count) && (quant_spec_is_zero));
|
||||
k += psy_out_ch[ch]->sfb_per_group) {
|
||||
for (i = 0; ((i < psy_out_ch[ch]->max_sfb_per_grp) && (quant_spec_is_zero)); i++) {
|
||||
for (j = psy_out_ch[ch]->sfb_offsets[i+k]; j < psy_out_ch[ch]->sfb_offsets[i+k+1]; j++)
|
||||
{
|
||||
if (pstr_qc_out_ch[ch]->quant_spec[j] != 0) {
|
||||
quant_spec_is_zero = 0;
|
||||
break;
|
||||
}
|
||||
|
|
@ -191,10 +192,11 @@ IA_ERRORCODE ia_enhaacplus_enc_qc_main(
|
|||
}
|
||||
}
|
||||
err_code = ia_enhaacplus_enc_dyn_bitcount(
|
||||
pstr_qc_out_ch[ch].quant_spec, pstr_qc_out_ch[ch].max_val_in_sfb,
|
||||
pstr_qc_out_ch[ch].scalefactor, psy_out_ch[ch].window_sequence,
|
||||
psy_out_ch[ch].sfb_count, psy_out_ch[ch].max_sfb_per_grp, psy_out_ch[ch].sfb_per_group,
|
||||
psy_out_ch[ch].sfb_offsets, &pstr_qc_out_ch[ch].section_data,
|
||||
pstr_qc_out_ch[ch]->quant_spec, pstr_qc_out_ch[ch]->max_val_in_sfb,
|
||||
pstr_qc_out_ch[ch]->scalefactor, psy_out_ch[ch]->window_sequence,
|
||||
psy_out_ch[ch]->sfb_count, psy_out_ch[ch]->max_sfb_per_grp,
|
||||
psy_out_ch[ch]->sfb_per_group,
|
||||
psy_out_ch[ch]->sfb_offsets, &pstr_qc_out_ch[ch]->section_data,
|
||||
pstr_qc_state->side_info_tab_long, pstr_qc_state->side_info_tab_short,
|
||||
pstr_aac_tables->pstr_huff_tab, pstr_qc_state->qc_scr.shared_buffer_2, aot,
|
||||
&ch_dyn_bits);
|
||||
|
|
@ -225,7 +227,7 @@ IA_ERRORCODE ia_enhaacplus_enc_qc_main(
|
|||
ch_dyn_bits = max_ch_dyn_bits[ch];
|
||||
}
|
||||
if (!constraints_fulfilled) {
|
||||
pstr_qc_out_ch[ch].global_gain++;
|
||||
pstr_qc_out_ch[ch]->global_gain++;
|
||||
}
|
||||
iterations++;
|
||||
|
||||
|
|
@ -233,8 +235,8 @@ IA_ERRORCODE ia_enhaacplus_enc_qc_main(
|
|||
|
||||
pstr_qc_out_element->dyn_bits_used += ch_dyn_bits;
|
||||
|
||||
pstr_qc_out_ch[ch].grouping_mask = psy_out_ch[ch].grouping_mask;
|
||||
pstr_qc_out_ch[ch].win_shape = psy_out_ch[ch].window_shape;
|
||||
pstr_qc_out_ch[ch]->grouping_mask = psy_out_ch[ch]->grouping_mask;
|
||||
pstr_qc_out_ch[ch]->win_shape = psy_out_ch[ch]->window_shape;
|
||||
}
|
||||
|
||||
pstr_adj_thr_elem->dyn_bits_last = pstr_qc_out_element->dyn_bits_used;
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ IA_ERRORCODE ia_enhaacplus_enc_qc_init(ixheaace_qc_state *pstr_qc_state, WORD32
|
|||
|
||||
IA_ERRORCODE ia_enhaacplus_enc_qc_main(
|
||||
ixheaace_qc_state *pstr_qc_state, WORD32 num_channels, ixheaace_element_bits *pstr_el_bits,
|
||||
ixheaace_psy_out_channel psy_out_ch[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_psy_out_channel **psy_out_ch,
|
||||
ixheaace_psy_out_element *pstr_psy_out_element,
|
||||
ixheaace_qc_out_channel pstr_qc_out_ch[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_qc_out_channel **pstr_qc_out_ch,
|
||||
ixheaace_qc_out_element *pstr_qc_out_element, WORD32 ancillary_data_bytes,
|
||||
ixheaace_aac_tables *pstr_aac_tables, WORD32 adts_flag, WORD32 aot, WORD32 stat_bits_flag,
|
||||
WORD32 flag_last_element, WORD32 frame_len_long, WORD8 *ptr_scratch,
|
||||
|
|
|
|||
|
|
@ -945,6 +945,9 @@ ixheaace_frame_info_generator(ixheaace_pstr_sbr_env_frame pstr_sbr_env_frame,
|
|||
ixheaace_freq_res *ptr_tuning_freq = (ixheaace_freq_res *)(ptr_v_tuning + 3);
|
||||
|
||||
ixheaace_freq_res freq_res_fix = pstr_sbr_env_frame->freq_res_fix;
|
||||
if (pstr_sbr_env_frame->use_low_freq_res == 1) {
|
||||
freq_res_fix = FREQ_RES_LOW;
|
||||
}
|
||||
if (is_ld_sbr) {
|
||||
if ((!tran_flag && ptr_v_pre_transient_info[1]) &&
|
||||
(num_time_slots - ptr_v_pre_transient_info[0] < 4)) {
|
||||
|
|
@ -1108,7 +1111,8 @@ ixheaace_frame_info_generator(ixheaace_pstr_sbr_env_frame pstr_sbr_env_frame,
|
|||
case IXHEAACE_LD_TRAN: {
|
||||
ixheaace_create_ld_transient_frame_info(&pstr_sbr_env_frame->sbr_frame_info,
|
||||
&pstr_sbr_env_frame->sbr_grid, tran_pos,
|
||||
num_time_slots, 0);
|
||||
num_time_slots,
|
||||
pstr_sbr_env_frame->use_low_freq_res);
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -1122,7 +1126,8 @@ ixheaace_frame_info_generator(ixheaace_pstr_sbr_env_frame pstr_sbr_env_frame,
|
|||
|
||||
VOID ixheaace_create_frame_info_generator(ixheaace_pstr_sbr_env_frame pstr_sbr_env_frame,
|
||||
WORD32 allow_spread, WORD32 num_env_static,
|
||||
WORD32 static_framing, ixheaace_freq_res freq_res_fix) {
|
||||
WORD32 static_framing, ixheaace_freq_res freq_res_fix,
|
||||
WORD32 use_low_freq_res) {
|
||||
memset(pstr_sbr_env_frame, 0, sizeof(ixheaace_str_sbr_env_frame));
|
||||
|
||||
pstr_sbr_env_frame->frame_type_old = IXHEAACE_FIXFIX;
|
||||
|
|
@ -1132,6 +1137,7 @@ VOID ixheaace_create_frame_info_generator(ixheaace_pstr_sbr_env_frame pstr_sbr_e
|
|||
pstr_sbr_env_frame->num_env_static = num_env_static;
|
||||
pstr_sbr_env_frame->static_framing = static_framing;
|
||||
pstr_sbr_env_frame->freq_res_fix = freq_res_fix;
|
||||
pstr_sbr_env_frame->use_low_freq_res = use_low_freq_res;
|
||||
|
||||
pstr_sbr_env_frame->length_v_bord = 0;
|
||||
pstr_sbr_env_frame->length_v_bord_follow = 0;
|
||||
|
|
|
|||
|
|
@ -84,13 +84,15 @@ typedef struct {
|
|||
WORD32 length_v_freq_follow;
|
||||
ixheaace_str_sbr_grid sbr_grid;
|
||||
ixheaace_str_frame_info_sbr sbr_frame_info;
|
||||
WORD32 use_low_freq_res;
|
||||
} ixheaace_str_sbr_env_frame;
|
||||
|
||||
typedef ixheaace_str_sbr_env_frame *ixheaace_pstr_sbr_env_frame;
|
||||
|
||||
VOID ixheaace_create_frame_info_generator(ixheaace_pstr_sbr_env_frame sbr_env_frame_handle,
|
||||
WORD32 allow_spread, WORD32 num_env_static,
|
||||
WORD32 static_framing, ixheaace_freq_res freq_res_fix);
|
||||
WORD32 static_framing, ixheaace_freq_res freq_res_fix,
|
||||
WORD32 use_low_freq_res);
|
||||
|
||||
IA_ERRORCODE
|
||||
ixheaace_frame_info_generator(ixheaace_pstr_sbr_env_frame pstr_sbr_env_frame,
|
||||
|
|
|
|||
|
|
@ -276,7 +276,8 @@ static IA_ERRORCODE ixheaace_create_env_channel(
|
|||
}
|
||||
|
||||
ixheaace_create_frame_info_generator(&pstr_env->str_sbr_env_frame, params->spread, e,
|
||||
params->stat, pstr_env->enc_env_data.freq_res_fix);
|
||||
params->stat, pstr_env->enc_env_data.freq_res_fix,
|
||||
params->use_low_freq_res);
|
||||
|
||||
ixheaace_create_sbr_transient_detector(
|
||||
&pstr_env->str_sbr_trans_detector, pstr_sbr_cfg->sample_freq,
|
||||
|
|
@ -502,8 +503,23 @@ VOID ixheaace_adjust_sbr_settings(const ixheaace_pstr_sbr_cfg pstr_config, UWORD
|
|||
break;
|
||||
}
|
||||
}
|
||||
pstr_config->use_low_freq_res = 0;
|
||||
if (pstr_config->sbr_codec == ELD_SBR) {
|
||||
pstr_config->send_header_data_time = -1;
|
||||
if ((num_ch == NUM_CHANS_MONO) && (bit_rate <= 22000)) {
|
||||
pstr_config->use_low_freq_res = 1;
|
||||
}
|
||||
if ((num_ch == NUM_CHANS_STEREO) && (bit_rate <= 48000)) {
|
||||
pstr_config->use_low_freq_res = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((num_ch == NUM_CHANS_MONO) && (bit_rate <= 18000)) {
|
||||
pstr_config->use_low_freq_res = 1;
|
||||
}
|
||||
if ((num_ch == NUM_CHANS_STEREO) && (bit_rate <= 28000)) {
|
||||
pstr_config->use_low_freq_res = 1;
|
||||
}
|
||||
}
|
||||
if (bit_rate <= 20000) {
|
||||
pstr_config->parametric_coding = 0;
|
||||
|
|
@ -739,107 +755,120 @@ VOID ixheaace_sbr_set_scratch_ptr(ixheaace_pstr_sbr_enc pstr_env_enc, VOID *ptr_
|
|||
|
||||
WORD32 ixheaace_sbr_enc_pers_size(WORD32 num_ch, WORD32 use_ps, WORD32 harmonic_sbr) {
|
||||
WORD32 num_bytes;
|
||||
num_bytes = sizeof(struct ixheaace_str_sbr_enc);
|
||||
num_bytes += sizeof(struct ixheaace_str_enc_channel) * num_ch;
|
||||
num_bytes += sizeof(ixheaace_pvc_enc);
|
||||
num_bytes += 2 * sizeof(FLOAT32) * num_ch * QMF_FILTER_LENGTH;
|
||||
num_bytes = IXHEAACE_GET_SIZE_ALIGNED(sizeof(struct ixheaace_str_sbr_enc), BYTE_ALIGN_8);
|
||||
num_bytes += (IXHEAACE_GET_SIZE_ALIGNED(sizeof(struct ixheaace_str_enc_channel), BYTE_ALIGN_8) *
|
||||
num_ch);
|
||||
num_bytes += IXHEAACE_GET_SIZE_ALIGNED(sizeof(ixheaace_pvc_enc), BYTE_ALIGN_8);
|
||||
num_bytes += (IXHEAACE_GET_SIZE_ALIGNED(2 * sizeof(FLOAT32) * QMF_FILTER_LENGTH, BYTE_ALIGN_8) *
|
||||
num_ch);
|
||||
if (1 == harmonic_sbr) {
|
||||
num_bytes += sizeof(ixheaace_str_hbe_enc) * num_ch;
|
||||
num_bytes += sizeof(ixheaace_str_esbr_hbe_txposer) * num_ch;
|
||||
num_bytes += IXHEAACE_MAX_HBE_PERSISTENT_SIZE * num_ch;
|
||||
num_bytes += ESBR_RESAMP_SAMPLES * sizeof(FLOAT32);
|
||||
num_bytes += (IXHEAACE_GET_SIZE_ALIGNED(sizeof(ixheaace_str_hbe_enc), BYTE_ALIGN_8) * num_ch);
|
||||
num_bytes += (IXHEAACE_GET_SIZE_ALIGNED(sizeof(ixheaace_str_esbr_hbe_txposer), BYTE_ALIGN_8) *
|
||||
num_ch);
|
||||
num_bytes += (IXHEAACE_GET_SIZE_ALIGNED(IXHEAACE_MAX_HBE_PERSISTENT_SIZE, BYTE_ALIGN_8) *
|
||||
num_ch);
|
||||
num_bytes += IXHEAACE_GET_SIZE_ALIGNED(ESBR_RESAMP_SAMPLES * sizeof(FLOAT32), BYTE_ALIGN_8);
|
||||
}
|
||||
num_bytes += sizeof(FLOAT32) * num_ch * 5 * NO_OF_ESTIMATES * MAXIMUM_FREQ_COEFFS;
|
||||
num_bytes += (IXHEAACE_GET_SIZE_ALIGNED(sizeof(FLOAT32) * 5 * NO_OF_ESTIMATES *
|
||||
MAXIMUM_FREQ_COEFFS, BYTE_ALIGN_8) * num_ch);
|
||||
|
||||
num_bytes += sizeof(FLOAT32) * num_ch * MAX_QMF_TIME_SLOTS * IXHEAACE_QMF_CHANNELS;
|
||||
num_bytes += (IXHEAACE_GET_SIZE_ALIGNED(sizeof(FLOAT32) * MAX_QMF_TIME_SLOTS *
|
||||
IXHEAACE_QMF_CHANNELS, BYTE_ALIGN_8) * num_ch);
|
||||
|
||||
if (use_ps) {
|
||||
num_bytes += sizeof(struct ixheaace_str_enc_channel);
|
||||
num_bytes += sizeof(struct ixheaace_ps_enc);
|
||||
num_bytes += sizeof(FLOAT32) * QMF_FILTER_LENGTH;
|
||||
num_bytes += IXHEAACE_GET_SIZE_ALIGNED(sizeof(struct ixheaace_str_enc_channel), BYTE_ALIGN_8);
|
||||
num_bytes += IXHEAACE_GET_SIZE_ALIGNED(sizeof(struct ixheaace_ps_enc), BYTE_ALIGN_8);
|
||||
num_bytes += IXHEAACE_GET_SIZE_ALIGNED(sizeof(FLOAT32) * QMF_FILTER_LENGTH, BYTE_ALIGN_8);
|
||||
|
||||
num_bytes += sizeof(WORD32) * 5 * NO_OF_ESTIMATES * MAXIMUM_FREQ_COEFFS;
|
||||
num_bytes += IXHEAACE_GET_SIZE_ALIGNED(sizeof(WORD32) * 5 * NO_OF_ESTIMATES *
|
||||
MAXIMUM_FREQ_COEFFS, BYTE_ALIGN_8);
|
||||
|
||||
/*shared between spectral_band_replication_envYBuffer_fix and IIC IDD PS data buffers*/
|
||||
num_bytes += sizeof(WORD32) * IXHEAACE_QMF_TIME_SLOTS * IXHEAACE_QMF_CHANNELS;
|
||||
num_bytes += IXHEAACE_GET_SIZE_ALIGNED(sizeof(WORD32) * IXHEAACE_QMF_TIME_SLOTS *
|
||||
IXHEAACE_QMF_CHANNELS, BYTE_ALIGN_8);
|
||||
}
|
||||
num_bytes += sizeof(ixheaace_str_sbr_qmf_filter_bank);
|
||||
num_bytes = IXHEAACE_GET_SIZE_ALIGNED(num_bytes, BYTE_ALIGN_8);
|
||||
num_bytes += IXHEAACE_GET_SIZE_ALIGNED(sizeof(ixheaace_str_sbr_qmf_filter_bank), BYTE_ALIGN_8);
|
||||
return num_bytes;
|
||||
}
|
||||
|
||||
VOID ia_enhaacplus_enc_sbr_set_persist_buf(WORD8 *ptr_base, WORD32 num_ch, WORD32 use_ps,
|
||||
WORD32 harmonic_sbr) {
|
||||
struct ixheaace_str_sbr_enc *pstr_env_enc;
|
||||
WORD8 *ptr_curr_mem = (WORD8 *)((WORD8 *)ptr_base + sizeof(struct ixheaace_str_sbr_enc));
|
||||
WORD8 *ptr_curr_mem = ptr_base +
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(struct ixheaace_str_sbr_enc), BYTE_ALIGN_8);
|
||||
WORD32 i;
|
||||
|
||||
pstr_env_enc = (struct ixheaace_str_sbr_enc *)ptr_base;
|
||||
|
||||
for (i = 0; i < num_ch; i++) {
|
||||
pstr_env_enc->pstr_env_channel[i] = (struct ixheaace_str_enc_channel *)(ptr_curr_mem);
|
||||
ptr_curr_mem = ptr_curr_mem + sizeof(struct ixheaace_str_enc_channel);
|
||||
ptr_curr_mem = ptr_curr_mem +
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(struct ixheaace_str_enc_channel), BYTE_ALIGN_8);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_ch; i++) {
|
||||
pstr_env_enc->pstr_env_channel[i]->str_sbr_qmf.ptr_sbr_qmf_states_ana =
|
||||
(FLOAT32 *)ptr_curr_mem;
|
||||
ptr_curr_mem +=
|
||||
ptr_curr_mem += IXHEAACE_GET_SIZE_ALIGNED(
|
||||
sizeof(pstr_env_enc->pstr_env_channel[i]->str_sbr_qmf.ptr_sbr_qmf_states_ana[0]) *
|
||||
QMF_FILTER_LENGTH;
|
||||
QMF_FILTER_LENGTH, BYTE_ALIGN_8);
|
||||
}
|
||||
if (!use_ps) {
|
||||
pstr_env_enc->ptr_common_buffer1 = (WORD32 *)ptr_curr_mem;
|
||||
ptr_curr_mem += sizeof(pstr_env_enc->ptr_common_buffer1[0]) * num_ch * 5 * NO_OF_ESTIMATES *
|
||||
MAXIMUM_FREQ_COEFFS;
|
||||
ptr_curr_mem += IXHEAACE_GET_SIZE_ALIGNED(sizeof(pstr_env_enc->ptr_common_buffer1[0]) *
|
||||
num_ch * 5 * NO_OF_ESTIMATES * MAXIMUM_FREQ_COEFFS, BYTE_ALIGN_8);
|
||||
|
||||
pstr_env_enc->ptr_common_buffer2 = (WORD32 *)ptr_curr_mem;
|
||||
ptr_curr_mem += sizeof(pstr_env_enc->ptr_common_buffer2[0]) * num_ch * MAX_QMF_TIME_SLOTS *
|
||||
IXHEAACE_QMF_CHANNELS;
|
||||
ptr_curr_mem += IXHEAACE_GET_SIZE_ALIGNED(sizeof(pstr_env_enc->ptr_common_buffer2[0]) *
|
||||
num_ch * MAX_QMF_TIME_SLOTS * IXHEAACE_QMF_CHANNELS, BYTE_ALIGN_8);
|
||||
} else {
|
||||
pstr_env_enc->ptr_common_buffer1 = (WORD32 *)ptr_curr_mem;
|
||||
ptr_curr_mem += 2 * sizeof(pstr_env_enc->ptr_common_buffer1[0]) * 5 * NO_OF_ESTIMATES *
|
||||
MAXIMUM_FREQ_COEFFS;
|
||||
ptr_curr_mem += IXHEAACE_GET_SIZE_ALIGNED(2 * sizeof(pstr_env_enc->ptr_common_buffer1[0]) *
|
||||
5 * NO_OF_ESTIMATES * MAXIMUM_FREQ_COEFFS, BYTE_ALIGN_8);
|
||||
|
||||
pstr_env_enc->ptr_common_buffer2 = (WORD32 *)ptr_curr_mem;
|
||||
ptr_curr_mem += 2 * sizeof(pstr_env_enc->ptr_common_buffer2[0]) * IXHEAACE_QMF_TIME_SLOTS *
|
||||
IXHEAACE_QMF_CHANNELS;
|
||||
ptr_curr_mem += IXHEAACE_GET_SIZE_ALIGNED(2 * sizeof(pstr_env_enc->ptr_common_buffer2[0]) *
|
||||
IXHEAACE_QMF_TIME_SLOTS * IXHEAACE_QMF_CHANNELS, BYTE_ALIGN_8);
|
||||
}
|
||||
// PVC encoder
|
||||
pstr_env_enc->pstr_pvc_enc = (ixheaace_pvc_enc *)ptr_curr_mem;
|
||||
ptr_curr_mem = ptr_curr_mem + sizeof(ixheaace_pvc_enc);
|
||||
ptr_curr_mem = ptr_curr_mem + IXHEAACE_GET_SIZE_ALIGNED(sizeof(ixheaace_pvc_enc), BYTE_ALIGN_8);
|
||||
// Harmonic SBR
|
||||
if (1 == harmonic_sbr) {
|
||||
for (i = 0; i < num_ch; i++) {
|
||||
pstr_env_enc->pstr_env_channel[i]->pstr_hbe_enc = (ixheaace_str_hbe_enc *)ptr_curr_mem;
|
||||
ptr_curr_mem = ptr_curr_mem + sizeof(ixheaace_str_hbe_enc);
|
||||
ptr_curr_mem = ptr_curr_mem +
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(ixheaace_str_hbe_enc), BYTE_ALIGN_8);
|
||||
pstr_env_enc->pstr_env_channel[i]->pstr_hbe_enc->pstr_hbe_txposer =
|
||||
(ixheaace_str_esbr_hbe_txposer *)ptr_curr_mem;
|
||||
ptr_curr_mem = ptr_curr_mem + sizeof(ixheaace_str_esbr_hbe_txposer);
|
||||
ptr_curr_mem = ptr_curr_mem +
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(ixheaace_str_esbr_hbe_txposer), BYTE_ALIGN_8);
|
||||
pstr_env_enc->pstr_env_channel[i]->pstr_hbe_enc->ptr_hbe_txposer_buffers =
|
||||
(VOID *)ptr_curr_mem;
|
||||
ptr_curr_mem = ptr_curr_mem + IXHEAACE_MAX_HBE_PERSISTENT_SIZE;
|
||||
}
|
||||
pstr_env_enc->ptr_hbe_resample_buf = (FLOAT32 *)ptr_curr_mem;
|
||||
ptr_curr_mem =
|
||||
ptr_curr_mem + (ESBR_RESAMP_SAMPLES * sizeof(pstr_env_enc->ptr_hbe_resample_buf[0]));
|
||||
ptr_curr_mem = ptr_curr_mem + IXHEAACE_GET_SIZE_ALIGNED(
|
||||
(ESBR_RESAMP_SAMPLES * sizeof(pstr_env_enc->ptr_hbe_resample_buf[0])), BYTE_ALIGN_8);
|
||||
}
|
||||
if (use_ps) {
|
||||
pstr_env_enc->pstr_env_channel[1] = (struct ixheaace_str_enc_channel *)(ptr_curr_mem);
|
||||
ptr_curr_mem = ptr_curr_mem + sizeof(struct ixheaace_str_enc_channel);
|
||||
ptr_curr_mem = ptr_curr_mem +
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(struct ixheaace_str_enc_channel), BYTE_ALIGN_8);
|
||||
memset(pstr_env_enc->pstr_env_channel[1], 0, sizeof(struct ixheaace_str_enc_channel));
|
||||
|
||||
pstr_env_enc->pstr_env_channel[1]->str_sbr_qmf.ptr_sbr_qmf_states_ana =
|
||||
(FLOAT32 *)ptr_curr_mem;
|
||||
ptr_curr_mem +=
|
||||
sizeof(pstr_env_enc->pstr_env_channel[1]->str_sbr_qmf.ptr_sbr_qmf_states_ana[0]) *
|
||||
QMF_FILTER_LENGTH;
|
||||
ptr_curr_mem += IXHEAACE_GET_SIZE_ALIGNED(
|
||||
sizeof(pstr_env_enc->pstr_env_channel[1]->str_sbr_qmf.ptr_sbr_qmf_states_ana[0]) *
|
||||
QMF_FILTER_LENGTH, BYTE_ALIGN_8);
|
||||
memset(pstr_env_enc->pstr_env_channel[1]->str_sbr_qmf.ptr_sbr_qmf_states_ana, 0,
|
||||
sizeof(pstr_env_enc->pstr_env_channel[1]->str_sbr_qmf.ptr_sbr_qmf_states_ana[0]) *
|
||||
QMF_FILTER_LENGTH);
|
||||
|
||||
pstr_env_enc->pstr_ps_enc = (struct ixheaace_ps_enc *)(ptr_curr_mem);
|
||||
ptr_curr_mem = ptr_curr_mem + sizeof(struct ixheaace_ps_enc);
|
||||
ptr_curr_mem = ptr_curr_mem +
|
||||
IXHEAACE_GET_SIZE_ALIGNED(sizeof(struct ixheaace_ps_enc), BYTE_ALIGN_8);
|
||||
memset(pstr_env_enc->pstr_ps_enc, 0, sizeof(struct ixheaace_ps_enc));
|
||||
}
|
||||
pstr_env_enc->pstr_synthesis_qmf_bank = (ixheaace_str_sbr_qmf_filter_bank *)(ptr_curr_mem);
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ typedef struct ixheaace_str_sbr_cfg {
|
|||
WORD32 sbr_harmonic;
|
||||
WORD32 hq_esbr;
|
||||
ixheaace_sbr_codec_type sbr_codec;
|
||||
WORD32 use_low_freq_res;
|
||||
} ixheaace_str_sbr_cfg, *ixheaace_pstr_sbr_cfg;
|
||||
|
||||
typedef struct ixheaace_str_sbr_enc *ixheaace_pstr_sbr_enc;
|
||||
|
|
|
|||
|
|
@ -621,8 +621,8 @@ static VOID iaace_assimilate_multiple_scf(ixheaace_psy_out_channel *pstr_psy_out
|
|||
}
|
||||
|
||||
VOID iaace_estimate_scfs_chan(
|
||||
ixheaace_psy_out_channel pstr_psy_out[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_qc_out_channel pstr_qc_out_chan[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_psy_out_channel **pstr_psy_out,
|
||||
ixheaace_qc_out_channel **pstr_qc_out_chan,
|
||||
FLOAT32 sfb_form_factor_ch[IXHEAACE_MAX_CH_IN_BS_ELE][MAXIMUM_GROUPED_SCALE_FACTOR_BAND],
|
||||
FLOAT32 sfb_num_relevant_lines_ch[][MAXIMUM_GROUPED_SCALE_FACTOR_BAND], WORD32 num_channels,
|
||||
WORD32 chn, WORD32 frame_len_long) {
|
||||
|
|
@ -648,19 +648,19 @@ VOID iaace_estimate_scfs_chan(
|
|||
memset(ptr_exp_spec, 0, frame_len_long * sizeof(ptr_exp_spec[0]));
|
||||
|
||||
for (ch = chn; ch < chn + num_channels; ch++) {
|
||||
ixheaace_psy_out_channel *pstr_psy_out_chan = &pstr_psy_out[ch];
|
||||
pstr_qc_out_chan[ch].global_gain = 0;
|
||||
ixheaace_psy_out_channel *pstr_psy_out_chan = pstr_psy_out[ch];
|
||||
pstr_qc_out_chan[ch]->global_gain = 0;
|
||||
|
||||
memset(pstr_qc_out_chan[ch].scalefactor, 0,
|
||||
sizeof(*pstr_qc_out_chan[ch].scalefactor) * pstr_psy_out[ch].sfb_count);
|
||||
memset(pstr_qc_out_chan[ch].quant_spec, 0,
|
||||
sizeof(*pstr_qc_out_chan[ch].quant_spec) * frame_len_long);
|
||||
memset(pstr_qc_out_chan[ch]->scalefactor, 0,
|
||||
sizeof(*pstr_qc_out_chan[ch]->scalefactor) * pstr_psy_out[ch]->sfb_count);
|
||||
memset(pstr_qc_out_chan[ch]->quant_spec, 0,
|
||||
sizeof(*pstr_qc_out_chan[ch]->quant_spec) * frame_len_long);
|
||||
|
||||
ptr_scalefactor = pstr_qc_out_chan[ch].scalefactor;
|
||||
global_gain = &pstr_qc_out_chan[ch].global_gain;
|
||||
ptr_scalefactor = pstr_qc_out_chan[ch]->scalefactor;
|
||||
global_gain = &pstr_qc_out_chan[ch]->global_gain;
|
||||
ptr_sfb_form_factor = &sfb_form_factor_ch[ch][0];
|
||||
ptr_sfb_num_relevant_lines_ch = &sfb_num_relevant_lines_ch[ch][0];
|
||||
ptr_quant_spec = pstr_qc_out_chan[ch].quant_spec;
|
||||
ptr_quant_spec = pstr_qc_out_chan[ch]->quant_spec;
|
||||
|
||||
for (i = 0; i < pstr_psy_out_chan->sfb_count; i++) {
|
||||
thresh = pstr_psy_out_chan->ptr_sfb_thr[i];
|
||||
|
|
@ -739,7 +739,7 @@ VOID iaace_estimate_scfs_chan(
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < pstr_psy_out[ch].sfb_count; i++) {
|
||||
for (i = 0; i < pstr_psy_out[ch]->sfb_count; i++) {
|
||||
if ((ptr_scalefactor[i] != MIN_SHRT_VAL) &&
|
||||
(min_scf + MAX_SCF_DELTA) < ptr_scalefactor[i]) {
|
||||
ptr_scalefactor[i] = min_scf + MAX_SCF_DELTA;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ VOID iaace_calc_form_fac_per_chan(FLOAT32 *ptr_sfb_form_factor,
|
|||
FLOAT32 *ptr_sfb_ld_energy);
|
||||
|
||||
VOID iaace_estimate_scfs_chan(
|
||||
ixheaace_psy_out_channel pstr_psy_out_ch[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_qc_out_channel pstr_qc_out_ch[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_psy_out_channel **pstr_psy_out_ch,
|
||||
ixheaace_qc_out_channel **pstr_qc_out_ch,
|
||||
FLOAT32 sfb_form_factor_ch[IXHEAACE_MAX_CH_IN_BS_ELE][MAXIMUM_GROUPED_SCALE_FACTOR_BAND],
|
||||
FLOAT32 sfb_num_relevant_lines_ch[][MAXIMUM_GROUPED_SCALE_FACTOR_BAND], WORD32 num_channels,
|
||||
WORD32 chn, WORD32 frame_len_long);
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ static WORD32 ia_enhaacplus_enc_count_tns_bits(
|
|||
}
|
||||
|
||||
WORD32 ia_enhaacplus_enc_count_static_bitdemand(
|
||||
ixheaace_psy_out_channel psy_out_ch[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_psy_out_channel **psy_out_ch,
|
||||
ixheaace_psy_out_element *pstr_psy_out_element, WORD32 channels, WORD32 aot, WORD32 adts_flag,
|
||||
WORD32 stat_bits_flag, WORD32 flag_last_element) {
|
||||
WORD32 static_bits = 0;
|
||||
|
|
@ -143,9 +143,9 @@ WORD32 ia_enhaacplus_enc_count_static_bitdemand(
|
|||
|
||||
static_bits += SI_ID_BITS + SI_SCE_BITS + SI_ICS_BITS;
|
||||
|
||||
static_bits += ia_enhaacplus_enc_count_tns_bits(&(psy_out_ch[0].tns_info),
|
||||
psy_out_ch[0].window_sequence);
|
||||
switch (psy_out_ch[0].window_sequence) {
|
||||
static_bits += ia_enhaacplus_enc_count_tns_bits(&(psy_out_ch[0]->tns_info),
|
||||
psy_out_ch[0]->window_sequence);
|
||||
switch (psy_out_ch[0]->window_sequence) {
|
||||
case LONG_WINDOW:
|
||||
case START_WINDOW:
|
||||
case STOP_WINDOW:
|
||||
|
|
@ -166,10 +166,10 @@ WORD32 ia_enhaacplus_enc_count_static_bitdemand(
|
|||
static_bits += SI_CPE_MS_MASK_BITS;
|
||||
|
||||
static_bits += ia_enhaacplus_enc_count_ms_mask_bits(
|
||||
psy_out_ch[0].sfb_count, psy_out_ch[0].sfb_per_group, psy_out_ch[0].max_sfb_per_grp,
|
||||
psy_out_ch[0]->sfb_count, psy_out_ch[0]->sfb_per_group, psy_out_ch[0]->max_sfb_per_grp,
|
||||
&pstr_psy_out_element->tools_info);
|
||||
|
||||
switch (psy_out_ch[0].window_sequence) {
|
||||
switch (psy_out_ch[0]->window_sequence) {
|
||||
case LONG_WINDOW:
|
||||
case START_WINDOW:
|
||||
case STOP_WINDOW:
|
||||
|
|
@ -184,8 +184,8 @@ WORD32 ia_enhaacplus_enc_count_static_bitdemand(
|
|||
}
|
||||
|
||||
for (ch = 0; ch < 2; ch++) {
|
||||
static_bits += ia_enhaacplus_enc_count_tns_bits(&(psy_out_ch[ch].tns_info),
|
||||
psy_out_ch[ch].window_sequence);
|
||||
static_bits += ia_enhaacplus_enc_count_tns_bits(&(psy_out_ch[ch]->tns_info),
|
||||
psy_out_ch[ch]->window_sequence);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,6 @@
|
|||
#pragma once
|
||||
|
||||
WORD32 ia_enhaacplus_enc_count_static_bitdemand(
|
||||
ixheaace_psy_out_channel psy_out_ch[IXHEAACE_MAX_CH_IN_BS_ELE],
|
||||
ixheaace_psy_out_channel **psy_out_ch,
|
||||
ixheaace_psy_out_element *pstr_psy_out_element, WORD32 channels, WORD32 aot, WORD32 adts_flag,
|
||||
WORD32 stat_bits_flag, WORD32 flag_last_element);
|
||||
|
|
|
|||
|
|
@ -237,17 +237,17 @@ VOID iaace_apply_stereo_preproc(ixheaace_stereo_pre_pro_pstr pstr_stereo_pre_pro
|
|||
pstr_stereo_pre_pro->average_freq_energy_l + pstr_stereo_pre_pro->average_freq_energy_r;
|
||||
}
|
||||
|
||||
VOID iaace_update_stereo_pre_process(ixheaace_psy_out_channel *pstr_psy_out,
|
||||
VOID iaace_update_stereo_pre_process(ixheaace_psy_out_channel **pstr_psy_out,
|
||||
ixheaace_qc_out_element *pstr_qc_out,
|
||||
ixheaace_stereo_pre_pro_pstr pstr_stereo_pre_pro,
|
||||
FLOAT32 weight_pe_fac) {
|
||||
if (pstr_stereo_pre_pro->stereo_attenuation_flag) {
|
||||
FLOAT32 delta = 0.1f;
|
||||
|
||||
pstr_stereo_pre_pro->average_freq_energy_l = pstr_psy_out[0].sfb_sum_lr_energy;
|
||||
pstr_stereo_pre_pro->average_freq_energy_r = pstr_psy_out[1].sfb_sum_lr_energy;
|
||||
pstr_stereo_pre_pro->average_freq_energy_m = pstr_psy_out[0].sfb_sum_ms_energy;
|
||||
pstr_stereo_pre_pro->average_freq_energy_s = pstr_psy_out[1].sfb_sum_ms_energy;
|
||||
pstr_stereo_pre_pro->average_freq_energy_l = pstr_psy_out[0]->sfb_sum_lr_energy;
|
||||
pstr_stereo_pre_pro->average_freq_energy_r = pstr_psy_out[1]->sfb_sum_lr_energy;
|
||||
pstr_stereo_pre_pro->average_freq_energy_m = pstr_psy_out[0]->sfb_sum_ms_energy;
|
||||
pstr_stereo_pre_pro->average_freq_energy_s = pstr_psy_out[1]->sfb_sum_ms_energy;
|
||||
|
||||
pstr_stereo_pre_pro->smoothed_pe_sum_sum =
|
||||
delta * pstr_qc_out->pe * weight_pe_fac +
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ VOID iaace_apply_stereo_preproc(ixheaace_stereo_pre_pro_pstr pstr_stereo_pre_pro
|
|||
WORD32 num_channels, ixheaace_element_info *pstr_elem_info,
|
||||
FLOAT32 *ptr_time_data, WORD32 granule_len);
|
||||
|
||||
VOID iaace_update_stereo_pre_process(ixheaace_psy_out_channel *pstr_psy_out,
|
||||
VOID iaace_update_stereo_pre_process(ixheaace_psy_out_channel **pstr_psy_out,
|
||||
ixheaace_qc_out_element *pstr_qc_out,
|
||||
ixheaace_stereo_pre_pro_pstr pstr_stereo_pre_pro,
|
||||
FLOAT32 weight_pe_fac);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue