Merge pull request #12 from ittiam-systems/eldv2

ELDv2 support for EXHEAAC decoder
This commit is contained in:
tripti-tiwari 2022-10-11 08:27:16 +05:30 committed by GitHub
commit 1a352d8d2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
83 changed files with 9281 additions and 4884 deletions

View file

@ -123,6 +123,8 @@ cc_library_static {
"decoder/ixheaacd_huff_code_reorder.c",
"decoder/ixheaacd_rev_vlc.c",
"decoder/ixheaacd_qmf_dec.c",
"decoder/ixheaacd_ld_mps_config.c",
"decoder/ixheaacd_ld_mps_dec.c",
"decoder/drc_src/impd_drc_api.c",
"decoder/drc_src/impd_drc_bitbuffer.c",
"decoder/drc_src/impd_drc_dec.c",

View file

@ -113,6 +113,8 @@ list(
"${XAAC_ROOT}/decoder/ixheaacd_huff_code_reorder.c"
"${XAAC_ROOT}/decoder/ixheaacd_rev_vlc.c"
"${XAAC_ROOT}/decoder/ixheaacd_qmf_dec.c"
"${XAAC_ROOT}/decoder/ixheaacd_ld_mps_dec.c"
"${XAAC_ROOT}/decoder/ixheaacd_ld_mps_config.c"
"${XAAC_ROOT}/decoder/drc_src/impd_drc_api.c"
"${XAAC_ROOT}/decoder/drc_src/impd_drc_bitbuffer.c"
"${XAAC_ROOT}/decoder/drc_src/impd_drc_dec.c"

View file

@ -32,9 +32,12 @@ ixheaacd_fwd_modulation:
LDR r2, [sp, #0x24]
MOV lr, r1
MOV r4, r1
MOV r1, #0x1f
LDR r1, [r3]
SUB r1, r1, #1
CMP r1, #0x3f
MOV r7, r5
ADD r8, r0, #0xfc
ADDEQ r8, r8, #0x100
MOV r6, r3
LOOP1:
LDR r3, [r0], #4
@ -70,12 +73,16 @@ LOOP1:
BL ixheaacd_cos_sin_mod
LDR r1, [sp, #0x28]
LDRSH r2, [r6]
CMP r1, #1
BEQ LOOP3
LDRSH r1, [r6, #0x2c]
LDRSH r2, [r6, #0x2a]
LDR r0, [r6, #0x18]
SUBS r2, r1, r2
@ LDMLEFD sp!, {r3-r9, r12, pc}
@ LDMLEFD sp!, {r3-r9, r12, pc}
LDMFDLE sp!, {r3-r9, r12, pc}
LOOP2:
LDR r1, [r0], #4
@ -99,5 +106,29 @@ LOOP2:
SUBS r2, r2, #1
STR r1, [r5], #4
BGT LOOP2
B END
LOOP3:
LDR r12, [r5, #0]
LDR r3, [r4, #0]
MOV r1, r3
MOV r3, #0
SUB r3, r3, r12
STR r3, [r4], #4
STR r1, [r5], #4
LDR r12, [r5, #0]
LDR r3, [r4, #0]
MOV r1, r12
MOV r12, #0
SUB r12, r12, r3
STR r12, [r5], #4
STR r1, [r4], #4
SUBS r2, r2, #2
BGT LOOP3
END:
LDMFD sp!, {r3-r9, r12, pc}

View file

@ -66,6 +66,8 @@
#define ROUNDING_SPECTRA 1
#define HQ_SHIFT_VAL 4
extern const WORD32 ixheaacd_ldmps_polyphase_filter_coeff_fix[1280];
VOID ixheaacd_dct2_64(WORD32 *x, WORD32 *X,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,
WORD16 *filter_states) {
@ -90,7 +92,7 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
ia_sbr_qmf_filter_bank_struct *qmf_bank,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,
WORD32 ch_fac, WORD32 low_pow_flag,
WORD audio_object_type) {
WORD audio_object_type, WORD32 ldmps_present) {
WORD32 i, k;
WORD32 num_time_slots = qmf_bank->num_time_slots;
@ -206,7 +208,7 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
if (!low_pow_flag) {
ixheaacd_fwd_modulation(analysis_buffer, qmf_real[i], qmf_imag[i],
qmf_bank, qmf_dec_tables_ptr);
qmf_bank, qmf_dec_tables_ptr, ldmps_present);
} else {
ixheaacd_dct3_32(
(WORD32 *)analysis_buffer, qmf_real[i], qmf_dec_tables_ptr->dct23_tw,
@ -227,6 +229,115 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
}
}
VOID ixheaacd_cplx_anal_qmffilt_32(const WORD32 *time_sample_buf,
ia_sbr_scale_fact_struct *sbr_scale_factor,
WORD32 **qmf_real, WORD32 **qmf_imag,
ia_sbr_qmf_filter_bank_struct *qmf_bank,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,
WORD32 ch_fac, WORD32 ldsbr_present) {
WORD32 i, k;
WORD32 num_time_slots = qmf_bank->num_time_slots;
WORD32 analysis_buffer[4 * NO_ANALYSIS_CHANNELS];
WORD32 *filter_states = qmf_bank->core_samples_buffer_32;
WORD32 *fp1, *fp2, *tmp;
WORD32 *filter_1;
WORD32 *filter_2;
WORD32 *filt_ptr;
WORD32 start_slot = 2;
if (ldsbr_present) {
qmf_bank->filter_pos_32 +=
(qmf_dec_tables_ptr->qmf_c_ldsbr_mps - qmf_bank->analy_win_coeff_32);
qmf_bank->analy_win_coeff_32 = qmf_dec_tables_ptr->qmf_c_ldsbr_mps;
} else {
qmf_bank->filter_pos_32 += (ixheaacd_ldmps_polyphase_filter_coeff_fix -
qmf_bank->analy_win_coeff_32);
qmf_bank->analy_win_coeff_32 =
(WORD32 *)ixheaacd_ldmps_polyphase_filter_coeff_fix;
}
filter_1 = qmf_bank->filter_pos_32;
filter_2 = filter_1 + qmf_bank->no_channels;
sbr_scale_factor->st_lb_scale = 0;
sbr_scale_factor->lb_scale = -10;
sbr_scale_factor->lb_scale = -9;
if (qmf_bank->no_channels != 64) {
qmf_bank->cos_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l32;
qmf_bank->alt_sin_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l32;
} else {
qmf_bank->cos_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l64;
qmf_bank->alt_sin_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l64;
}
qmf_bank->t_cos =
(WORD16 *)qmf_dec_tables_ptr->ixheaacd_sbr_t_cos_sin_l32_eld;
fp1 = qmf_bank->anal_filter_states_32;
fp2 = qmf_bank->anal_filter_states_32 + qmf_bank->no_channels;
filter_2 = qmf_bank->filter_2_32;
fp1 = qmf_bank->fp1_anal_32;
fp2 = qmf_bank->fp2_anal_32;
for (i = start_slot; i < num_time_slots + start_slot; i++) {
for (k = 0; k < qmf_bank->no_channels; k++)
filter_states[qmf_bank->no_channels - 1 - k] =
time_sample_buf[ch_fac * k];
if (ldsbr_present) {
ixheaacd_sbr_qmfanal32_winadd_eld_32(fp1, fp2, filter_1, filter_2,
analysis_buffer);
} else {
ixheaacd_sbr_qmfanal32_winadd_eld_mps(fp1, fp2, filter_1, filter_2,
analysis_buffer);
}
time_sample_buf += qmf_bank->no_channels * ch_fac;
filter_states -= qmf_bank->no_channels;
if (filter_states < qmf_bank->anal_filter_states_32) {
filter_states = qmf_bank->anal_filter_states_32 +
((qmf_bank->no_channels * 10) - qmf_bank->no_channels);
}
tmp = fp1;
fp1 = fp2;
fp2 = tmp;
filter_1 += qmf_bank->no_channels;
filter_2 += qmf_bank->no_channels;
filt_ptr = filter_1;
filter_1 = filter_2;
filter_2 = filt_ptr;
if (filter_2 >
(qmf_bank->analy_win_coeff_32 + (qmf_bank->no_channels * 10))) {
filter_1 = (WORD32 *)qmf_bank->analy_win_coeff_32;
filter_2 = (WORD32 *)qmf_bank->analy_win_coeff_32 + qmf_bank->no_channels;
}
ixheaacd_fwd_modulation(analysis_buffer, qmf_real[i], qmf_imag[i], qmf_bank,
qmf_dec_tables_ptr, 1);
}
qmf_bank->filter_pos_32 = filter_1;
qmf_bank->core_samples_buffer_32 = filter_states;
qmf_bank->fp1_anal_32 = fp1;
qmf_bank->fp2_anal_32 = fp2;
qmf_bank->filter_2_32 = filter_2;
}
VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states,
ia_sbr_qmf_filter_bank_struct *syn_qmf,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
@ -351,4 +462,4 @@ VOID ixheaacd_esbr_cos_sin_mod(WORD32 *subband,
}
p_sin = qmf_bank->esbr_alt_sin_twiddle;
ixheaacd_esbr_cos_sin_mod_loop2(subband, p_sin, M);
}
}

View file

@ -64,6 +64,8 @@
#define ROUNDING_SPECTRA 1
#define HQ_SHIFT_VAL 4
extern const WORD32 ixheaacd_ldmps_polyphase_filter_coeff_fix[1280];
VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
const WORD16 *main_twidle_fwd, const WORD16 *post_tbl,
const WORD16 *w_16, const WORD32 *p_table) {
@ -302,15 +304,16 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
VOID ixheaacd_fwd_modulation(const WORD32 *p_time_in1, WORD32 *real_subband,
WORD32 *imag_subband,
ia_sbr_qmf_filter_bank_struct *qmf_bank,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,
WORD32 ld_mps_flag) {
WORD32 i;
const WORD32 *p_time_in2 = &p_time_in1[2 * NO_ANALYSIS_CHANNELS - 1];
const WORD32 *p_time_in2 = &p_time_in1[2 * qmf_bank->no_channels - 1];
WORD32 temp1, temp2;
WORD32 *t_real_subband = real_subband;
WORD32 *t_imag_subband = imag_subband;
const WORD16 *tcos;
for (i = NO_ANALYSIS_CHANNELS - 1; i >= 0; i--) {
for (i = qmf_bank->no_channels - 1; i >= 0; i--) {
temp1 = ixheaacd_shr32(*p_time_in1++, HQ_SHIFT_VAL);
temp2 = ixheaacd_shr32(*p_time_in2--, HQ_SHIFT_VAL);
@ -326,18 +329,33 @@ VOID ixheaacd_fwd_modulation(const WORD32 *p_time_in1, WORD32 *real_subband,
tcos = qmf_bank->t_cos;
for (i = (qmf_bank->usb - qmf_bank->lsb - 1); i >= 0; i--) {
WORD16 cosh, sinh;
WORD32 re, im;
if (ld_mps_flag == 0) {
for (i = (qmf_bank->usb - qmf_bank->lsb - 1); i >= 0; i--) {
WORD16 cosh, sinh;
WORD32 re, im;
re = *real_subband;
im = *imag_subband;
cosh = *tcos++;
sinh = *tcos++;
*real_subband++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32_shl(re, cosh),
ixheaacd_mult32x16in32_shl(im, sinh));
*imag_subband++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(im, cosh),
ixheaacd_mult32x16in32_shl(re, sinh));
re = *real_subband;
im = *imag_subband;
cosh = *tcos++;
sinh = *tcos++;
*real_subband++ =
ixheaacd_add32_sat(ixheaacd_mult32x16in32_shl(re, cosh),
ixheaacd_mult32x16in32_shl(im, sinh));
*imag_subband++ =
ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(im, cosh),
ixheaacd_mult32x16in32_shl(re, sinh));
}
} else {
WORD32 i_band;
for (i = 0; i < min(64, qmf_bank->no_channels); i += 2) {
i_band = real_subband[i];
real_subband[i] = -imag_subband[i];
imag_subband[i] = i_band;
i_band = -real_subband[i + 1];
real_subband[i + 1] = imag_subband[i + 1];
imag_subband[i + 1] = i_band;
}
}
}
@ -347,7 +365,7 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
ia_sbr_qmf_filter_bank_struct *qmf_bank,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,
WORD32 ch_fac, WORD32 low_pow_flag,
WORD audio_object_type) {
WORD audio_object_type, WORD32 ldmps_present) {
WORD32 i, k;
WORD32 num_time_slots = qmf_bank->num_time_slots;
@ -464,7 +482,7 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
if (!low_pow_flag) {
ixheaacd_fwd_modulation(analysis_buffer, qmf_real[i], qmf_imag[i],
qmf_bank, qmf_dec_tables_ptr);
qmf_bank, qmf_dec_tables_ptr, ldmps_present);
} else {
ixheaacd_dct3_32(
(WORD32 *)analysis_buffer, qmf_real[i], qmf_dec_tables_ptr->dct23_tw,
@ -485,6 +503,115 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
}
}
VOID ixheaacd_cplx_anal_qmffilt_32(const WORD32 *time_sample_buf,
ia_sbr_scale_fact_struct *sbr_scale_factor,
WORD32 **qmf_real, WORD32 **qmf_imag,
ia_sbr_qmf_filter_bank_struct *qmf_bank,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,
WORD32 ch_fac, WORD32 ldsbr_present) {
WORD32 i, k;
WORD32 num_time_slots = qmf_bank->num_time_slots;
WORD32 analysis_buffer[4 * NO_ANALYSIS_CHANNELS];
WORD32 *filter_states = qmf_bank->core_samples_buffer_32;
WORD32 *fp1, *fp2, *tmp;
WORD32 *filter_1;
WORD32 *filter_2;
WORD32 *filt_ptr;
WORD32 start_slot = 2;
if (ldsbr_present) {
qmf_bank->filter_pos_32 +=
(qmf_dec_tables_ptr->qmf_c_ldsbr_mps - qmf_bank->analy_win_coeff_32);
qmf_bank->analy_win_coeff_32 = qmf_dec_tables_ptr->qmf_c_ldsbr_mps;
} else {
qmf_bank->filter_pos_32 += (ixheaacd_ldmps_polyphase_filter_coeff_fix -
qmf_bank->analy_win_coeff_32);
qmf_bank->analy_win_coeff_32 =
(WORD32 *)ixheaacd_ldmps_polyphase_filter_coeff_fix;
}
filter_1 = qmf_bank->filter_pos_32;
filter_2 = filter_1 + qmf_bank->no_channels;
sbr_scale_factor->st_lb_scale = 0;
sbr_scale_factor->lb_scale = -10;
sbr_scale_factor->lb_scale = -9;
if (qmf_bank->no_channels != 64) {
qmf_bank->cos_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l32;
qmf_bank->alt_sin_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l32;
} else {
qmf_bank->cos_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l64;
qmf_bank->alt_sin_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l64;
}
qmf_bank->t_cos =
(WORD16 *)qmf_dec_tables_ptr->ixheaacd_sbr_t_cos_sin_l32_eld;
fp1 = qmf_bank->anal_filter_states_32;
fp2 = qmf_bank->anal_filter_states_32 + qmf_bank->no_channels;
filter_2 = qmf_bank->filter_2_32;
fp1 = qmf_bank->fp1_anal_32;
fp2 = qmf_bank->fp2_anal_32;
for (i = start_slot; i < num_time_slots + start_slot; i++) {
for (k = 0; k < qmf_bank->no_channels; k++)
filter_states[qmf_bank->no_channels - 1 - k] =
time_sample_buf[ch_fac * k];
if (ldsbr_present) {
ixheaacd_sbr_qmfanal32_winadd_eld_32(fp1, fp2, filter_1, filter_2,
analysis_buffer);
} else {
ixheaacd_sbr_qmfanal32_winadd_eld_mps(fp1, fp2, filter_1, filter_2,
analysis_buffer);
}
time_sample_buf += qmf_bank->no_channels * ch_fac;
filter_states -= qmf_bank->no_channels;
if (filter_states < qmf_bank->anal_filter_states_32) {
filter_states = qmf_bank->anal_filter_states_32 +
((qmf_bank->no_channels * 10) - qmf_bank->no_channels);
}
tmp = fp1;
fp1 = fp2;
fp2 = tmp;
filter_1 += qmf_bank->no_channels;
filter_2 += qmf_bank->no_channels;
filt_ptr = filter_1;
filter_1 = filter_2;
filter_2 = filt_ptr;
if (filter_2 >
(qmf_bank->analy_win_coeff_32 + (qmf_bank->no_channels * 10))) {
filter_1 = (WORD32 *)qmf_bank->analy_win_coeff_32;
filter_2 = (WORD32 *)qmf_bank->analy_win_coeff_32 + qmf_bank->no_channels;
}
ixheaacd_fwd_modulation(analysis_buffer, qmf_real[i], qmf_imag[i], qmf_bank,
qmf_dec_tables_ptr, 1);
}
qmf_bank->filter_pos_32 = filter_1;
qmf_bank->core_samples_buffer_32 = filter_states;
qmf_bank->fp1_anal_32 = fp1;
qmf_bank->fp2_anal_32 = fp2;
qmf_bank->filter_2_32 = filter_2;
}
VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states,
ia_sbr_qmf_filter_bank_struct *syn_qmf,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
@ -1337,4 +1464,4 @@ VOID ixheaacd_radix4bfly(const WORD16 *w, WORD32 *x, WORD32 index1,
x += fft_jmp;
w_ptr = w_ptr - fft_jmp;
}
}
}

View file

@ -185,11 +185,9 @@ WORD32 impd_process_drc_bitstream_dec_gain(
WORD32* num_bits_read) {
WORD32 err_code = 0;
WORD32 dummy;
impd_create_init_bit_buf(it_bit_buff, bitstream_gain, num_bytes);
dummy = impd_read_bits_buf(it_bit_buff, num_bits_offset);
impd_read_bits_buf(it_bit_buff, num_bits_offset);
if (it_bit_buff->error) return it_bit_buff->error;
err_code = impd_drc_uni_gain_read(it_bit_buff, p_drc_bs_dec_struct,

View file

@ -353,7 +353,7 @@ WORD32 impd_parse_uni_drc_gain_ext(
ia_bit_buf_struct* it_bit_buff,
ia_uni_drc_gain_ext_struct* uni_drc_gain_ext) {
WORD32 k;
WORD32 bit_size_len, ext_size_bits, bit_size, other_bit;
WORD32 bit_size_len, ext_size_bits, bit_size;
k = 0;
uni_drc_gain_ext->uni_drc_gain_ext_type[k] =
@ -369,7 +369,6 @@ WORD32 impd_parse_uni_drc_gain_ext(
if (it_bit_buff->error) return it_bit_buff->error;
uni_drc_gain_ext->ext_bit_size[k] = bit_size + 1;
other_bit =
impd_skip_bits_buf(it_bit_buff, uni_drc_gain_ext->ext_bit_size[k]);
if (it_bit_buff->error) return it_bit_buff->error;
k++;

View file

@ -244,22 +244,22 @@ impd_map_gain(
ia_split_drc_characteristic_struct* split_drc_characteristic_source,
ia_split_drc_characteristic_struct* split_drc_characteristic_target,
FLOAT32 gain_in_db, FLOAT32* gain_out_db) {
FLOAT32 inLevel;
FLOAT32 in_level=0;
WORD32 err = 0;
switch (split_drc_characteristic_source->characteristic_format) {
case CHARACTERISTIC_SIGMOID:
err = impd_compressor_io_sigmoid_inv(split_drc_characteristic_source,
gain_in_db, &inLevel);
gain_in_db, &in_level);
if (err) return (err);
break;
case CHARACTERISTIC_NODES:
impd_compressor_io_nodes_inverse(split_drc_characteristic_source,
gain_in_db, &inLevel);
gain_in_db, &in_level);
break;
case CHARACTERISTIC_PASS_THRU:
inLevel = gain_in_db;
in_level = gain_in_db;
break;
default:
return (UNEXPECTED_ERROR);
@ -267,23 +267,23 @@ impd_map_gain(
}
switch (split_drc_characteristic_target->characteristic_format) {
case CHARACTERISTIC_SIGMOID:
err = impd_compressor_io_sigmoid(split_drc_characteristic_target, inLevel,
err = impd_compressor_io_sigmoid(split_drc_characteristic_target, in_level,
gain_out_db);
if (err) return (err);
break;
case CHARACTERISTIC_NODES:
if (inLevel < DRC_INPUT_LOUDNESS_TARGET) {
if (in_level < DRC_INPUT_LOUDNESS_TARGET) {
err = impd_compressor_io_nodes_lt(split_drc_characteristic_target,
inLevel, gain_out_db);
in_level, gain_out_db);
if (err) return (err);
} else {
err = impd_compressor_io_nodes_rt(split_drc_characteristic_target,
inLevel, gain_out_db);
in_level, gain_out_db);
if (err) return (err);
}
break;
case CHARACTERISTIC_PASS_THRU:
*gain_out_db = inLevel;
*gain_out_db = in_level;
break;
default:
break;

View file

@ -734,7 +734,6 @@ WORD32 impd_init_loudness_control(
if (overall_loudness_info_present == 1) {
WORD32 requested_method_definition = METHOD_DEFINITION_PROGRAM_LOUDNESS;
WORD32 other_method_definition = METHOD_DEFINITION_PROGRAM_LOUDNESS;
WORD32 requested_measurement_system = MEASUREMENT_SYSTEM_BS_1770_4;
WORD32 requested_preprocessing = 0;
const WORD32* system_bonus = measurement_system_default_tbl;
@ -761,35 +760,27 @@ WORD32 impd_init_loudness_control(
switch (pstr_drc_sel_proc_params_struct->loudness_measurement_system) {
case USER_MEASUREMENT_SYSTEM_DEFAULT:
case USER_MEASUREMENT_SYSTEM_BS_1770_4:
requested_measurement_system = MEASUREMENT_SYSTEM_BS_1770_4;
system_bonus = measurement_system_bs1770_3_tbl;
break;
case USER_MEASUREMENT_SYSTEM_USER:
requested_measurement_system = MEASUREMENT_SYSTEM_USER;
system_bonus = measurement_system_user_tbl;
break;
case USER_MEASUREMENT_SYSTEM_EXPERT_PANEL:
requested_measurement_system = MEASUREMENT_SYSTEM_EXPERT_PANEL;
system_bonus = measurement_system_expert_tbl;
break;
case USER_MEASUREMENT_SYSTEM_RESERVED_A:
requested_measurement_system = USER_MEASUREMENT_SYSTEM_RESERVED_A;
system_bonus = measurement_system_rms_a_tbl;
break;
case USER_MEASUREMENT_SYSTEM_RESERVED_B:
requested_measurement_system = USER_MEASUREMENT_SYSTEM_RESERVED_B;
system_bonus = measurement_system_rms_b_tbl;
break;
case USER_MEASUREMENT_SYSTEM_RESERVED_C:
requested_measurement_system = USER_MEASUREMENT_SYSTEM_RESERVED_C;
system_bonus = measurement_system_rms_c_tbl;
break;
case USER_MEASUREMENT_SYSTEM_RESERVED_D:
requested_measurement_system = USER_MEASUREMENT_SYSTEM_RESERVED_D;
system_bonus = measurement_system_rms_d_tbl;
break;
case USER_MEASUREMENT_SYSTEM_RESERVED_E:
requested_measurement_system = USER_MEASUREMENT_SYSTEM_RESERVED_E;
system_bonus = measurement_system_rms_e_tbl;
break;

View file

@ -40,13 +40,13 @@ VOID impd_apply_gains_and_add(
FLOAT32* channel_audio[], WORD32 impd_apply_gains) {
WORD32 c, b, g, i;
WORD32 offset = 0, signalIndex = 0;
WORD32 gainIndexForGroup[CHANNEL_GROUP_COUNT_MAX];
WORD32 signalIndexForChannel[MAX_CHANNEL_COUNT];
WORD32 offset = 0, signal_index = 0;
WORD32 gain_index_for_group[CHANNEL_GROUP_COUNT_MAX];
WORD32 signal_index_for_channel[MAX_CHANNEL_COUNT];
FLOAT32* lpcm_gains;
FLOAT32 sum;
FLOAT32 drc_gain_last, gainThr;
WORD32 iEnd, iStart;
FLOAT32 drc_gain_last = 0, gain_thr;
WORD32 i_end, i_start;
ia_drc_instructions_struct* str_drc_instruction_str =
&(pstr_drc_instruction_arr[drc_instructions_index]);
@ -58,21 +58,21 @@ VOID impd_apply_gains_and_add(
if (ia_drc_params_struct->delay_mode == DELAY_MODE_LOW_DELAY) {
offset = ia_drc_params_struct->drc_frame_size;
}
gainIndexForGroup[0] = 0;
gain_index_for_group[0] = 0;
for (g = 0; g < str_drc_instruction_str->num_drc_ch_groups - 1; g++) {
gainIndexForGroup[g + 1] =
gainIndexForGroup[g] +
gain_index_for_group[g + 1] =
gain_index_for_group[g] +
str_drc_instruction_str->band_count_of_ch_group[g];
}
signalIndexForChannel[0] = 0;
signal_index_for_channel[0] = 0;
for (c = 0; c < str_drc_instruction_str->audio_num_chan - 1; c++) {
if (str_drc_instruction_str->channel_group_of_ch[c] >= 0) {
signalIndexForChannel[c + 1] =
signalIndexForChannel[c] +
signal_index_for_channel[c + 1] =
signal_index_for_channel[c] +
str_drc_instruction_str->band_count_of_ch_group
[str_drc_instruction_str->channel_group_of_ch[c]];
} else {
signalIndexForChannel[c + 1] = signalIndexForChannel[c] + 1;
signal_index_for_channel[c + 1] = signal_index_for_channel[c] + 1;
}
}
@ -81,59 +81,59 @@ VOID impd_apply_gains_and_add(
b++) {
if (str_drc_instruction_str->ch_group_parametric_drc_flag[g] == 0) {
lpcm_gains =
pstr_gain_buf->buf_interpolation[gainIndexForGroup[g] + b]
pstr_gain_buf->buf_interpolation[gain_index_for_group[g] + b]
.lpcm_gains +
MAX_SIGNAL_DELAY - ia_drc_params_struct->gain_delay_samples -
ia_drc_params_struct->audio_delay_samples + offset;
} else {
lpcm_gains =
pstr_gain_buf->buf_interpolation[gainIndexForGroup[g] + b]
pstr_gain_buf->buf_interpolation[gain_index_for_group[g] + b]
.lpcm_gains +
MAX_SIGNAL_DELAY +
str_drc_instruction_str
->parametric_drc_look_ahead_samples[g] -
ia_drc_params_struct->audio_delay_samples;
}
iEnd = 0;
iStart = 0;
while (iEnd < ia_drc_params_struct->drc_frame_size) {
i_end = 0;
i_start = 0;
while (i_end < ia_drc_params_struct->drc_frame_size) {
if (shape_filter_block[g].shape_flter_block_flag) {
drc_gain_last = shape_filter_block[g].drc_gain_last;
gainThr = 0.0001f * drc_gain_last;
while ((iEnd < ia_drc_params_struct->drc_frame_size) &&
(fabs(lpcm_gains[iEnd] - drc_gain_last) <= gainThr))
iEnd++;
gain_thr = 0.0001f * drc_gain_last;
while ((i_end < ia_drc_params_struct->drc_frame_size) &&
(fabs(lpcm_gains[i_end] - drc_gain_last) <= gain_thr))
i_end++;
} else {
iEnd = ia_drc_params_struct->drc_frame_size;
i_end = ia_drc_params_struct->drc_frame_size;
}
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
{
if (g == str_drc_instruction_str->channel_group_of_ch[c]) {
signalIndex = signalIndexForChannel[c] + b;
signal_index = signal_index_for_channel[c] + b;
if (impd_apply_gains == 1) {
impd_shape_filt_block_time_process(
&shape_filter_block[g], &lpcm_gains[0], signalIndex,
&deinterleaved_audio[signalIndex][0], iStart, iEnd);
&shape_filter_block[g], &lpcm_gains[0], signal_index,
&deinterleaved_audio[signal_index][0], i_start, i_end);
} else {
for (i = iStart; i < iEnd; i++) {
deinterleaved_audio[signalIndex][i] = lpcm_gains[i];
for (i = i_start; i < i_end; i++) {
deinterleaved_audio[signal_index][i] = lpcm_gains[i];
}
}
}
}
if ((iEnd < ia_drc_params_struct->drc_frame_size) &&
if ((i_end < ia_drc_params_struct->drc_frame_size) &&
(shape_filter_block[g].shape_flter_block_flag)) {
impd_shape_filt_block_adapt(lpcm_gains[iEnd],
impd_shape_filt_block_adapt(lpcm_gains[i_end],
&shape_filter_block[g]);
}
if ((iEnd == iStart) &&
if ((i_end == i_start) &&
(drc_gain_last == shape_filter_block[g].drc_gain_last))
break;
iStart = iEnd;
i_start = i_end;
}
}
}
@ -141,7 +141,7 @@ VOID impd_apply_gains_and_add(
}
}
signalIndex = 0;
signal_index = 0;
if (str_drc_instruction_str->drc_set_id > 0) {
for (c = 0; c < str_drc_instruction_str->audio_num_chan; c++)
@ -153,17 +153,17 @@ VOID impd_apply_gains_and_add(
sum = 0.0f;
for (b = 0; b < str_drc_instruction_str->band_count_of_ch_group[g];
b++) {
sum += deinterleaved_audio[signalIndex + b][i];
sum += deinterleaved_audio[signal_index + b][i];
}
channel_audio[c][i] = sum;
}
signalIndex += str_drc_instruction_str->band_count_of_ch_group[g];
signal_index += str_drc_instruction_str->band_count_of_ch_group[g];
} else {
for (i = 0; i < ia_drc_params_struct->drc_frame_size; i++) {
channel_audio[c][i] = deinterleaved_audio[signalIndex][i];
channel_audio[c][i] = deinterleaved_audio[signal_index][i];
}
signalIndex++;
signal_index++;
}
}
} else {

View file

@ -541,7 +541,6 @@ WORD32 impd_match_eq_set(ia_drc_config* drc_config, WORD32 downmix_id,
WORD32* matching_eq_set_idx) {
ia_eq_instructions_struct* str_eq_instructions = NULL;
WORD32 i, k, n;
WORD32 match = 0;
*matching_eq_set_count = 0;
for (i = 0; i < drc_config->str_drc_config_ext.eq_instructions_count; i++) {
str_eq_instructions =
@ -557,7 +556,6 @@ WORD32 impd_match_eq_set(ia_drc_config* drc_config, WORD32 downmix_id,
for (n = 0; n < str_eq_instructions->drc_set_id_count; n++) {
if ((str_eq_instructions->drc_set_id[n] == ID_FOR_ANY_DRC) ||
(drc_set_id == str_eq_instructions->drc_set_id[n])) {
match = 1;
matching_eq_set_idx[*matching_eq_set_count] = i;
(*matching_eq_set_count)++;
}

View file

@ -203,8 +203,6 @@ WORD32 impd_get_selected_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
WORD32 drc_set_id_selected) {
WORD32 n;
ia_drc_instructions_struct* str_drc_instruction_str = NULL;
for (n = 0; n < pstr_drc_uni_sel_proc->drc_config.drc_instructions_count_plus;
n++) {
if (pstr_drc_uni_sel_proc->drc_config.str_drc_instruction_str[n]
@ -215,9 +213,6 @@ WORD32 impd_get_selected_drc_set(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
return (EXTERNAL_ERROR);
}
pstr_drc_uni_sel_proc->drc_inst_index_sel = n;
str_drc_instruction_str = &(
pstr_drc_uni_sel_proc->drc_config
.str_drc_instruction_str[pstr_drc_uni_sel_proc->drc_inst_index_sel]);
pstr_drc_uni_sel_proc->drc_instructions_index[0] =
pstr_drc_uni_sel_proc->drc_inst_index_sel;
@ -431,10 +426,9 @@ WORD32 impd_match_effect_types(
WORD32 k, err;
WORD32 match_found_flag = 0;
WORD32 state_requested;
WORD32 desired_effect_type_found, fallback_effect_type_found;
WORD32 desired_effect_type_found;
desired_effect_type_found = 0;
fallback_effect_type_found = 0;
k = 0;
while (k < effect_type_requested_desired_count) {
state_requested = 1;
@ -453,7 +447,6 @@ WORD32 impd_match_effect_types(
&match_found_flag, selection_candidate_count,
selection_candidate_info);
if (err) return (err);
if (match_found_flag) fallback_effect_type_found = 1;
k++;
}
}

View file

@ -41,7 +41,7 @@ VOID impd_shape_filt_block_adapt(const FLOAT32 drc_gain,
shape_filter_block* shape_filter_block) {
// WORD32 err = 0;
WORD32 i;
FLOAT32 warpedGain, x1, y1;
FLOAT32 warped_gain = 0, x1 = 0, y1;
shape_filter_block->drc_gain_last = drc_gain;
for (i = 0; i < 4; i++) {
if (shape_filter_block->shape_filter[i].type == SHAPE_FILTER_TYPE_OFF)
@ -51,9 +51,9 @@ VOID impd_shape_filt_block_adapt(const FLOAT32 drc_gain,
shape_filter_block->shape_filter[i].type ==
SHAPE_FILTER_TYPE_HF_CUT) {
if (drc_gain < 1.0f)
warpedGain = -1.0f;
warped_gain = -1.0f;
else
warpedGain =
warped_gain =
(drc_gain - 1.0f) /
(drc_gain - 1.0f + shape_filter_block->shape_filter[i].gain_offset);
x1 = shape_filter_block->shape_filter[i].a1;
@ -62,9 +62,9 @@ VOID impd_shape_filt_block_adapt(const FLOAT32 drc_gain,
shape_filter_block->shape_filter[i].type ==
SHAPE_FILTER_TYPE_HF_BOOST) {
if (drc_gain >= 1.0f)
warpedGain = -1.0f;
warped_gain = -1.0f;
else
warpedGain =
warped_gain =
(1.0f - drc_gain) /
(1.0f +
drc_gain *
@ -72,11 +72,11 @@ VOID impd_shape_filt_block_adapt(const FLOAT32 drc_gain,
x1 = shape_filter_block->shape_filter[i].b1;
}
if (warpedGain <= 0.0f) {
if (warped_gain <= 0.0f) {
y1 = x1;
} else if (warpedGain <
} else if (warped_gain <
shape_filter_block->shape_filter[i].warped_gain_max) {
y1 = x1 + shape_filter_block->shape_filter[i].factor * warpedGain;
y1 = x1 + shape_filter_block->shape_filter[i].factor * warped_gain;
} else {
y1 = shape_filter_block->shape_filter[i].y1_bound;
}

View file

@ -574,7 +574,7 @@ static WORD32 impd_parse_parametric_drc_instructions(
ia_bit_buf_struct* it_bit_buff, WORD32 parametric_drc_frame_size,
ia_parametric_drc_instructions_struct* str_parametric_drc_instructions) {
WORD32 i = 0, err = 0, temp;
WORD32 bit_size_len, bit_size, other_bit;
WORD32 bit_size_len, bit_size;
str_parametric_drc_instructions->drc_characteristic = 0;
str_parametric_drc_instructions->disable_paramteric_drc = 0;
@ -678,7 +678,7 @@ static WORD32 impd_parse_parametric_drc_instructions(
default:
str_parametric_drc_instructions->disable_paramteric_drc = 1;
for (i = 0; i < str_parametric_drc_instructions->len_bit_size; i++) {
other_bit = impd_read_bits_buf(it_bit_buff, 1);
impd_read_bits_buf(it_bit_buff, 1);
if (it_bit_buff->error) return it_bit_buff->error;
}
break;
@ -908,7 +908,7 @@ impd_parse_drc_config_ext(ia_bit_buf_struct* it_bit_buff,
ia_drc_config* drc_config,
ia_drc_config_ext* str_drc_config_ext) {
WORD32 err = 0, i, k;
WORD32 bit_size_len, ext_size_bits, bit_size, other_bit;
WORD32 bit_size_len, ext_size_bits, bit_size;
k = 0;
str_drc_config_ext->drc_config_ext_type[k] =
@ -955,7 +955,7 @@ impd_parse_drc_config_ext(ia_bit_buf_struct* it_bit_buff,
break;
default:
for (i = 0; i < str_drc_config_ext->ext_bit_size[k]; i++) {
other_bit = impd_read_bits_buf(it_bit_buff, 1);
impd_read_bits_buf(it_bit_buff, 1);
if (it_bit_buff->error) return it_bit_buff->error;
}
break;
@ -1622,7 +1622,7 @@ impd_parse_loudness_info_set_ext(
ia_bit_buf_struct* it_bit_buff,
ia_drc_loudness_info_set_struct* loudness_info_set) {
WORD32 err = 0, i, k;
WORD32 bit_size_len, ext_size_bits, bit_size, other_bit;
WORD32 bit_size_len, ext_size_bits, bit_size;
k = 0;
loudness_info_set->str_loudness_info_set_ext.loudness_info_set_ext_type[k] =
@ -1649,7 +1649,7 @@ impd_parse_loudness_info_set_ext(
for (i = 0;
i < loudness_info_set->str_loudness_info_set_ext.ext_bit_size[k];
i++) {
other_bit = impd_read_bits_buf(it_bit_buff, 1);
impd_read_bits_buf(it_bit_buff, 1);
if (it_bit_buff->error) return it_bit_buff->error;
}
break;
@ -2199,9 +2199,9 @@ impd_parse_drc_instructions_uni_drc(
if (it_bit_buff->error) return it_bit_buff->error;
repeat_parameters_cnt += 1;
if ((c + repeat_parameters_cnt) > MAX_CHANNEL_COUNT)
return (UNEXPECTED_ERROR);
for (k = 0; k < repeat_parameters_cnt; k++) {
if (c > (MAX_CHANNEL_COUNT-1))
return (UNEXPECTED_ERROR);
str_drc_instruction_str->gain_set_index[c] =
str_drc_instruction_str->gain_set_index[c - 1];
str_drc_instruction_str->str_ducking_modifiers_for_channel[c] =
@ -2343,9 +2343,9 @@ impd_parse_drc_instructions_uni_drc(
if (it_bit_buff->error) return it_bit_buff->error;
repeat_gain_set_idx_cnt += 1;
if ((c + repeat_gain_set_idx_cnt) > MAX_CHANNEL_COUNT)
return (UNEXPECTED_ERROR);
for (k = 0; k < repeat_gain_set_idx_cnt; k++) {
if (c > (MAX_CHANNEL_COUNT - 1))
return (UNEXPECTED_ERROR);
str_drc_instruction_str->gain_set_index[c] = bs_gain_set_idx - 1;
c++;
}

View file

@ -58,6 +58,8 @@
#define RADIXSHIFT 1
#define HQ_SHIFT_VAL 4
extern const WORD32 ixheaacd_ldmps_polyphase_filter_coeff_fix[1280];
VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
const WORD16 *main_twidle_fwd, const WORD16 *post_tbl,
const WORD16 *w_16, const WORD32 *p_table) {
@ -83,12 +85,12 @@ VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
temp1[0] = *ptr_forward++;
temp1[1] = *ptr_reverse--;
temp1[0] = ixheaacd_add32_sat(ixheaacd_shr32(temp1[0], LP_SHIFT_VAL),
ixheaacd_shr32(temp1[1], LP_SHIFT_VAL));
ixheaacd_shr32(temp1[1], LP_SHIFT_VAL));
temp1[2] = *(ptr_forward - 33);
temp1[3] = *(ptr_reverse - 31);
temp1[1] = ixheaacd_sub32_sat(ixheaacd_shr32(temp1[2], LP_SHIFT_VAL),
ixheaacd_shr32(temp1[3], LP_SHIFT_VAL));
ixheaacd_shr32(temp1[3], LP_SHIFT_VAL));
twid_re = *twidle_fwd++;
twid_im = *twidle_fwd;
@ -108,7 +110,7 @@ VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
temp1[1] = *ptr_reverse--;
temp1[0] = *(ptr_reverse - 31);
temp1[1] = ixheaacd_sub32_sat(ixheaacd_shr32(temp1[1], LP_SHIFT_VAL),
ixheaacd_shr32(temp1[0], LP_SHIFT_VAL));
ixheaacd_shr32(temp1[0], LP_SHIFT_VAL));
temp1[0] = temp1[1];
@ -293,7 +295,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
wre = *p_sin_cos++;
*psubband_t++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
ixheaacd_mult32x16in32(im, wim));
*psubband_t++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wre),
ixheaacd_mult32x16in32(re, wim));
@ -303,7 +305,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
*psubband_t2++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wim),
ixheaacd_mult32x16in32(re, wre));
*psubband_t2++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
ixheaacd_mult32x16in32(im, wre));
re = *psubband1--;
im = *psubband++;
@ -314,13 +316,13 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
*psubband1_t-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wre),
ixheaacd_mult32x16in32(re, wim));
*psubband1_t-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
ixheaacd_mult32x16in32(im, wim));
re = *psubband12--;
im = *psubband2++;
*psubband1_t2-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
ixheaacd_mult32x16in32(im, wre));
*psubband1_t2-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wim),
ixheaacd_mult32x16in32(re, wre));
@ -331,7 +333,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
wre = *p_sin_cos++;
*psubband_t++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
ixheaacd_mult32x16in32(im, wim));
*psubband_t++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wre),
ixheaacd_mult32x16in32(re, wim));
@ -341,7 +343,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
*psubband_t2++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wim),
ixheaacd_mult32x16in32(re, wre));
*psubband_t2++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
ixheaacd_mult32x16in32(im, wre));
re = *psubband1--;
im = *psubband++;
@ -352,14 +354,14 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
*psubband1_t-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wre),
ixheaacd_mult32x16in32(re, wim));
*psubband1_t-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
ixheaacd_mult32x16in32(im, wim));
re = *psubband12--;
im = *psubband2++;
;
*psubband1_t2-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
ixheaacd_mult32x16in32(im, wre));
*psubband1_t2-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wim),
ixheaacd_mult32x16in32(re, wre));
}
@ -400,7 +402,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
im = *psubband1;
*psubband1-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
ixheaacd_mult32x16in32(im, wim));
*psubband++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wre),
ixheaacd_mult32x16in32(re, wim));
@ -430,7 +432,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
re2 = *psubband1;
*psubband++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
ixheaacd_mult32x16in32(im, wre));
*psubband1-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wim),
ixheaacd_mult32x16in32(re, wre));
@ -450,7 +452,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
im = psubband1[0];
*psubband1-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re2, wre),
ixheaacd_mult32x16in32(im, wim));
ixheaacd_mult32x16in32(im, wim));
*psubband++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wre),
ixheaacd_mult32x16in32(re2, wim));
@ -466,15 +468,16 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
VOID ixheaacd_fwd_modulation(const WORD32 *p_time_in1, WORD32 *real_subband,
WORD32 *imag_subband,
ia_sbr_qmf_filter_bank_struct *qmf_bank,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,
WORD32 ld_mps_flag) {
WORD32 i;
const WORD32 *p_time_in2 = &p_time_in1[2 * NO_ANALYSIS_CHANNELS - 1];
const WORD32 *p_time_in2 = &p_time_in1[2 * qmf_bank->no_channels - 1];
WORD32 temp1, temp2;
WORD32 *t_real_subband = real_subband;
WORD32 *t_imag_subband = imag_subband;
const WORD16 *tcos;
for (i = NO_ANALYSIS_CHANNELS - 1; i >= 0; i--) {
for (i = qmf_bank->no_channels - 1; i >= 0; i--) {
temp1 = ixheaacd_shr32(*p_time_in1++, HQ_SHIFT_VAL);
temp2 = ixheaacd_shr32(*p_time_in2--, HQ_SHIFT_VAL);
@ -483,28 +486,48 @@ VOID ixheaacd_fwd_modulation(const WORD32 *p_time_in1, WORD32 *real_subband,
*t_imag_subband++ = ixheaacd_add32_sat(temp1, temp2);
}
ixheaacd_cos_sin_mod(real_subband, qmf_bank, qmf_dec_tables_ptr->w_16,
qmf_dec_tables_ptr->dig_rev_table4_16);
if (qmf_bank->no_channels != 64)
ixheaacd_cos_sin_mod(real_subband, qmf_bank, qmf_dec_tables_ptr->w_16,
qmf_dec_tables_ptr->dig_rev_table4_16);
else
ixheaacd_cos_sin_mod(real_subband, qmf_bank, qmf_dec_tables_ptr->w_32,
qmf_dec_tables_ptr->dig_rev_table2_32);
tcos = qmf_bank->t_cos;
if (ld_mps_flag == 0) {
tcos = qmf_bank->t_cos;
for (i = (qmf_bank->usb - qmf_bank->lsb - 1); i >= 0; i--) {
WORD16 cosh, sinh;
WORD32 re, im;
for (i = (qmf_bank->usb - qmf_bank->lsb - 1); i >= 0; i--) {
WORD16 cosh, sinh;
WORD32 re, im;
re = *real_subband;
im = *imag_subband;
cosh = *tcos++;
sinh = *tcos++;
*real_subband++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32_shl(re, cosh),
ixheaacd_mult32x16in32_shl(im, sinh));
*imag_subband++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(im, cosh),
ixheaacd_mult32x16in32_shl(re, sinh));
re = *real_subband;
im = *imag_subband;
cosh = *tcos++;
sinh = *tcos++;
*real_subband++ =
ixheaacd_add32_sat(ixheaacd_mult32x16in32_shl(re, cosh),
ixheaacd_mult32x16in32_shl(im, sinh));
*imag_subband++ =
ixheaacd_sub32_sat(ixheaacd_mult32x16in32_shl(im, cosh),
ixheaacd_mult32x16in32_shl(re, sinh));
}
} else {
WORD32 i_band;
for (i = 0; i < min(64, qmf_bank->no_channels); i += 2) {
i_band = real_subband[i];
real_subband[i] = -imag_subband[i];
imag_subband[i] = i_band;
i_band = -real_subband[i + 1];
real_subband[i + 1] = imag_subband[i + 1];
imag_subband[i + 1] = i_band;
}
}
}
VOID ixheaacd_sbr_qmfanal32_winadd(WORD16 *inp1, WORD16 *inp2, WORD16 *p_qmf1,
WORD16 *p_qmf2, WORD32 *p_out) {
VOID ixheaacd_sbr_qmfanal32_winadd(WORD16 *inp1, WORD16 *inp2,
const WORD16 *p_qmf1, const WORD16 *p_qmf2,
WORD32 *p_out) {
WORD32 n;
for (n = 0; n < 32; n += 2) {
@ -570,7 +593,7 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
ia_sbr_qmf_filter_bank_struct *qmf_bank,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,
WORD32 ch_fac, WORD32 low_pow_flag,
WORD audio_object_type) {
WORD audio_object_type, WORD32 ldmps_present) {
WORD32 i, k;
WORD32 num_time_slots = qmf_bank->num_time_slots;
@ -582,6 +605,8 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
WORD16 *filter_1;
WORD16 *filter_2;
WORD16 *filt_ptr;
WORD32 start_slot = 0;
if (audio_object_type != AOT_ER_AAC_ELD &&
audio_object_type != AOT_ER_AAC_LD) {
qmf_bank->filter_pos +=
@ -599,7 +624,7 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
audio_object_type != AOT_ER_AAC_LD) {
filter_2 = filter_1 + 64;
} else {
filter_2 = filter_1 + 32;
filter_2 = filter_1 + qmf_bank->no_channels;
}
sbr_scale_factor->st_lb_scale = 0;
@ -611,10 +636,17 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
} else {
sbr_scale_factor->lb_scale = -9;
}
qmf_bank->cos_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l32;
qmf_bank->alt_sin_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l32;
if (qmf_bank->no_channels != 64) {
qmf_bank->cos_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l32;
qmf_bank->alt_sin_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l32;
} else {
qmf_bank->cos_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l64;
qmf_bank->alt_sin_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l64;
}
if (audio_object_type != AOT_ER_AAC_ELD &&
audio_object_type != AOT_ER_AAC_LD) {
qmf_bank->t_cos = (WORD16 *)qmf_dec_tables_ptr->sbr_t_cos_sin_l32;
@ -625,7 +657,7 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
}
fp1 = qmf_bank->anal_filter_states;
fp2 = qmf_bank->anal_filter_states + NO_ANALYSIS_CHANNELS;
fp2 = qmf_bank->anal_filter_states + qmf_bank->no_channels;
if (audio_object_type == AOT_ER_AAC_ELD ||
audio_object_type == AOT_ER_AAC_LD) {
@ -634,9 +666,10 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
fp2 = qmf_bank->fp2_anal;
}
for (i = 0; i < num_time_slots; i++) {
for (k = 0; k < NO_ANALYSIS_CHANNELS; k++)
filter_states[NO_ANALYSIS_CHANNELS - 1 - k] = time_sample_buf[ch_fac * k];
for (i = start_slot; i < num_time_slots + start_slot; i++) {
for (k = 0; k < qmf_bank->no_channels; k++)
filter_states[qmf_bank->no_channels - 1 - k] =
time_sample_buf[ch_fac * k];
if (audio_object_type != AOT_ER_AAC_ELD &&
audio_object_type != AOT_ER_AAC_LD) {
@ -647,11 +680,12 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
analysis_buffer);
}
time_sample_buf += NO_ANALYSIS_CHANNELS * ch_fac;
time_sample_buf += qmf_bank->no_channels * ch_fac;
filter_states -= NO_ANALYSIS_CHANNELS;
filter_states -= qmf_bank->no_channels;
if (filter_states < qmf_bank->anal_filter_states) {
filter_states = qmf_bank->anal_filter_states + 288;
filter_states = qmf_bank->anal_filter_states +
((qmf_bank->no_channels * 10) - qmf_bank->no_channels);
}
tmp = fp1;
@ -662,8 +696,8 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
filter_1 += 64;
filter_2 += 64;
} else {
filter_1 += 32;
filter_2 += 32;
filter_1 += qmf_bank->no_channels;
filter_2 += qmf_bank->no_channels;
}
filt_ptr = filter_1;
@ -676,15 +710,16 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
filter_2 = (WORD16 *)qmf_bank->analy_win_coeff + 64;
}
} else {
if (filter_2 > (qmf_bank->analy_win_coeff + 320)) {
if (filter_2 >
(qmf_bank->analy_win_coeff + (qmf_bank->no_channels * 10))) {
filter_1 = (WORD16 *)qmf_bank->analy_win_coeff;
filter_2 = (WORD16 *)qmf_bank->analy_win_coeff + 32;
filter_2 = (WORD16 *)qmf_bank->analy_win_coeff + qmf_bank->no_channels;
}
}
if (!low_pow_flag) {
ixheaacd_fwd_modulation(analysis_buffer, qmf_real[i], qmf_imag[i],
qmf_bank, qmf_dec_tables_ptr);
qmf_bank, qmf_dec_tables_ptr, ldmps_present);
} else {
ixheaacd_dct3_32(
(WORD32 *)analysis_buffer, qmf_real[i], qmf_dec_tables_ptr->dct23_tw,
@ -705,6 +740,114 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_sample_buf,
}
}
VOID ixheaacd_cplx_anal_qmffilt_32(const WORD32 *time_sample_buf,
ia_sbr_scale_fact_struct *sbr_scale_factor,
WORD32 **qmf_real, WORD32 **qmf_imag,
ia_sbr_qmf_filter_bank_struct *qmf_bank,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,
WORD32 ch_fac, WORD32 ldsbr_present) {
WORD32 i, k;
WORD32 num_time_slots = qmf_bank->num_time_slots;
WORD32 analysis_buffer[4 * NO_ANALYSIS_CHANNELS];
WORD32 *filter_states = qmf_bank->core_samples_buffer_32;
WORD32 *fp1, *fp2, *tmp;
WORD32 *filter_1;
WORD32 *filter_2;
WORD32 *filt_ptr;
WORD32 start_slot = 2;
if (ldsbr_present) {
qmf_bank->filter_pos_32 +=
(qmf_dec_tables_ptr->qmf_c_ldsbr_mps - qmf_bank->analy_win_coeff_32);
qmf_bank->analy_win_coeff_32 = qmf_dec_tables_ptr->qmf_c_ldsbr_mps;
} else {
qmf_bank->filter_pos_32 += (ixheaacd_ldmps_polyphase_filter_coeff_fix -
qmf_bank->analy_win_coeff_32);
qmf_bank->analy_win_coeff_32 =
(WORD32 *)ixheaacd_ldmps_polyphase_filter_coeff_fix;
}
filter_1 = qmf_bank->filter_pos_32;
filter_2 = filter_1 + qmf_bank->no_channels;
sbr_scale_factor->st_lb_scale = 0;
sbr_scale_factor->lb_scale = -10;
sbr_scale_factor->lb_scale = -9;
if (qmf_bank->no_channels != 64) {
qmf_bank->cos_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l32;
qmf_bank->alt_sin_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l32;
} else {
qmf_bank->cos_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_sin_cos_twiddle_l64;
qmf_bank->alt_sin_twiddle =
(WORD16 *)qmf_dec_tables_ptr->sbr_alt_sin_twiddle_l64;
}
qmf_bank->t_cos =
(WORD16 *)qmf_dec_tables_ptr->ixheaacd_sbr_t_cos_sin_l32_eld;
fp1 = qmf_bank->anal_filter_states_32;
fp2 = qmf_bank->anal_filter_states_32 + qmf_bank->no_channels;
filter_2 = qmf_bank->filter_2_32;
fp1 = qmf_bank->fp1_anal_32;
fp2 = qmf_bank->fp2_anal_32;
for (i = start_slot; i < num_time_slots + start_slot; i++) {
for (k = 0; k < qmf_bank->no_channels; k++)
filter_states[qmf_bank->no_channels - 1 - k] =
time_sample_buf[ch_fac * k];
if (ldsbr_present) {
ixheaacd_sbr_qmfanal32_winadd_eld_32(fp1, fp2, filter_1, filter_2,
analysis_buffer);
} else {
ixheaacd_sbr_qmfanal32_winadd_eld_mps(fp1, fp2, filter_1, filter_2,
analysis_buffer);
}
time_sample_buf += qmf_bank->no_channels * ch_fac;
filter_states -= qmf_bank->no_channels;
if (filter_states < qmf_bank->anal_filter_states_32) {
filter_states = qmf_bank->anal_filter_states_32 +
((qmf_bank->no_channels * 10) - qmf_bank->no_channels);
}
tmp = fp1;
fp1 = fp2;
fp2 = tmp;
filter_1 += qmf_bank->no_channels;
filter_2 += qmf_bank->no_channels;
filt_ptr = filter_1;
filter_1 = filter_2;
filter_2 = filt_ptr;
if (filter_2 >
(qmf_bank->analy_win_coeff_32 + (qmf_bank->no_channels * 10))) {
filter_1 = (WORD32 *)qmf_bank->analy_win_coeff_32;
filter_2 = (WORD32 *)qmf_bank->analy_win_coeff_32 + qmf_bank->no_channels;
}
ixheaacd_fwd_modulation(analysis_buffer, qmf_real[i], qmf_imag[i], qmf_bank,
qmf_dec_tables_ptr, 1);
}
qmf_bank->filter_pos_32 = filter_1;
qmf_bank->core_samples_buffer_32 = filter_states;
qmf_bank->fp1_anal_32 = fp1;
qmf_bank->fp2_anal_32 = fp2;
qmf_bank->filter_2_32 = filter_2;
}
VOID ixheaacd_inv_modulation_lp(WORD32 *qmf_real, WORD16 *filter_states,
ia_sbr_qmf_filter_bank_struct *syn_qmf,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr) {
@ -746,9 +889,6 @@ VOID ixheaacd_esbr_radix4bfly(const WORD32 *w, WORD32 *x, WORD32 index1,
WORD64 mul_1, mul_2, mul_3, mul_4, mul_5, mul_6;
WORD64 mul_7, mul_8, mul_9, mul_10, mul_11, mul_12;
WORD32 *x_l1;
WORD32 *x_l2;
WORD32 *x_h2;
const WORD32 *w_ptr = w;
WORD32 i1;
@ -756,10 +896,6 @@ VOID ixheaacd_esbr_radix4bfly(const WORD32 *w, WORD32 *x, WORD32 index1,
l1 = index << 2;
l2 = (index << 2) + (index << 1);
x_l1 = &(x[l1]);
x_l2 = &(x[l2]);
x_h2 = &(x[h2]);
fft_jmp = 6 * (index);
for (i1 = 0; i1 < index1; i1++) {
@ -846,7 +982,6 @@ VOID ixheaacd_esbr_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
WORD32 x_8, x_9, x_a, x_b, x_c, x_d, x_e, x_f;
WORD32 n00, n10, n20, n30, n01, n11, n21, n31;
WORD32 n02, n12, n22, n32, n03, n13, n23, n33;
WORD32 n0, j0;
WORD32 *x2, *x0;
WORD32 *y0, *y1, *y2, *y3;
@ -857,8 +992,6 @@ VOID ixheaacd_esbr_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
y1 = y0 + (WORD32)(npoints >> 2);
y3 = y2 + (WORD32)(npoints >> 2);
j0 = 8;
n0 = npoints >> 1;
for (k = 0; k < 2; k++) {
for (i = 0; i<npoints>> 1; i += 8) {
@ -936,7 +1069,6 @@ VOID ixheaacd_esbr_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
WORD32 x_8, x_9, x_a, x_b, x_c, x_d, x_e, x_f;
WORD32 n00, n10, n20, n30, n01, n11, n21, n31;
WORD32 n02, n12, n22, n32, n03, n13, n23, n33;
WORD32 n0, j0;
WORD32 *x2, *x0;
WORD32 *y0, *y1, *y2, *y3;
@ -948,9 +1080,6 @@ VOID ixheaacd_esbr_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
y1 = y0 + (WORD32)(npoints >> 1);
y3 = y2 + (WORD32)(npoints >> 1);
j0 = 4;
n0 = npoints >> 2;
for (k = 0; k < 2; k++) {
for (i = 0; i<npoints>> 1; i += 8) {
h2 = *p_dig_rev_tbl++ >> 2;
@ -1386,8 +1515,8 @@ VOID ixheaacd_sbr_qmfsyn64_winadd(WORD16 *tmp1, WORD16 *tmp2, WORD16 *inp1,
for (k = 0; k < 64; k++) {
WORD32 syn_out = rounding_fac;
syn_out = ixheaacd_add32_sat(syn_out,
ixheaacd_mult16x16in32(tmp1[0 + k], inp1[k + 0]));
syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp1[0 + k], inp1[k + 0]));
syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp1[256 + k], inp1[k + 128]));
syn_out = ixheaacd_add32_sat(
@ -1583,9 +1712,6 @@ VOID ixheaacd_radix4bfly(const WORD16 *w, WORD32 *x, WORD32 index1,
WORD32 mul_1, mul_2, mul_3, mul_4, mul_5, mul_6;
WORD32 mul_7, mul_8, mul_9, mul_10, mul_11, mul_12;
WORD32 *x_l1;
WORD32 *x_l2;
WORD32 *x_h2;
const WORD16 *w_ptr = w;
WORD32 i1;
@ -1593,10 +1719,6 @@ VOID ixheaacd_radix4bfly(const WORD16 *w, WORD32 *x, WORD32 index1,
l1 = index << 2;
l2 = (index << 2) + (index << 1);
x_l1 = &(x[l1]);
x_l2 = &(x[l2]);
x_h2 = &(x[h2]);
fft_jmp = 6 * (index);
for (i1 = 0; i1 < index1; i1++) {
@ -1685,7 +1807,6 @@ VOID ixheaacd_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
WORD32 x_8, x_9, x_a, x_b, x_c, x_d, x_e, x_f;
WORD32 n00, n10, n20, n30, n01, n11, n21, n31;
WORD32 n02, n12, n22, n32, n03, n13, n23, n33;
WORD32 n0, j0;
WORD32 *x2, *x0;
WORD32 *y0, *y1, *y2, *y3;
@ -1697,9 +1818,6 @@ VOID ixheaacd_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
y1 = y0 + (WORD32)(npoints >> 1);
y3 = y2 + (WORD32)(npoints >> 1);
j0 = 4;
n0 = npoints >> 2;
for (k = 0; k < 2; k++) {
for (i = 0; i<npoints>> 1; i += 8) {
h2 = *p_dig_rev_tbl++ >> 2;
@ -1789,7 +1907,6 @@ VOID ixheaacd_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
WORD32 x_8, x_9, x_a, x_b, x_c, x_d, x_e, x_f;
WORD32 n00, n10, n20, n30, n01, n11, n21, n31;
WORD32 n02, n12, n22, n32, n03, n13, n23, n33;
WORD32 n0, j0;
WORD32 *x2, *x0;
WORD32 *y0, *y1, *y2, *y3;
@ -1800,8 +1917,6 @@ VOID ixheaacd_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
y1 = y0 + (WORD32)(npoints >> 2);
y3 = y2 + (WORD32)(npoints >> 2);
j0 = 8;
n0 = npoints >> 1;
for (k = 0; k < 2; k++) {
for (i = 0; i<npoints>> 1; i += 8) {

View file

@ -215,7 +215,6 @@ VOID ixheaacd_tns_ar_filter_fixed_dec(WORD32 *spectrum, WORD32 size, WORD32 inc,
order = ((order & 0xfffffffc) + 4);
}
{
WORD32 temp_lo = 0;
for (i = 0; i < order; i++) {
y = ixheaacd_shl32_sat((*spectrum), scale_spec);
acc = 0;
@ -230,7 +229,6 @@ VOID ixheaacd_tns_ar_filter_fixed_dec(WORD32 *spectrum, WORD32 size, WORD32 inc,
*spectrum = y >> scale_spec;
spectrum += inc;
}
temp_lo = 0;
for (i = order; i < size; i++) {
y = ixheaacd_shl32_sat((*spectrum), scale_spec);
acc = 0;
@ -264,7 +262,6 @@ VOID ixheaacd_tns_ar_filter_fixed_non_neon_armv7(WORD32 *spectrum, WORD32 size,
order = ((order & 0xfffffffc) + 4);
}
{
WORD32 temp_lo = 0;
for (i = 0; i < order; i++) {
y = ixheaacd_shl32_sat((*spectrum), scale_spec);
acc = 0;
@ -279,7 +276,6 @@ VOID ixheaacd_tns_ar_filter_fixed_non_neon_armv7(WORD32 *spectrum, WORD32 size,
*spectrum = y >> scale_spec;
spectrum += inc;
}
temp_lo = 0;
for (i = order; i < size; i++) {
WORD64 acc = 0;
WORD32 acc1;
@ -314,7 +310,6 @@ VOID ixheaacd_tns_ar_filter_fixed_armv8(WORD32 *spectrum, WORD32 size,
order = ((order & 0xfffffffc) + 4);
}
{
WORD32 temp_lo = 0;
for (i = 0; i < order; i++) {
y = ixheaacd_shl32_sat((*spectrum), scale_spec);
acc = 0;
@ -329,7 +324,6 @@ VOID ixheaacd_tns_ar_filter_fixed_armv8(WORD32 *spectrum, WORD32 size,
*spectrum = y >> scale_spec;
spectrum += inc;
}
temp_lo = 0;
for (i = order; i < size; i++) {
WORD64 acc = 0;
WORD32 acc1;

View file

@ -72,11 +72,13 @@
#include "ixheaacd_aacdec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_struct_def.h"
#include "ixheaacd_headerdecode.h"
#include "ixheaacd_multichannel.h"
#include "ixheaacd_adts_crc_check.h"
#include "ixheaacd_ld_mps_dec.h"
#include "ixheaacd_hcr.h"
@ -84,6 +86,8 @@
#define EXT_FILL_DATA 1
#define EXT_FIL 0
#define EXT_DATA_LENGTH 3
#define EXT_LDSAC_DATA 9
#define MIN(x, y) ((x) > (y) ? (y) : (x))
@ -96,7 +100,7 @@ WORD32 ixheaacd_aacdec_decodeframe(
WORD32 frame_length, WORD32 frame_size, ia_drc_dec_struct *pstr_drc_dec,
WORD32 object_type, WORD32 ch_config,
ia_eld_specific_config_struct eld_specific_config, WORD16 adtsheader,
ia_drc_dec_struct *drc_dummy, UWORD8 *slot_pos)
ia_drc_dec_struct *drc_dummy, WORD32 ldmps_present, UWORD8 *slot_pos)
{
WORD ch, ele_type;
@ -714,8 +718,14 @@ WORD32 ixheaacd_aacdec_decodeframe(
bits_decoded = (it_bit_buff->size - it_bit_buff->cnt_bits);
cnt_bits = (frame_size * 8 - bits_decoded);
p_obj_exhaacplus_dec->p_state_aac->mps_dec_handle.ldmps_config
.no_ldsbr_present = 1;
if (cnt_bits >= 8) {
error_code = ixheaacd_extension_payload(it_bit_buff, cnt_bits);
error_code = ixheaacd_extension_payload(
it_bit_buff, &cnt_bits,
&p_obj_exhaacplus_dec->p_state_aac->mps_dec_handle);
if (error_code) return error_code;
}
@ -812,10 +822,11 @@ WORD32 ixheaacd_aacdec_decodeframe(
str_ics_info[ch].frame_length);
}
if (skip_full_decode == 0) {
ixheaacd_imdct_process(
aac_dec_handle->pstr_aac_dec_overlap_info[ch], spec_coef[ch],
&str_ics_info[ch], time_data + slot_element, ch_fac, scratch[ch],
aac_dec_handle->pstr_aac_tables, object_type, slot_element);
ixheaacd_imdct_process(aac_dec_handle->pstr_aac_dec_overlap_info[ch],
spec_coef[ch], &str_ics_info[ch],
time_data + slot_element, ch_fac, scratch[ch],
aac_dec_handle->pstr_aac_tables, object_type,
ldmps_present, slot_element);
if (slot_pos != NULL) *slot_pos = slot_element;
if (p_obj_exhaacplus_dec->p_state_aac->qshift_cnt > 15)
@ -871,8 +882,10 @@ WORD32 ixheaacd_aacdec_decodeframe(
return error_code;
}
WORD32 ixheaacd_extension_payload(ia_bit_buf_struct *it_bit_buff, WORD32 cnt) {
WORD16 extension_type, discard;
WORD32 ixheaacd_extension_payload(ia_bit_buf_struct *it_bit_buff, WORD32 *cnt,
ia_mps_dec_state_struct *self) {
WORD16 extension_type;
WORD32 len, add_len;
WORD32 i;
WORD32 fill_nibble;
@ -884,18 +897,52 @@ WORD32 ixheaacd_extension_payload(ia_bit_buf_struct *it_bit_buff, WORD32 cnt) {
fill_nibble = ixheaacd_read_bits_buf(it_bit_buff, 4);
if (fill_nibble == 0) {
for (i = 0; i < (cnt >> 3) - 1; i++) {
for (i = 0; i < (*cnt >> 3) - 1; i++) {
ixheaacd_read_bits_buf(it_bit_buff, 8);
}
} else
err = -1;
err = -1;
*cnt = it_bit_buff->cnt_bits;
break;
case EXT_DATA_LENGTH:
len = (WORD32)ixheaacd_read_bits_buf(it_bit_buff, 4);
if (len == 15) {
add_len = ixheaacd_read_bits_buf(it_bit_buff, 8);
len += add_len;
if (add_len == 255) {
len += ixheaacd_read_bits_buf(it_bit_buff, 16);
}
}
len <<= 3;
ixheaacd_extension_payload(it_bit_buff, cnt, self);
break;
case EXT_LDSAC_DATA:
self->parse_nxt_frame = 1;
ixheaacd_read_bits_buf(it_bit_buff, 2);/*anc_type*/
ixheaacd_read_bits_buf(it_bit_buff, 2);/*anc_start_stop*/
err = ixheaacd_ld_mps_frame_parsing(self, it_bit_buff);
if (err) return err;
*cnt = it_bit_buff->cnt_bits;
break;
case EXT_FIL:
default:
for (i = 0; i < ((cnt)-8) + 4; i++) {
discard = (WORD16)ixheaacd_read_bits_buf(it_bit_buff, 1);
for (i = 0; i < (*cnt) - 4; i++) {
ixheaacd_skip_bits_buf(it_bit_buff, 1);/*discard*/
}
*cnt = it_bit_buff->cnt_bits;
break;
}
return err;

View file

@ -39,9 +39,6 @@ WORD16 ixheaacd_rand_gen(WORD16 *seed) {
VOID ixheaacd_preemphsis_tool(WORD32 *signal, WORD32 mu, WORD32 len,
WORD32 mem) {
WORD32 i;
WORD32 temp;
temp = signal[len - 1];
for (i = len - 1; i > 0; i--) {
signal[i] -= (WORD32)ixheaacd_mul32_sh(mu, signal[i - 1], 16);
}
@ -52,8 +49,6 @@ VOID ixheaacd_preemphsis_tool(WORD32 *signal, WORD32 mu, WORD32 len,
VOID ixheaacd_preemphsis_tool_float(FLOAT32 *signal, FLOAT32 mu, WORD32 len,
FLOAT32 mem) {
WORD32 i;
FLOAT32 temp;
temp = signal[len - 1];
for (i = len - 1; i > 0; i--) {
signal[i] = signal[i] - mu * signal[i - 1];
}

View file

@ -24,6 +24,7 @@
#include "ixheaacd_aac_rom.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_env_extr_part.h"
#include "ixheaacd_sbr_rom.h"
@ -48,8 +49,12 @@
#include "ixheaacd_latmdemux.h"
#include "ixheaacd_aacdec.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_struct_def.h"

View file

@ -107,6 +107,7 @@
#include "ixheaacd_arith_dec.h"
#include "ixheaacd_create.h"
#include "ixheaacd_function_selector.h"
#include "ixheaacd_ld_mps_dec.h"
#define MAX_TRACKS_PER_LAYER 50
@ -208,6 +209,24 @@ VOID ixheaacd_updatebytesconsumed(
}
}
static VOID copy_qmf_to_ldmps(ia_mps_dec_state_struct *mps_dec_handle,
VOID *sbr_persistent_mem_v) {
ia_sbr_pers_struct *sbr_persistent_mem =
(ia_sbr_pers_struct *)sbr_persistent_mem_v;
memcpy(&mps_dec_handle->str_mps_qmf_bank,
&sbr_persistent_mem->str_sbr_dec_inst.pstr_sbr_channel[0]
->str_sbr_dec.str_codec_qmf_bank,
sizeof(ia_sbr_qmf_filter_bank_struct));
mps_dec_handle->sbr_tables_ptr =
sbr_persistent_mem->str_sbr_dec_inst.pstr_sbr_tables;
mps_dec_handle->qmf_dec_tables_ptr =
sbr_persistent_mem->str_sbr_dec_inst.pstr_sbr_tables->qmf_dec_tables_ptr;
mps_dec_handle->str_sbr_scale_fact =
&sbr_persistent_mem->str_sbr_dec_inst.pstr_sbr_channel[0]
->str_sbr_dec.str_sbr_scale_fact;
}
WORD32 ixheaacd_readifadts(ia_aac_dec_state_struct *p_state_enhaacplus_dec,
struct ia_bit_buf_struct *it_bit_buff,
ia_adts_header_struct *adts) {
@ -1354,6 +1373,30 @@ IA_ERRORCODE ixheaacd_dec_table_api(
return IA_NO_ERROR;
}
VOID ixheaacd_mps_payload(ia_handle_sbr_dec_inst_struct self,
ia_exhaacplus_dec_api_struct *p_obj_exhaacplus_dec) {
struct ia_bit_buf_struct local_bit_buff;
struct ia_bit_buf_struct *it_bit_buff;
if (self->ptr_mps_data != NULL) {
ixheaacd_create_init_bit_buf(&local_bit_buff, (UWORD8 *)self->ptr_mps_data,
(self->left_mps_bits >> 3) + 1);
}
local_bit_buff.xaac_jmp_buf =
&p_obj_exhaacplus_dec->p_state_aac->xaac_jmp_buf;
it_bit_buff = &local_bit_buff;
it_bit_buff->bit_pos = self->mps_bits_pos;
it_bit_buff->cnt_bits = self->left_mps_bits;
while (self->left_mps_bits >= 8) {
ixheaacd_extension_payload(
it_bit_buff, &self->left_mps_bits,
&p_obj_exhaacplus_dec->p_state_aac->mps_dec_handle);
}
}
IA_ERRORCODE ixheaacd_dec_init(
ia_exhaacplus_dec_api_struct *p_obj_exhaacplus_dec) {
FLAG frame_status = 1;
@ -1377,6 +1420,11 @@ IA_ERRORCODE ixheaacd_dec_init(
p_obj_exhaacplus_dec->p_state_aac =
p_obj_exhaacplus_dec->pp_mem_aac[IA_ENHAACPLUS_DEC_PERSIST_IDX];
if (p_obj_exhaacplus_dec->p_state_aac->ui_init_done)
{
return IA_NO_ERROR;
}
p_obj_exhaacplus_dec->p_state_aac->preroll_config_present = 0;
if (p_obj_exhaacplus_dec->p_state_aac != NULL) {
@ -1869,6 +1917,7 @@ IA_ERRORCODE ixheaacd_dec_init(
p_state_enhaacplus_dec->eld_specific_config,
p_state_enhaacplus_dec->s_adts_hdr_present,
&p_state_enhaacplus_dec->drc_dummy,
p_state_enhaacplus_dec->ldmps_present,
&p_state_enhaacplus_dec->slot_pos);
if (p_state_enhaacplus_dec->pstr_drc_dec->drc_element_found == 1) {
@ -1956,7 +2005,11 @@ IA_ERRORCODE ixheaacd_dec_init(
p_state_enhaacplus_dec->ptr_overlap_buf, MAXNRSBRCHANNELS, (WORD)1,
1, frame_size_1 * 2, NULL, NULL,
p_state_enhaacplus_dec->str_sbr_config,
p_state_enhaacplus_dec->audio_object_type);
p_state_enhaacplus_dec->audio_object_type,
p_state_enhaacplus_dec->mps_dec_handle.ldmps_config
.ldmps_present_flag,
p_state_enhaacplus_dec->mps_dec_handle.ldmps_config
.no_ldsbr_present);
if (p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]) {
p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]->xaac_jmp_buf =
&(p_state_enhaacplus_dec->xaac_jmp_buf);
@ -1980,13 +2033,19 @@ IA_ERRORCODE ixheaacd_dec_init(
p_obj_exhaacplus_dec->aac_config.down_sample_flag, 0,
&sbr_scratch_struct, 1, 1, 0, NULL, NULL,
p_state_enhaacplus_dec->eld_specific_config.ld_sbr_flag_present,
p_state_enhaacplus_dec->audio_object_type) != SBRDEC_OK) {
p_state_enhaacplus_dec->audio_object_type, 1,
p_state_enhaacplus_dec->ldmps_present) != SBRDEC_OK) {
p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx] = 0;
return -1;
} else {
if (!p_obj_exhaacplus_dec->aac_config.down_sample_flag) {
sample_rate_1 *= 2;
}
if (p_state_enhaacplus_dec->eld_specific_config.ld_sbr_flag_present ==
1)
ixheaacd_mps_payload(
p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx],
p_obj_exhaacplus_dec);
}
if (p_obj_exhaacplus_dec->aac_config.flag_downmix) {
@ -2019,7 +2078,11 @@ IA_ERRORCODE ixheaacd_dec_init(
p_state_enhaacplus_dec->ptr_overlap_buf, MAXNRSBRCHANNELS, 1, 1,
frame_size_2 * 2, NULL, NULL,
p_state_enhaacplus_dec->str_sbr_config,
p_state_enhaacplus_dec->audio_object_type);
p_state_enhaacplus_dec->audio_object_type,
p_state_enhaacplus_dec->mps_dec_handle.ldmps_config
.ldmps_present_flag,
p_state_enhaacplus_dec->mps_dec_handle.ldmps_config
.no_ldsbr_present);
}
if (p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]) {
p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]->xaac_jmp_buf =
@ -2160,19 +2223,32 @@ IA_ERRORCODE ixheaacd_dec_init(
p_state_enhaacplus_dec->ptr_overlap_buf, channel, ps_enable, 1,
frame_size_2 * 2, NULL, NULL,
p_state_enhaacplus_dec->str_sbr_config,
p_state_enhaacplus_dec->audio_object_type);
p_state_enhaacplus_dec->audio_object_type,
p_state_enhaacplus_dec->mps_dec_handle.ldmps_config
.ldmps_present_flag,
p_state_enhaacplus_dec->mps_dec_handle.ldmps_config
.no_ldsbr_present);
if (p_state_enhaacplus_dec->str_sbr_dec_info[i]) {
p_state_enhaacplus_dec->str_sbr_dec_info[i]->xaac_jmp_buf =
&(p_state_enhaacplus_dec->xaac_jmp_buf);
}
if (sbr_present_flag &&
if ((sbr_present_flag &&
((p_obj_exhaacplus_dec->p_state_aac->audio_object_type ==
AOT_AAC_LC) ||
(p_obj_exhaacplus_dec->p_state_aac->audio_object_type ==
AOT_SBR) ||
(p_obj_exhaacplus_dec->p_state_aac->audio_object_type == AOT_PS)))
p_obj_exhaacplus_dec->aac_config.flag_to_stereo = 1;
(p_obj_exhaacplus_dec->p_state_aac->audio_object_type ==
AOT_PS))) ||
((p_state_enhaacplus_dec->mps_dec_handle.ldmps_config
.ldmps_present_flag == 1) &&
(p_obj_exhaacplus_dec->p_state_aac->audio_object_type ==
AOT_ER_AAC_ELD)))
p_obj_exhaacplus_dec->aac_config.flag_to_stereo = 1;
if (p_state_enhaacplus_dec->mps_dec_handle.ldmps_config
.ldmps_present_flag == 1) {
copy_qmf_to_ldmps(&p_obj_exhaacplus_dec->p_state_aac->mps_dec_handle,
p_state_enhaacplus_dec->sbr_persistent_mem_v);
}
i++;
}
p_state_enhaacplus_dec->pers_mem_ptr =
@ -2308,6 +2384,7 @@ IA_ERRORCODE ixheaacd_dec_execute(
SIZE_T bytes_for_sync;
WORD32 audio_mux_length_bytes_last = 0;
WORD32 ret_val;
WORD32 mps_out_samples;
p_obj_exhaacplus_dec->aac_config.ui_sbr_mode = 0;
@ -2738,6 +2815,7 @@ IA_ERRORCODE ixheaacd_dec_execute(
p_state_enhaacplus_dec->eld_specific_config,
p_state_enhaacplus_dec->s_adts_hdr_present,
&p_state_enhaacplus_dec->drc_dummy,
p_state_enhaacplus_dec->ldmps_present,
&p_state_enhaacplus_dec->slot_pos);
p_state_enhaacplus_dec->slot_pos -= (channel - 1);
@ -2818,7 +2896,10 @@ IA_ERRORCODE ixheaacd_dec_execute(
p_state_enhaacplus_dec->ptr_overlap_buf, ps_enable ? 2 : channel,
ps_enable, 1, frame_size * 2, NULL, NULL,
p_state_enhaacplus_dec->str_sbr_config,
p_state_enhaacplus_dec->audio_object_type);
p_state_enhaacplus_dec->audio_object_type,
p_state_enhaacplus_dec->mps_dec_handle.ldmps_config
.ldmps_present_flag,
p_state_enhaacplus_dec->mps_dec_handle.ldmps_config.no_ldsbr_present);
if (p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]) {
p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx]->xaac_jmp_buf =
&(p_state_enhaacplus_dec->xaac_jmp_buf);
@ -2848,7 +2929,8 @@ IA_ERRORCODE ixheaacd_dec_execute(
esbr_mono_downmix, &sbr_scratch_struct, ps_enable, ch_fac,
slot_ele, NULL, &p_state_enhaacplus_dec->str_drc_dec_info,
p_state_enhaacplus_dec->eld_specific_config.ld_sbr_flag_present,
p_state_enhaacplus_dec->audio_object_type) != SBRDEC_OK) {
p_state_enhaacplus_dec->audio_object_type, 0,
p_state_enhaacplus_dec->ldmps_present) != SBRDEC_OK) {
p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx] = 0;
return -1;
} else {
@ -2856,8 +2938,25 @@ IA_ERRORCODE ixheaacd_dec_execute(
frame_size = (WORD16)(frame_size * 2);
sample_rate_dec *= 2;
}
if (p_state_enhaacplus_dec->mps_dec_handle.ldmps_config
.ldmps_present_flag == 1) {
ixheaacd_mps_payload(
p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx],
p_obj_exhaacplus_dec);
}
}
p_state_enhaacplus_dec->mps_dec_handle.ldmps_config.no_ldsbr_present =
0;
} else
p_state_enhaacplus_dec->mps_dec_handle.ldmps_config.no_ldsbr_present =
1;
}
if (p_state_enhaacplus_dec->mps_dec_handle.ldmps_config
.ldmps_present_flag == 1 &&
p_state_enhaacplus_dec->str_sbr_dec_info[ch_idx] &&
p_state_enhaacplus_dec->mps_dec_handle.mps_init_done == 1) {
ixheaacd_ld_mps_apply(p_obj_exhaacplus_dec, actual_out_buffer);
}
if (sample_rate < sample_rate_dec) {
sample_rate = sample_rate_dec;
@ -2878,11 +2977,24 @@ IA_ERRORCODE ixheaacd_dec_execute(
p_state_enhaacplus_dec->num_channel_last = num_ch;
p_state_enhaacplus_dec->num_of_out_samples = num_of_out_samples;
if (p_obj_exhaacplus_dec->aac_config.element_type[ch_idx] != 2)
if (p_state_enhaacplus_dec->mps_dec_handle.ldmps_config
.ldmps_present_flag == 1 &&
p_state_enhaacplus_dec->mps_dec_handle.mps_init_done == 1) {
ixheaacd_samples_sat(
(WORD8 *)actual_out_buffer, num_of_out_samples,
p_obj_exhaacplus_dec->aac_config.ui_pcm_wdsz,
p_obj_exhaacplus_dec->p_state_aac->mps_dec_handle.output_buffer,
&mps_out_samples, 2);
num_ch = p_obj_exhaacplus_dec->p_state_aac->mps_dec_handle.out_ch_count;
p_obj_exhaacplus_dec->p_state_aac->ui_out_bytes = mps_out_samples;
} else {
if (p_obj_exhaacplus_dec->aac_config.element_type[ch_idx] != 2)
{
if (p_obj_exhaacplus_dec->aac_config.flag_to_stereo == 1 &&
channel == 1 && total_elements == 1 && num_ch == 1) {
{
if (p_obj_exhaacplus_dec->aac_config.flag_to_stereo == 1 &&
channel == 1 && total_elements == 1 && num_ch == 1 &&
(!p_state_enhaacplus_dec->mps_dec_handle.ldmps_config
.ldmps_present_flag)) {
num_ch = 2;
p_obj_exhaacplus_dec->aac_config.dup_stereo_flag = 1;
@ -2895,11 +3007,10 @@ IA_ERRORCODE ixheaacd_dec_execute(
p_obj_exhaacplus_dec->p_state_aac->ui_out_bytes +=
p_state_enhaacplus_dec->num_of_out_samples * num_ch * sizeof(WORD16);
}
else {
} else {
channel_coupling_flag = 1;
}
}
if (p_state_enhaacplus_dec->sbr_present && total_channels > 2) {
for (int j = 0; j < channel; j++) {

View file

@ -131,11 +131,11 @@ WORD32 ixheaacd_inv_quant(WORD32 *x_quant, WORD32 *ixheaacd_pow_table_Q13);
VOID ixheaacd_imdct_process(ia_aac_dec_overlap_info *ptr_aac_dec_overlap_info,
WORD32 *ptr_spec_coeff,
ia_ics_info_struct *ptr_ics_info,
VOID* out_samples, const WORD16 ch_fac,
WORD32 *scratch,
ia_ics_info_struct *ptr_ics_info, VOID *out_samples,
const WORD16 ch_fac, WORD32 *scratch,
ia_aac_dec_tables_struct *ptr_aac_tables,
WORD32 object_type , WORD slot_element);
WORD32 object_type, WORD32 ld_mps_present,
WORD slot_element);
VOID ixheaacd_neg_shift_spec_dec(WORD32 *coef, WORD32 *out, WORD16 q_shift,
WORD16 ch_fac);
@ -175,7 +175,10 @@ void ixheaacd_eld_dec_windowing(WORD32 *ptr_spect_coeff, const WORD16 *ptr_win,
WORD32 *ptr_overlap_buf, const WORD16 stride,
VOID *out_samples, WORD slot_element);
WORD32 ixheaacd_extension_payload(ia_bit_buf_struct *it_bit_buff, WORD32 cnt);
void ixheaacd_eld_dec_windowing_32bit(WORD32 *ptr_spect_coeff,
const WORD16 *ptr_win, WORD32 framesize,
WORD16 q_shift, WORD32 *ptr_overlap_buf,
const WORD16 stride, WORD32 *out_samples);
VOID ixheaacd_process_single_scf(WORD32 scale_factor, WORD32 *x_invquant,
WORD32 width, WORD32 *ptr_scale_table,
@ -184,6 +187,6 @@ VOID ixheaacd_process_single_scf(WORD32 scale_factor, WORD32 *x_invquant,
void ixheaacd_lap1_512_480(WORD32 *coef, WORD32 *prev, VOID *out_tmp,
const WORD16 *window, WORD16 q_shift, WORD16 size,
WORD16 stride , WORD slot_element);
WORD16 stride, WORD slot_element);
#endif /* #ifndef IXHEAACD_BLOCK_H */

View file

@ -71,8 +71,11 @@
#include "ixheaacd_audioobjtypes.h"
#include "ixheaacd_sbrdecoder.h"
#include "ixheaacd_memory_standards.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_struct_def.h"
#include "ixheaacd_adts_crc_check.h"
@ -142,14 +145,11 @@ void ixheaacd_cblock_scale_spect_data(
WORD32 *ptr_spect_coeff = ptr_aac_dec_channel_info->ptr_spec_coeff;
WORD8 *ptr_sfb_width = (WORD8 *)(ixheaacd_getscalefactorbandwidth(
&(ptr_aac_dec_channel_info->str_ics_info), ptr_aac_tables));
int max_band;
WORD16 *ptr_scale_fac = ptr_aac_dec_channel_info->ptr_scale_factor;
WORD tot_bands = ptr_aac_dec_channel_info->str_ics_info.max_sfb;
WORD tot_groups = ptr_aac_dec_channel_info->str_ics_info.num_window_groups;
WORD32 *scale_table_ptr = ptr_aac_tables->pstr_block_tables->scale_table;
max_band = ptr_aac_dec_channel_info->str_ics_info.max_sfb;
do {
grp_win =
ptr_aac_dec_channel_info->str_ics_info.window_group_length[group++];

View file

@ -66,8 +66,11 @@
#include "ixheaacd_latmdemux.h"
#include "ixheaacd_aacdec.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_struct_def.h"
#include "ixheaacd_headerdecode.h"

View file

@ -67,8 +67,12 @@
#include "ixheaacd_audioobjtypes.h"
#include "ixheaacd_latmdemux.h"
#include "ixheaacd_aacdec.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_struct_def.h"
#include "ixheaacd_headerdecode.h"

View file

@ -51,6 +51,23 @@
#define ID_CONFIG_EXT_FILL 0
#define ID_CONFIG_EXT_LOUDNESS_INFO (2)
#define MAX_PARAMETER_BANDS (40)
#define MAX_PARAMETER_BANDS_MPS (28)
#define MAX_NUM_OTT (5)
#define MAX_NUM_TTT (1)
#define MAX_INPUT_CHANNELS (2)
#define MAX_RESIDUAL_CHANNELS (3)
#define MAX_OUTPUT_CHANNELS (7)
#define MAX_NUM_EXT_TYPES (8)
#define MAX_M_INPUT (2)
#define MAX_M_OUTPUT (2)
#define QMF_BANDS_TO_HYBRID (3)
#define MAX_HYBRID_ONLY_BANDS_PER_QMF (8)
#define MAX_ARBITRARY_TREE_LEVELS (2)
#define MAX_OUTPUT_CHANNELS_AT \
(MAX_OUTPUT_CHANNELS * (1 << MAX_ARBITRARY_TREE_LEVELS))
#define MAX_ARBITRARY_TREE_INDEX ((1 << (MAX_ARBITRARY_TREE_LEVELS + 1)) - 1)
typedef UWORD8 UINT8;
typedef UWORD32 UINT32;
@ -83,6 +100,66 @@ typedef struct {
UINT32 bs_residual_bands;
UINT32 bs_pseudo_lr;
UINT32 bs_env_quant_mode;
UINT32 ldmps_present_flag;
UINT32 bs_sampling_freq_index;
UINT32 bs_fampling_frequency;
UINT32 bs_frame_length;
UINT32 bs_tree_config;
UINT32 bs_quant_mode;
UINT32 bs_one_icc;
UINT32 bs_arbitrary_downmix;
UINT32 bs_residual_coding;
UINT32 bs_fixed_gain_sur;
UINT32 bs_fixed_gain_LFE;
UINT32 bs_matrix_mode;
UINT32 bs_3D_audio_mode;
UINT32 bs_3D_audio_HRTF_set;
UINT32 bs_HRTF_freq_res;
UINT32 HRTF_num_band;
UINT32 HRTF_num_phase; // new
UINT32 bs_HRTF_num_chan;
UINT32 bs_HRTF_asymmetric;
UINT32 bs_HRTF_level_left[MAX_OUTPUT_CHANNELS][MAX_PARAMETER_BANDS];
UINT32 bs_HRTF_level_right[MAX_OUTPUT_CHANNELS][MAX_PARAMETER_BANDS];
UINT32 bs_HRTF_phase[MAX_OUTPUT_CHANNELS];
UINT32 bs_HRTF_phase_LR[MAX_OUTPUT_CHANNELS][MAX_PARAMETER_BANDS];
UINT32 bs_HRTF_icc[MAX_OUTPUT_CHANNELS];
UINT32 bs_HRTF_icc_LR[MAX_OUTPUT_CHANNELS][MAX_PARAMETER_BANDS];
UINT32 bs_ott_bands[MAX_NUM_OTT];
UINT32 bs_ttt_dual_mode[MAX_NUM_TTT];
UINT32 bs_ttt_mode_low[MAX_NUM_TTT];
UINT32 bs_ttt_mode_high[MAX_NUM_TTT];
UINT32 bs_ttt_bands_low[MAX_NUM_TTT];
UINT32 bs_ttt_bands_high[MAX_NUM_TTT];
UINT32 bs_sac_ext_type[MAX_NUM_EXT_TYPES];
UINT32 sac_ext_cnt;
UINT32 bs_residual_present[MAX_RESIDUAL_CHANNELS];
UINT32 bs_residual_sampling_freq_index;
UINT32 bs_residual_frames_per_spatial_frame;
UINT32 bs_residual_bands_ld_mps[MAX_RESIDUAL_CHANNELS];
UINT32 bs_arbitrary_downmix_residual_sampling_freq_index;
UINT32 bs_arbitrary_downmix_residual_frames_per_spatial_frame;
UINT32 bs_arbitrary_downmix_residual_bands;
UINT32 num_out_chan_AT;
UINT32 num_ott_boxes_AT;
UINT32 bs_output_channel_pos_AT[MAX_OUTPUT_CHANNELS_AT];
UINT32 bs_ott_box_present_AT[MAX_OUTPUT_CHANNELS][MAX_ARBITRARY_TREE_INDEX];
UINT32 bs_ott_default_cld_AT[MAX_OUTPUT_CHANNELS * MAX_ARBITRARY_TREE_INDEX];
UINT32 bs_ott_mode_lfe_AT[MAX_OUTPUT_CHANNELS * MAX_ARBITRARY_TREE_INDEX];
UINT32 bs_ott_bands_AT[MAX_OUTPUT_CHANNELS * MAX_ARBITRARY_TREE_INDEX];
WORD32 num_ott_boxes;
WORD32 num_ttt_boxes;
WORD32 num_input_channels;
WORD32 num_output_channels;
WORD32 ott_mode_lfe[MAX_NUM_OTT]; // new
WORD32 no_ldsbr_present;
} ia_usac_dec_mps_config_struct;
#define BS_OUTPUT_CHANNEL_POS_NA -1 /* n/a */

View file

@ -369,9 +369,6 @@ WORD32 ixheaacd_dec_data_init(VOID *handle,
ia_usac_data_struct *usac_data) {
ia_audio_specific_config_struct *pstr_stream_config, *layer_config;
WORD32 err_code = 0;
WORD32 num_out_chan = 0;
WORD32 i_ch, i, ele_id;
WORD32 num_elements;
@ -422,8 +419,6 @@ WORD32 ixheaacd_dec_data_init(VOID *handle,
usac_data->esbr_bit_str[0].no_elements = 0;
usac_data->esbr_bit_str[1].no_elements = 0;
num_out_chan = ptr_usac_config->num_out_channels;
if (usac_data->ccfl == 768)
pstr_frame_data->str_layer.sample_rate_layer =
4 * pstr_frame_data->str_layer.sample_rate_layer / 3;
@ -579,7 +574,6 @@ WORD32 ixheaacd_decode_create(ia_exhaacplus_dec_api_struct *handle,
handle->aac_config.ui_sbr_mode = 0;
}
break;
default:
@ -602,9 +596,6 @@ WORD32 ixheaacd_decode_create(ia_exhaacplus_dec_api_struct *handle,
ia_usac_config_struct *ptr_usac_config =
&(pstr_frame_data->str_audio_specific_config.str_usac_config);
WORD32 inter_tes[MAX_NUM_ELEMENTS] = {0};
WORD32 bs_pvc[MAX_NUM_ELEMENTS] = {0};
WORD32 harmonic_sbr[MAX_NUM_ELEMENTS] = {0};
WORD32 inter_test_flag = 0;
WORD32 bs_pvc_flag = 0;
WORD32 harmonic_Sbr_flag = 0;
@ -626,12 +617,6 @@ WORD32 ixheaacd_decode_create(ia_exhaacplus_dec_api_struct *handle,
ia_usac_dec_sbr_config_struct *ptr_usac_sbr_config =
&(ptr_usac_dec_config->str_usac_element_config[elem_idx]
.str_usac_sbr_config);
inter_tes[elem_idx] =
(ptr_usac_sbr_config != NULL) ? ptr_usac_sbr_config->bs_inter_tes : 0;
bs_pvc[elem_idx] =
(ptr_usac_sbr_config != NULL) ? ptr_usac_sbr_config->bs_pvc : 0;
harmonic_sbr[elem_idx] =
(ptr_usac_sbr_config != NULL) ? ptr_usac_sbr_config->harmonic_sbr : 0;
if (ptr_usac_sbr_config->bs_inter_tes) inter_test_flag = 1;
if (ptr_usac_sbr_config->bs_pvc) bs_pvc_flag = 1;
@ -686,7 +671,7 @@ WORD32 ixheaacd_decode_create(ia_exhaacplus_dec_api_struct *handle,
pstr_dec_data->str_usac_data.sbr_ratio_idx,
pstr_dec_data->str_usac_data.output_samples, &harmonic_Sbr_flag,
(void *)&usac_def_header, aac_dec_handle->str_sbr_config,
pstr_dec_data->str_usac_data.audio_object_type);
pstr_dec_data->str_usac_data.audio_object_type, 0, 0);
pstr_dec_data->str_usac_data.sbr_scratch_mem_base =
aac_dec_handle->sbr_scratch_mem_u;
if (num_ele)

View file

@ -39,7 +39,7 @@ ia_handle_sbr_dec_inst_struct ixheaacd_init_sbr(
VOID *sbr_persistent_mem_v, WORD32 *ptr_overlap_buf, WORD channel,
WORD ps_enable, WORD sbr_ratio_idx, WORD output_frame_size, WORD *use_hbe,
VOID *p_usac_dflt_header, ia_sbr_header_data_struct str_sbr_config,
WORD audio_object_type);
WORD audio_object_type, WORD32 ldmps_present, WORD32 ldsbr_present);
VOID ixheaacd_setesbr_flags(VOID *sbr_persistent_mem_v, FLAG pvc_flag,
FLAG hbe_flag, FLAG inter_tes_flag);

View file

@ -24,6 +24,7 @@
#include "ixheaacd_error_standards.h"
#include "ixheaacd_memory_standards.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_env_extr_part.h"
#include "ixheaacd_defines.h"
#include "ixheaacd_aac_rom.h"
@ -35,6 +36,8 @@
#include "ixheaacd_lt_predict.h"
#include "ixheaacd_channelinfo.h"
#include "ixheaacd_sbr_common.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_drc_data_struct.h"
#include "ixheaacd_drc_dec.h"
#include "ixheaacd_channel.h"
@ -46,6 +49,7 @@
#include "ixheaacd_sbr_common.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_struct_def.h"
#include "ixheaacd_bitbuffer.h"
@ -120,13 +124,10 @@ static WORD32 ixheaacd_audio_preroll_parsing(
WORD32 *preroll_frame_offset, ia_aac_dec_state_struct *aac_dec_handle) {
ia_bit_buf_struct *temp_buff =
(ia_bit_buf_struct *)&(pstr_dec_data->dec_bit_buf);
WORD32 independency_flag = 0;
WORD32 ext_ele_present = 0;
WORD32 ext_ele_use_dflt_len = 0;
WORD32 ext_ele_payload_len = 0;
WORD32 apply_crossfade = 0;
WORD32 un_used_val = 0;
WORD32 num_pre_roll_frames = 0;
WORD32 frame_idx = 0;
@ -138,14 +139,13 @@ static WORD32 ixheaacd_audio_preroll_parsing(
if (pstr_dec_data->str_frame_data.str_audio_specific_config.str_usac_config
.str_usac_dec_config.usac_element_type[0] == ID_USAC_EXT) {
temp = ixheaacd_show_bits_buf(temp_buff, 3);
independency_flag = (temp >> 2) & 0x1;
ext_ele_present = (temp >> 1) & 0x1;
if (ext_ele_present) {
ext_ele_use_dflt_len = temp & 0x1; // ixheaacd_read_bit(&temp_buff, 1);
ext_ele_use_dflt_len = temp & 0x1;
if (ext_ele_use_dflt_len != 0) return 0;
un_used_val = ixheaacd_read_bits_buf(temp_buff, 3);
ixheaacd_read_bits_buf(temp_buff, 3);
ext_ele_payload_len = ixheaacd_read_bits_buf(temp_buff, 8);
@ -156,7 +156,6 @@ static WORD32 ixheaacd_audio_preroll_parsing(
(UWORD32)((WORD32)ext_ele_payload_len + val_add - 2);
}
// escapedValue(4, 4, 8);
config_len = ixheaacd_read_bits_buf(temp_buff, 4);
if (config_len == 15) {
WORD32 val_add = 0;
@ -182,10 +181,9 @@ static WORD32 ixheaacd_audio_preroll_parsing(
memcpy(aac_dec_handle->preroll_config_prev, conf_buf,
sizeof(aac_dec_handle->preroll_config_prev));
apply_crossfade = ixheaacd_read_bits_buf(temp_buff, 1);
un_used_val = ixheaacd_read_bits_buf(temp_buff, 1); // reserverd
ixheaacd_read_bits_buf(temp_buff, 1);
ixheaacd_read_bits_buf(temp_buff, 1);
// escapedValue(2, 4, 0);
num_pre_roll_frames = ixheaacd_read_bits_buf(temp_buff, 2);
if (num_pre_roll_frames == 3) {
WORD32 val_add = 0;
@ -196,7 +194,7 @@ static WORD32 ixheaacd_audio_preroll_parsing(
if (num_pre_roll_frames > MAX_AUDIO_PREROLLS) return IA_FATAL_ERROR;
for (frame_idx = 0; frame_idx < num_pre_roll_frames; frame_idx++) {
WORD32 au_len = 0; // escapedValued(16,16,0)
WORD32 au_len = 0;
au_len = ixheaacd_read_bits_buf(temp_buff, 16);
if (au_len == 65535) {
WORD32 val_add = ixheaacd_read_bits_buf(temp_buff, 16);
@ -287,7 +285,6 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
pstr_dec_data->dec_bit_buf.bit_pos = 7;
pstr_dec_data->dec_bit_buf.cnt_bits = pstr_dec_data->dec_bit_buf.size;
pstr_dec_data->dec_bit_buf.xaac_jmp_buf = &(aac_dec_handle->xaac_jmp_buf);
pstr_dec_data->str_usac_data.usac_flag = aac_dec_handle->usac_flag;
if (pstr_dec_data->dec_bit_buf.size > pstr_dec_data->dec_bit_buf.max_size)
pstr_dec_data->dec_bit_buf.max_size = pstr_dec_data->dec_bit_buf.size;
@ -364,7 +361,6 @@ WORD32 ixheaacd_dec_main(VOID *temp_handle, WORD8 *inbuffer, WORD8 *outbuffer,
(preroll_frame_offset[access_units] / 8);
}
// temp_read=ixheaacd_show_bits_buf(pstr_dec_data->dec_bit_buf,preroll_frame_offset[access_unit]);
if (!aac_dec_handle->decode_create_done) return IA_FATAL_ERROR;
err =

View file

@ -76,6 +76,7 @@
#include "ixheaacd_aacdec.h"
#include "ixheaacd_config.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_struct_def.h"
@ -600,8 +601,6 @@ static WORD32 ixheaacd_drc_element_read(
ia_handle_bit_buf_struct bs, ixheaac_drc_bs_data_struct *pstr_bs_data) {
WORD32 ich, idrc, nbyte = 1;
WORD32 pce_tag_present, drc_bands_present;
WORD32 pce_instance_tag, drc_tag_reserved_bits;
WORD32 prog_ref_level_reserved_bits;
WORD32 excluded_chns_present;
UWORD8 drc_band_incr;
WORD8 max_dyn_rng_dlbl = -128;
@ -610,8 +609,8 @@ static WORD32 ixheaacd_drc_element_read(
pce_tag_present = ixheaacd_read_bits_buf(bs, 1);
if (pce_tag_present) {
pce_instance_tag = ixheaacd_read_bits_buf(bs, 4);
drc_tag_reserved_bits = ixheaacd_read_bits_buf(bs, 4);
ixheaacd_read_bits_buf(bs, 4);/*pce_instance_tag*/
ixheaacd_read_bits_buf(bs, 4);/*drc_tag_reserved_bits*/
nbyte++;
}
@ -645,7 +644,7 @@ static WORD32 ixheaacd_drc_element_read(
if (pstr_bs_data->prog_ref_level_present) {
pstr_bs_data->prog_ref_level = ixheaacd_read_bits_buf(bs, 7);
prog_ref_level_reserved_bits = ixheaacd_read_bits_buf(bs, 1);
ixheaacd_read_bits_buf(bs, 1);/*prog_ref_level_reserved_bits*/
nbyte++;
}
@ -764,13 +763,12 @@ WORD32 ixheaacd_dec_drc_read_element(ia_drc_dec_struct *pstr_drc_dec,
ia_drc_dec_struct *drc_dummy,
ia_handle_bit_buf_struct bs) {
WORD32 bits_read = 0;
WORD32 bits_parse = 0;
if (pstr_drc_dec->num_drc_elements < pstr_drc_dec->max_audio_channels) {
bits_read = ixheaacd_drc_element_read(
bs, &pstr_drc_dec->str_drc_bs_data[pstr_drc_dec->num_drc_elements]);
if (pstr_drc_dec->dvb_anc_data_present) {
bits_parse = ixheaacd_drc_read_compression(
ixheaacd_drc_read_compression(
bs, pstr_drc_dec, pstr_drc_dec->dvb_anc_data_pos);
}
pstr_drc_dec->num_drc_elements++;
@ -780,7 +778,7 @@ WORD32 ixheaacd_dec_drc_read_element(ia_drc_dec_struct *pstr_drc_dec,
bits_read = ixheaacd_drc_element_read(bs, &drc_ele_dummy);
if (pstr_drc_dec->dvb_anc_data_present) {
bits_parse = ixheaacd_drc_read_compression(
ixheaacd_drc_read_compression(
bs, drc_dummy, pstr_drc_dec->dvb_anc_data_pos);
}
}

View file

@ -994,7 +994,7 @@ VOID ixheaacd_equalize_filt_buff_exp(WORD16 *ptr_filt_buf, WORD16 *nrg_gain,
}
}
static PLATFORM_INLINE VOID ixheaacd_filt_buf_update(WORD16 *ptr_filt_buf,
VOID ixheaacd_filt_buf_update(WORD16 *ptr_filt_buf,
WORD16 *ptr_filt_buf_noise,
WORD16 *nrg_gain,
WORD16 *noise_level_mant,

View file

@ -50,15 +50,11 @@ VOID ixheaacd_derive_lim_band_tbl(
const ia_patch_param_struct *p_str_patch_param, WORD16 num_patches,
ixheaacd_misc_tables *pstr_common_tables);
PLATFORM_INLINE VOID ixheaacd_equalize_filt_buff_exp(WORD16 *ptr_filt_buf,
WORD16 *nrg_gain_mant,
WORD32 subbands);
static PLATFORM_INLINE VOID ixheaacd_filt_buf_update(WORD16 *filt_buf_mant,
WORD16 *ptr_filt_buf_noise,
WORD16 *nrg_gain_mant,
WORD16 *noise_level_mant,
WORD32 num_sub_bands);
VOID ixheaacd_filt_buf_update(WORD16 *filt_buf_mant,
WORD16 *ptr_filt_buf_noise,
WORD16 *nrg_gain_mant,
WORD16 *noise_level_mant,
WORD32 num_sub_bands);
VOID ixheaacd_noise_level_rescaling(WORD16 *noise_level_mant, WORD32 diff,
WORD32 num_sub_bands,
@ -180,7 +176,7 @@ VOID ixheaacd_subbandgain_calc(WORD16 e_orig_mant_matrix, WORD16 tmp_noise_mant,
WORD16 *ptr_nrg_sine_m,
ixheaacd_misc_tables *pstr_common_tables);
PLATFORM_INLINE VOID ixheaacd_equalize_filt_buff_exp(WORD16 *ptr_filt_buf,
VOID ixheaacd_equalize_filt_buff_exp(WORD16 *ptr_filt_buf,
WORD16 *nrg_gain,
WORD32 subbands);

View file

@ -576,13 +576,14 @@ VOID ixheaacd_sbr_env_dequant_coup(
(1 + pow(2, temp_r - pan_offset[1])));
}
}
WORD32 ixheaacd_dec_sbrdata(ia_sbr_header_data_struct *ptr_header_data_ch_0,
ia_sbr_header_data_struct *ptr_header_data_ch_1,
ia_sbr_frame_info_data_struct *ptr_sbr_data_ch_0,
ia_sbr_prev_frame_data_struct *ptr_prev_data_ch_0,
ia_sbr_frame_info_data_struct *ptr_sbr_data_ch_1,
ia_sbr_prev_frame_data_struct *ptr_prev_data_ch_1,
ixheaacd_misc_tables *ptr_common_tables) {
IA_ERRORCODE ixheaacd_dec_sbrdata(
ia_sbr_header_data_struct *ptr_header_data_ch_0,
ia_sbr_header_data_struct *ptr_header_data_ch_1,
ia_sbr_frame_info_data_struct *ptr_sbr_data_ch_0,
ia_sbr_prev_frame_data_struct *ptr_prev_data_ch_0,
ia_sbr_frame_info_data_struct *ptr_sbr_data_ch_1,
ia_sbr_prev_frame_data_struct *ptr_prev_data_ch_1,
ixheaacd_misc_tables *ptr_common_tables, WORD32 ldmps_present) {
FLAG error_code;
WORD32 err = 0;
WORD32 usac_flag = ptr_header_data_ch_0->usac_flag;
@ -595,10 +596,8 @@ WORD32 ixheaacd_dec_sbrdata(ia_sbr_header_data_struct *ptr_header_data_ch_0,
err = ixheaacd_calc_noise_floor(ptr_header_data_ch_0, ptr_sbr_data_ch_0,
ptr_prev_data_ch_0);
if (err == (WORD32)IA_FATAL_ERROR) return (WORD32)IA_FATAL_ERROR;
if (!ptr_sbr_data_ch_0->coupling_mode && usac_flag) {
if (err) return err;
if ((!ptr_sbr_data_ch_0->coupling_mode && usac_flag) || ldmps_present) {
ptr_sbr_data_ch_0->num_noise_sfac =
ptr_header_data_ch_0->pstr_freq_band_data->num_nf_bands *
ptr_sbr_data_ch_0->str_frame_info_details.num_noise_env;
@ -656,18 +655,20 @@ WORD32 ixheaacd_dec_sbrdata(ia_sbr_header_data_struct *ptr_header_data_ch_0,
return 0;
}
WORD32 ixheaacd_dec_envelope(ia_sbr_header_data_struct *ptr_header_data,
ia_sbr_frame_info_data_struct *ptr_sbr_data,
ia_sbr_prev_frame_data_struct *ptr_prev_data_ch_0,
ia_sbr_prev_frame_data_struct *ptr_prev_data_ch_1,
ixheaacd_misc_tables *pstr_common_tables) {
IA_ERRORCODE ixheaacd_dec_envelope(
ia_sbr_header_data_struct *ptr_header_data,
ia_sbr_frame_info_data_struct *ptr_sbr_data,
ia_sbr_prev_frame_data_struct *ptr_prev_data_ch_0,
ia_sbr_prev_frame_data_struct *ptr_prev_data_ch_1,
ixheaacd_misc_tables *pstr_common_tables) {
FLAG error_code;
WORD32 err;
WORD16 env_sf_local_arr[MAX_FREQ_COEFFS];
WORD32 usac_flag = ptr_header_data->usac_flag;
WORD32 temp_1 =
ptr_prev_data_ch_0->end_position - ptr_header_data->num_time_slots;
if (temp_1 < 0) return -1;
if (temp_1 < 0) return IA_FATAL_ERROR;
temp_1 = ptr_sbr_data->str_frame_info_details.border_vec[0] - temp_1;
if ((!ptr_header_data->err_flag_prev) && (!ptr_header_data->err_flag) &&

View file

@ -20,13 +20,14 @@
#ifndef IXHEAACD_ENV_DEC_H
#define IXHEAACD_ENV_DEC_H
WORD32 ixheaacd_dec_sbrdata(ia_sbr_header_data_struct *ptr_header_data_ch_0,
ia_sbr_header_data_struct *ptr_header_data_ch_1,
ia_sbr_frame_info_data_struct *ptr_sbr_data_ch_0,
ia_sbr_prev_frame_data_struct *ptr_prev_data_ch_0,
ia_sbr_frame_info_data_struct *ptr_sbr_data_ch_1,
ia_sbr_prev_frame_data_struct *ptr_prev_data_ch_1,
ixheaacd_misc_tables *ptr_common_tables);
IA_ERRORCODE ixheaacd_dec_sbrdata(
ia_sbr_header_data_struct *ptr_header_data_ch_0,
ia_sbr_header_data_struct *ptr_header_data_ch_1,
ia_sbr_frame_info_data_struct *ptr_sbr_data_ch_0,
ia_sbr_prev_frame_data_struct *ptr_prev_data_ch_0,
ia_sbr_frame_info_data_struct *ptr_sbr_data_ch_1,
ia_sbr_prev_frame_data_struct *ptr_prev_data_ch_1,
ixheaacd_misc_tables *ptr_common_tables, WORD32 ldmps_present);
IA_ERRORCODE ixheaacd_dec_sbrdata_for_pvc(
ia_sbr_header_data_struct *ptr_header_data,
@ -56,11 +57,12 @@ VOID ixheaacd_harm_idx_onethree(FLAG noise_absc_flag, WORD16 num_subband,
WORD16 *ptr_sine_level_buf, WORD16 noise_e,
WORD freq_inv_flag, WORD32 harm_index);
WORD32 ixheaacd_dec_envelope(ia_sbr_header_data_struct *ptr_header_data,
ia_sbr_frame_info_data_struct *ptr_sbr_data,
ia_sbr_prev_frame_data_struct *ptr_prev_data,
ia_sbr_prev_frame_data_struct *ptr_prev_data_ch_1,
ixheaacd_misc_tables *pstr_common_tables);
IA_ERRORCODE ixheaacd_dec_envelope(
ia_sbr_header_data_struct *ptr_header_data,
ia_sbr_frame_info_data_struct *ptr_sbr_data,
ia_sbr_prev_frame_data_struct *ptr_prev_data,
ia_sbr_prev_frame_data_struct *ptr_prev_data_ch_1,
ixheaacd_misc_tables *pstr_common_tables);
VOID ixheaacd_lean_sbrconcealment(ia_sbr_header_data_struct *ptr_header_data,
ia_sbr_frame_info_data_struct *ptr_sbr_data,

View file

@ -178,8 +178,8 @@ IA_ERRORCODE ixheaacd_createlimiterbands(
struct ixheaacd_lpp_trans_patch *patch_param);
WORD32 ixheaacd_apply_inter_tes(FLOAT32 *qmf_real1, FLOAT32 *qmf_imag1,
FLOAT32 *qmf_real, FLOAT32 *qmf_imag,
WORD32 num_sample, WORD32 sub_band_start,
WORD32 num_subband, WORD32 gamma_idx);
FLOAT32 *qmf_real, FLOAT32 *qmf_imag,
WORD32 num_sample, WORD32 sub_band_start,
WORD32 num_subband, WORD32 gamma_idx);
#endif

View file

@ -73,7 +73,8 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
FLOAT32 input_real1[][64],
FLOAT32 input_imag1[][64],
WORD32 x_over_qmf[MAX_NUM_PATCHES],
FLOAT32 *scratch_buff, FLOAT32 *env_out) {
FLOAT32 *scratch_buff, FLOAT32 *env_out,
WORD32 ldmps_present) {
WORD32 error_code = 0;
WORD8 harmonics[64];
FLOAT32(*env_tmp)[48];
@ -152,6 +153,8 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
WORD32 rate = upsamp_4_flag ? 4 : 2;
if (ldmps_present == 1) rate = 1;
env_tmp = frame_data->env_tmp;
noise_level_pvc = frame_data->noise_level_pvc;
nrg_est_pvc = frame_data->nrg_est_pvc;
@ -164,10 +167,10 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
freq_band_table[1] =
frame_data->pstr_sbr_header->pstr_freq_band_data->freq_band_table[1];
if (reset) {
if (reset || (ldmps_present == 1)) {
esbr_start_up = 1;
esbr_start_up_pvc = 1;
phase_index = 0;
if (reset) phase_index = 0;
if (ixheaacd_createlimiterbands(
(*lim_table), (*gate_mode),
frame_data->pstr_sbr_header->pstr_freq_band_data->freq_band_tbl_lo,
@ -687,7 +690,7 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
}
}
if (esbr_start_up) {
if (esbr_start_up && (ldmps_present != 1)) {
for (n = 0; n < 4; n++) {
memcpy((*e_gain)[n], nrg_gain, num_subbands * sizeof(FLOAT32));
memcpy((*noise_buf)[n], noise_level,
@ -702,6 +705,9 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
ptr_real_buf = *(input_real + l) + sub_band_start;
ptr_imag_buf = *(input_imag + l) + sub_band_start;
freq_inv = 1;
if ((ldmps_present == 1) && (sub_band_start & 1)) freq_inv = -1;
for (k = 0; k < num_subbands; k++) {
(*e_gain)[4][k] = nrg_gain[k];
(*noise_buf)[4][k] = noise_level[k];
@ -714,14 +720,27 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
phase_index = (phase_index + 1) & 511;
sb_noise = (nrg_tone[k] != 0 || noise_absc_flag) ? 0 : sb_noise;
*ptr_real_buf = *ptr_real_buf * sb_gain +
if (ldmps_present == 1) {
*ptr_real_buf = *ptr_real_buf * sb_gain +
sb_noise * ixheaacd_random_phase[phase_index][0] +
nrg_tone[k] * ixheaacd_hphase_tbl[0][harm_index];
*ptr_imag_buf =
*ptr_imag_buf * sb_gain +
sb_noise * ixheaacd_random_phase[phase_index][1] +
nrg_tone[k] * freq_inv * ixheaacd_hphase_tbl[1][harm_index];
freq_inv = -freq_inv;
} else {
*ptr_real_buf = *ptr_real_buf * sb_gain +
sb_noise * ixheaacd_random_phase[phase_index][0];
*ptr_imag_buf = *ptr_imag_buf * sb_gain +
*ptr_imag_buf = *ptr_imag_buf * sb_gain +
sb_noise * ixheaacd_random_phase[phase_index][1];
}
ptr_real_buf++;
ptr_imag_buf++;
}
if (ldmps_present == 1) harm_index = (harm_index + 1) & 3;
memcpy(temp, (*e_gain)[0], 64 * sizeof(FLOAT32));
for (n = 0; n < 4; n++)
@ -733,7 +752,8 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
memcpy((*noise_buf)[4], temp, 64 * sizeof(FLOAT32));
}
error_code = ixheaacd_apply_inter_tes(
if (ldmps_present != 1) {
error_code = ixheaacd_apply_inter_tes(
*(input_real1 + rate * p_frame_info->border_vec[i]),
*(input_imag1 + rate * p_frame_info->border_vec[i]),
*(input_real + rate * p_frame_info->border_vec[i]),
@ -767,6 +787,7 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
}
}
}
}
for (i = 0; i < 64; i++) {
(*harm_flag_varlen_prev)[i] = (*harm_flag_prev)[i];
@ -782,6 +803,7 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
frame_data->env_short_flag_prev = -1;
}
if (ldmps_present != 1) {
memcpy((VOID *)&frame_data->str_frame_info_prev,
(VOID *)&frame_data->str_frame_info_details,
sizeof(ia_frame_info_struct));
@ -803,6 +825,7 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
num_nf_bands +
i];
}
}
frame_data->harm_index = harm_index;
frame_data->phase_index = phase_index;

View file

@ -522,7 +522,6 @@ void ixheaacd_real_synth_fft_p2(FLOAT32 *ptr_x, FLOAT32 *ptr_y,
x1r = *ptr_y;
x1i = *(ptr_y + 1);
tmp = (FLOAT32)(((FLOAT32)x1r * W4) - ((FLOAT32)x1i * W1));
x1i = (FLOAT32)(((FLOAT32)x1r * W1) + ((FLOAT32)x1i * W4));
x1r = tmp;

View file

@ -28,6 +28,7 @@
#include "ixheaacd_function_selector.h"
extern const WORD32 ixheaacd_twiddle_table_fft_32x32[514];
extern const FLOAT32 ixheaacd_twiddle_table_fft[514];
extern const FLOAT32 ixheaacd_twiddle_table_fft_flt[16];
extern const WORD32 ixheaacd_twiddle_table_3pr[1155];
extern const WORD32 ixheaacd_twiddle_table_3pi[1155];
@ -864,6 +865,550 @@ VOID ixheaacd_mps_synth_calc_fft(FLOAT32 *ptr_xr, FLOAT32 *ptr_xi,
}
}
VOID ixheaacd_mps_complex_fft(FLOAT32 *xr, FLOAT32 *xi, WORD32 nlength) {
WORD32 i, j, k, n_stages, h2;
FLOAT32 x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
WORD32 del, nodespacing, in_loop_cnt;
WORD32 dig_rev_shift;
WORD32 not_power_4;
FLOAT32 ptr_x[256];
FLOAT32 y[256];
WORD32 npoints = nlength;
FLOAT32 *ptr_y = y;
const FLOAT32 *ptr_w;
dig_rev_shift = ixheaacd_norm32(npoints) + 1 - 16;
n_stages = 30 - ixheaacd_norm32(npoints);
not_power_4 = n_stages & 1;
n_stages = n_stages >> 1;
for (i = 0; i<nlength; i++)
{
ptr_x[2 * i] = xr[i];
ptr_x[2 * i + 1] = xi[i];
}
ptr_w = ixheaacd_twiddle_table_fft;
for (i = 0; i<npoints; i += 4)
{
FLOAT32 *inp = ptr_x;
DIG_REV(i, dig_rev_shift, h2);
if (not_power_4)
{
h2 += 1;
h2 &= ~1;
}
inp += (h2);
x0r = *inp;
x0i = *(inp + 1);
inp += (npoints >> 1);
x1r = *inp;
x1i = *(inp + 1);
inp += (npoints >> 1);
x2r = *inp;
x2i = *(inp + 1);
inp += (npoints >> 1);
x3r = *inp;
x3i = *(inp + 1);
x0r = x0r + x2r;
x0i = x0i + x2i;
x2r = x0r - (x2r * 2);
x2i = x0i - (x2i * 2);
x1r = x1r + x3r;
x1i = x1i + x3i;
x3r = x1r - (x3r * 2);
x3i = x1i - (x3i * 2);
x0r = x0r + x1r;
x0i = x0i + x1i;
x1r = x0r - (x1r * 2);
x1i = x0i - (x1i * 2);
x2r = x2r + x3i;
x2i = x2i - x3r;
x3i = x2r - (x3i * 2);
x3r = x2i + (x3r * 2);
*ptr_y++ = x0r;
*ptr_y++ = x0i;
*ptr_y++ = x2r;
*ptr_y++ = x2i;
*ptr_y++ = x1r;
*ptr_y++ = x1i;
*ptr_y++ = x3i;
*ptr_y++ = x3r;
}
ptr_y -= 2 * npoints;
del = 4;
nodespacing = 64;
in_loop_cnt = npoints >> 4;
for (i = n_stages - 1; i>0; i--)
{
const FLOAT32 *twiddles = ptr_w;
FLOAT32 *data = ptr_y;
FLOAT32 w1h, w2h, w3h, w1l, w2l, w3l;
WORD32 sec_loop_cnt;
for (k = in_loop_cnt; k != 0; k--)
{
x0r = (*data);
x0i = (*(data + 1));
data += (del << 1);
x1r = (*data);
x1i = (*(data + 1));
data += (del << 1);
x2r = (*data);
x2i = (*(data + 1));
data += (del << 1);
x3r = (*data);
x3i = (*(data + 1));
data -= 3 * (del << 1);
x0r = x0r + x2r;
x0i = x0i + x2i;
x2r = x0r - (x2r * 2);
x2i = x0i - (x2i * 2);
x1r = x1r + x3r;
x1i = x1i + x3i;
x3r = x1r - (x3r * 2);
x3i = x1i - (x3i * 2);
x0r = x0r + x1r;
x0i = x0i + x1i;
x1r = x0r - (x1r * 2);
x1i = x0i - (x1i * 2);
x2r = x2r + x3i;
x2i = x2i - x3r;
x3i = x2r - (x3i * 2);
x3r = x2i + (x3r * 2);
*data = x0r;
*(data + 1) = x0i;
data += (del << 1);
*data = x2r;
*(data + 1) = x2i;
data += (del << 1);
*data = x1r;
*(data + 1) = x1i;
data += (del << 1);
*data = x3i;
*(data + 1) = x3r;
data += (del << 1);
}
data = ptr_y + 2;
sec_loop_cnt = (nodespacing * del);
sec_loop_cnt = (sec_loop_cnt / 4) + (sec_loop_cnt / 8) - (sec_loop_cnt / 16) \
+ (sec_loop_cnt / 32) - (sec_loop_cnt / 64) + (sec_loop_cnt / 128) \
- (sec_loop_cnt / 256);
j = nodespacing;
for (j = nodespacing; j <= sec_loop_cnt; j += nodespacing)
{
w1h = *(twiddles + 2 * j);
w1l = *(twiddles + 2 * j + 1);
w2h = *(twiddles + 2 * (j << 1));
w2l = *(twiddles + 2 * (j << 1) + 1);
w3h = *(twiddles + 2 * j + 2 * (j << 1));
w3l = *(twiddles + 2 * j + 2 * (j << 1) + 1);
for (k = in_loop_cnt; k != 0; k--)
{
FLOAT32 tmp;
FLOAT32 x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
data += (del << 1);
x1r = *data;
x1i = *(data + 1);
data += (del << 1);
x2r = *data;
x2i = *(data + 1);
data += (del << 1);
x3r = *data;
x3i = *(data + 1);
data -= 3 * (del << 1);
tmp = (mult32X32float(x1r, w1l) - mult32X32float(x1i, w1h));
x1i = mac32X32float(mult32X32float(x1r, w1h), x1i, w1l);
x1r = tmp;
tmp = (mult32X32float(x2r, w2l) - mult32X32float(x2i, w2h));
x2i = mac32X32float(mult32X32float(x2r, w2h), x2i, w2l);
x2r = tmp;
tmp = (mult32X32float(x3r, w3l) - mult32X32float(x3i, w3h));
x3i = mac32X32float(mult32X32float(x3r, w3h), x3i, w3l);
x3r = tmp;
x0r = (*data);
x0i = (*(data + 1));
x0r = x0r + (x2r);
x0i = x0i + (x2i);
x2r = x0r - (x2r * 2);
x2i = x0i - (x2i * 2);
x1r = x1r + x3r;
x1i = x1i + x3i;
x3r = x1r - (x3r * 2);
x3i = x1i - (x3i * 2);
x0r = x0r + (x1r);
x0i = x0i + (x1i);
x1r = x0r - (x1r * 2);
x1i = x0i - (x1i * 2);
x2r = x2r + (x3i);
x2i = x2i - (x3r);
x3i = x2r - (x3i * 2);
x3r = x2i + (x3r * 2);
*data = x0r;
*(data + 1) = x0i;
data += (del << 1);
*data = x2r;
*(data + 1) = x2i;
data += (del << 1);
*data = x1r;
*(data + 1) = x1i;
data += (del << 1);
*data = x3i;
*(data + 1) = x3r;
data += (del << 1);
}
data -= 2 * npoints;
data += 2;
}
for (; j <= (nodespacing * del) >> 1; j += nodespacing)
{
w1h = *(twiddles + 2 * j);
w2h = *(twiddles + 2 * (j << 1));
w3h = *(twiddles + 2 * j + 2 * (j << 1) - 512);
w1l = *(twiddles + 2 * j + 1);
w2l = *(twiddles + 2 * (j << 1) + 1);
w3l = *(twiddles + 2 * j + 2 * (j << 1) - 511);
for (k = in_loop_cnt; k != 0; k--)
{
FLOAT32 tmp;
FLOAT32 x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
data += (del << 1);
x1r = *data;
x1i = *(data + 1);
data += (del << 1);
x2r = *data;
x2i = *(data + 1);
data += (del << 1);
x3r = *data;
x3i = *(data + 1);
data -= 3 * (del << 1);
tmp = (mult32X32float(x1r, w1l) - mult32X32float(x1i, w1h));
x1i = mac32X32float(mult32X32float(x1r, w1h), x1i, w1l);
x1r = tmp;
tmp = (mult32X32float(x2r, w2l) - mult32X32float(x2i, w2h));
x2i = mac32X32float(mult32X32float(x2r, w2h), x2i, w2l);
x2r = tmp;
tmp = (mult32X32float(x3r, w3h) + mult32X32float(x3i, w3l));
x3i = -mult32X32float(x3r, w3l) + mult32X32float(x3i, w3h);
x3r = tmp;
x0r = (*data);
x0i = (*(data + 1));
x0r = x0r + (x2r);
x0i = x0i + (x2i);
x2r = x0r - (x2r * 2);
x2i = x0i - (x2i * 2);
x1r = x1r + x3r;
x1i = x1i + x3i;
x3r = x1r - (x3r * 2);
x3i = x1i - (x3i * 2);
x0r = x0r + (x1r);
x0i = x0i + (x1i);
x1r = x0r - (x1r * 2);
x1i = x0i - (x1i * 2);
x2r = x2r + (x3i);
x2i = x2i - (x3r);
x3i = x2r - (x3i * 2);
x3r = x2i + (x3r * 2);
*data = x0r;
*(data + 1) = x0i;
data += (del << 1);
*data = x2r;
*(data + 1) = x2i;
data += (del << 1);
*data = x1r;
*(data + 1) = x1i;
data += (del << 1);
*data = x3i;
*(data + 1) = x3r;
data += (del << 1);
}
data -= 2 * npoints;
data += 2;
}
for (; j <= sec_loop_cnt * 2; j += nodespacing)
{
w1h = *(twiddles + 2 * j);
w2h = *(twiddles + 2 * (j << 1) - 512);
w3h = *(twiddles + 2 * j + 2 * (j << 1) - 512);
w1l = *(twiddles + 2 * j + 1);
w2l = *(twiddles + 2 * (j << 1) - 511);
w3l = *(twiddles + 2 * j + 2 * (j << 1) - 511);
for (k = in_loop_cnt; k != 0; k--)
{
FLOAT32 tmp;
FLOAT32 x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
data += (del << 1);
x1r = *data;
x1i = *(data + 1);
data += (del << 1);
x2r = *data;
x2i = *(data + 1);
data += (del << 1);
x3r = *data;
x3i = *(data + 1);
data -= 3 * (del << 1);
tmp = (mult32X32float(x1r, w1l) - mult32X32float(x1i, w1h));
x1i = mac32X32float(mult32X32float(x1r, w1h), x1i, w1l);
x1r = tmp;
tmp = (mult32X32float(x2r, w2h) + mult32X32float(x2i, w2l));
x2i = -mult32X32float(x2r, w2l) + mult32X32float(x2i, w2h);
x2r = tmp;
tmp = (mult32X32float(x3r, w3h) + mult32X32float(x3i, w3l));
x3i = -mult32X32float(x3r, w3l) + mult32X32float(x3i, w3h);
x3r = tmp;
x0r = (*data);
x0i = (*(data + 1));
x0r = x0r + (x2r);
x0i = x0i + (x2i);
x2r = x0r - (x2r * 2);
x2i = x0i - (x2i * 2);
x1r = x1r + x3r;
x1i = x1i + x3i;
x3r = x1r - (x3r * 2);
x3i = x1i - (x3i * 2);
x0r = x0r + (x1r);
x0i = x0i + (x1i);
x1r = x0r - (x1r * 2);
x1i = x0i - (x1i * 2);
x2r = x2r + (x3i);
x2i = x2i - (x3r);
x3i = x2r - (x3i * 2);
x3r = x2i + (x3r * 2);
*data = x0r;
*(data + 1) = x0i;
data += (del << 1);
*data = x2r;
*(data + 1) = x2i;
data += (del << 1);
*data = x1r;
*(data + 1) = x1i;
data += (del << 1);
*data = x3i;
*(data + 1) = x3r;
data += (del << 1);
}
data -= 2 * npoints;
data += 2;
}
for (; j<nodespacing * del; j += nodespacing)
{
w1h = *(twiddles + 2 * j);
w2h = *(twiddles + 2 * (j << 1) - 512);
w3h = *(twiddles + 2 * j + 2 * (j << 1) - 1024);
w1l = *(twiddles + 2 * j + 1);
w2l = *(twiddles + 2 * (j << 1) - 511);
w3l = *(twiddles + 2 * j + 2 * (j << 1) - 1023);
for (k = in_loop_cnt; k != 0; k--)
{
FLOAT32 tmp;
FLOAT32 x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
data += (del << 1);
x1r = *data;
x1i = *(data + 1);
data += (del << 1);
x2r = *data;
x2i = *(data + 1);
data += (del << 1);
x3r = *data;
x3i = *(data + 1);
data -= 3 * (del << 1);
tmp = (mult32X32float(x1r, w1l) - mult32X32float(x1i, w1h));
x1i = mac32X32float(mult32X32float(x1r, w1h), x1i, w1l);
x1r = tmp;
tmp = (mult32X32float(x2r, w2h) + mult32X32float(x2i, w2l));
x2i = -mult32X32float(x2r, w2l) + mult32X32float(x2i, w2h);
x2r = tmp;
tmp = (-mult32X32float(x3r, w3l) + mult32X32float(x3i, w3h));
x3i = mac32X32float(mult32X32float(x3r, w3h), x3i, w3l);
x3r = tmp;
x0r = (*data);
x0i = (*(data + 1));
x0r = x0r + (x2r);
x0i = x0i + (x2i);
x2r = x0r - (x2r * 2);
x2i = x0i - (x2i * 2);
x1r = x1r + x3r;
x1i = x1i - x3i;
x3r = x1r - (x3r * 2);
x3i = x1i + (x3i * 2);
x0r = x0r + (x1r);
x0i = x0i + (x1i);
x1r = x0r - (x1r * 2);
x1i = x0i - (x1i * 2);
x2r = x2r + (x3i);
x2i = x2i - (x3r);
x3i = x2r - (x3i * 2);
x3r = x2i + (x3r * 2);
*data = x0r;
*(data + 1) = x0i;
data += (del << 1);
*data = x2r;
*(data + 1) = x2i;
data += (del << 1);
*data = x1r;
*(data + 1) = x1i;
data += (del << 1);
*data = x3i;
*(data + 1) = x3r;
data += (del << 1);
}
data -= 2 * npoints;
data += 2;
}
nodespacing >>= 2;
del <<= 2;
in_loop_cnt >>= 2;
}
if (not_power_4)
{
const FLOAT32 *twiddles = ptr_w;
nodespacing <<= 1;
for (j = del / 2; j != 0; j--)
{
FLOAT32 w1h = *twiddles;
FLOAT32 w1l = *(twiddles + 1);
FLOAT32 tmp;
twiddles += nodespacing * 2;
x0r = *ptr_y;
x0i = *(ptr_y + 1);
ptr_y += (del << 1);
x1r = *ptr_y;
x1i = *(ptr_y + 1);
tmp = (mult32X32float(x1r, w1l) - mult32X32float(x1i, w1h));
x1i = mac32X32float(mult32X32float(x1r, w1h), x1i, w1l);
x1r = tmp;
*ptr_y = (x0r) - (x1r);
*(ptr_y + 1) = (x0i) - (x1i);
ptr_y -= (del << 1);
*ptr_y = (x0r) + (x1r);
*(ptr_y + 1) = (x0i) + (x1i);
ptr_y += 2;
}
twiddles = ptr_w;
for (j = del / 2; j != 0; j--)
{
FLOAT32 w1h = *twiddles;
FLOAT32 w1l = *(twiddles + 1);
FLOAT32 tmp;
twiddles += nodespacing * 2;
x0r = *ptr_y;
x0i = *(ptr_y + 1);
ptr_y += (del << 1);
x1r = *ptr_y;
x1i = *(ptr_y + 1);
tmp = (mult32X32float(x1r, w1h) + mult32X32float(x1i, w1l));
x1i = -mult32X32float(x1r, w1l) + mult32X32float(x1i, w1h);
x1r = tmp;
*ptr_y = (x0r) - (x1r);
*(ptr_y + 1) = (x0i) - (x1i);
ptr_y -= (del << 1);
*ptr_y = (x0r) + (x1r);
*(ptr_y + 1) = (x0i) + (x1i);
ptr_y += 2;
}
}
for (i = 0; i<nlength; i++)
{
xr[i] = y[2 * i];
xi[i] = y[2 * i + 1];
}
return;
}
VOID ixheaacd_complex_fft_p2_dec(WORD32 *xr, WORD32 *xi, WORD32 nlength,
WORD32 fft_mode, WORD32 *preshift) {
WORD32 i, j, k, n_stages;

View file

@ -661,7 +661,7 @@ WORD32 ixheaacd_derive_noise_freq_bnd_tbl(
WORD32 ixheaacd_calc_frq_bnd_tbls(ia_sbr_header_data_struct *ptr_header_data,
ixheaacd_misc_tables *pstr_common_tables) {
WORD32 err;
WORD16 num_lf_bands, num_hf_bands, lsb, usb;
WORD16 num_lf_bands, lsb, usb;
ia_freq_band_data_struct *pstr_freq_band_data =
ptr_header_data->pstr_freq_band_data;
@ -676,7 +676,6 @@ WORD32 ixheaacd_calc_frq_bnd_tbls(ia_sbr_header_data_struct *ptr_header_data,
ixheaacd_derive_hi_lo_freq_bnd_tbls(pstr_freq_band_data, ptr_header_data);
num_lf_bands = pstr_freq_band_data->num_sf_bands[LOW];
num_hf_bands = pstr_freq_band_data->num_sf_bands[HIGH];
if ((num_lf_bands <= 0) ||
(num_lf_bands > ixheaacd_shr16(MAX_FREQ_COEFFS, 1))) {

View file

@ -65,6 +65,7 @@
#include "ixheaacd_aacdec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_struct_def.h"
@ -76,11 +77,12 @@
#include "ixheaacd_interface.h"
#include "ixheaacd_info.h"
#include "ixheaacd_mps_interface.h"
#include "ixheaacd_config.h"
#include "ixheaacd_struct.h"
#include "ixheaacd_function_selector.h"
#include "ixheaacd_ld_mps_dec.h"
#include "ixheaacd_error_standards.h"
@ -91,6 +93,9 @@
#undef FRAME_SIZE_SMALL
#define FRAME_SIZE_SMALL 960
#endif
#define ELDEXT_SAOC 1
#define ELDEXT_TERM 0
#define ELDEXT_LDSAC 2
extern const WORD32 ixheaacd_sampl_freq_idx_table[17];
@ -674,6 +679,7 @@ WORD32 ixheaacd_ga_hdr_dec(ia_aac_dec_state_struct *aac_state_struct,
return 0;
}
aac_state_struct->frame_length = FRAME_SIZE;
if (aac_state_struct->frame_len_flag)
#ifdef ALLOW_SMALL_FRAMELENGTH
aac_state_struct->frame_length = FRAME_SIZE_SMALL;
@ -702,49 +708,101 @@ if (aac_state_struct->audio_object_type == AOT_ER_AAC_ELD) {
!aac_state_struct->eld_specific_config.ld_sbr_samp_rate;
}
ixheaacd_read_bits_buf(it_bit_buff, 1);
}
if (aac_state_struct->audio_object_type == AOT_ER_AAC_ELD) {
int ep_config = ixheaacd_read_bits_buf(it_bit_buff, 2);
if (ep_config == 2 || ep_config == 3) {
}
if (ep_config == 3) {
int direct_map = ixheaacd_read_bits_buf(it_bit_buff, 1);
if (!direct_map) {
{
UWORD16 len, eld_ext_type;
WORD32 err;
UWORD16 cnt;
if (ixheaacd_show_bits_buf(it_bit_buff, 4) != ELDEXT_TERM) {
while ((eld_ext_type = ixheaacd_read_bits_buf(it_bit_buff, 4)) !=
ELDEXT_TERM) {
len = ixheaacd_read_bits_buf(it_bit_buff, 4);
if (len == 15) {
len += ixheaacd_read_bits_buf(it_bit_buff, 8);
}
if (len == 15 + 255) {
len += ixheaacd_read_bits_buf(it_bit_buff, 16);
}
switch (eld_ext_type) {
case ELDEXT_SAOC:
break;
case ELDEXT_LDSAC:
aac_state_struct->ldmps_present = 1;
aac_state_struct->mps_dec_handle.ldmps_config.ldmps_present_flag =
1;
aac_state_struct->mps_dec_handle.object_type =
aac_state_struct->audio_object_type;
err = ixheaacd_ld_spatial_specific_config(
&(aac_state_struct->mps_dec_handle.ldmps_config), it_bit_buff);
if (err) return err;
if (ixheaacd_mps_create(
&aac_state_struct->mps_dec_handle,
aac_state_struct->mps_dec_handle.ldmps_config
.bs_frame_length,
0, &(aac_state_struct->mps_dec_handle.ldmps_config))) {
return -1;
}
break;
default:
for (cnt = 0; cnt < len; cnt++) {
ixheaacd_read_bits_buf(it_bit_buff, 8);
}
break;
}
break;
}
}
}
if (!((aac_state_struct->ldmps_present == 1) &&
!(it_bit_buff->cnt_bits >= 1)))
ixheaacd_read_bits_buf(it_bit_buff, 1);
}
if (!((aac_state_struct->ldmps_present == 1) && !(it_bit_buff->cnt_bits > 0))) {
if (aac_state_struct->audio_object_type == AOT_ER_AAC_ELD) {
WORD32 ep_config = ixheaacd_read_bits_buf(it_bit_buff, 2);
if (ep_config == 2 || ep_config == 3) {
}
if (ep_config == 3) {
WORD32 direct_map = ixheaacd_read_bits_buf(it_bit_buff, 1);
if (!direct_map) {
}
}
}
tmp = (header_len * 8) - it_bit_buff->cnt_bits;
tmp = (header_len * 8) - it_bit_buff->cnt_bits;
if (aac_state_struct->audio_object_type != AOT_SBR &&
(it_bit_buff->cnt_bits >= 16)) {
tmp = ixheaacd_read_bits_buf(it_bit_buff, 11);
if (aac_state_struct->audio_object_type != AOT_SBR &&
(it_bit_buff->cnt_bits >= 16)) {
tmp = ixheaacd_read_bits_buf(it_bit_buff, 11);
if (tmp == 0x2b7) {
tmp = ixheaacd_read_bits_buf(it_bit_buff, 5);
if (tmp == 0x2b7) {
tmp = ixheaacd_read_bits_buf(it_bit_buff, 5);
if (tmp == AOT_SBR) {
WORD32 sbr_present_flag = ixheaacd_read_bits_buf(it_bit_buff, 1);
if (sbr_present_flag) {
tmp = ixheaacd_get_samp_rate(it_bit_buff, pstr_samp_rate_info,
pstr_audio_specific_config);
if (tmp == -1) {
*bytes_consumed = 1;
return IA_ENHAACPLUS_DEC_INIT_FATAL_DEC_INIT_FAIL;
} else
aac_state_struct->extension_samp_rate = tmp;
if (tmp == AOT_SBR) {
WORD32 sbr_present_flag = ixheaacd_read_bits_buf(it_bit_buff, 1);
if (sbr_present_flag) {
tmp = ixheaacd_get_samp_rate(it_bit_buff, pstr_samp_rate_info,
pstr_audio_specific_config);
if (tmp == -1) {
*bytes_consumed = 1;
return IA_ENHAACPLUS_DEC_INIT_FATAL_DEC_INIT_FAIL;
} else
aac_state_struct->extension_samp_rate = tmp;
if (it_bit_buff->cnt_bits >= 12) {
tmp = ixheaacd_read_bits_buf(it_bit_buff, 11);
if (tmp == 0x548) {
tmp = ixheaacd_read_bits_buf(it_bit_buff, 1);
if (it_bit_buff->cnt_bits >= 12) {
tmp = ixheaacd_read_bits_buf(it_bit_buff, 11);
if (tmp == 0x548) {
tmp = ixheaacd_read_bits_buf(it_bit_buff, 1);
}
}
}
}
} else if (aac_state_struct->bs_format == LOAS_BSFORMAT) {
ixheaacd_read_bidirection(it_bit_buff, -11);
}
} else if (aac_state_struct->bs_format == LOAS_BSFORMAT) {
ixheaacd_read_bidirection(it_bit_buff, -11);
}
}
@ -975,6 +1033,13 @@ WORD32 ixheaacd_aac_headerdecode(
handle_bit_buff->pstr_adts_crc_info = &handle_bit_buff->str_adts_crc_info;
ixheaacd_adts_crc_open(handle_bit_buff->pstr_adts_crc_info);
aac_state_struct->ldmps_present = 0;
aac_state_struct->latm_initialized = 0;
memset(&aac_state_struct->mps_dec_handle, 0,
sizeof(aac_state_struct->mps_dec_handle));
memset(&aac_state_struct->eld_specific_config, 0,
sizeof(aac_state_struct->eld_specific_config));
if ((buffer[0] == 'A') && (buffer[1] == 'D') && (buffer[2] == 'I') &&
(buffer[3] == 'F')) {
adif.prog_config_present = 0;

View file

@ -20,6 +20,7 @@
#include <string.h>
#include "ixheaacd_sbr_common.h"
#include "ixheaacd_type_def.h"
#include "ixheaacd_error_standards.h"
#include "ixheaacd_constants.h"
#include "ixheaacd_basic_ops32.h"
@ -49,7 +50,7 @@
#include "ixheaacd_aacdec.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_env_extr_part.h"
#include "ixheaacd_sbr_rom.h"
#include "ixheaacd_audioobjtypes.h"
@ -57,6 +58,9 @@
#include "ixheaacd_latmdemux.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_config.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_struct_def.h"
@ -1131,8 +1135,10 @@ static VOID ixheaacd_decode_pcw(ia_bit_buf_struct *itt_bit_buff,
if (codebook <= 4) {
WORD32 tbl_sign = 0;
const UWORD16 *cb_table = (UWORD16 *)(ptr_aac_tables->code_book[codebook]);
const UWORD32 *idx_table = (UWORD32 *)(ptr_aac_tables->index_table[codebook]);
const UWORD16 *cb_table =
(UWORD16 *)(ptr_aac_tables->code_book[codebook]);
const UWORD32 *idx_table =
(UWORD32 *)(ptr_aac_tables->index_table[codebook]);
if (codebook > 2) {
tbl_sign = 1;
@ -1168,8 +1174,10 @@ static VOID ixheaacd_decode_pcw(ia_bit_buf_struct *itt_bit_buff,
{
WORD32 tbl_sign = 0;
WORD32 huff_mode = 9;
const UWORD16 *cb_table = (UWORD16 *)(ptr_aac_tables->code_book[codebook]);
const UWORD32 *idx_table = (UWORD32 *)(ptr_aac_tables->index_table[codebook]);
const UWORD16 *cb_table =
(UWORD16 *)(ptr_aac_tables->code_book[codebook]);
const UWORD32 *idx_table =
(UWORD32 *)(ptr_aac_tables->index_table[codebook]);
num_decoded_bits = 0;
if (codebook > 6) {
@ -1360,11 +1368,12 @@ static PLATFORM_INLINE UWORD16 ixheaacd_huff_dec_word_hcr_non_pcw(
WORD32 read_word;
WORD32 increment;
UWORD8 *ptr_read_next;
read_word = ixheaacd_aac_showbits_32(itt_bit_buff->byte_ptr,
itt_bit_buff->bit_count, &increment);
UWORD8 *ptr_read_next = itt_bit_buff->byte_ptr;
ptr_read_next = itt_bit_buff->byte_ptr;
ptr_read_next += increment;
ixheaacd_huff_sfb_table(read_word, &index, &length, code_book_tbl, idx_table);

View file

@ -29,6 +29,7 @@
#include "ixheaacd_defines.h"
#include "ixheaacd_memory_standards.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_env_extr_part.h"
#include "ixheaacd_aac_rom.h"
#include "ixheaacd_common_rom.h"
@ -51,6 +52,9 @@
#include "ixheaacd_aacdec.h"
#include "ixheaacd_sbr_common.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_config.h"
#include "ixheaacd_mps_dec.h"
@ -330,7 +334,7 @@ IA_ERRORCODE ixheaacd_mps212_config(
pstr_usac_mps212_config->bs_residual_bands =
ixheaacd_read_bits_buf(it_bit_buff, 5);
if (pstr_usac_mps212_config->bs_residual_bands > MAX_PARAMETER_BANDS)
if (pstr_usac_mps212_config->bs_residual_bands > MAX_PARAMETER_BANDS_MPS)
return IA_FATAL_ERROR;
pstr_usac_mps212_config->bs_ott_bands_phase =
@ -470,7 +474,6 @@ WORD32 ixheaacd_config_extension(
USAC_MAX_CONFIG_EXTENSIONS * sizeof(WORD32));
for (j = 0; j < num_config_extensions; j++) {
UWORD32 tmp;
UWORD32 fill_byte_val = 0xa5;
ixheaacd_read_escape_value(it_bit_buff, &(usac_config_ext_type), 4, 8, 16);
@ -499,7 +502,7 @@ WORD32 ixheaacd_config_extension(
pstr_usac_decoder_config->usac_cfg_ext_info_present[j] = 1;
} else {
for (i = 0; i < usac_config_ext_len; i++)
tmp = ixheaacd_read_bits_buf(it_bit_buff, 8);
ixheaacd_read_bits_buf(it_bit_buff, 8);
}
break;
}

View file

@ -75,6 +75,7 @@
#include "ixheaacd_aacdec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_struct_def.h"
@ -428,7 +429,7 @@ ia_aac_decoder_struct *ixheaacd_aac_decoder_init(
}
} else {
WORD16 *ptr_sfb_idx[2];
const WORD8 *ptr_sfb_width[2];
const WORD8 *ptr_sfb_width[2] = {0};
WORD width_idx;
WORD32 j;

View file

@ -71,6 +71,7 @@
#include "ixheaacd_aacdec.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_struct_def.h"
@ -156,7 +157,6 @@ IA_ERRORCODE ixheaacd_latm_stream_mux_config(
UWORD32 lay;
WORD32 bytes_consumed;
WORD32 audio_mux_version_a;
UWORD32 tara_buf_fullness;
IA_ERRORCODE error_code = AAC_DEC_OK;
ixheaacd_latm_layer_info *layer_info = 0;
@ -169,7 +169,7 @@ IA_ERRORCODE ixheaacd_latm_stream_mux_config(
if (audio_mux_version_a == 0) {
if (latm_element->audio_mux_version == 1) {
tara_buf_fullness = ixheaacd_latm_get_value(it_bit_buff);
ixheaacd_latm_get_value(it_bit_buff);/*tara_buf_fullness*/
}
latm_element->all_streams_same_time_framing =
ixheaacd_read_bits_buf(it_bit_buff, 1);

View file

@ -0,0 +1,312 @@
/******************************************************************************
* *
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include "ixheaacd_type_def.h"
#include <ixheaacd_constants.h>
#include <ixheaacd_error_standards.h>
#include "ixheaacd_bitbuffer.h"
#include "ixheaacd_config.h"
#include <assert.h>
#ifndef sign
#define sign(a) (((a) > 0) ? 1 : ((a) < 0) ? -1 : 0)
#endif
typedef struct {
WORD32 num_input_chan;
WORD32 num_output_chan;
WORD32 num_ott_boxes;
WORD32 num_ttt_boxes;
WORD32 ott_mode_lfe[MAX_NUM_OTT];
} TREEPROPERTIES;
static WORD32 ixheaacd_freq_res_table[] = {0, 23, 15, 12, 9, 7, 5, 4};
static WORD32 ixheaacd_HRTF_freq_res_table[][8] = {{0, 28, 20, 14, 10, 7, 5, 4},
{0, 13, 13, 8, 7, 4, 3, 3}};
static TREEPROPERTIES ixheaacd_tree_property_table[] = {
{1, 6, 5, 0, {0, 0, 0, 0, 1}}, {1, 6, 5, 0, {0, 0, 1, 0, 0}},
{2, 6, 3, 1, {1, 0, 0, 0, 0}}, {2, 8, 5, 1, {1, 0, 0, 0, 0}},
{2, 8, 5, 1, {1, 0, 0, 0, 0}}, {6, 8, 2, 0, {0, 0, 0, 0, 0}},
{6, 8, 2, 0, {0, 0, 0, 0, 0}}, {1, 2, 1, 0, {0, 0, 0, 0, 0}}};
static IA_ERRORCODE ixheaacd_ld_spatial_extension_config(
ia_bit_buf_struct *it_bit_buff, ia_usac_dec_mps_config_struct *config,
WORD32 bits_available) {
WORD32 j, ch, idx, tmp, tmp_open, sac_ext_len, bits_read, n_fill_bits;
UWORD32 i;
WORD32 ba = bits_available;
config->sac_ext_cnt = 0;
tmp = it_bit_buff->cnt_bits;
while (ba >= 8) {
if (config->sac_ext_cnt >= MAX_NUM_EXT_TYPES) return IA_FATAL_ERROR;
config->bs_sac_ext_type[config->sac_ext_cnt] =
ixheaacd_read_bits_buf(it_bit_buff, 4);
ba -= 4;
sac_ext_len = ixheaacd_read_bits_buf(it_bit_buff, 4);
ba -= 4;
if ((ba >= 6) && (sac_ext_len > 0)) {
if (sac_ext_len == 15) {
sac_ext_len += ixheaacd_read_bits_buf(it_bit_buff, 8);
ba -= 8;
if (sac_ext_len == 15 + 255) {
sac_ext_len += ixheaacd_read_bits_buf(it_bit_buff, 16);
ba -= 16;
}
}
switch (config->bs_sac_ext_type[config->sac_ext_cnt]) {
case 0:
config->bs_residual_coding = 1;
config->bs_residual_sampling_freq_index =
ixheaacd_read_bits_buf(it_bit_buff, 4);
config->bs_residual_frames_per_spatial_frame =
ixheaacd_read_bits_buf(it_bit_buff, 2);
if ((config->num_ott_boxes + config->num_ttt_boxes) >
MAX_RESIDUAL_CHANNELS)
return IA_FATAL_ERROR;
for (j = 0; j < config->num_ott_boxes + config->num_ttt_boxes; j++) {
config->bs_residual_present[j] =
ixheaacd_read_bits_buf(it_bit_buff, 1);
if (config->bs_residual_present[j]) {
config->bs_residual_bands_ld_mps[j] =
ixheaacd_read_bits_buf(it_bit_buff, 5);
}
}
break;
case 1:
config->bs_arbitrary_downmix = 2;
config->bs_arbitrary_downmix_residual_sampling_freq_index =
ixheaacd_read_bits_buf(it_bit_buff, 4);
config->bs_arbitrary_downmix_residual_frames_per_spatial_frame =
ixheaacd_read_bits_buf(it_bit_buff, 2);
config->bs_arbitrary_downmix_residual_bands =
ixheaacd_read_bits_buf(it_bit_buff, 5);
break;
case 2:
config->num_out_chan_AT = 0;
config->num_ott_boxes_AT = 0;
if (config->num_output_channels > MAX_OUTPUT_CHANNELS)
return IA_FATAL_ERROR;
for (ch = 0; ch < config->num_output_channels; ch++) {
tmp_open = 1;
idx = 0;
while ((tmp_open > 0) && (idx < MAX_ARBITRARY_TREE_INDEX)) {
config->bs_ott_box_present_AT[ch][idx] =
ixheaacd_read_bits_buf(it_bit_buff, 1);
if (config->bs_ott_box_present_AT[ch][idx]) {
config->num_ott_boxes_AT++;
tmp_open++;
} else {
config->num_out_chan_AT++;
tmp_open--;
}
idx++;
}
}
for (i = 0; i < config->num_ott_boxes_AT; i++) {
config->bs_ott_default_cld_AT[i] =
ixheaacd_read_bits_buf(it_bit_buff, 1);
config->bs_ott_mode_lfe_AT[i] =
ixheaacd_read_bits_buf(it_bit_buff, 1);
if (config->bs_ott_mode_lfe_AT[i]) {
config->bs_ott_bands_AT[i] =
ixheaacd_read_bits_buf(it_bit_buff, 5);
} else {
config->bs_ott_bands_AT[i] = ixheaacd_freq_res_table[config->bs_freq_res];
}
}
for (i = 0; i < config->num_out_chan_AT; i++) {
config->bs_output_channel_pos_AT[i] =
ixheaacd_read_bits_buf(it_bit_buff, 5);
}
break;
default:;
}
}
bits_read = tmp - it_bit_buff->cnt_bits;
n_fill_bits = 8 * sac_ext_len - bits_read;
while (n_fill_bits > 7) {
ixheaacd_read_bits_buf(it_bit_buff, 8);
n_fill_bits -= 8;
}
if (n_fill_bits > 0) {
ixheaacd_read_bits_buf(it_bit_buff, n_fill_bits);
}
ba -= 8 * sac_ext_len;
config->sac_ext_cnt++;
}
return IA_NO_ERROR;
}
IA_ERRORCODE ixheaacd_ld_spatial_specific_config(
ia_usac_dec_mps_config_struct *config, ia_bit_buf_struct *it_bit_buff) {
WORD32 i, num_header_bits;
UWORD32 hc, hb;
WORD32 sac_header_len;
WORD32 bits_available;
WORD32 tmp = it_bit_buff->cnt_bits;
WORD32 err = 0;
sac_header_len = tmp;
bits_available = sac_header_len;
config->bs_sampling_freq_index = ixheaacd_read_bits_buf(it_bit_buff, 4);
if (config->bs_sampling_freq_index == 15) {
config->bs_fampling_frequency = ixheaacd_read_bits_buf(it_bit_buff, 24);
}
config->bs_frame_length = ixheaacd_read_bits_buf(it_bit_buff, 5);
config->bs_freq_res = ixheaacd_read_bits_buf(it_bit_buff, 3);
config->bs_tree_config = ixheaacd_read_bits_buf(it_bit_buff, 4);
if (config->bs_tree_config > 7) return IA_FATAL_ERROR;
if (config->bs_tree_config != 15) {
config->num_ott_boxes =
ixheaacd_tree_property_table[config->bs_tree_config].num_ott_boxes;
config->num_ttt_boxes =
ixheaacd_tree_property_table[config->bs_tree_config].num_ttt_boxes;
config->num_input_channels =
ixheaacd_tree_property_table[config->bs_tree_config].num_input_chan;
config->num_output_channels =
ixheaacd_tree_property_table[config->bs_tree_config].num_output_chan;
for (i = 0; i < MAX_NUM_OTT; i++) {
config->ott_mode_lfe[i] =
ixheaacd_tree_property_table[config->bs_tree_config].ott_mode_lfe[i];
}
}
config->bs_quant_mode = ixheaacd_read_bits_buf(it_bit_buff, 2);
if (config->bs_tree_config != 7) {
config->bs_one_icc = ixheaacd_read_bits_buf(it_bit_buff, 1);
}
config->bs_arbitrary_downmix = ixheaacd_read_bits_buf(it_bit_buff, 1);
if (config->bs_tree_config != 7) {
config->bs_fixed_gain_sur = ixheaacd_read_bits_buf(it_bit_buff, 3);
config->bs_fixed_gain_LFE = ixheaacd_read_bits_buf(it_bit_buff, 3);
}
config->bs_fixed_gain_dmx = ixheaacd_read_bits_buf(it_bit_buff, 3);
if (config->bs_tree_config != 7) {
config->bs_matrix_mode = ixheaacd_read_bits_buf(it_bit_buff, 1);
}
config->bs_temp_shape_config = ixheaacd_read_bits_buf(it_bit_buff, 2);
config->bs_decorr_config = ixheaacd_read_bits_buf(it_bit_buff, 2);
if (config->bs_tree_config != 7) {
config->bs_3D_audio_mode = ixheaacd_read_bits_buf(it_bit_buff, 1);
} else {
config->bs_3D_audio_mode = 0;
}
// ott_config
for (i = 0; i < config->num_ott_boxes; i++) {
if (config->ott_mode_lfe[i]) {
config->bs_ott_bands[i] = ixheaacd_read_bits_buf(it_bit_buff, 5);
} else {
config->bs_ott_bands[i] = ixheaacd_freq_res_table[config->bs_freq_res];
}
}
// ttt_config
for (i = 0; i < config->num_ttt_boxes; i++) {
config->bs_ttt_dual_mode[i] = ixheaacd_read_bits_buf(it_bit_buff, 1);
config->bs_ttt_mode_low[i] = ixheaacd_read_bits_buf(it_bit_buff, 3);
if (config->bs_ttt_dual_mode[i]) {
config->bs_ttt_mode_high[i] = ixheaacd_read_bits_buf(it_bit_buff, 3);
config->bs_ttt_bands_low[i] = ixheaacd_read_bits_buf(it_bit_buff, 5);
config->bs_ttt_bands_high[i] = ixheaacd_freq_res_table[config->bs_freq_res];
} else {
config->bs_ttt_bands_low[i] = ixheaacd_freq_res_table[config->bs_freq_res];
}
}
if (config->bs_temp_shape_config == 2) {
config->bs_env_quant_mode = ixheaacd_read_bits_buf(it_bit_buff, 1);
}
if (config->bs_3D_audio_mode) {
config->bs_3D_audio_HRTF_set = ixheaacd_read_bits_buf(it_bit_buff, 2);
// param_HRTF_set
if (config->bs_3D_audio_HRTF_set == 0) {
config->bs_HRTF_freq_res = ixheaacd_read_bits_buf(it_bit_buff, 3);
config->bs_HRTF_num_chan = 5;
config->bs_HRTF_asymmetric = ixheaacd_read_bits_buf(it_bit_buff, 1);
config->HRTF_num_band = ixheaacd_HRTF_freq_res_table[0][config->bs_HRTF_freq_res];
config->HRTF_num_phase = ixheaacd_HRTF_freq_res_table[1][config->bs_HRTF_freq_res];
for (hc = 0; hc < config->bs_HRTF_num_chan; hc++) {
for (hb = 0; hb < config->HRTF_num_band; hb++) {
config->bs_HRTF_level_left[hc][hb] =
ixheaacd_read_bits_buf(it_bit_buff, 6);
}
for (hb = 0; hb < config->HRTF_num_band; hb++) {
config->bs_HRTF_level_right[hc][hb] =
config->bs_HRTF_asymmetric
? ixheaacd_read_bits_buf(it_bit_buff, 6)
: config->bs_HRTF_level_left[hc][hb];
}
config->bs_HRTF_phase[hc] = ixheaacd_read_bits_buf(it_bit_buff, 1);
for (hb = 0; hb < config->HRTF_num_phase; hb++) {
config->bs_HRTF_phase_LR[hc][hb] =
config->bs_HRTF_phase[hc] ? ixheaacd_read_bits_buf(it_bit_buff, 6)
: 0;
}
config->bs_HRTF_icc[hc] = ixheaacd_read_bits_buf(it_bit_buff, 1);
if (config->bs_HRTF_icc[hc]) {
for (hb = 0; hb < config->HRTF_num_band; hb++)
config->bs_HRTF_icc_LR[hc][hb] =
ixheaacd_read_bits_buf(it_bit_buff, 3);
}
}
}
}
// byte_align
i = (it_bit_buff->cnt_bits & 0x7);
ixheaacd_read_bits_buf(it_bit_buff, i);
num_header_bits = tmp - (it_bit_buff->cnt_bits);
bits_available -= num_header_bits;
err =
ixheaacd_ld_spatial_extension_config(it_bit_buff, config, bits_available);
return err;
}

View file

@ -0,0 +1,207 @@
/******************************************************************************
* *
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "ixheaacd_sbr_common.h"
#include "ixheaacd_type_def.h"
#include "ixheaacd_constants.h"
#include "ixheaacd_basic_ops32.h"
#include "ixheaacd_basic_ops16.h"
#include "ixheaacd_basic_ops40.h"
#include "ixheaacd_basic_ops.h"
#include "ixheaacd_bitbuffer.h"
#include "ixheaacd_basic_op.h"
#include "ixheaacd_intrinsics.h"
#include "ixheaacd_sbr_const.h"
#include "ixheaacd_defines.h"
#include "ixheaacd_aac_rom.h"
#include "ixheaacd_definitions.h"
#include "ixheaacd_error_codes.h"
#include "ixheaacd_pulsedata.h"
#include "ixheaacd_pns.h"
#include "ixheaacd_drc_data_struct.h"
#include "ixheaacd_lt_predict.h"
#include "ixheaacd_channelinfo.h"
#include "ixheaacd_cnst.h"
#include "ixheaacd_drc_dec.h"
#include "ixheaacd_sbrdecoder.h"
#include "ixheaacd_block.h"
#include "ixheaacd_channel.h"
#include "ixheaacd_sbr_payload.h"
#include "ixheaacd_common_rom.h"
#include "ixheaacd_type_def.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_env_extr_part.h"
#include "ixheaacd_sbr_rom.h"
#include "ixheaacd_stereo.h"
#include "ixheaacd_lpp_tran.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_env_extr.h"
#include "ixheaacd_adts.h"
#
#include "ixheaacd_audioobjtypes.h"
#include "ixheaacd_memory_standards.h"
#include "ixheaacd_latmdemux.h"
#include "ixheaacd_aacdec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_env_calc.h"
#include "ixheaacd_pvc_dec.h"
#include "ixheaacd_sbr_dec.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_struct_def.h"
#include "ixheaacd_mps_process.h"
#include "ixheaacd_ld_mps_dec.h"
#include "ixheaacd_interface.h"
#include "ixheaacd_info.h"
#include "ixheaacd_tns_usac.h"
#include "ixheaacd_acelp_info.h"
#include "ixheaacd_main.h"
#include "ixheaacd_struct.h"
#include "ixheaacd_create.h"
WORD32 ixheaacd_ld_qmf_analysis(ia_mps_dec_state_struct *self,
WORD16 *output_buf) {
WORD32 *p_arr_qmf_buf_real[MAX_ENV_COLS + MAX_ENV_COLS];
WORD32 **p_arr_qmf_buf_imag = &p_arr_qmf_buf_real[MAX_ENV_COLS];
WORD32 temp_arr[64 * 64];
WORD32 *ptr = &temp_arr[0];
float in_gain_n_q8_fac = self->input_gain * 0.00390625f;
int i;
WORD32 ts;
for (ts = 2; ts < self->time_slots + 2; ts++) {
p_arr_qmf_buf_real[ts] = ptr;
ptr += NO_SYNTHESIS_CHANNELS;
p_arr_qmf_buf_imag[ts] = ptr;
ptr += NO_SYNTHESIS_CHANNELS;
}
self->str_mps_qmf_bank.num_time_slots = self->time_slots;
self->str_mps_qmf_bank.no_channels = self->qmf_band_count;
ixheaacd_cplx_anal_qmffilt_32((WORD32 *)output_buf, self->str_sbr_scale_fact,
&p_arr_qmf_buf_real[0], &p_arr_qmf_buf_imag[0],
&self->str_mps_qmf_bank,
self->qmf_dec_tables_ptr, 2, 0);
for (ts = 0; ts < self->time_slots; ts++) {
for (i = 0; i < self->qmf_band_count; i++) {
self->qmf_in[0][ts][i].re =
(p_arr_qmf_buf_real[ts + 2][i] * in_gain_n_q8_fac);
self->qmf_in[0][ts][i].im =
(p_arr_qmf_buf_imag[ts + 2][i] * in_gain_n_q8_fac);
}
}
return 0;
}
WORD32 ixheaacd_ld_mps_apply(ia_exhaacplus_dec_api_struct *p_obj_exhaacplus_dec,
WORD16 *output_buf) {
ia_aac_dec_state_struct *aac_handle = p_obj_exhaacplus_dec->p_state_aac;
ia_mps_dec_state_struct *mps_handle = &(aac_handle->mps_dec_handle);
WORD32 err = 0;
WORD32 ts, i;
ia_dec_data_struct *pstr_dec_data =
(ia_dec_data_struct *)aac_handle->pstr_dec_data;
ia_usac_data_struct *pstr_usac_data = &(pstr_dec_data->str_usac_data);
mps_handle->hyb_band_count[0] = mps_handle->hyb_band_count_max;
mps_handle->hyb_band_count[1] = mps_handle->hyb_band_count_max;
err = ixheaacd_mps_frame_decode(mps_handle);
if (err != IA_NO_ERROR) return err;
if (mps_handle->ldmps_config.bs_tree_config == 7) {
ixheaacd_pre_and_mix_matrix_calculation(&(aac_handle->mps_dec_handle));
ixheaacd_mps_pre_matrix_mix_matrix_smoothing(&(aac_handle->mps_dec_handle));
}
mps_handle->output_buffer = pstr_usac_data->time_sample_vector;
if (mps_handle->ldmps_config.no_ldsbr_present)
ixheaacd_ld_qmf_analysis(mps_handle, output_buf);
else {
for (ts = 0; ts < mps_handle->time_slots; ts++) {
FLOAT32 *qmf_re = p_obj_exhaacplus_dec->p_state_aac->str_sbr_dec_info[0]
->pstr_sbr_channel[0]
->str_sbr_dec.mps_qmf_buf_real[ts + 2];
FLOAT32 *qmf_im = p_obj_exhaacplus_dec->p_state_aac->str_sbr_dec_info[0]
->pstr_sbr_channel[0]
->str_sbr_dec.mps_qmf_buf_imag[ts + 2];
for (i = 0; i < mps_handle->qmf_band_count; i++) {
mps_handle->qmf_in[0][ts][i].re = qmf_re[i] * mps_handle->input_gain;
mps_handle->qmf_in[0][ts][i].im = qmf_im[i] * mps_handle->input_gain;
}
}
}
ixheaacd_mps_qmf_hyb_analysis(mps_handle);
err = ixheaacd_mps_apply_pre_matrix(mps_handle);
if (err < 0) return err;
ixheaacd_mps_create_w(mps_handle);
if ((!(mps_handle->res_bands | mps_handle->pre_mix_req)) &&
(mps_handle->config->bs_phase_coding == 0)) {
err = ixheaacd_mps_apply_mix_matrix_type1(mps_handle);
} else if (mps_handle->pre_mix_req) {
err = ixheaacd_mps_apply_mix_matrix_type2(mps_handle);
} else {
err = ixheaacd_mps_apply_mix_matrix_type3(mps_handle);
}
if (err < 0) return err;
if (mps_handle->ldmps_config.bs_temp_shape_config == 2) {
ixheaacd_mps_time_env_shaping(mps_handle);
}
err = ixheaacd_mps_temp_process(mps_handle);
mps_handle->pre_mix_req = 0;
if (err)
return err;
return err;
}

View file

@ -0,0 +1,31 @@
/******************************************************************************
* *
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*****************************************************************************
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
WORD32 ixheaacd_ld_mps_apply(ia_exhaacplus_dec_api_struct *p_obj_exhaacplus_dec,
WORD16 *output_buf);
IA_ERRORCODE ixheaacd_ld_mps_frame_parsing(
ia_mps_dec_state_struct *self, ia_handle_bit_buf_struct it_bit_buff);
WORD32 ixheaacd_extension_payload(ia_bit_buf_struct *it_bit_buff, WORD32 *cnt,
ia_mps_dec_state_struct *self);
IA_ERRORCODE ixheaacd_ld_spatial_specific_config(
ia_usac_dec_mps_config_struct *config, ia_bit_buf_struct *it_bit_buff);

View file

@ -356,7 +356,7 @@ WORD32 ixheaacd_lpd_dec(ia_usac_data_struct *usac_data,
WORD32 *ptr_scratch = &usac_data->scratch_buffer[0];
WORD32 subfr_len, n_subfr;
WORD32 subfr_len = 0, n_subfr = 0;
WORD32 err = 0;
len_fr = usac_data->ccfl;
@ -663,15 +663,13 @@ WORD32 ixheaacd_lpd_bpf_fix(ia_usac_data_struct *usac_data,
float *synth, synth_corr, synth_energy;
WORD32 pitch[NUM_SUBFR_SUPERFRAME_BY2 + 3];
float pitch_gain[NUM_SUBFR_SUPERFRAME_BY2 + 3];
WORD32 len_fr, lpd_sbf_len, lpd_delay, num_subfr_by2, synth_delay, fac_length;
WORD32 len_fr, lpd_sbf_len, num_subfr_by2, synth_delay;
WORD32 err = 0;
len_fr = usac_data->ccfl;
lpd_sbf_len = (NUM_FRAMES * usac_data->num_subfrm) / 2;
lpd_delay = lpd_sbf_len * LEN_SUBFR;
num_subfr_by2 = lpd_sbf_len - 1;
synth_delay = num_subfr_by2 * LEN_SUBFR;
fac_length = (usac_data->len_subfrm) / 2;
ixheaacd_memset(synth_buf, MAX_PITCH + synth_delay + len_fr);
ixheaacd_mem_cpy(st->synth_prev, synth_buf, MAX_PITCH + synth_delay);

View file

@ -65,7 +65,7 @@ VOID ixheaacd_lsf_weight_2st_flt(FLOAT32 *lsfq, FLOAT32 *w, WORD32 mode) {
}
static WORD32 ixheaacd_decoding_avq_tool(WORD32 *read_arr, WORD32 *nvecq) {
WORD32 i, k, n, qn, nk, kv[8] = {0};
WORD32 i, k, qn, kv[8] = {0};
WORD32 code_book_idx;
WORD32 *ptr_kv = &kv[0];
@ -74,13 +74,6 @@ static WORD32 ixheaacd_decoding_avq_tool(WORD32 *read_arr, WORD32 *nvecq) {
for (k = 0; k < 2; k++) {
qn = read_arr[k];
nk = 0;
n = qn;
if (qn > 4) {
nk = (qn - 3) >> 1;
n = qn - nk * 2;
}
if (qn > 0) {
code_book_idx = read_arr[position++];
@ -104,7 +97,7 @@ static WORD32 ixheaacd_avq_first_approx_abs(FLOAT32 *lsf, WORD32 *indx) {
extern const FLOAT32 ixheaacd_weight_table_avq[];
WORD32 position = 0;
WORD32 avq[ORDER];
FLOAT32 d[ORDER + 1], lsf_min;
FLOAT32 lsf_min;
const FLOAT32 *ptr_w;
ptr_w = &ixheaacd_weight_table_avq[(indx[0] * ORDER)];
@ -117,12 +110,6 @@ static WORD32 ixheaacd_avq_first_approx_abs(FLOAT32 *lsf, WORD32 *indx) {
position += ixheaacd_decoding_avq_tool(&indx[position], avq);
d[0] = lsf[0];
d[ORDER] = FREQ_MAX - lsf[ORDER - 1];
for (i = 1; i < ORDER; i++) {
d[i] = lsf[i] - lsf[i - 1];
}
lsf_min = LSF_GAP;
for (i = 0; i < ORDER; i++) {
lsf[i] += (ptr_w[i] * avq[i]);

View file

@ -72,6 +72,7 @@
#include "ixheaacd_latmdemux.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_aacdec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_config.h"
@ -352,7 +353,8 @@ VOID ixheaacd_imdct_process(ia_aac_dec_overlap_info *ptr_aac_dec_overlap_info,
ia_ics_info_struct *ptr_ics_info, VOID *out_samples,
const WORD16 ch_fac, WORD32 *scratch,
ia_aac_dec_tables_struct *ptr_aac_tables,
WORD32 object_type, WORD slot_element) {
WORD32 object_type, WORD32 ld_mps_present,
WORD slot_element) {
WORD32 *ptr_overlap_buf;
const WORD16 *ptr_long_window;
const WORD16 *ptr_short_window;
@ -443,12 +445,18 @@ VOID ixheaacd_imdct_process(ia_aac_dec_overlap_info *ptr_aac_dec_overlap_info,
q_shift, 240);
}
} else {
ixheaacd_eld_dec_windowing(ptr_spec_coeff, ptr_long_window,
ptr_ics_info->frame_length, q_shift,
ptr_overlap_buf, ch_fac,
(WORD16 *)out_samples, slot_element);
ptr_ics_info->qshift_adj = -2;
if (ld_mps_present == 1) {
ixheaacd_eld_dec_windowing_32bit(
ptr_spec_coeff, ptr_long_window,
ptr_ics_info->frame_length, q_shift, ptr_overlap_buf,
ch_fac, (WORD32 *)out_samples);
} else {
ixheaacd_eld_dec_windowing(
ptr_spec_coeff, ptr_long_window,
ptr_ics_info->frame_length, q_shift, ptr_overlap_buf,
ch_fac, (WORD16 *)out_samples, slot_element);
ptr_ics_info->qshift_adj = -2;
}
}
}
break;
@ -860,3 +868,201 @@ void ixheaacd_eld_dec_windowing(WORD32 *ptr_spect_coeff, const WORD16 *p_win,
}
}
}
void ixheaacd_eld_dec_windowing_32bit(WORD32 *ptr_spect_coeff,
const WORD16 *p_win, WORD32 framesize,
WORD16 q_shift, WORD32 *p_overlap_buffer,
const WORD16 stride, WORD32 *out_samples)
{
WORD32 i = 0;
WORD32 loop_size;
WORD32 *ptr_z = ptr_spect_coeff;
WORD32 *ptr_out, *p_out2;
WORD32 *p_overlap_buffer32 = (WORD32 *)p_overlap_buffer;
WORD32 delay = framesize >> 2;
ptr_z = ptr_spect_coeff + delay;
p_win += delay;
ptr_out = p_overlap_buffer32;
q_shift = q_shift + 2;
if (q_shift >= 0) {
for (i = (delay)-1; i >= 0; i--) {
WORD32 win_op;
WORD16 win_val;
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*out_samples =
ixheaacd_add32_sat(ixheaacd_shl32(win_op, q_shift), *ptr_out++);
out_samples += stride;
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*out_samples =
ixheaacd_add32_sat(ixheaacd_shl32(win_op, q_shift), *ptr_out++);
out_samples += stride;
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*out_samples =
ixheaacd_add32_sat(ixheaacd_shl32(win_op, q_shift), *ptr_out++);
out_samples += stride;
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*out_samples =
ixheaacd_add32_sat(ixheaacd_shl32(win_op, q_shift), *ptr_out++);
out_samples += stride;
}
p_out2 = p_overlap_buffer32;
loop_size = (((framesize * 3) - framesize) >> 2) - 1;
for (i = loop_size; i >= 0; i--) {
WORD32 win_op;
WORD16 win_val;
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*p_out2++ =
ixheaacd_add32_sat(ixheaacd_shl32(win_op, q_shift), *ptr_out++);
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*p_out2++ =
ixheaacd_add32_sat(ixheaacd_shl32(win_op, q_shift), *ptr_out++);
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*p_out2++ =
ixheaacd_add32_sat(ixheaacd_shl32(win_op, q_shift), *ptr_out++);
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*p_out2++ =
ixheaacd_add32_sat(ixheaacd_shl32(win_op, q_shift), *ptr_out++);
}
loop_size = ((((framesize << 2) - delay) - (framesize * 3)) >> 2) - 1;
for (i = loop_size; i >= 0; i--) {
WORD32 win_op;
WORD16 win_val;
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*p_out2++ = ixheaacd_shl32(win_op, q_shift);
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*p_out2++ = ixheaacd_shl32(win_op, q_shift);
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*p_out2++ = ixheaacd_shl32(win_op, q_shift);
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*p_out2++ = ixheaacd_shl32(win_op, q_shift);
}
} else {
q_shift = -q_shift;
for (i = (delay)-1; i >= 0; i--) {
WORD32 win_op;
WORD16 win_val;
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*out_samples =
ixheaacd_add32_sat(ixheaacd_shr32(win_op, q_shift), *ptr_out++);
out_samples += stride;
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*out_samples =
ixheaacd_add32_sat(ixheaacd_shr32(win_op, q_shift), *ptr_out++);
out_samples += stride;
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*out_samples =
ixheaacd_add32_sat(ixheaacd_shr32(win_op, q_shift), *ptr_out++);
out_samples += stride;
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*out_samples =
ixheaacd_add32_sat(ixheaacd_shr32(win_op, q_shift), *ptr_out++);
out_samples += stride;
}
p_out2 = p_overlap_buffer32;
loop_size = (((framesize * 3) - framesize) >> 2) - 1;
for (i = loop_size; i >= 0; i--) {
WORD32 win_op;
WORD16 win_val;
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*p_out2++ =
ixheaacd_add32_sat(ixheaacd_shr32(win_op, q_shift), *ptr_out++);
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*p_out2++ =
ixheaacd_add32_sat(ixheaacd_shr32(win_op, q_shift), *ptr_out++);
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*p_out2++ =
ixheaacd_add32_sat(ixheaacd_shr32(win_op, q_shift), *ptr_out++);
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*p_out2++ =
ixheaacd_add32_sat(ixheaacd_shr32(win_op, q_shift), *ptr_out++);
}
loop_size = ((((framesize << 2) - delay) - (framesize * 3)) >> 2) - 1;
for (i = loop_size; i >= 0; i--) {
WORD32 win_op;
WORD16 win_val;
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*p_out2++ = ixheaacd_shr32(win_op, q_shift);
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*p_out2++ = ixheaacd_shr32(win_op, q_shift);
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*p_out2++ = ixheaacd_shr32(win_op, q_shift);
win_val = *p_win++;
win_op = ixheaacd_mult32x16in32(*ptr_z++, (win_val));
*p_out2++ = ixheaacd_shr32(win_op, q_shift);
}
}
}

View file

@ -815,7 +815,7 @@ VOID ixheaacd_low_pow_hf_generator(ia_sbr_hf_generator_struct *hf_generator,
stop_patch = hf_generator->pstr_settings->stop_patch;
for (low_band = start_patch; low_band < stop_patch; low_band++) {
WORD32 src_start_band, src_end_band, dst_start_band, dst_end_band;
WORD32 src_start_band, src_end_band, dst_start_band;
patch = 0;
while (patch < num_patches) {
@ -824,7 +824,6 @@ VOID ixheaacd_low_pow_hf_generator(ia_sbr_hf_generator_struct *hf_generator,
src_start_band = ptr_loc_patch_param->src_start_band;
src_end_band = ptr_loc_patch_param->src_end_band;
dst_start_band = ptr_loc_patch_param->dst_start_band;
dst_end_band = ptr_loc_patch_param->dst_end_band;
high_band = (low_band + ptr_loc_patch_param->dst_end_band);

View file

@ -218,13 +218,12 @@ VOID ixheaacd_filter_bank_ltp(ia_aac_dec_tables_struct *aac_tables_ptr,
}
} else {
WORD32 *win1, *win2, *win3;
WORD32 *win1, *win2;
WORD32 *ptr_in1, *ptr_in2;
win1 = (WORD32 *)window_long_prev;
win2 = (WORD32 *)window_long;
ptr_in1 = &in_data[0];
ptr_in2 = &in_data[nlong];
win3 = win2 + nlong - 1;
for (i = nlong - 1; i >= 0; i--) {
WORD32 temp1 = ixheaacd_mult32_shl(*ptr_in1, *win1++);

View file

@ -29,6 +29,7 @@
#include "ixheaacd_bitbuffer.h"
#include "ixheaacd_defines.h"
#include "ixheaacd_sbr_const.h"
#include "ixheaacd_memory_standards.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_env_extr_part.h"
@ -52,6 +53,15 @@
#include "ixheaacd_aacdec.h"
#include "ixheaacd_sbr_common.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_lpp_tran.h"
#include "ixheaacd_env_extr.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_env_calc.h"
#include "ixheaacd_pvc_dec.h"
#include "ixheaacd_sbr_dec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_config.h"
#include "ixheaacd_mps_dec.h"
@ -71,7 +81,6 @@
#include "ixheaacd_mps_huff_tab.h"
#include "math.h"
#include <assert.h>
#include <string.h>
#include "ixheaacd_error_standards.h"
@ -116,7 +125,9 @@ WORD32 ixheaacd_mps_create(ia_mps_dec_state_struct* self, WORD32 bs_frame_len,
err_code = ixheaacd_mps_header_decode(self);
if (err_code != 0) return err_code;
if (err_code != IA_NO_ERROR) {
return err_code;
}
if ((self->residual_coding) && (self->res_bands > 0)) self->res_ch_count++;
@ -134,8 +145,12 @@ WORD32 ixheaacd_mps_create(ia_mps_dec_state_struct* self, WORD32 bs_frame_len,
ixheaacd_mps_qmf_hybrid_analysis_init(&self->hyb_filt_state[1]);
err_code = ixheaacd_mps_decor_init(&(self->mps_decor), self->hyb_band_count_max,
self->config->bs_decorr_config);
if (err_code != IA_NO_ERROR) return err_code;
self->config->bs_decorr_config,
self->object_type);
if (err_code != IA_NO_ERROR) {
return err_code;
}
ixheaacd_mps_init_pre_and_post_matrix(self);
@ -156,6 +171,7 @@ WORD32 ixheaacd_mps_create(ia_mps_dec_state_struct* self, WORD32 bs_frame_len,
MAX_PARAMETER_BANDS * sizeof(WORD32));
memset(self->opd_smooth.smooth_r_phase, 0,
MAX_PARAMETER_BANDS * sizeof(WORD32));
self->mps_init_done = 1;
return 0;
}
@ -169,9 +185,21 @@ static const FLOAT32 ixheaacd_tsd_mul_im[] = {
0.0f, -0.707106781186548f, -1.0f, -0.707106781186548f};
VOID ixheaacd_mps_qmf_hyb_analysis(ia_mps_dec_state_struct* self) {
ixheaacd_mps_qmf_hybrid_analysis(&self->hyb_filt_state[0], self->qmf_in[0],
self->band_count[0], self->time_slots,
if (self->object_type == AOT_ER_AAC_ELD ||
self->object_type == AOT_ER_AAC_LD) {
int k, n;
for (n = 0; n < self->time_slots; n++) {
for (k = 0; k < self->qmf_band_count; k++) {
self->hyb_in[0][k][n].re = self->qmf_in[0][n][k].re;
self->hyb_in[0][k][n].im = self->qmf_in[0][n][k].im;
}
}
} else {
ixheaacd_mps_qmf_hybrid_analysis(&self->hyb_filt_state[0], self->qmf_in[0],
self->qmf_band_count, self->time_slots,
self->hyb_in[0]);
}
if ((self->residual_coding) && (self->res_bands > 0)) {
ixheaacd_mps_qmf_hybrid_analysis(&self->hyb_filt_state[self->in_ch_count],
@ -183,10 +211,23 @@ VOID ixheaacd_mps_qmf_hyb_analysis(ia_mps_dec_state_struct* self) {
VOID ixheaacd_mps_qmf_hyb_synthesis(ia_mps_dec_state_struct* self) {
WORD32 ch;
for (ch = 0; ch < self->out_ch_count; ch++) {
ixheaacd_mps_qmf_hybrid_synthesis(self->hyb_dir_out[ch],
self->band_count[0], self->time_slots,
if (self->object_type == AOT_ER_AAC_ELD ||
self->object_type == AOT_ER_AAC_LD) {
int k, n;
for (ch = 0; ch < self->out_ch_count; ch++) {
for (n = 0; n < self->time_slots; n++) {
for (k = 0; k < self->qmf_band_count; k++) {
self->qmf_out_dir[ch][n][k].re = self->hyb_dir_out[ch][n][k].re;
self->qmf_out_dir[ch][n][k].im = self->hyb_dir_out[ch][n][k].im;
}
}
}
} else {
for (ch = 0; ch < self->out_ch_count; ch++) {
ixheaacd_mps_qmf_hybrid_synthesis(self->hyb_dir_out[ch],
self->qmf_band_count, self->time_slots,
self->qmf_out_dir[ch]);
}
}
}
@ -216,7 +257,8 @@ VOID ixheaacd_mps_decor(ia_mps_dec_state_struct* self) {
}
ixheaacd_mps_decor_apply(&self->mps_decor, self->v[k], self->w_diff[k],
self->time_slots, NO_RES_BANDS);
self->time_slots, NO_RES_BANDS,
self->ldmps_config.ldmps_present_flag);
if (self->bs_tsd_enable) {
for (sb_sample = 0; sb_sample < self->time_slots; sb_sample++) {
@ -315,13 +357,15 @@ VOID ixheaacd_mps_qmf_hyb_analysis_no_pre_mix(ia_mps_dec_state_struct* self) {
if (self->res_bands != 28) {
ixheaacd_mps_decor_apply(&self->mps_decor, self->w_dir[0],
self->w_diff[1], self->time_slots,
self->res_bands);
self->res_bands,
self->ldmps_config.ldmps_present_flag);
ixheaacd_mps_mix_res_decor_residual_band(self);
}
} else {
ixheaacd_mps_decor_apply(&self->mps_decor, self->w_dir[0], self->w_diff[1],
self->time_slots, NO_RES_BANDS);
self->time_slots, NO_RES_BANDS,
self->ldmps_config.ldmps_present_flag);
}
}
@ -342,7 +386,7 @@ WORD32 ixheaacd_mps_apply(ia_mps_dec_state_struct* self,
err = ixheaacd_mps_frame_decode(self);
if (err != 0) return err;
if (err != IA_NO_ERROR) return err;
ixheaacd_pre_and_mix_matrix_calculation(self);
@ -392,6 +436,7 @@ WORD32 ixheaacd_mps_apply(ia_mps_dec_state_struct* self,
if (err) return err;
self->parse_nxt_frame = 1;
self->pre_mix_req = 0;
return 0;
}
@ -922,7 +967,7 @@ static WORD32 ixheaacd_huff_decode(ia_handle_bit_buf_struct it_bit_buff,
WORD32 data_type, WORD32 diff_type_1,
WORD32 diff_type_2, WORD32 pilot_coding_flag,
WORD32* pilot_data, WORD32 num_val,
WORD32* cdg_scheme) {
WORD32* cdg_scheme, WORD32 ld_mps_flag) {
WORD32 diff_type;
WORD32 i = 0;
@ -978,7 +1023,7 @@ static WORD32 ixheaacd_huff_decode(ia_handle_bit_buf_struct it_bit_buff,
*cdg_scheme = data << PAIR_SHIFT;
if (*cdg_scheme >> PAIR_SHIFT == HUFF_2D) {
if ((out_data_1 != NULL) && (out_data_2 != NULL)) {
if ((out_data_1 != NULL) && (out_data_2 != NULL) && (ld_mps_flag != 1)) {
data = ixheaacd_read_bits_buf(it_bit_buff, 1);
*cdg_scheme |= data;
} else {
@ -1317,10 +1362,10 @@ WORD32 ixheaacd_mps_ecdatapairdec(ia_handle_bit_buf_struct it_bit_buff,
WORD32 history[MAXBANDS], WORD32 data_type,
WORD32 set_idx, WORD32 data_bands,
WORD32 pair_flag, WORD32 coarse_flag,
WORD32 independency_flag)
WORD32 diff_time_back_flag,
WORD32 ld_mps_flag)
{
WORD32 diff_time_back_flag = !independency_flag || (set_idx > 0);
WORD32 attach_lsb_flag = 0;
WORD32 pcm_coding_flag = 0;
WORD32 pilot_coding_flag = 0;
@ -1435,7 +1480,7 @@ WORD32 ixheaacd_mps_ecdatapairdec(ia_handle_bit_buf_struct it_bit_buff,
if (!ixheaacd_huff_decode(it_bit_buff, data_array[0], data_array[1],
data_type, diff_type[0], diff_type[1],
pilot_coding_flag, pilot_data, data_bands,
&cdg_scheme)) {
&cdg_scheme, ld_mps_flag)) {
return 0;
}

View file

@ -31,12 +31,18 @@
#define MAX_OUTPUT_CHANNELS_MPS_AT (2)
#define HYBRID_BAND_BORDER (12)
#define DECORR_FILT_0_ORD_LD_MPS (20)
#define DECORR_FILT_1_ORD_LD_MPS (15)
#define DECORR_FILT_2_ORD_LD_MPS (6)
#define DECORR_FILT_3_ORD_LD_MPS (3)
#define DECORR_FILT_0_ORD (10)
#define DECORR_FILT_1_ORD (8)
#define DECORR_FILT_2_ORD (3)
#define DECORR_FILT_3_ORD (2)
#define MAX_DECORR_FIL_ORDER (DECORR_FILT_0_ORD)
#define MAX_DECORR_FIL_ORDER (DECORR_FILT_0_ORD_LD_MPS)
#define MAX_DECORR_FIL_ORDER_MPS (DECORR_FILT_0_ORD)
#define NO_RES_BANDS -1
@ -70,18 +76,17 @@ typedef struct ia_mps_decor_filt_struct {
typedef struct ia_mps_decor_struct *ia_mps_decor_struct_handle;
#define MAX_HYBRID_BANDS_MPS (MAX_NUM_QMF_BANDS_MPS_NEW - 3 + 10)
#define MAX_HYBRID_BANDS_MPS_LD (MAX_NUM_QMF_BANDS_MPS - 3 + 10)
#define MAX_TIME_SLOTS (72)
#define MAX_PARAMETER_BANDS (28)
#define MAX_M_INPUT_MPS (2)
#define MAX_M_OUTPUT_MPS (2)
#define MAX_M1_INPUT (2)
#define MAX_M1_OUTPUT (2)
#define MAX_M2_INPUT (2)
#define MAX_M_INPUT (2)
#define MAX_M_OUTPUT (2)
#define QMF_BANDS_TO_HYBRID (3)
#define MAX_HYBRID_ONLY_BANDS_PER_QMF (8)
#define QMF_HYBRID_FILT_ORDER (13)
#define BUFFER_LEN_LF_MPS (QMF_HYBRID_FILT_ORDER - 1 + MAX_TIME_SLOTS)
#define MAX_NO_TIME_SLOTS_DELAY (14)
@ -225,6 +230,7 @@ typedef struct ia_mps_dec_state_struct {
WORD32 bs_residual_bands;
ia_usac_dec_mps_config_struct *config;
ia_usac_dec_mps_config_struct ldmps_config;
ia_mps_bs_frame bs_frame;
WORD32 smoothing_time[MAX_PARAMETER_SETS_MPS];
@ -273,10 +279,9 @@ typedef struct ia_mps_dec_state_struct {
ia_cmplx_flt_struct qmf_in[2][MAX_NUM_QMF_BANDS_MPS_NEW][MAX_TIME_SLOTS];
ia_cmplx_flt_struct hyb_in[2][MAX_HYBRID_BANDS_MPS][MAX_TIME_SLOTS];
ia_cmplx_flt_struct hyb_res[MAX_HYBRID_BANDS_MPS][MAX_TIME_SLOTS];
ia_cmplx_flt_struct v[MAX_M1_OUTPUT][MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS];
ia_cmplx_flt_struct w_diff[MAX_M2_INPUT][MAX_TIME_SLOTS]
[MAX_HYBRID_BANDS_MPS];
ia_cmplx_flt_struct w_dir[MAX_M2_INPUT][MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS];
ia_cmplx_flt_struct v[MAX_M_OUTPUT][MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS];
ia_cmplx_flt_struct w_diff[MAX_M_INPUT][MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS];
ia_cmplx_flt_struct w_dir[MAX_M_INPUT][MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS];
ia_cmplx_flt_struct hyb_dir_out[2][MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS];
ia_cmplx_flt_struct hyb_diff_out[2][MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS];
@ -334,16 +339,28 @@ typedef struct ia_mps_dec_state_struct {
VOID *p_sbr_dec[MAXNRSBRCHANNELS];
VOID *p_sbr_frame[MAXNRSBRCHANNELS];
VOID *p_sbr_header[MAXNRSBRCHANNELS];
WORD32 object_type;
WORD32 mps_init_done;
ia_sbr_qmf_filter_bank_struct str_mps_qmf_bank;
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr;
ia_sbr_tables_struct *sbr_tables_ptr;
ia_sbr_scale_fact_struct *str_sbr_scale_fact;
} ia_mps_dec_state_struct;
VOID ixheaacd_mps_init_pre_and_post_matrix(ia_mps_dec_state_struct *self);
VOID ixheaacd_pre_and_mix_matrix_calculation(ia_mps_dec_state_struct *self);
WORD32 ixheaacd_mps_apply_pre_matrix(ia_mps_dec_state_struct *self);
WORD32 ixheaacd_mps_apply_mix_matrix(ia_mps_dec_state_struct *self);
WORD32 ixheaacd_mps_apply_mix_matrix_type1(ia_mps_dec_state_struct *self);
WORD32 ixheaacd_mps_apply_mix_matrix_type2(ia_mps_dec_state_struct *self);
WORD32 ixheaacd_mps_apply_mix_matrix_type3(ia_mps_dec_state_struct *self);
WORD32 ixheaacd_mps_frame_decode(ia_mps_dec_state_struct *self);
VOID ixheaacd_samples_sat(WORD8 *outbuffer, WORD32 num_samples_out,
WORD32 pcmsize, FLOAT32 (*out_samples)[4096],
WORD32 *out_bytes, WORD32 num_channel_out);
IA_ERRORCODE ixheaacd_mps_frame_decode(ia_mps_dec_state_struct *self);
WORD32 ixheaacd_mps_header_decode(ia_mps_dec_state_struct *self);
@ -363,9 +380,17 @@ VOID ixheaacd_mps_par2umx_ps_ipd_opd(ia_mps_dec_state_struct *self,
FLOAT32 *h_real, WORD32 param_set_idx);
VOID ixheaacd_mps_par2umx_pred(ia_mps_dec_state_struct *self,
ia_mps_bs_frame *curr_bit_stream,
FLOAT32 *h_imag, FLOAT32 *h_real,
WORD32 param_set_idx, WORD32 res_bands);
ia_mps_bs_frame *curr_bit_stream, FLOAT32 *h_imag,
FLOAT32 *h_real, WORD32 param_set_idx,
WORD32 res_bands);
WORD32 ixheaacd_mps_upmix_interp(
FLOAT32 m_matrix[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT]
[MAX_M_INPUT],
FLOAT32 r_matrix[MAX_TIME_SLOTS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT]
[MAX_M_INPUT],
FLOAT32 m_matrix_prev[MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],
WORD32 num_rows, WORD32 num_cols, ia_mps_dec_state_struct *self, WORD32 bs_high_rate_mode);
WORD32 ixheaacd_mps_upmix_interp_type1(
FLOAT32 m_matrix[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT]
@ -392,4 +417,6 @@ VOID ixheaacd_mps_phase_interpolation(
FLOAT32 r_im[MAX_TIME_SLOTS][MAX_PARAMETER_BANDS][2],
ia_mps_dec_state_struct *self);
VOID ixheaacd_mps_complex_fft(FLOAT32 *xr, FLOAT32 *xi, WORD32 nlength);
#endif

View file

@ -24,12 +24,12 @@
#define ONE_MINUS_DECOR_ALPHA (1 - DECOR_ALPHA)
#define DECOR_GAMMA (1.5f)
IA_ERRORCODE ixheaacd_mps_decor_init(ia_mps_decor_struct_handle, int, int);
IA_ERRORCODE ixheaacd_mps_decor_init(ia_mps_decor_struct_handle, WORD32, WORD32, WORD32);
VOID ixheaacd_mps_decor_apply(
ia_mps_decor_struct_handle self,
ia_cmplx_flt_struct in[MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS],
ia_cmplx_flt_struct out[MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS],
WORD32 length, WORD32 res_bands);
WORD32 length, WORD32 res_bands, WORD32 ldmps_present);
#endif

View file

@ -25,8 +25,21 @@
#include "ixheaacd_type_def.h"
#include "ixheaacd_bitbuffer.h"
#include "ixheaacd_defines.h"
#include "ixheaacd_aac_rom.h"
#include "ixheaacd_pulsedata.h"
#include "ixheaacd_pns.h"
#include "ixheaacd_channelinfo.h"
#include "ixheaacd_common_rom.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_env_extr_part.h"
#include "ixheaacd_sbr_rom.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_audioobjtypes.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_mps_interface.h"
@ -39,11 +52,17 @@
#include "ixheaacd_constants.h"
static const WORD32 ixheaacd_decorr_delay[] = {11, 10, 5, 2};
static const WORD32 ixheaacd_decorr_delay_ldmps[] = {8, 7, 2, 1};
static const WORD32 ixheaacd_qmf_split_freq_0[] = {3, 15, 24, 65};
static const WORD32 ixheaacd_qmf_split_freq_1[] = {3, 50, 65, 65};
static const WORD32 ixheaacd_qmf_split_freq_2[] = {0, 15, 65, 65};
static const WORD32 ixheaacd_qmf_split_freq_0_ldmps[] = {0, 15, 24, 65};
static const WORD32 ixheaacd_qmf_split_freq_1_ldmps[] = {0, 50, 65, 65};
static const WORD32 ixheaacd_qmf_split_freq_2_ldmps[] = {0, 15, 65, 65};
extern const WORD32 ixheaacd_mps_gain_set_indx[29];
static const FLOAT32
@ -78,8 +97,44 @@ static const FLOAT32
ixheaacd_lattice_coeff_3_filt_num_coeff[DECORR_FILT_3_ORD + 1] = {
-0.013000f, 0.034742f, 1.000000f};
extern const WORD32
static const FLOAT32
ixheaacd_lattice_coeff_1_filt_num_ldmps[DECORR_FILT_1_ORD_LD_MPS + 1] = {
(0.3355999887f), (0.0024894588f), (-0.1572290659f), (0.2807503343f),
(-0.1942857355f), (0.3840600252f), (-0.4084388912f), (-0.1750483066f),
(0.5559588671f), (-0.4935829639f), (0.0567415841f), (-0.0658148378f),
(0.3378961682f), (0.2284426540f), (-0.7025330663f), (1.0000000000f)};
static const FLOAT32
ixheaacd_lattice_coeff_1_filt_den_ldmps[DECORR_FILT_1_ORD_LD_MPS + 1] = {
(1.0000000000f), (-0.7025330663f), (0.2284426540f), (0.3378961682f),
(-0.0658148378f), (0.0567415841f), (-0.4935829639f), (0.5559588671f),
(-0.1750483066f), (-0.4084388912f), (0.3840600252f), (-0.1942857355f),
(0.2807503343f), (-0.1572290659f), (0.0024894588f), (0.3355999887f)};
static const FLOAT32
ixheaacd_lattice_coeff_2_filt_num_ldmps[DECORR_FILT_2_ORD_LD_MPS + 1] = {
(-0.4623999894f), (0.2341193259f), (0.5163637400f), (-0.0253488291f),
(-0.2871030867f), (0.0153170601f), (1.0000000000f)};
static const FLOAT32
ixheaacd_lattice_coeff_2_filt_den_ldmps[DECORR_FILT_2_ORD_LD_MPS + 1] = {
(1.0000000000f), (0.0153170601f), (-0.2871030867f), (-0.0253488291f),
(0.5163637400f), (0.2341193259f), (-0.4623999894f)
};
static const FLOAT32
ixheaacd_lattice_coeff_3_filt_num_ldmps[DECORR_FILT_3_ORD_LD_MPS + 1] = {
(0.2468000054f), (0.0207958221f), (-0.3898491263f), (1.0000000000f)};
static const FLOAT32
ixheaacd_lattice_coeff_3_filt_den_ldmps[DECORR_FILT_3_ORD_LD_MPS + 1] = {
(1.0000000000f), (-0.3898491263f), (0.0207958221f), (0.2468000054f)};
extern WORD32
ixheaacd_hybrid_band_71_to_processing_band_28_map[MAX_HYBRID_BANDS_MPS];
extern WORD32
ixheaacd_hybrid_band_64_to_processing_band_23_map[MAX_HYBRID_BANDS_MPS];
static const WORD32 ixheaacd_hybrid_to_qmf_map[MAX_HYBRID_BANDS_MPS] = {
0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10,
@ -87,31 +142,65 @@ static const WORD32 ixheaacd_hybrid_to_qmf_map[MAX_HYBRID_BANDS_MPS] = {
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63};
static const WORD32 ixheaacd_hybrid_to_qmf_map_ldmps[MAX_HYBRID_BANDS_MPS] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70};
static void ixheaacd_mps_decor_filt_init(ia_mps_decor_filt_struct *self,
WORD32 reverb_band) {
switch (reverb_band) {
case 0:
self->num_len = self->den_len = DECORR_FILT_0_ORD + 1;
self->num = ixheaacd_lattice_coeff_0_filt_num_coeff;
self->den = ixheaacd_lattice_coeff_0_filt_den_coeff;
WORD32 reverb_band,
WORD32 object_type) {
if (object_type == AOT_ER_AAC_ELD || object_type == AOT_ER_AAC_LD) {
switch (reverb_band) {
case 0:
self->num_len = self->den_len = DECORR_FILT_0_ORD_LD_MPS + 1;
self->num = NULL;
self->den = NULL;
break;
case 1:
self->num_len = self->den_len = DECORR_FILT_1_ORD + 1;
self->num = ixheaacd_lattice_coeff_1_filt_num_coeff;
self->den = ixheaacd_lattice_coeff_1_filt_den_coeff;
break;
case 1:
self->num_len = self->den_len = DECORR_FILT_1_ORD_LD_MPS + 1;
self->num = ixheaacd_lattice_coeff_1_filt_num_ldmps;
self->den = ixheaacd_lattice_coeff_1_filt_den_ldmps;
break;
case 2:
self->num_len = self->den_len = DECORR_FILT_2_ORD + 1;
self->num = ixheaacd_lattice_coeff_2_filt_num_coeff;
self->den = ixheaacd_lattice_coeff_2_filt_den_coeff;
break;
case 3:
self->num_len = self->den_len = DECORR_FILT_3_ORD + 1;
self->num = ixheaacd_lattice_coeff_3_filt_num_coeff;
self->den = ixheaacd_lattice_coeff_3_filt_den_coeff;
break;
break;
case 2:
self->num_len = self->den_len = DECORR_FILT_2_ORD_LD_MPS + 1;
self->num = ixheaacd_lattice_coeff_2_filt_num_ldmps;
self->den = ixheaacd_lattice_coeff_2_filt_den_ldmps;
break;
case 3:
self->num_len = self->den_len = DECORR_FILT_3_ORD_LD_MPS + 1;
self->num = ixheaacd_lattice_coeff_3_filt_num_ldmps;
self->den = ixheaacd_lattice_coeff_3_filt_den_ldmps;
break;
}
} else {
switch (reverb_band) {
case 0:
self->num_len = self->den_len = DECORR_FILT_0_ORD + 1;
self->num = ixheaacd_lattice_coeff_0_filt_num_coeff;
self->den = ixheaacd_lattice_coeff_0_filt_den_coeff;
break;
case 1:
self->num_len = self->den_len = DECORR_FILT_1_ORD + 1;
self->num = ixheaacd_lattice_coeff_1_filt_num_coeff;
self->den = ixheaacd_lattice_coeff_1_filt_den_coeff;
break;
case 2:
self->num_len = self->den_len = DECORR_FILT_2_ORD + 1;
self->num = ixheaacd_lattice_coeff_2_filt_num_coeff;
self->den = ixheaacd_lattice_coeff_2_filt_den_coeff;
break;
case 3:
self->num_len = self->den_len = DECORR_FILT_3_ORD + 1;
self->num = ixheaacd_lattice_coeff_3_filt_num_coeff;
self->den = ixheaacd_lattice_coeff_3_filt_den_coeff;
break;
}
}
self->state_len = self->num_len;
@ -143,13 +232,20 @@ static VOID ixheaacd_mps_decor_energy_adjustment(
ixheaacd_mps_decor_energy_adjust_filt_struct *handle,
ia_cmplx_flt_struct in[MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS],
ia_cmplx_flt_struct out[MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS],
WORD32 time_slots, WORD32 res_bands) {
WORD32 time_slots, WORD32 res_bands, WORD32 ldmps_present) {
ixheaacd_mps_decor_energy_adjust_filt_struct *self =
(ixheaacd_mps_decor_energy_adjust_filt_struct *)handle;
FLOAT32 in_energy[MAX_PARAMETER_BANDS] = {0};
FLOAT32 out_energy[MAX_PARAMETER_BANDS] = {0};
FLOAT32 gain[MAX_PARAMETER_BANDS];
WORD32 i, j, k;
WORD32 i, j, k, loop_counter;
WORD32 *ptr_hybrid_band;
if (ldmps_present == 1)
ptr_hybrid_band = ixheaacd_hybrid_band_64_to_processing_band_23_map;
else
ptr_hybrid_band = ixheaacd_hybrid_band_71_to_processing_band_28_map;
WORD32 start_param_band = 0, start_bin = 0;
if (res_bands != NO_RES_BANDS) {
@ -162,14 +258,19 @@ static VOID ixheaacd_mps_decor_energy_adjustment(
memset(out_energy, 0, sizeof(FLOAT32) * MAX_PARAMETER_BANDS);
for (j = start_bin; j < self->num_bins; j++) {
k = ixheaacd_hybrid_band_71_to_processing_band_28_map[j];
k = ptr_hybrid_band[j];
in_energy[k] += in[i][j].re * in[i][j].re + in[i][j].im * in[i][j].im;
out_energy[k] +=
out[i][j].re * out[i][j].re + out[i][j].im * out[i][j].im;
}
for (k = start_param_band; k < MAX_PARAMETER_BANDS; k++) {
if (ldmps_present == 1)
loop_counter = MAX_PARAMETER_BANDS;
else
loop_counter = MAX_PARAMETER_BANDS_MPS;
for (k = start_param_band; k < loop_counter; k++) {
self->smooth_in_energy[k] = self->smooth_in_energy[k] * DECOR_ALPHA +
in_energy[k] * ONE_MINUS_DECOR_ALPHA;
self->smooth_out_energy[k] = self->smooth_out_energy[k] * DECOR_ALPHA +
@ -193,7 +294,7 @@ static VOID ixheaacd_mps_decor_energy_adjustment(
}
for (j = start_bin; j < self->num_bins; j++) {
k = ixheaacd_hybrid_band_71_to_processing_band_28_map[j];
k = ptr_hybrid_band[j];
out[i][j].re *= gain[k];
out[i][j].im *= gain[k];
@ -202,34 +303,57 @@ static VOID ixheaacd_mps_decor_energy_adjustment(
}
IA_ERRORCODE ixheaacd_mps_decor_init(ia_mps_decor_struct_handle self,
WORD32 subbands, WORD32 decor_config) {
WORD32 subbands, WORD32 decor_config,
WORD32 object_type) {
WORD32 i, reverb_band;
const WORD32 *splitfreq;
switch (decor_config) {
case 0:
splitfreq = ixheaacd_qmf_split_freq_0;
break;
case 1:
splitfreq = ixheaacd_qmf_split_freq_1;
break;
case 2:
splitfreq = ixheaacd_qmf_split_freq_2;
break;
default:
return IA_FATAL_ERROR;
const WORD32 *ptr_ixheaacd_hybrid_to_qmf_map;
const WORD32 *ptr_decorr_delay;
if (object_type == AOT_ER_AAC_ELD || object_type == AOT_ER_AAC_LD) {
ptr_ixheaacd_hybrid_to_qmf_map = ixheaacd_hybrid_to_qmf_map_ldmps;
ptr_decorr_delay = ixheaacd_decorr_delay_ldmps;
switch (decor_config) {
case 0:
splitfreq = ixheaacd_qmf_split_freq_0_ldmps;
break;
case 1:
splitfreq = ixheaacd_qmf_split_freq_1_ldmps;
break;
case 2:
splitfreq = ixheaacd_qmf_split_freq_2_ldmps;
break;
default:
return IA_FATAL_ERROR;
}
} else {
ptr_ixheaacd_hybrid_to_qmf_map = ixheaacd_hybrid_to_qmf_map;
ptr_decorr_delay = ixheaacd_decorr_delay;
switch (decor_config) {
case 0:
splitfreq = ixheaacd_qmf_split_freq_0;
break;
case 1:
splitfreq = ixheaacd_qmf_split_freq_1;
break;
case 2:
splitfreq = ixheaacd_qmf_split_freq_2;
break;
default:
return IA_FATAL_ERROR;
}
}
self->num_bins = subbands;
if (self->num_bins > MAX_HYBRID_BANDS_MPS) return IA_FATAL_ERROR;
for (i = 0; i < self->num_bins; i++) {
reverb_band = 0;
while ((reverb_band < 3) &&
(ixheaacd_hybrid_to_qmf_map[i] >= (splitfreq[reverb_band] - 1)))
(ptr_ixheaacd_hybrid_to_qmf_map[i] >= (splitfreq[reverb_band] - 1)))
reverb_band++;
self->delay_sample_count[i] = ixheaacd_decorr_delay[reverb_band];
ixheaacd_mps_decor_filt_init(&self->filter[i], reverb_band);
self->delay_sample_count[i] = ptr_decorr_delay[reverb_band];
ixheaacd_mps_decor_filt_init(&self->filter[i], reverb_band, object_type);
}
self->decor_nrg_smooth.num_bins = self->num_bins;
@ -241,7 +365,7 @@ VOID ixheaacd_mps_decor_apply(
ia_mps_decor_struct_handle self,
ia_cmplx_flt_struct in[MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS],
ia_cmplx_flt_struct out[MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS],
WORD32 length, WORD32 res_bands) {
WORD32 length, WORD32 res_bands, WORD32 ldmps_present) {
WORD32 idx, sb_sample, index = 0;
ia_cmplx_flt_struct scratch[MAX_TIME_SLOTS];
@ -273,5 +397,6 @@ VOID ixheaacd_mps_decor_apply(
}
ixheaacd_mps_decor_energy_adjustment(&self->decor_nrg_smooth, in, out, length,
res_bands);
res_bands,
ldmps_present);
}

View file

@ -21,7 +21,20 @@
#include <string.h>
#include "ixheaacd_type_def.h"
#include "ixheaacd_bitbuffer.h"
#include "ixheaacd_defines.h"
#include "ixheaacd_aac_rom.h"
#include "ixheaacd_pulsedata.h"
#include "ixheaacd_pns.h"
#include "ixheaacd_channelinfo.h"
#include "ixheaacd_common_rom.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_env_extr_part.h"
#include "ixheaacd_sbr_rom.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_mps_dec.h"

View file

@ -52,7 +52,7 @@ WORD32 ixheaacd_mps_ecdatapairdec(ia_handle_bit_buf_struct strm,
WORD32 a_history[MAXBANDS], WORD32 data_type,
WORD32 set_idx, WORD32 data_bands,
WORD32 pair_flag, WORD32 coarse_flag,
WORD32 independency_flag);
WORD32 independency_flag, WORD32 ldmps_flag);
VOID ixheaacd_mps_huff_decode(ia_handle_bit_buf_struct strm, WORD32 *out_data,
WORD32 num_val);

View file

@ -22,7 +22,22 @@
#include <stdio.h>
#include "ixheaacd_type_def.h"
#include "ixheaacd_bitbuffer.h"
#include "ixheaacd_defines.h"
#include "ixheaacd_aac_rom.h"
#include "ixheaacd_pulsedata.h"
#include "ixheaacd_pns.h"
#include "ixheaacd_channelinfo.h"
#include "ixheaacd_common_rom.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_env_extr_part.h"
#include "ixheaacd_sbr_rom.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_audioobjtypes.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_mps_interface.h"
@ -30,82 +45,155 @@
#include "ixheaacd_mps_hybfilter.h"
#include "ixheaacd_error_standards.h"
#include "ixheaacd_error_standards.h"
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
static const int ixheaacd_freq_res_table[] = {0, 28, 20, 14, 10, 7, 5, 4};
static const WORD32 ixheaacd_freq_res_table[] = {0, 28, 20, 14, 10, 7, 5, 4};
static const int
static const WORD32 ixheaacd_freq_res_table_ld[] = {0, 23, 15, 12, 9, 7, 5, 4};
static const WORD32
ixheaacd_hybrid_band_71_to_processing_band_4_map[MAX_HYBRID_BANDS_MPS] = {
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3};
static const int
static const WORD32
ixheaacd_hybrid_band_71_to_processing_band_5_map[MAX_HYBRID_BANDS_MPS] = {
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4};
static const int
static const WORD32
ixheaacd_hybrid_band_71_to_processing_band_7_map[MAX_HYBRID_BANDS_MPS] = {
0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5,
5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6};
static const int
static const WORD32
ixheaacd_hybrid_band_71_to_processing_band_10_map[MAX_HYBRID_BANDS_MPS] = {
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8,
8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9};
static const int
static const WORD32
ixheaacd_hybrid_band_71_to_processing_band_14_map[MAX_HYBRID_BANDS_MPS] = {
0, 0, 0, 0, 1, 1, 2, 3, 4, 4, 5, 6, 6, 7, 7, 8, 8, 8,
9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13};
const int
const WORD32
ixheaacd_hybrid_band_71_to_processing_band_20_map[MAX_HYBRID_BANDS_MPS] = {
1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14,
15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18,
18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19};
const int
const WORD32
ixheaacd_hybrid_band_71_to_processing_band_28_map[MAX_HYBRID_BANDS_MPS] = {
1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23,
23, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26,
26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27};
static const float ixheaacd_mps_clip_gain_table[] = {
const WORD32
ixheaacd_hybrid_band_64_to_processing_band_4_map[MAX_HYBRID_BANDS_MPS_LD] =
{0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3};
const WORD32
ixheaacd_hybrid_band_64_to_processing_band_5_map[MAX_HYBRID_BANDS_MPS_LD] =
{0, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4};
const WORD32
ixheaacd_hybrid_band_64_to_processing_band_7_map[MAX_HYBRID_BANDS_MPS_LD] =
{0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6};
const WORD32
ixheaacd_hybrid_band_64_to_processing_band_9_map[MAX_HYBRID_BANDS_MPS_LD] =
{0, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7,
7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8};
const WORD32
ixheaacd_hybrid_band_64_to_processing_band_12_map[MAX_HYBRID_BANDS_MPS_LD] =
{0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8,
8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11};
const WORD32
ixheaacd_hybrid_band_64_to_processing_band_15_map[MAX_HYBRID_BANDS_MPS_LD] =
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 10, 10, 11, 11,
11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13,
13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14};
const WORD32
ixheaacd_hybrid_band_64_to_processing_band_23_map[MAX_HYBRID_BANDS_MPS_LD] =
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12, 13, 13,
14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19, 19,
19, 19, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22};
static const FLOAT32 ixheaacd_mps_clip_gain_table[] = {
1.000000f, 1.189207f, 1.414213f, 1.681792f,
2.000000f, 2.378414f, 2.828427f, 4.000000f};
static const int ixheaacd_mps_stride_table[] = {1, 2, 5, 28};
static const WORD32 ixheaacd_mps_stride_table[] = {1, 2, 5, 28};
static const float ixheaacd_cld_de_quant_table[] = {
static const FLOAT32 ixheaacd_cld_de_quant_table[] = {
-150.0, -45.0, -40.0, -35.0, -30.0, -25.0, -22.0, -19.0,
-16.0, -13.0, -10.0, -8.0, -6.0, -4.0, -2.0, 0.0,
2.0, 4.0, 6.0, 8.0, 10.0, 13.0, 16.0, 19.0,
22.0, 25.0, 30.0, 35.0, 40.0, 45.0, 150.0};
static const float ixheaacd_icc_de_quant_table[] = {
static const FLOAT32 ixheaacd_icc_de_quant_table[] = {
1.0000f, 0.9370f, 0.84118f, 0.60092f, 0.36764f, 0.0f, -0.5890f, -0.9900f};
const float ixheaacd_ipd_de_quant_table[] = {
const FLOAT32 ixheaacd_ipd_de_quant_table[] = {
0.f, 0.392699082f, 0.785398163f, 1.178097245f,
1.570796327f, 1.963495408f, 2.35619449f, 2.748893572f,
3.141592654f, 3.534291735f, 3.926990817f, 4.319689899f,
4.71238898f, 5.105088062f, 5.497787144f, 5.890486225f};
const int ixheaacd_ipd_de_quant_table_q28[] = {
const WORD32 ixheaacd_ipd_de_quant_table_q28[] = {
0, 105414360, 210828720, 316243072, 421657440, 527071776,
632486144, 737900480, 843314880, 948729216, 1054143552, 1159557888,
1264972288, 1370386688, 1475800960, 1581215360};
static const int ixheaacd_smoothing_time_table[] = {64, 128, 256, 512};
static const WORD32 ixheaacd_smoothing_time_table[] = {64, 128, 256, 512};
static const FLOAT32 ixheaacd_inverse_smoothing_time_table[] = {
1.0f / 64.0f, 1.0f / 128.0f, 1.0f / 256.0f, 1.0f / 512.0f};
@ -319,7 +407,7 @@ static IA_ERRORCODE ixheaacd_mps_ecdata_decoding(
err = ixheaacd_mps_ecdatapairdec(
bitstream, data, lastdata, datatype, set_index, data_bands,
bs_data_pair, frame_xxx_data->bs_quant_coarse_xxx[set_index],
frame->independency_flag && (i == 0));
!(frame->independency_flag && (i == 0)) || (set_index > 0), 0);
if (err) return err;
for (pb = 0; pb < data_bands; pb++) {
@ -610,6 +698,247 @@ IA_ERRORCODE ixheaacd_mps_frame_parsing(ia_mps_dec_state_struct *self,
return err;
}
static VOID ixheaacd_ld_mps_ecdata_decoding(
ia_mps_dec_state_struct *self, ia_handle_bit_buf_struct it_bit_buff,
WORD32 data[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS], WORD32 datatype,
WORD32 start_band) {
WORD32 i, j, pb, data_set, set_index, bs_data_pair, data_bands,
old_quant_coarse_xxx;
WORD32 strides[MAX_PARAMETER_BANDS + 1] = {0};
WORD32 band_stop = 0;
WORD32 *lastdata = NULL;
ia_mps_data_struct *frame_xxx_data = NULL;
WORD32 default_val = 0;
ia_mps_bs_frame *frame = &(self->bs_frame);
if (datatype == CLD) {
frame_xxx_data = &frame->cld_data;
lastdata = frame->cmp_cld_idx_prev;
band_stop = self->bs_param_bands;
} else if (datatype == ICC) {
frame_xxx_data = &frame->icc_data;
lastdata = frame->cmp_icc_idx_prev;
band_stop = self->bs_param_bands;
} else if (datatype == IPD) {
frame_xxx_data = &frame->ipd_data;
lastdata = frame->ipd_idx_data_prev;
band_stop = self->num_bands_ipd;
} else {
frame_xxx_data = &frame->cld_data;
lastdata = frame->cmp_cld_idx_prev;
band_stop = self->bs_param_bands;
}
data_set = 0;
for (i = 0; i < self->num_parameter_sets; i++) {
frame_xxx_data->bs_xxx_data_mode[i] =
ixheaacd_read_bits_buf(it_bit_buff, 2);
if (frame_xxx_data->bs_xxx_data_mode[i] == 3) {
data_set++;
}
}
set_index = 0;
bs_data_pair = 0;
old_quant_coarse_xxx = frame_xxx_data->bs_quant_coarse_xxx_prev;
for (i = 0; i < self->num_parameter_sets; i++) {
if (frame_xxx_data->bs_xxx_data_mode[i] == 0) {
for (pb = 0; pb < band_stop; pb++) {
lastdata[pb] = default_val;
}
old_quant_coarse_xxx = 0;
}
if (frame_xxx_data->bs_xxx_data_mode[i] == 3) {
if (bs_data_pair) {
bs_data_pair = 0;
} else {
bs_data_pair = ixheaacd_read_bits_buf(it_bit_buff, 1);
frame_xxx_data->bs_quant_coarse_xxx[set_index] =
ixheaacd_read_bits_buf(it_bit_buff, 1);
frame_xxx_data->bs_freq_res_stride_xxx[set_index] =
ixheaacd_read_bits_buf(it_bit_buff, 2);
if (frame_xxx_data->bs_quant_coarse_xxx[set_index] !=
old_quant_coarse_xxx) {
if (old_quant_coarse_xxx) {
ixheaacd_mps_coarse2fine(lastdata, datatype, 0, band_stop - 0);
} else {
ixheaacd_mps_fine2coarse(lastdata, band_stop);
}
}
data_bands = ixheaacd_mps_getstridemap(
frame_xxx_data->bs_freq_res_stride_xxx[set_index], start_band,
band_stop, strides);
for (pb = 0; pb < data_bands; pb++) {
lastdata[pb] = lastdata[strides[pb]];
}
ixheaacd_mps_ecdatapairdec(
it_bit_buff, data, lastdata, datatype, set_index, data_bands,
bs_data_pair, frame_xxx_data->bs_quant_coarse_xxx[set_index],
!(frame->independency_flag && (i == 0)) || (set_index > 0), 1);
for (pb = 0; pb < data_bands; pb++) {
for (j = strides[pb]; j < strides[pb + 1]; j++) {
if (datatype == IPD) {
if (frame_xxx_data->bs_quant_coarse_xxx[set_index]) {
lastdata[j] = data[set_index + bs_data_pair][pb] & 7;
} else {
lastdata[j] = data[set_index + bs_data_pair][pb] & 15;
}
} else {
lastdata[j] = data[set_index + bs_data_pair][pb];
}
}
}
old_quant_coarse_xxx = frame_xxx_data->bs_quant_coarse_xxx[set_index];
if (bs_data_pair) {
frame_xxx_data->bs_quant_coarse_xxx[set_index + 1] =
frame_xxx_data->bs_quant_coarse_xxx[set_index];
frame_xxx_data->bs_freq_res_stride_xxx[set_index + 1] =
frame_xxx_data->bs_freq_res_stride_xxx[set_index];
}
set_index += bs_data_pair + 1;
}
}
}
}
IA_ERRORCODE ixheaacd_ld_mps_frame_parsing(
ia_mps_dec_state_struct *self, ia_handle_bit_buf_struct it_bit_buff) {
WORD32 i, bs_frame_type, data_bands, bs_temp_shape_enable,
num_of_temp_shape_ch;
WORD32 ps, pg, ts, ic;
WORD32 env_shape_data[MAX_TIME_SLOTS];
WORD32 alignment;
WORD32 bits_param_slot = 0;
ia_mps_bs_frame *frame = &(self->bs_frame);
alignment = it_bit_buff->cnt_bits;
if (self->parse_nxt_frame == 0) return IA_NO_ERROR;
self->num_parameter_sets_prev = self->num_parameter_sets;
bs_frame_type = ixheaacd_read_bits_buf(it_bit_buff, 1);
self->num_parameter_sets = ixheaacd_read_bits_buf(it_bit_buff, 1) + 1;
if (self->time_slots == 32)
bits_param_slot = 5;
else if (self->time_slots == 64)
bits_param_slot = 6;
else if (self->time_slots == 8)
bits_param_slot = 3;
else if (self->time_slots == 16 || self->time_slots == 15)
bits_param_slot = 4;
if (bs_frame_type) {
for (i = 0; i < self->num_parameter_sets; i++) {
self->param_slots[i] =
ixheaacd_read_bits_buf(it_bit_buff, bits_param_slot);
}
} else {
self->param_slots[0] = self->time_slots - 1;
}
frame->independency_flag = ixheaacd_read_bits_buf(it_bit_buff, 1);
for (i = 0; i < self->ldmps_config.num_ott_boxes; i++) {
ixheaacd_ld_mps_ecdata_decoding(self, it_bit_buff, frame->cmp_cld_idx, CLD,
0);
}
if (self->ldmps_config.bs_one_icc) {
ixheaacd_ld_mps_ecdata_decoding(self, it_bit_buff, frame->cmp_icc_idx, ICC,
0);
} else {
for (i = 0; i < self->ldmps_config.num_ott_boxes; i++) {
if (!self->ldmps_config.ott_mode_lfe[i])
ixheaacd_ld_mps_ecdata_decoding(self, it_bit_buff, frame->cmp_icc_idx,
ICC, 0);
}
}
for (ps = 0; ps < self->num_parameter_sets; ps++) {
frame->bs_smooth_mode[ps] = ixheaacd_read_bits_buf(it_bit_buff, 2);
if (frame->bs_smooth_mode[ps] >= 2) {
frame->bs_smooth_time[ps] = ixheaacd_read_bits_buf(it_bit_buff, 2);
}
if (frame->bs_smooth_mode[ps] == 3) {
frame->bs_freq_res_stride_smg[ps] =
ixheaacd_read_bits_buf(it_bit_buff, 2);
data_bands =
(ixheaacd_freq_res_table_ld[self->ldmps_config.bs_freq_res] - 1) /
ixheaacd_mps_stride_table[frame->bs_freq_res_stride_smg[ps]] +
1;
for (pg = 0; pg < data_bands; pg++) {
frame->bs_smg_data[ps][pg] = ixheaacd_read_bits_buf(it_bit_buff, 1);
}
}
}
for (i = 0; i < 2; i++) {
self->temp_shape_enable_ch_stp[i] = 0;
self->temp_shape_enable_ch_ges[i] = 0;
}
if (self->ldmps_config.bs_temp_shape_config != 0) {
bs_temp_shape_enable = ixheaacd_read_bits_buf(it_bit_buff, 1);
if (bs_temp_shape_enable) {
num_of_temp_shape_ch = 2;
switch (self->ldmps_config.bs_temp_shape_config) {
case 1:
for (i = 0; i < num_of_temp_shape_ch; i++) {
self->temp_shape_enable_ch_stp[i] =
ixheaacd_read_bits_buf(it_bit_buff, 1);
}
break;
case 2:
for (i = 0; i < num_of_temp_shape_ch; i++) {
self->temp_shape_enable_ch_ges[i] =
ixheaacd_read_bits_buf(it_bit_buff, 1);
}
for (i = 0; i < num_of_temp_shape_ch; i++) {
if (self->temp_shape_enable_ch_ges[i]) {
ixheaacd_mps_huff_decode(it_bit_buff, env_shape_data,
self->time_slots);
for (ts = 0; ts < self->time_slots; ts++) {
self->env_shape_data[i][ts] = (float)pow(
2, (float)env_shape_data[ts] /
(self->ldmps_config.bs_env_quant_mode + 2) -
1);
}
}
}
break;
default:
return IA_FATAL_ERROR;
}
}
}
if (self->ldmps_config.bs_arbitrary_downmix != 0) {
for (ic = 0; ic < self->ldmps_config.num_input_channels; ic++) {
ixheaacd_ld_mps_ecdata_decoding(self, it_bit_buff, frame->cmp_cld_idx,
CLD, 0);
}
}
ixheaacd_byte_align(it_bit_buff, &alignment);
while (it_bit_buff->cnt_bits > 8) {
ixheaacd_read_bits_buf(it_bit_buff, 8);/*discard*/
}
ixheaacd_read_bits_buf(it_bit_buff, it_bit_buff->cnt_bits);/*discard*/
return IA_NO_ERROR;
}
static VOID ixheaacd_mps_createmapping(int map[MAX_PARAMETER_BANDS + 1],
int band_start, int band_stop,
int ch_fac) {
@ -672,7 +1001,7 @@ static VOID ixheaacd_mps_mapfrequency(int *in, int *out, int *map,
static float ixheaacd_mps_de_quantize(int value, int param_type) {
switch (param_type) {
case CLD:
return ixheaacd_cld_de_quant_table[value + 15];
return ixheaacd_cld_de_quant_table[(value + 15)];
case ICC:
return ixheaacd_icc_de_quant_table[value];
@ -686,7 +1015,7 @@ static float ixheaacd_mps_de_quantize(int value, int param_type) {
}
}
static WORD32 ixheaacd_mps_mapindexdata(
static IA_ERRORCODE ixheaacd_mps_mapindexdata(
ia_mps_dec_state_struct *self, ia_mps_data_struct *frame_xxx_data,
float out_data[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS],
int out_idx_data[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS],
@ -793,9 +1122,7 @@ static WORD32 ixheaacd_mps_mapindexdata(
x2 = param_slots[i2];
if (interpolate_local[i] == 1) {
if (i2 < num_parameter_sets) {
return -1;
}
if (i2 < num_parameter_sets) return IA_FATAL_ERROR;
for (band = band_start; band < band_stop; band++) {
int yi, y1, y2;
yi = 0;
@ -805,9 +1132,7 @@ static WORD32 ixheaacd_mps_mapindexdata(
if (y2 - y1 > 8) y1 += 16;
if (y1 - y2 > 8) y2 += 16;
if (x2 != x1) {
yi = (y1 + (xi - x1) * (y2 - y1) / (x2 - x1)) % 16;
}
if (x2 != x1) yi = (y1 + (xi - x1) * (y2 - y1) / (x2 - x1)) % 16;
} else {
if (x2 != x1) {
yi = y1 + (xi - x1) * (y2 - y1) / (x2 - x1);
@ -839,35 +1164,33 @@ static WORD32 ixheaacd_mps_mapindexdata(
out_idx_data[num_parameter_sets - 1][band];
}
}
return 0;
return IA_NO_ERROR;
}
static WORD32 ixheaacd_mps_dec_and_mapframeott(ia_mps_dec_state_struct *self) {
static IA_ERRORCODE ixheaacd_mps_dec_and_mapframeott(
ia_mps_dec_state_struct *self) {
ia_mps_bs_frame *cur_bit_stream_ptr = &(self->bs_frame);
WORD32 err_code = 0;
IA_ERRORCODE err_code = 0;
err_code = ixheaacd_mps_mapindexdata(
self, &cur_bit_stream_ptr->cld_data, self->cld_data,
cur_bit_stream_ptr->cld_idx, cur_bit_stream_ptr->cmp_cld_idx,
cur_bit_stream_ptr->cld_idx_pre, CLD);
if (err_code != 0) return err_code;
if (err_code != IA_NO_ERROR) return err_code;
err_code = ixheaacd_mps_mapindexdata(
self, &cur_bit_stream_ptr->icc_data, self->icc_data,
cur_bit_stream_ptr->icc_idx, cur_bit_stream_ptr->cmp_icc_idx,
cur_bit_stream_ptr->icc_idx_pre, ICC);
if (err_code != 0) return err_code;
if (err_code != IA_NO_ERROR) return err_code;
if ((self->config->bs_phase_coding)) {
err_code = ixheaacd_mps_mapindexdata(
self, &cur_bit_stream_ptr->ipd_data, self->ipd_data,
cur_bit_stream_ptr->ipd_idx, cur_bit_stream_ptr->ipd_idx_data,
cur_bit_stream_ptr->ipd_idx_prev, IPD);
if (err_code != 0) return err_code;
if (err_code != IA_NO_ERROR) return err_code;
}
return 0;
return IA_NO_ERROR;
}
static VOID ixheaacd_mps_dec_and_mapframesmg(ia_mps_dec_state_struct *self) {
@ -956,20 +1279,18 @@ static VOID ixheaacd_mps_dec_and_mapframesmg(ia_mps_dec_state_struct *self) {
}
}
WORD32 ixheaacd_mps_frame_decode(ia_mps_dec_state_struct *self) {
IA_ERRORCODE ixheaacd_mps_frame_decode(ia_mps_dec_state_struct *self) {
int i;
WORD32 err_code = 0;
if (self->parse_nxt_frame == 1) return 0;
IA_ERRORCODE err_code = 0;
if (self->ldmps_config.ldmps_present_flag != 1)
if (self->parse_nxt_frame == 1) return err_code;
self->ext_frame_flag = 0;
if (self->param_slots[self->num_parameter_sets - 1] != self->time_slots - 1) {
self->ext_frame_flag = 1;
}
err_code = ixheaacd_mps_dec_and_mapframeott(self);
if (err_code != 0) return err_code;
if (err_code != IA_NO_ERROR) return err_code;
ixheaacd_mps_dec_and_mapframesmg(self);
if (self->ext_frame_flag) {
@ -986,58 +1307,125 @@ WORD32 ixheaacd_mps_frame_decode(ia_mps_dec_state_struct *self) {
self->inv_param_slot_diff_Q30[i] =
(int)floor(self->inv_param_slot_diff[i] * 1073741824 + 0.5);
}
return 0;
return IA_NO_ERROR;
}
WORD32 ixheaacd_mps_header_decode(ia_mps_dec_state_struct *self) {
self->time_slots = self->frame_length;
WORD32 samp_freq;
WORD32 sampling_rate_tbl[] = {96000, 88200, 64000, 48000, 44100, 32000,
24000, 22050, 16000, 12000, 11025, 8000,
7350, 0, 0, 0};
if (self->ldmps_config.ldmps_present_flag == 1)
self->time_slots = self->frame_length + 1;
else
self->time_slots = self->frame_length;
self->bs_param_bands = ixheaacd_freq_res_table[self->config->bs_freq_res];
self->hyb_band_count_max = self->qmf_band_count - QMF_BANDS_TO_HYBRID + 10;
if (self->ldmps_config.ldmps_present_flag == 1) {
if (self->ldmps_config.bs_sampling_freq_index == 15) {
samp_freq = self->ldmps_config.bs_fampling_frequency;
} else {
samp_freq = sampling_rate_tbl[self->ldmps_config.bs_sampling_freq_index];
}
switch (self->bs_param_bands) {
case 4:
if (samp_freq < 27713.0) {
self->qmf_band_count = 32;
} else if (samp_freq >= 55426.0) {
self->qmf_band_count = 128;
} else {
self->qmf_band_count = 64;
}
}
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_71_to_processing_band_4_map;
break;
case 5:
if (self->object_type == AOT_ER_AAC_ELD ||
self->object_type == AOT_ER_AAC_LD) {
self->bs_param_bands =
ixheaacd_freq_res_table_ld[self->config->bs_freq_res];
self->hyb_band_count_max = self->qmf_band_count;
} else
self->hyb_band_count_max = self->qmf_band_count - QMF_BANDS_TO_HYBRID + 10;
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_71_to_processing_band_5_map;
break;
case 7:
if (self->object_type == AOT_ER_AAC_ELD ||
self->object_type == AOT_ER_AAC_LD) {
switch (self->bs_param_bands) {
case 4:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_71_to_processing_band_7_map;
break;
case 10:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_64_to_processing_band_4_map;
break;
case 5:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_71_to_processing_band_10_map;
break;
case 14:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_64_to_processing_band_5_map;
break;
case 7:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_71_to_processing_band_14_map;
break;
case 20:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_64_to_processing_band_7_map;
break;
case 9:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_71_to_processing_band_20_map;
break;
case 28:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_64_to_processing_band_9_map;
break;
case 12:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_71_to_processing_band_28_map;
break;
default:
self->hyb_band_to_processing_band_table = NULL;
return -1;
break;
};
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_64_to_processing_band_12_map;
break;
case 15:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_64_to_processing_band_15_map;
break;
case 23:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_64_to_processing_band_23_map;
break;
default:
self->hyb_band_to_processing_band_table = NULL;
return -1;
break;
}
} else {
switch (self->bs_param_bands) {
case 4:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_71_to_processing_band_4_map;
break;
case 5:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_71_to_processing_band_5_map;
break;
case 7:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_71_to_processing_band_7_map;
break;
case 10:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_71_to_processing_band_10_map;
break;
case 14:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_71_to_processing_band_14_map;
break;
case 20:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_71_to_processing_band_20_map;
break;
case 28:
self->hyb_band_to_processing_band_table =
ixheaacd_hybrid_band_71_to_processing_band_28_map;
break;
default:
self->hyb_band_to_processing_band_table = NULL;
return -1;
break;
}
}
self->in_ch_count = 1;
self->out_ch_count = 2;
@ -1047,27 +1435,30 @@ WORD32 ixheaacd_mps_header_decode(ia_mps_dec_state_struct *self) {
if (self->config->bs_ott_bands_phase_present) {
self->num_bands_ipd = self->config->bs_ott_bands_phase;
} else {
switch (self->bs_param_bands) {
case 4:
case 5:
self->num_bands_ipd = 2;
break;
case 7:
self->num_bands_ipd = 3;
break;
case 10:
self->num_bands_ipd = 5;
break;
case 14:
self->num_bands_ipd = 7;
break;
case 20:
case 28:
self->num_bands_ipd = 10;
break;
default:
assert(0);
break;
if (!(self->object_type == AOT_ER_AAC_ELD ||
self->object_type == AOT_ER_AAC_LD)) {
switch (self->bs_param_bands) {
case 4:
case 5:
self->num_bands_ipd = 2;
break;
case 7:
self->num_bands_ipd = 3;
break;
case 10:
self->num_bands_ipd = 5;
break;
case 14:
self->num_bands_ipd = 7;
break;
case 20:
case 28:
self->num_bands_ipd = 10;
break;
default:
assert(0);
break;
}
}
}
@ -1090,6 +1481,7 @@ WORD32 ixheaacd_mps_header_decode(ia_mps_dec_state_struct *self) {
self->decor_sig_count = 1;
self->bs_high_rate_mode = self->config->bs_high_rate_mode;
self->pre_mix_req = 1;
return 0;
}

View file

@ -22,8 +22,24 @@
#include <string.h>
#include <math.h>
#include "ixheaacd_type_def.h"
#include "ixheaacd_bitbuffer.h"
#include "ixheaacd_interface.h"
#include "ixheaacd_defines.h"
#include "ixheaacd_aac_rom.h"
#include "ixheaacd_pulsedata.h"
#include "ixheaacd_pns.h"
#include "ixheaacd_channelinfo.h"
#include "ixheaacd_common_rom.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_env_extr_part.h"
#include "ixheaacd_sbr_rom.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_type_def.h"
#include "ixheaacd_bitbuffer.h"
#include "ixheaacd_config.h"
#include "ixheaacd_mps_dec.h"
@ -37,6 +53,12 @@ extern const FLOAT32
extern const FLOAT32 ixheaacd_mps_post_twid[30];
extern const FLOAT32 ixheaacd_mps_pre_twid[64];
extern const FLOAT32 ixheaacd_ldmps_polyphase_filter_coeff[1280];
extern const FLOAT32 ixheaacd_ldmps_pre_twid[32];
extern const FLOAT32 ixheaacd_mps_post_re_32[64];
extern const FLOAT32 ixheaacd_mps_post_im_32[64];
VOID ixheaacd_mps_synt_create(ia_mps_poly_phase_struct *kernel,
WORD32 resolution) {
kernel->resolution = resolution;
@ -46,6 +68,18 @@ VOID ixheaacd_mps_synt_init(ia_mps_poly_phase_synth_struct *self) {
memset(self->state, 0, sizeof(FLOAT32) * POLY_PHASE_SYNTH_SIZE);
}
VOID ixheaacd_mps_synt_post_fft_twiddle_dec(WORD32 resolution, FLOAT32 *fin_re,
FLOAT32 *fin_im,
const FLOAT32 *table_re,
const FLOAT32 *table_im,
FLOAT32 *state) {
WORD32 l;
for (l = 0; l < 2 * resolution; l++) {
state[2 * resolution - l - 1] =
((fin_re[l] * table_re[l]) + (fin_im[l] * table_im[l]));
}
}
VOID ixheaacd_mps_synt_out_calc_dec(WORD32 resolution, FLOAT32 *out,
FLOAT32 *state,
const FLOAT32 *filter_coeff) {
@ -68,6 +102,58 @@ VOID ixheaacd_mps_synt_out_calc_dec(WORD32 resolution, FLOAT32 *out,
}
}
VOID ixheaacd_mps_synt_out_calc_dec_ldmps(WORD32 resolution, FLOAT32 *out,
FLOAT32 *state, const FLOAT32 *filter_coeff) {
WORD32 l, k;
FLOAT32 *out1, *out2, *state1, *state2;
const FLOAT32 *filter1, *filter2;
filter1 = filter_coeff;
filter2 = filter_coeff + resolution;
out1 = out;
out2 = out + resolution;
state1 = state;
state2 = state + (3 * resolution);
for (k = 0; k < 5; k++) {
for (l = 0; l < resolution; l++) {
*out1++ = (*state1++) * (*filter1++);
*out2++ = (*state2++) * (*filter2++);
}
filter1 += resolution;
filter2 += resolution;
out1 += resolution;
out2 += resolution;
state1 += (3 * resolution);
state2 += (3 * resolution);
}
}
VOID ixheaacd_mps_synt_out_calc_dec_ldmps_32(WORD32 resolution, FLOAT32 *out,
FLOAT32 *state, const FLOAT32 *filter_coeff) {
WORD32 l, k;
FLOAT32 *out1, *out2, *state1, *state2;
const FLOAT32 *filter1, *filter2;
filter1 = filter_coeff;
filter2 = filter_coeff + 2 * resolution;
out1 = out;
out2 = out + resolution;
state1 = state;
state2 = state + (3 * resolution);
for (k = 0; k < 5; k++) {
for (l = 0; l < resolution; l++) {
*out1++ = ((*state1++) * (filter1[2*l] + filter1[2*l+1])/2);
*out2++ = ((*state2++) * (filter2[2 * l] + filter2[2 * l + 1])/2);
}
filter1 += 4 * resolution;
filter2 += 4 * resolution;
out1 += resolution;
out2 += resolution;
state1 += (3 * resolution);
state2 += (3 * resolution);
}
}
VOID ixheaacd_mps_synth_pre_twidle(FLOAT32 *out_re, FLOAT32 *out_im,
FLOAT32 *c_in, WORD32 len) {
WORD32 i;
@ -186,6 +272,38 @@ VOID ixheaacd_mps_synth_post_twidle(FLOAT32 *state, FLOAT32 *out_re,
}
}
VOID ixheaacd_mps_synt_pre_twiddle_dec(FLOAT32 *ptr_in, const FLOAT32 *table,
FLOAT32 *fin_re, FLOAT32 *fin_im,
WORD32 resolution) {
WORD32 k;
FLOAT32 *c_s = ptr_in;
FLOAT32 *p_re_s = fin_re;
FLOAT32 *p_im_s = fin_im;
FLOAT32 *c_e = ptr_in + (resolution << 1) - 1;
FLOAT32 *p_im_e = fin_im + resolution - 1;
FLOAT32 *p_re_e = fin_re + resolution - 1;
for (k = 0; k < resolution; k += 2) {
*p_re_s = (*c_s++) * (*table);
*p_im_s = (*c_s) * (*table);
*p_re_e = (*c_e--) * (*table);
*p_im_e = -(*c_e) * (*table++);
*p_re_s += (*c_s--) * (*table);
*p_im_s += -(*c_s++) * (*table);
p_re_s++;
p_im_s++;
c_s++;
*p_re_e += (*c_e++) * (*table);
*p_im_e += (*c_e--) * (*table++);
p_re_e--;
p_im_e--;
c_e--;
}
}
VOID ixheaacd_mps_synt_calc(ia_mps_dec_state_struct *self) {
WORD32 k, l, ts, ch;
FLOAT32 *state, *tmp_state, *out;
@ -197,34 +315,92 @@ VOID ixheaacd_mps_synt_calc(ia_mps_dec_state_struct *self) {
ia_mps_poly_phase_struct kernel = self->poly_phase_filt_kernel;
WORD32 resolution = kernel.resolution;
WORD32 m_resolution = resolution >> 1;
for (ch = 0; ch < self->out_ch_count; ch++) {
tmp_state = (&self->qmf_filt_state[ch])->state;
state = &tmp_buf[self->time_slots * 2 * resolution];
memcpy(state, tmp_state, sizeof(FLOAT32) * 18 * resolution);
out = &tmp_buf[74 * MAX_NUM_QMF_BANDS_SAC];
const FLOAT32 *ixheaacd_mps_post_re, *ixheaacd_mps_post_im;
VOID(*ixheaacd_mps_synt_out_calc_pointer)
(WORD32 resolution, FLOAT32 *out, FLOAT32 *state, const FLOAT32 *filter_coeff);
for (ts = 0; ts < self->time_slots; ts++) {
filt_coeff = ixheaacd_mps_polyphase_filter_coeff;
if (self->ldmps_config.ldmps_present_flag)
{
ixheaacd_mps_synt_out_calc_pointer = &ixheaacd_mps_synt_out_calc_dec_ldmps;
filt_coeff = ixheaacd_ldmps_polyphase_filter_coeff;
}
else
{
ixheaacd_mps_synt_out_calc_pointer = ixheaacd_mps_synt_out_calc;
filt_coeff = ixheaacd_mps_polyphase_filter_coeff;
}
if (self->qmf_band_count == 32)
{
for (ch = 0; ch < self->out_ch_count; ch++) {
tmp_state = (&self->qmf_filt_state[ch])->state;
state = &tmp_buf[self->time_slots * 2 * resolution];
memcpy(state, tmp_state, sizeof(FLOAT32) * 18 * resolution);
out = &tmp_buf[74 * MAX_NUM_QMF_BANDS_SAC];
state -= (2 * resolution);
ixheaacd_mps_post_re = ixheaacd_mps_post_re_32;
ixheaacd_mps_post_im = ixheaacd_mps_post_im_32;
ixheaacd_mps_synth_pre_twidle(
for (ts = 0; ts < self->time_slots; ts++) {
state -= (2 * resolution);
ixheaacd_mps_synt_pre_twiddle_dec(&self->qmf_out_dir[ch][ts][0].re,
ixheaacd_ldmps_pre_twid, fin_re, fin_im, resolution);
for (k = resolution; k < 2 * resolution; k++)
{
fin_re[k] = 0;
fin_im[k] = 0;
}
ixheaacd_mps_complex_fft(fin_re, fin_im, 2 * resolution);
ixheaacd_mps_synt_post_fft_twiddle_dec(resolution, fin_re, fin_im,
ixheaacd_mps_post_re,
ixheaacd_mps_post_im, state);
ixheaacd_mps_synt_out_calc_dec_ldmps_32(resolution, out, state, filt_coeff);
for (k = 0; k < resolution; k++) {
FLOAT32 acc = out[k];
for (l = 1; l < 10; l++) {
acc += out[resolution * l + k];
}
self->output_buffer[ch][self->qmf_band_count * ts + k] = acc;
}
}
memcpy(tmp_state, state, sizeof(FLOAT32) * 18 * resolution);
}
}
else
{
for (ch = 0; ch < self->out_ch_count; ch++) {
tmp_state = (&self->qmf_filt_state[ch])->state;
state = &tmp_buf[self->time_slots * 2 * resolution];
memcpy(state, tmp_state, sizeof(FLOAT32) * 18 * resolution);
out = &tmp_buf[74 * MAX_NUM_QMF_BANDS_SAC];
for (ts = 0; ts < self->time_slots; ts++) {
state -= (2 * resolution);
ixheaacd_mps_synth_pre_twidle(
fin_re, fin_im, &self->qmf_out_dir[ch][ts][0].re, resolution);
ixheaacd_mps_synth_calc_fft(fin_re, fin_im, m_resolution);
ixheaacd_mps_synth_calc_fft(fin_re, fin_im, m_resolution);
ixheaacd_mps_synth_post_twidle(state, fin_re, fin_im, resolution);
ixheaacd_mps_synth_post_twidle(state, fin_re, fin_im, resolution);
(*ixheaacd_mps_synt_out_calc_pointer)(resolution, out, state, filt_coeff);
(*ixheaacd_mps_synt_out_calc)(resolution, out, state, filt_coeff);
for (k = 0; k < resolution; k++) {
FLOAT32 acc = out[k];
for (l = 1; l < 10; l++) {
acc += out[resolution * l + k];
for (k = 0; k < resolution; k++) {
FLOAT32 acc = out[k];
for (l = 1; l < 10; l++) {
acc += out[resolution * l + k];
}
self->output_buffer[ch][self->qmf_band_count * ts + k] = acc;
}
self->output_buffer[ch][self->qmf_band_count * ts + k] = acc;
}
memcpy(tmp_state, state, sizeof(FLOAT32) * 18 * resolution);
}
memcpy(tmp_state, state, sizeof(FLOAT32) * 18 * resolution);
}
}

View file

@ -23,12 +23,26 @@
#include <assert.h>
#include "ixheaacd_type_def.h"
#include "ixheaacd_bitbuffer.h"
#include "ixheaacd_defines.h"
#include "ixheaacd_aac_rom.h"
#include "ixheaacd_pulsedata.h"
#include "ixheaacd_pns.h"
#include "ixheaacd_channelinfo.h"
#include "ixheaacd_common_rom.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_env_extr_part.h"
#include "ixheaacd_sbr_rom.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_mps_interface.h"
#include "ixheaacd_type_def.h"
#include "ixheaacd_constants.h"
#include "ixheaacd_basic_ops32.h"
#include "ixheaacd_basic_ops40.h"
@ -394,6 +408,224 @@ WORD32 ixheaacd_mps_apply_pre_matrix(ia_mps_dec_state_struct *self) {
return 0;
}
WORD32 ixheaacd_mps_apply_mix_matrix(ia_mps_dec_state_struct *self) {
WORD32 ts, qs, row, col;
WORD32 complex_m2 = ((self->config->bs_phase_coding != 0));
WORD32 phase_interpolation = (self->config->bs_phase_coding == 1);
WORD32 err = 0;
WORD32 num_col_iters = 0;
err = ixheaacd_mps_upmix_interp(
self->m2_decor_re, self->r_out_diff_re_in_m2, self->m2_decor_re_prev,
self->out_ch_count, (self->dir_sig_count + self->decor_sig_count), self, 1);
if (err < 0)
return err;
err = ixheaacd_mps_upmix_interp(
self->m2_resid_re, self->r_out_re_in_m2, self->m2_resid_re_prev,
self->out_ch_count, (self->dir_sig_count + self->decor_sig_count), self, 1);
if (err < 0)
return err;
if (complex_m2 && !phase_interpolation) {
err = ixheaacd_mps_upmix_interp(self->m2_decor_im, self->r_out_diff_im_in_m2,
self->m2_decor_im_prev, self->out_ch_count,
(self->dir_sig_count + self->decor_sig_count),
self, 1);
if (err < 0)
return err;
err = ixheaacd_mps_upmix_interp(self->m2_resid_im, self->r_out_im_in_m2,
self->m2_resid_im_prev, self->out_ch_count,
(self->dir_sig_count + self->decor_sig_count),
self, 1);
if (err < 0)
return err;
}
if (phase_interpolation) {
ixheaacd_mps_phase_interpolation(
self->phase_l, self->phase_r, self->phase_l_prev, self->phase_r_prev,
self->r_out_ph_re_in_m2, self->r_out_ph_im_in_m2, self);
for (ts = 0; ts < self->time_slots; ts++) {
WORD32 pb;
for (pb = 0; pb < self->bs_param_bands; pb++) {
self->r_out_im_in_m2[ts][pb][0][0] =
self->r_out_re_in_m2[ts][pb][0][0] *
self->r_out_ph_im_in_m2[ts][pb][0];
self->r_out_im_in_m2[ts][pb][0][1] =
self->r_out_re_in_m2[ts][pb][0][1] *
self->r_out_ph_im_in_m2[ts][pb][0];
self->r_out_im_in_m2[ts][pb][1][0] =
self->r_out_re_in_m2[ts][pb][1][0] *
self->r_out_ph_im_in_m2[ts][pb][1];
self->r_out_im_in_m2[ts][pb][1][1] =
self->r_out_re_in_m2[ts][pb][1][1] *
self->r_out_ph_im_in_m2[ts][pb][1];
self->r_out_re_in_m2[ts][pb][0][0] =
self->r_out_re_in_m2[ts][pb][0][0] *
self->r_out_ph_re_in_m2[ts][pb][0];
self->r_out_re_in_m2[ts][pb][0][1] =
self->r_out_re_in_m2[ts][pb][0][1] *
self->r_out_ph_re_in_m2[ts][pb][0];
self->r_out_re_in_m2[ts][pb][1][0] =
self->r_out_re_in_m2[ts][pb][1][0] *
self->r_out_ph_re_in_m2[ts][pb][1];
self->r_out_re_in_m2[ts][pb][1][1] =
self->r_out_re_in_m2[ts][pb][1][1] *
self->r_out_ph_re_in_m2[ts][pb][1];
self->r_out_diff_im_in_m2[ts][pb][0][0] = 0;
self->r_out_diff_im_in_m2[ts][pb][0][1] =
self->r_out_diff_re_in_m2[ts][pb][0][1] *
self->r_out_ph_im_in_m2[ts][pb][0];
self->r_out_diff_im_in_m2[ts][pb][1][0] = 0;
self->r_out_diff_im_in_m2[ts][pb][1][1] =
self->r_out_diff_re_in_m2[ts][pb][1][1] *
self->r_out_ph_im_in_m2[ts][pb][1];
self->r_out_diff_re_in_m2[ts][pb][0][0] = 0;
self->r_out_diff_re_in_m2[ts][pb][0][1] =
self->r_out_diff_re_in_m2[ts][pb][0][1] *
self->r_out_ph_re_in_m2[ts][pb][0];
self->r_out_diff_re_in_m2[ts][pb][1][0] = 0;
self->r_out_diff_re_in_m2[ts][pb][1][1] =
self->r_out_diff_re_in_m2[ts][pb][1][1] *
self->r_out_ph_re_in_m2[ts][pb][1];
}
}
}
if (self->res_bands == 0) {
num_col_iters = self->dir_sig_count;
}
else {
num_col_iters = (self->dir_sig_count + self->decor_sig_count);
}
for (ts = 0; ts < self->time_slots; ts++) {
for (qs = 0; qs < self->hyb_band_count_max; qs++) {
WORD32 indx = self->hyb_band_to_processing_band_table[qs];
for (row = 0; row < self->out_ch_count; row++) {
FLOAT32 sum_re_dir = 0;
FLOAT32 sum_im_dir = 0;
for (col = 0; col < num_col_iters; col++) {
sum_re_dir += self->w_dir[col][ts][qs].re *
self->r_out_re_in_m2[ts][indx][row][col];
sum_im_dir += self->w_dir[col][ts][qs].im *
self->r_out_re_in_m2[ts][indx][row][col];
}
self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
self->hyb_diff_out[row][ts][qs].re =
self->w_diff[1][ts][qs].re *
self->r_out_diff_re_in_m2[ts][indx][row][1];
self->hyb_diff_out[row][ts][qs].im =
self->w_diff[1][ts][qs].im *
self->r_out_diff_re_in_m2[ts][indx][row][1];
}
}
}
if (complex_m2) {
if (phase_interpolation) {
for (ts = 0; ts < self->time_slots; ts++) {
for (qs = 0; qs < 2; qs++) {
WORD32 indx = self->hyb_band_to_processing_band_table[qs];
for (row = 0; row < self->out_ch_count; row++) {
FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
FLOAT32 sum_im_dir = self->hyb_dir_out[row][ts][qs].im;
for (col = 0; col < num_col_iters; col++) {
sum_re_dir += self->w_dir[col][ts][qs].im *
self->r_out_im_in_m2[ts][indx][row][col];
sum_im_dir -= self->w_dir[col][ts][qs].re *
self->r_out_im_in_m2[ts][indx][row][col];
}
self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
self->hyb_diff_out[row][ts][qs].re +=
self->w_diff[1][ts][qs].im *
self->r_out_diff_im_in_m2[ts][indx][row][1];
self->hyb_diff_out[row][ts][qs].im -=
self->w_diff[1][ts][qs].re *
self->r_out_diff_im_in_m2[ts][indx][row][1];
}
}
for (qs = 2; qs < self->hyb_band_count_max; qs++) {
WORD32 indx = self->hyb_band_to_processing_band_table[qs];
for (row = 0; row < self->out_ch_count; row++) {
FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
FLOAT32 sum_im_dir = self->hyb_dir_out[row][ts][qs].im;
for (col = 0; col < num_col_iters; col++) {
sum_re_dir -= self->w_dir[col][ts][qs].im *
self->r_out_im_in_m2[ts][indx][row][col];
sum_im_dir += self->w_dir[col][ts][qs].re *
self->r_out_im_in_m2[ts][indx][row][col];
}
self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
self->hyb_diff_out[row][ts][qs].re -=
self->w_diff[1][ts][qs].im *
self->r_out_diff_im_in_m2[ts][indx][row][1];
self->hyb_diff_out[row][ts][qs].im +=
self->w_diff[1][ts][qs].re *
self->r_out_diff_im_in_m2[ts][indx][row][1];
}
}
}
}
else {
WORD32 num_cols = (self->dir_sig_count + self->decor_sig_count) > 1
? 1
: (self->dir_sig_count + self->decor_sig_count);
for (ts = 0; ts < self->time_slots; ts++) {
for (qs = 0; qs < 2; qs++) {
WORD32 indx = self->hyb_band_to_processing_band_table[qs];
for (row = 0; row < self->out_ch_count; row++) {
FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
FLOAT32 sum_im_dir = self->hyb_dir_out[row][ts][qs].im;
if (num_cols > 0) {
sum_re_dir += self->w_dir[0][ts][qs].im *
self->r_out_im_in_m2[ts][indx][row][0];
sum_im_dir -= self->w_dir[0][ts][qs].re *
self->r_out_im_in_m2[ts][indx][row][0];
}
self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
}
}
for (qs = 2; qs < self->hyb_band_count_max; qs++) {
WORD32 indx = self->hyb_band_to_processing_band_table[qs];
for (row = 0; row < self->out_ch_count; row++) {
FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
FLOAT32 sum_im_dir = self->hyb_dir_out[row][ts][qs].im;
if (num_cols > 0) {
sum_re_dir -= self->w_dir[0][ts][qs].im *
self->r_out_im_in_m2[ts][indx][row][0];
sum_im_dir += self->w_dir[0][ts][qs].re *
self->r_out_im_in_m2[ts][indx][row][0];
}
self->hyb_dir_out[row][ts][qs].re = sum_re_dir;
self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
}
}
}
}
}
return 0;
}
WORD32 ixheaacd_mps_apply_mix_matrix_type1(ia_mps_dec_state_struct *self) {
WORD32 ts, qs, row;
WORD32 err = 0;
@ -439,7 +671,8 @@ WORD32 ixheaacd_mps_apply_mix_matrix_type2(ia_mps_dec_state_struct *self) {
self->m2_decor_re, self->r_out_diff_re_in_m2, self->m2_decor_re_prev,
self->out_ch_count, (self->dir_sig_count + self->decor_sig_count), self,
1);
if (err < 0) return err;
if (err < 0)
return err;
err = ixheaacd_mps_upmix_interp_type1(
self->m2_resid_re, self->r_out_re_in_m2, self->m2_resid_re_prev,
self->out_ch_count, (self->dir_sig_count + self->decor_sig_count), self,
@ -474,7 +707,6 @@ WORD32 ixheaacd_mps_apply_mix_matrix_type2(ia_mps_dec_state_struct *self) {
self->r_out_im_in_m2[ts][pb][0][1] =
self->r_out_re_in_m2[ts][pb][0][1] *
self->r_out_ph_im_in_m2[ts][pb][0];
self->r_out_im_in_m2[ts][pb][1][0] =
self->r_out_re_in_m2[ts][pb][1][0] *
self->r_out_ph_im_in_m2[ts][pb][1];
@ -576,7 +808,7 @@ WORD32 ixheaacd_mps_apply_mix_matrix_type2(ia_mps_dec_state_struct *self) {
self->r_out_diff_im_in_m2[ts][indx][row][1];
}
}
for (qs = 2; qs < self->hyb_band_count[0]; qs++) {
for (qs = 2; qs < self->hyb_band_count_max; qs++) {
WORD32 indx = self->hyb_band_to_processing_band_table[qs];
for (row = 0; row < self->out_ch_count; row++) {
FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
@ -599,7 +831,7 @@ WORD32 ixheaacd_mps_apply_mix_matrix_type2(ia_mps_dec_state_struct *self) {
}
}
} else {
int num_cols = (self->dir_sig_count + self->decor_sig_count) > 1
WORD32 num_cols = (self->dir_sig_count + self->decor_sig_count) > 1
? 1
: (self->dir_sig_count + self->decor_sig_count);
for (ts = 0; ts < self->time_slots; ts++) {
@ -618,7 +850,7 @@ WORD32 ixheaacd_mps_apply_mix_matrix_type2(ia_mps_dec_state_struct *self) {
self->hyb_dir_out[row][ts][qs].im = sum_im_dir;
}
}
for (qs = 2; qs < self->hyb_band_count[0]; qs++) {
for (qs = 2; qs < self->hyb_band_count_max; qs++) {
WORD32 indx = self->hyb_band_to_processing_band_table[qs];
for (row = 0; row < self->out_ch_count; row++) {
FLOAT32 sum_re_dir = self->hyb_dir_out[row][ts][qs].re;
@ -1003,6 +1235,59 @@ WORD32 ixheaacd_mps_apply_mix_matrix_type3(ia_mps_dec_state_struct *self) {
return 0;
}
WORD32 ixheaacd_mps_upmix_interp(
FLOAT32 m_matrix[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT]
[MAX_M_INPUT],
FLOAT32 r_matrix_float[MAX_TIME_SLOTS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT]
[MAX_M_INPUT],
FLOAT32 m_matrix_prev[MAX_PARAMETER_BANDS][MAX_M_OUTPUT][MAX_M_INPUT],
WORD32 num_rows, WORD32 num_cols, ia_mps_dec_state_struct *self, WORD32 bs_high_rate_mode) {
WORD32 ts, ps, pb, row, col, i;
FLOAT32 ks, ms, ls;
FLOAT32 fl_step, fl_base;
if (MAX_TIME_SLOTS < (self->param_slot_diff[0]))
return -1;
for (pb = 0; pb < self->bs_param_bands; pb++) {
for (row = 0; row < num_rows; row++) {
for (col = 0; col < num_cols; col++) {
ts = 0;
ps = 0;
ks = self->inv_param_slot_diff[ps];
ms = m_matrix[ps][pb][row][col];
ls = m_matrix_prev[pb][row][col];
fl_step = ks * (ms - ls);
fl_base = ls + fl_step;
for (i = 1; i <= (WORD32)self->param_slot_diff[0]; i++) {
r_matrix_float[ts][pb][row][col] = fl_base;
fl_base += fl_step;
ts++;
}
if (bs_high_rate_mode) {
for (ps = 1; ps < self->num_parameter_sets; ps++) {
if (MAX_TIME_SLOTS < (ts + self->param_slot_diff[ps]))
return -1;
ks = self->inv_param_slot_diff[ps];
ms = m_matrix[ps][pb][row][col];
ls = m_matrix[ps - 1][pb][row][col];
fl_step = ks * (ms - ls);
fl_base = ls + fl_step;
for (i = 1; i <= (WORD32)self->param_slot_diff[ps]; i++) {
r_matrix_float[ts][pb][row][col] = fl_base;
fl_base += fl_step;
ts++;
}
}
}
}
}
}
return 0;
}
WORD32 ixheaacd_mps_upmix_interp_type1(
FLOAT32 m_matrix[MAX_PARAMETER_SETS_MPS][MAX_PARAMETER_BANDS][MAX_M_OUTPUT]
[MAX_M_INPUT],

View file

@ -25,7 +25,20 @@
#include "ixheaacd_type_def.h"
#include "ixheaacd_bitbuffer.h"
#include "ixheaacd_defines.h"
#include "ixheaacd_aac_rom.h"
#include "ixheaacd_pulsedata.h"
#include "ixheaacd_pns.h"
#include "ixheaacd_channelinfo.h"
#include "ixheaacd_common_rom.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_env_extr_part.h"
#include "ixheaacd_sbr_rom.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_mps_dec.h"
@ -6077,6 +6090,54 @@ const FLOAT32 ixheaacd_mps_post_twid[30] = {
0.881921f, 0.471397f, 0.857729f, 0.514103f, 0.831470f, 0.555570f,
0.803208f, 0.595699f, 0.773010f, 0.634393f, 0.740951f, 0.671559f};
const FLOAT32 ixheaacd_ldmps_pre_twid[32] = {
0.0156202940f, 0.0003834558f, 0.0155826630f, 0.0011494453f,
0.0155074932f, 0.0019126660f, 0.0153949633f, 0.0026712785f,
0.0152453454f, 0.0034234561f, 0.0150590008f, 0.0041673859f,
0.0148363775f, 0.0049012764f, 0.0145780127f, 0.0056233592f,
0.0142845269f, 0.0063318950f, 0.0139566287f, 0.0070251762f,
0.0135951089f, 0.0077015338f, 0.0132008363f, 0.0083593372f,
0.0127747618f, 0.0089970026f, 0.0123179127f, 0.0096129924f,
0.0118313879f, 0.0102058258f, 0.0113163600f, 0.0107740704f };
const FLOAT32 ixheaacd_mps_post_re_32[64] = {
1.0000000000f, 0.9987954497f, 0.9951847196f, 0.9891765118f,
0.9807852507f, 0.9700312614f, 0.9569403529f, 0.9415440559f,
0.9238795042f, 0.9039893150f, 0.8819212317f, 0.8577286005f,
0.8314695954f, 0.8032075167f, 0.7730104327f, 0.7409511209f,
0.7071067691f, 0.6715589166f, 0.6343932748f, 0.5956993103f,
0.5555701852f, 0.5141026974f, 0.4713966548f, 0.4275551140f,
0.3826834261f, 0.3368898332f, 0.2902846336f, 0.2429801226f,
0.1950902343f, 0.1467304826f, 0.0980171338f, 0.0490676500f,
-0.0000000433f, -0.0490677357f, -0.0980172232f, -0.1467305720f,
-0.1950903237f, -0.2429801971f, -0.2902847230f, -0.3368899226f,
-0.3826835155f, -0.4275550842f, -0.4713968337f, -0.5141027570f,
-0.5555703640f, -0.5956993699f, -0.6343932748f, -0.6715590358f,
-0.7071067691f, -0.7409512401f, -0.7730104923f, -0.8032076359f,
-0.8314696550f, -0.8577286005f, -0.8819213510f, -0.9039893150f,
-0.9238796234f, -0.9415441155f, -0.9569403529f, -0.9700312614f,
-0.9807853103f, -0.9891765118f, -0.9951847196f, -0.9987954497f
};
const FLOAT32 ixheaacd_mps_post_im_32[64] = {
0.0000000000f, 0.0490676761f, 0.0980171412f, 0.1467304677f,
0.1950903237f, 0.2429801822f, 0.2902846634f, 0.3368898630f,
0.3826834559f, 0.4275550842f, 0.4713967443f, 0.5141027570f,
0.5555702448f, 0.5956993103f, 0.6343933344f, 0.6715589762f,
0.7071067691f, 0.7409511805f, 0.7730104327f, 0.8032075167f,
0.8314696550f, 0.8577286601f, 0.8819212914f, 0.9039893150f,
0.9238795042f, 0.9415440559f, 0.9569403529f, 0.9700312614f,
0.9807853103f, 0.9891765118f, 0.9951847196f, 0.9987954497f,
1.0000000000f, 0.9987954497f, 0.9951847196f, 0.9891765118f,
0.9807852507f, 0.9700312614f, 0.9569402933f, 0.9415440559f,
0.9238795042f, 0.9039893150f, 0.8819212317f, 0.8577286005f,
0.8314695358f, 0.8032075167f, 0.7730104923f, 0.7409510612f,
0.7071067691f, 0.6715588570f, 0.6343932748f, 0.5956991315f,
0.5555701852f, 0.5141027570f, 0.4713966250f, 0.4275550544f,
0.3826832771f, 0.3368898034f, 0.2902846932f, 0.2429800779f,
0.1950903088f, 0.1467303336f, 0.0980170965f, 0.0490674861f,
};
const FLOAT32 ixheaacd_mps_pre_twid[64] = {
0.015624f, 0.000192f, 0.015614f, 0.000575f, 0.015596f, 0.000958f, 0.015567f,
0.001341f, 0.015530f, 0.001722f, 0.015483f, 0.002103f, 0.015427f, 0.002482f,
@ -6134,6 +6195,665 @@ const FLOAT32 ixheaacd_cosine[8][8] = {
{1.000000f, 0.923880f, 0.707107f, 0.382684f, 704.000000f, -0.382683f,
-0.707106f, -0.923880f}};
const WORD32 ixheaacd_cosine2[2][13] = {
{
1073741823, 1073741823, 1073741823, 1073741823, 1073741823, 1073741823,
1073741823, 1073741823, 1073741823, 1073741823, 1073741823, 1073741823,
1073741823,
},
{
1073741823, -1073741823, 1073741823, -1073741823, 1073741823,
-1073741823, 1073741823, -1073741823, 1073741823, -1073741823,
1073741823, -1073741823, 1073741823,
},
};
const WORD32 ixheaacd_mps_gain_set_indx[29] = {
1, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 21, 23, 25, 27, 30, 33, 37, 42, 48, 55, 70};
const FLOAT32 ixheaacd_ldmps_polyphase_filter_coeff[1280] = {
-0.0007949257f, -0.0012320746f, -0.0016010543f, -0.0019807201f,
-0.0023975046f, -0.0028387094f, -0.0033147549f, -0.0038251812f,
-0.0043653073f, -0.0049372604f, -0.0055373814f, -0.0061642416f,
-0.0068165790f, -0.0074901022f, -0.0081837112f, -0.0088949297f,
-0.0096200043f, -0.0103569683f, -0.0111023858f, -0.0118535860f,
-0.0126076927f, -0.0133608067f, -0.0141103314f, -0.0148531627f,
-0.0155855091f, -0.0163043682f, -0.0170061402f, -0.0176877063f,
-0.0183456801f, -0.0189761259f, -0.0195760578f, -0.0201421324f,
-0.0206706170f, -0.0211581476f, -0.0216013081f, -0.0219969619f,
-0.0223416910f, -0.0226317085f, -0.0228641648f, -0.0230358951f,
-0.0231434479f, -0.0231835246f, -0.0231529772f, -0.0230491832f,
-0.0228686444f, -0.0226079077f, -0.0222644433f, -0.0218351875f,
-0.0213169195f, -0.0207061488f, -0.0199998133f, -0.0191956628f,
-0.0182893611f, -0.0172771178f, -0.0161564853f, -0.0149233583f,
-0.0135741979f, -0.0121037029f, -0.0105075520f, -0.0087857461f,
-0.0069273291f, -0.0049293786f, -0.0028003342f, -0.0004685577f,
0.0022103144f, 0.0051832944f, 0.0083509637f, 0.0116611840f,
0.0151316673f, 0.0187726468f, 0.0225889906f, 0.0265906155f,
0.0307808779f, 0.0351639129f, 0.0397467501f, 0.0445330814f,
0.0495262593f, 0.0547302663f, 0.0601483546f, 0.0657841489f,
0.0716395080f, 0.0777165666f, 0.0840179473f, 0.0905451626f,
0.0972988978f, 0.1042804047f, 0.1114900783f, 0.1189284250f,
0.1265947521f, 0.1344885528f, 0.1426091045f, 0.1509550363f,
0.1595243514f, 0.1683151573f, 0.1773250401f, 0.1865511388f,
0.1959902197f, 0.2056386322f, 0.2154925913f, 0.2255475521f,
0.2357989848f, 0.2462418824f, 0.2568709552f, 0.2676805258f,
0.2786645591f, 0.2898168266f, 0.3011307418f, 0.3125994802f,
0.3242157102f, 0.3359722793f, 0.3478614092f, 0.3598752320f,
0.3720056713f, 0.3842444420f, 0.3965831101f, 0.4090129435f,
0.4215250909f, 0.4341109097f, 0.4467608333f, 0.4594659507f,
0.4722166657f, 0.4850038290f, 0.4978178144f, 0.5106483698f,
0.5234865546f, 0.5363218188f, 0.5491440296f, 0.5619440079f,
-0.5746001601f, -0.5872559547f, -0.5998619199f, -0.6123980284f,
-0.6248505116f, -0.6372103095f, -0.6494654417f, -0.6616044044f,
-0.6736174226f, -0.6854929924f, -0.6972201467f, -0.7087881565f,
-0.7201859951f, -0.7314035296f, -0.7424294949f, -0.7532534599f,
-0.7638649344f, -0.7742537856f, -0.7844095230f, -0.7943222523f,
-0.8039818406f, -0.8133789897f, -0.8225036860f, -0.8313468695f,
-0.8398991823f, -0.8481519818f, -0.8560963273f, -0.8637239933f,
-0.8710266352f, -0.8779965043f, -0.8846257925f, -0.8909071684f,
-0.8968337178f, -0.9023985267f, -0.9075955749f, -0.9124187231f,
-0.9168621302f, -0.9209204316f, -0.9245886207f, -0.9278619289f,
-0.9307362437f, -0.9332075119f, -0.9352724552f, -0.9369278550f,
-0.9381709695f, -0.9389997125f, -0.9394121170f, -0.9394068122f,
-0.9389829040f, -0.9381397963f, -0.9368773103f, -0.9351961017f,
-0.9330966473f, -0.9305803180f, -0.9276487827f, -0.9243040681f,
-0.9205487967f, -0.9163856506f, -0.9118180275f, -0.9068503380f,
-0.9014858603f, -0.8957295418f, -0.8895882368f, -0.8830582500f,
-0.8761259913f, -0.8688043952f, -0.8611140251f, -0.8530684114f,
-0.8446723223f, -0.8359322548f, -0.8268554807f, -0.8174491525f,
-0.8077214956f, -0.7976809740f, -0.7873360515f, -0.7766956687f,
-0.7657692432f, -0.7545663714f, -0.7430967689f, -0.7313705087f,
-0.7193979621f, -0.7071895599f, -0.6947561502f, -0.6821083426f,
-0.6692573428f, -0.6562142968f, -0.6429904699f, -0.6295973659f,
-0.6160464287f, -0.6023493409f, -0.5885176659f, -0.5745630264f,
-0.5604973435f, -0.5463322401f, -0.5320795774f, -0.5177509785f,
-0.5033583045f, -0.4889132082f, -0.4744274616f, -0.4599125087f,
-0.4453800321f, -0.4308412969f, -0.4163077474f, -0.4017905891f,
-0.3873008788f, -0.3728497028f, -0.3584479988f, -0.3441060781f,
-0.3298346698f, -0.3156442046f, -0.3015447557f, -0.2875462472f,
-0.2736584544f, -0.2598909736f, -0.2462531626f, -0.2327540070f,
-0.2194025517f, -0.2062072009f, -0.1931765229f, -0.1803186089f,
-0.1676410586f, -0.1551517546f, -0.1428578347f, -0.1307662129f,
-0.1188837960f, -0.1072167307f, -0.0957711190f, -0.0845528170f,
0.0735579357f, 0.0628051385f, 0.0522958934f, 0.0420338102f,
0.0320230126f, 0.0222672001f, 0.0127700046f, 0.0035346728f,
-0.0054356726f, -0.0141385710f, -0.0225714780f, -0.0307325479f,
-0.0386199504f, -0.0462324508f, -0.0535687581f, -0.0606284477f,
-0.0674108788f, -0.0739159212f, -0.0801439285f, -0.0860951766f,
-0.0917705968f, -0.0971711874f, -0.1022983864f, -0.1071535870f,
-0.1117390916f, -0.1160565540f, -0.1201089993f, -0.1238986105f,
-0.1274286509f, -0.1307021976f, -0.1337226629f, -0.1364936531f,
-0.1390190870f, -0.1413030326f, -0.1433497667f, -0.1451636255f,
-0.1467494071f, -0.1481117010f, -0.1492556185f, -0.1501862854f,
-0.1509089023f, -0.1514289081f, -0.1517517567f, -0.1518831998f,
-0.1518289149f, -0.1515947729f, -0.1511866748f, -0.1506105959f,
-0.1498726010f, -0.1489787102f, -0.1479352117f, -0.1467481852f,
-0.1454239190f, -0.1439685971f, -0.1423884183f, -0.1406896859f,
-0.1388785988f, -0.1369612068f, -0.1349437684f, -0.1328323931f,
-0.1306331158f, -0.1283520460f, -0.1259952188f, -0.1235680804f,
-0.1210755706f, -0.1185237169f, -0.1159184426f, -0.1132654399f,
-0.1105698794f, -0.1078369170f, -0.1050716117f, -0.1022789180f,
-0.0994636714f, -0.0966306925f, -0.0937845483f, -0.0909297019f,
-0.0880705118f, -0.0852110758f, -0.0823556259f, -0.0795079023f,
-0.0766717792f, -0.0738509223f, -0.0710486695f, -0.0682684705f,
-0.0655134097f, -0.0627865866f, -0.0600909144f, -0.0574291982f,
-0.0548038296f, -0.0522173792f, -0.0496721379f, -0.0471702330f,
-0.0447136387f, -0.0423043817f, -0.0399438478f, -0.0376337133f,
-0.0353754386f, -0.0331703536f, -0.0310197119f, -0.0289245304f,
-0.0268857535f, -0.0249042176f, -0.0229805857f, -0.0211154576f,
-0.0193092767f, -0.0175623931f, -0.0158751141f, -0.0142475078f,
-0.0126795555f, -0.0111712581f, -0.0097224051f, -0.0083327051f,
-0.0070017893f, -0.0057292255f, -0.0045145033f, -0.0033569466f,
-0.0022558495f, -0.0012104595f, -0.0002199477f, 0.0007167263f,
0.0016004397f, 0.0024323659f, 0.0032136049f, 0.0039453004f,
0.0046286648f, 0.0052649761f, 0.0058556525f, 0.0064016338f,
-0.0069030458f, -0.0073645366f, -0.0077859173f, -0.0081687812f,
-0.0085145105f, -0.0088245263f, -0.0091004446f, -0.0093438197f,
-0.0095560895f, -0.0097389296f, -0.0098937284f, -0.0100222183f,
-0.0101256752f, -0.0102057597f, -0.0102638984f, -0.0103016300f,
-0.0103203785f, -0.0103215463f, -0.0103065800f, -0.0102768280f,
-0.0102336034f, -0.0101782102f, -0.0101119522f, -0.0100360261f,
-0.0099515645f, -0.0098597351f, -0.0097616902f, -0.0096583357f,
-0.0095505062f, -0.0094392402f, -0.0093253115f, -0.0092095714f,
-0.0090927295f, -0.0089755040f, -0.0088585643f, -0.0087425476f,
-0.0086279176f, -0.0085152360f, -0.0084048351f, -0.0082970457f,
-0.0081921816f, -0.0080905585f, -0.0079923403f, -0.0078977877f,
-0.0078069791f, -0.0077200048f, -0.0076368991f, -0.0075576920f,
-0.0074823610f, -0.0074108820f, -0.0073430836f, -0.0072789183f,
-0.0072182063f, -0.0071608433f, -0.0071066003f, -0.0070552491f,
-0.0070065912f, -0.0069604507f, -0.0069165546f, -0.0068746237f,
-0.0068344427f, -0.0067957863f, -0.0067584766f, -0.0067221262f,
-0.0066861408f, -0.0066502281f, -0.0066143544f, -0.0065783206f,
-0.0065418649f, -0.0065047294f, -0.0064666905f, -0.0064275563f,
-0.0063871238f, -0.0063452618f, -0.0063017663f, -0.0062565422f,
-0.0062093716f, -0.0061602155f, -0.0061089024f, -0.0060553551f,
-0.0059994739f, -0.0059412112f, -0.0058804955f, -0.0058172857f,
-0.0057515362f, -0.0056832312f, -0.0056123761f, -0.0055389581f,
-0.0054629631f, -0.0053843958f, -0.0053033372f, -0.0052197399f,
-0.0051336233f, -0.0050450461f, -0.0049540084f, -0.0048605883f,
-0.0047647208f, -0.0046664691f, -0.0045659458f, -0.0044631511f,
-0.0043581501f, -0.0042509669f, -0.0041416343f, -0.0040301653f,
-0.0039165970f, -0.0038009947f, -0.0036834506f, -0.0035639144f,
-0.0034424895f, -0.0033192560f, -0.0031942502f, -0.0030675260f,
-0.0029391386f, -0.0028091520f, -0.0026777033f, -0.0025448306f,
-0.0024106177f, -0.0022751903f, -0.0021385867f, -0.0020008814f,
-0.0018621609f, -0.0017228508f, -0.0015830053f, -0.0014426354f,
-0.0013017356f, -0.0011605313f, -0.0010187104f, -0.0008753659f,
0.0007250868f, 0.0005901512f, 0.0004571248f, 0.0003254497f,
0.0001951829f, 0.0000666175f, -0.0000600275f, -0.0001845164f,
-0.0003065709f, -0.0004259665f, -0.0005424777f, -0.0006558085f,
-0.0007659104f, -0.0008724863f, -0.0009753527f, -0.0010743001f,
-0.0011691442f, -0.0012597255f, -0.0013458347f, -0.0014273394f,
-0.0015040794f, -0.0015758807f, -0.0016426332f, -0.0017042002f,
-0.0017605145f, -0.0018114587f, -0.0018569818f, -0.0018970286f,
-0.0019315863f, -0.0019606268f, -0.0019841781f, -0.0020022886f,
-0.0020149164f, -0.0020221891f, -0.0020242548f, -0.0020211563f,
-0.0020131115f, -0.0020002127f, -0.0019826870f, -0.0019606939f,
-0.0019344082f, -0.0019041235f, -0.0018700724f, -0.0018325197f,
-0.0017917566f, -0.0017479789f, -0.0017015412f, -0.0016526897f,
-0.0016016904f, -0.0015489543f, -0.0014947094f, -0.0014391905f,
-0.0013827635f, -0.0013256427f, -0.0012681838f, -0.0012105964f,
-0.0011530248f, -0.0010959618f, -0.0010395534f, -0.0009838343f,
-0.0009290278f, -0.0008749813f, -0.0008215802f, -0.0007706117f,
-0.0007240456f, -0.0006849431f, -0.0006499495f, -0.0006169267f,
-0.0005864026f, -0.0005585561f, -0.0005332623f, -0.0005106712f,
-0.0004907669f, -0.0004734583f, -0.0004585870f, -0.0004460039f,
-0.0004356373f, -0.0004273243f, -0.0004208330f, -0.0004159436f,
-0.0004123962f, -0.0004100222f, -0.0004085470f, -0.0004077079f,
-0.0004073251f, -0.0004070932f, -0.0004067607f, -0.0004061488f,
-0.0004050555f, -0.0004033837f, -0.0004008813f, -0.0003973767f,
-0.0003928188f, -0.0003870558f, -0.0003799992f, -0.0003715968f,
-0.0003617546f, -0.0003505340f, -0.0003378810f, -0.0003237817f,
-0.0003083795f, -0.0002916576f, -0.0002737129f, -0.0002546264f,
-0.0002344782f, -0.0002134573f, -0.0001916261f, -0.0001692856f,
-0.0001466954f, -0.0001236852f, -0.0001005735f, -0.0000775065f,
-0.0000546696f, -0.0000325590f, -0.0000109682f, 0.0000098813f,
0.0000295145f, 0.0000481009f, 0.0000651376f, 0.0000805138f,
0.0000942973f, 0.0001058290f, 0.0001155818f, 0.0001229653f,
0.0001266878f, 0.0001279376f, 0.0001216913f, 0.0000938624f,
-0.0007949257f, -0.0012320746f, -0.0016010543f, -0.0019807201f,
-0.0023975046f, -0.0028387094f, -0.0033147549f, -0.0038251812f,
-0.0043653073f, -0.0049372604f, -0.0055373814f, -0.0061642416f,
-0.0068165790f, -0.0074901022f, -0.0081837112f, -0.0088949297f,
-0.0096200043f, -0.0103569683f, -0.0111023858f, -0.0118535860f,
-0.0126076927f, -0.0133608067f, -0.0141103314f, -0.0148531627f,
-0.0155855091f, -0.0163043682f, -0.0170061402f, -0.0176877063f,
-0.0183456801f, -0.0189761259f, -0.0195760578f, -0.0201421324f,
-0.0206706170f, -0.0211581476f, -0.0216013081f, -0.0219969619f,
-0.0223416910f, -0.0226317085f, -0.0228641648f, -0.0230358951f,
-0.0231434479f, -0.0231835246f, -0.0231529772f, -0.0230491832f,
-0.0228686444f, -0.0226079077f, -0.0222644433f, -0.0218351875f,
-0.0213169195f, -0.0207061488f, -0.0199998133f, -0.0191956628f,
-0.0182893611f, -0.0172771178f, -0.0161564853f, -0.0149233583f,
-0.0135741979f, -0.0121037029f, -0.0105075520f, -0.0087857461f,
-0.0069273291f, -0.0049293786f, -0.0028003342f, -0.0004685577f,
0.0022103144f, 0.0051832944f, 0.0083509637f, 0.0116611840f,
0.0151316673f, 0.0187726468f, 0.0225889906f, 0.0265906155f,
0.0307808779f, 0.0351639129f, 0.0397467501f, 0.0445330814f,
0.0495262593f, 0.0547302663f, 0.0601483546f, 0.0657841489f,
0.0716395080f, 0.0777165666f, 0.0840179473f, 0.0905451626f,
0.0972988978f, 0.1042804047f, 0.1114900783f, 0.1189284250f,
0.1265947521f, 0.1344885528f, 0.1426091045f, 0.1509550363f,
0.1595243514f, 0.1683151573f, 0.1773250401f, 0.1865511388f,
0.1959902197f, 0.2056386322f, 0.2154925913f, 0.2255475521f,
0.2357989848f, 0.2462418824f, 0.2568709552f, 0.2676805258f,
0.2786645591f, 0.2898168266f, 0.3011307418f, 0.3125994802f,
0.3242157102f, 0.3359722793f, 0.3478614092f, 0.3598752320f,
0.3720056713f, 0.3842444420f, 0.3965831101f, 0.4090129435f,
0.4215250909f, 0.4341109097f, 0.4467608333f, 0.4594659507f,
0.4722166657f, 0.4850038290f, 0.4978178144f, 0.5106483698f,
0.5234865546f, 0.5363218188f, 0.5491440296f, 0.5619440079f,
-0.5746001601f, -0.5872559547f, -0.5998619199f, -0.6123980284f,
-0.6248505116f, -0.6372103095f, -0.6494654417f, -0.6616044044f,
-0.6736174226f, -0.6854929924f, -0.6972201467f, -0.7087881565f,
-0.7201859951f, -0.7314035296f, -0.7424294949f, -0.7532534599f,
-0.7638649344f, -0.7742537856f, -0.7844095230f, -0.7943222523f,
-0.8039818406f, -0.8133789897f, -0.8225036860f, -0.8313468695f,
-0.8398991823f, -0.8481519818f, -0.8560963273f, -0.8637239933f,
-0.8710266352f, -0.8779965043f, -0.8846257925f, -0.8909071684f,
-0.8968337178f, -0.9023985267f, -0.9075955749f, -0.9124187231f,
-0.9168621302f, -0.9209204316f, -0.9245886207f, -0.9278619289f,
-0.9307362437f, -0.9332075119f, -0.9352724552f, -0.9369278550f,
-0.9381709695f, -0.9389997125f, -0.9394121170f, -0.9394068122f,
-0.9389829040f, -0.9381397963f, -0.9368773103f, -0.9351961017f,
-0.9330966473f, -0.9305803180f, -0.9276487827f, -0.9243040681f,
-0.9205487967f, -0.9163856506f, -0.9118180275f, -0.9068503380f,
-0.9014858603f, -0.8957295418f, -0.8895882368f, -0.8830582500f,
-0.8761259913f, -0.8688043952f, -0.8611140251f, -0.8530684114f,
-0.8446723223f, -0.8359322548f, -0.8268554807f, -0.8174491525f,
-0.8077214956f, -0.7976809740f, -0.7873360515f, -0.7766956687f,
-0.7657692432f, -0.7545663714f, -0.7430967689f, -0.7313705087f,
-0.7193979621f, -0.7071895599f, -0.6947561502f, -0.6821083426f,
-0.6692573428f, -0.6562142968f, -0.6429904699f, -0.6295973659f,
-0.6160464287f, -0.6023493409f, -0.5885176659f, -0.5745630264f,
-0.5604973435f, -0.5463322401f, -0.5320795774f, -0.5177509785f,
-0.5033583045f, -0.4889132082f, -0.4744274616f, -0.4599125087f,
-0.4453800321f, -0.4308412969f, -0.4163077474f, -0.4017905891f,
-0.3873008788f, -0.3728497028f, -0.3584479988f, -0.3441060781f,
-0.3298346698f, -0.3156442046f, -0.3015447557f, -0.2875462472f,
-0.2736584544f, -0.2598909736f, -0.2462531626f, -0.2327540070f,
-0.2194025517f, -0.2062072009f, -0.1931765229f, -0.1803186089f,
-0.1676410586f, -0.1551517546f, -0.1428578347f, -0.1307662129f,
-0.1188837960f, -0.1072167307f, -0.0957711190f, -0.0845528170f,
0.0735579357f, 0.0628051385f, 0.0522958934f, 0.0420338102f,
0.0320230126f, 0.0222672001f, 0.0127700046f, 0.0035346728f,
-0.0054356726f, -0.0141385710f, -0.0225714780f, -0.0307325479f,
-0.0386199504f, -0.0462324508f, -0.0535687581f, -0.0606284477f,
-0.0674108788f, -0.0739159212f, -0.0801439285f, -0.0860951766f,
-0.0917705968f, -0.0971711874f, -0.1022983864f, -0.1071535870f,
-0.1117390916f, -0.1160565540f, -0.1201089993f, -0.1238986105f,
-0.1274286509f, -0.1307021976f, -0.1337226629f, -0.1364936531f,
-0.1390190870f, -0.1413030326f, -0.1433497667f, -0.1451636255f,
-0.1467494071f, -0.1481117010f, -0.1492556185f, -0.1501862854f,
-0.1509089023f, -0.1514289081f, -0.1517517567f, -0.1518831998f,
-0.1518289149f, -0.1515947729f, -0.1511866748f, -0.1506105959f,
-0.1498726010f, -0.1489787102f, -0.1479352117f, -0.1467481852f,
-0.1454239190f, -0.1439685971f, -0.1423884183f, -0.1406896859f,
-0.1388785988f, -0.1369612068f, -0.1349437684f, -0.1328323931f,
-0.1306331158f, -0.1283520460f, -0.1259952188f, -0.1235680804f,
-0.1210755706f, -0.1185237169f, -0.1159184426f, -0.1132654399f,
-0.1105698794f, -0.1078369170f, -0.1050716117f, -0.1022789180f,
-0.0994636714f, -0.0966306925f, -0.0937845483f, -0.0909297019f,
-0.0880705118f, -0.0852110758f, -0.0823556259f, -0.0795079023f,
-0.0766717792f, -0.0738509223f, -0.0710486695f, -0.0682684705f,
-0.0655134097f, -0.0627865866f, -0.0600909144f, -0.0574291982f,
-0.0548038296f, -0.0522173792f, -0.0496721379f, -0.0471702330f,
-0.0447136387f, -0.0423043817f, -0.0399438478f, -0.0376337133f,
-0.0353754386f, -0.0331703536f, -0.0310197119f, -0.0289245304f,
-0.0268857535f, -0.0249042176f, -0.0229805857f, -0.0211154576f,
-0.0193092767f, -0.0175623931f, -0.0158751141f, -0.0142475078f,
-0.0126795555f, -0.0111712581f, -0.0097224051f, -0.0083327051f,
-0.0070017893f, -0.0057292255f, -0.0045145033f, -0.0033569466f,
-0.0022558495f, -0.0012104595f, -0.0002199477f, 0.0007167263f,
0.0016004397f, 0.0024323659f, 0.0032136049f, 0.0039453004f,
0.0046286648f, 0.0052649761f, 0.0058556525f, 0.0064016338f,
-0.0069030458f, -0.0073645366f, -0.0077859173f, -0.0081687812f,
-0.0085145105f, -0.0088245263f, -0.0091004446f, -0.0093438197f,
-0.0095560895f, -0.0097389296f, -0.0098937284f, -0.0100222183f,
-0.0101256752f, -0.0102057597f, -0.0102638984f, -0.0103016300f,
-0.0103203785f, -0.0103215463f, -0.0103065800f, -0.0102768280f,
-0.0102336034f, -0.0101782102f, -0.0101119522f, -0.0100360261f,
-0.0099515645f, -0.0098597351f, -0.0097616902f, -0.0096583357f,
-0.0095505062f, -0.0094392402f, -0.0093253115f, -0.0092095714f,
-0.0090927295f, -0.0089755040f, -0.0088585643f, -0.0087425476f,
-0.0086279176f, -0.0085152360f, -0.0084048351f, -0.0082970457f,
-0.0081921816f, -0.0080905585f, -0.0079923403f, -0.0078977877f,
-0.0078069791f, -0.0077200048f, -0.0076368991f, -0.0075576920f,
-0.0074823610f, -0.0074108820f, -0.0073430836f, -0.0072789183f,
-0.0072182063f, -0.0071608433f, -0.0071066003f, -0.0070552491f,
-0.0070065912f, -0.0069604507f, -0.0069165546f, -0.0068746237f,
-0.0068344427f, -0.0067957863f, -0.0067584766f, -0.0067221262f,
-0.0066861408f, -0.0066502281f, -0.0066143544f, -0.0065783206f,
-0.0065418649f, -0.0065047294f, -0.0064666905f, -0.0064275563f,
-0.0063871238f, -0.0063452618f, -0.0063017663f, -0.0062565422f,
-0.0062093716f, -0.0061602155f, -0.0061089024f, -0.0060553551f,
-0.0059994739f, -0.0059412112f, -0.0058804955f, -0.0058172857f,
-0.0057515362f, -0.0056832312f, -0.0056123761f, -0.0055389581f,
-0.0054629631f, -0.0053843958f, -0.0053033372f, -0.0052197399f,
-0.0051336233f, -0.0050450461f, -0.0049540084f, -0.0048605883f,
-0.0047647208f, -0.0046664691f, -0.0045659458f, -0.0044631511f,
-0.0043581501f, -0.0042509669f, -0.0041416343f, -0.0040301653f,
-0.0039165970f, -0.0038009947f, -0.0036834506f, -0.0035639144f,
-0.0034424895f, -0.0033192560f, -0.0031942502f, -0.0030675260f,
-0.0029391386f, -0.0028091520f, -0.0026777033f, -0.0025448306f,
-0.0024106177f, -0.0022751903f, -0.0021385867f, -0.0020008814f,
-0.0018621609f, -0.0017228508f, -0.0015830053f, -0.0014426354f,
-0.0013017356f, -0.0011605313f, -0.0010187104f, -0.0008753659f,
0.0007250868f, 0.0005901512f, 0.0004571248f, 0.0003254497f,
0.0001951829f, 0.0000666175f, -0.0000600275f, -0.0001845164f,
-0.0003065709f, -0.0004259665f, -0.0005424777f, -0.0006558085f,
-0.0007659104f, -0.0008724863f, -0.0009753527f, -0.0010743001f,
-0.0011691442f, -0.0012597255f, -0.0013458347f, -0.0014273394f,
-0.0015040794f, -0.0015758807f, -0.0016426332f, -0.0017042002f,
-0.0017605145f, -0.0018114587f, -0.0018569818f, -0.0018970286f,
-0.0019315863f, -0.0019606268f, -0.0019841781f, -0.0020022886f,
-0.0020149164f, -0.0020221891f, -0.0020242548f, -0.0020211563f,
-0.0020131115f, -0.0020002127f, -0.0019826870f, -0.0019606939f,
-0.0019344082f, -0.0019041235f, -0.0018700724f, -0.0018325197f,
-0.0017917566f, -0.0017479789f, -0.0017015412f, -0.0016526897f,
-0.0016016904f, -0.0015489543f, -0.0014947094f, -0.0014391905f,
-0.0013827635f, -0.0013256427f, -0.0012681838f, -0.0012105964f,
-0.0011530248f, -0.0010959618f, -0.0010395534f, -0.0009838343f,
-0.0009290278f, -0.0008749813f, -0.0008215802f, -0.0007706117f,
-0.0007240456f, -0.0006849431f, -0.0006499495f, -0.0006169267f,
-0.0005864026f, -0.0005585561f, -0.0005332623f, -0.0005106712f,
-0.0004907669f, -0.0004734583f, -0.0004585870f, -0.0004460039f,
-0.0004356373f, -0.0004273243f, -0.0004208330f, -0.0004159436f,
-0.0004123962f, -0.0004100222f, -0.0004085470f, -0.0004077079f,
-0.0004073251f, -0.0004070932f, -0.0004067607f, -0.0004061488f,
-0.0004050555f, -0.0004033837f, -0.0004008813f, -0.0003973767f,
-0.0003928188f, -0.0003870558f, -0.0003799992f, -0.0003715968f,
-0.0003617546f, -0.0003505340f, -0.0003378810f, -0.0003237817f,
-0.0003083795f, -0.0002916576f, -0.0002737129f, -0.0002546264f,
-0.0002344782f, -0.0002134573f, -0.0001916261f, -0.0001692856f,
-0.0001466954f, -0.0001236852f, -0.0001005735f, -0.0000775065f,
-0.0000546696f, -0.0000325590f, -0.0000109682f, 0.0000098813f,
0.0000295145f, 0.0000481009f, 0.0000651376f, 0.0000805138f,
0.0000942973f, 0.0001058290f, 0.0001155818f, 0.0001229653f,
0.0001266878f, 0.0001279376f, 0.0001216913f, 0.0000938624f
};
const WORD32 ixheaacd_ldmps_polyphase_filter_coeff_fix[1280]=
{
-853545, -1322930, -1719119, -2126782,
-2574301, -3048041, -3559191, -4107257,
-4687213, -5301343, -5945718, -6618804,
-7319246, -8042436, -8787193, -9550858,
-10329401, -11120710, -11921096, -12727691,
-13537407, -14346057, -15150853, -15948462,
-16734813, -17506682, -18260204, -18992030,
-19698524, -20375460, -21019632, -21627450,
-22194906, -22718388, -23194228, -23619058,
-23989208, -24300612, -24550210, -24734604,
-24850088, -24893120, -24860320, -24748872,
-24555020, -24275056, -23906264, -23445354,
-22888868, -22233058, -21474636, -20611186,
-19638052, -18551164, -17347894, -16023834,
-14575184, -12996252, -11282398, -9433623,
-7438163, -5292880, -3006836, -503110,
2373307, 5565520, 8966779, 12521101,
16247504, 20156977, 24254745, 28551455,
33050715, 37756963, 42677747, 47817031,
53178415, 58766175, 64583803, 70635191,
76922335, 83447527, 90213583, 97222127,
104473895, 111970231, 119711559, 127698423,
135930079, 144405983, 153125359, 162086735,
171287967, 180727023, 190401311, 200307759,
210442895, 220802799, 231383407, 242179839,
253187231, 264400207, 275813087, 287419775,
299213791, 311188447, 323336671, 335651135,
348123967, 360747487, 373513343, 386413087,
399438047, 412579327, 425827871, 439174303,
452609119, 466123039, 479705791, 493347807,
507038783, 520768895, 534527807, 548304511,
562089407, 575871167, 589638911, 603382783,
-616972224, -630561280, -644096832, -657557376,
-670928128, -684199360, -697358208, -710392320,
-723291200, -736042496, -748634432, -761055488,
-773293824, -785338560, -797177600, -808799744,
-820193728, -831348672, -842253312, -852897024,
-863268928, -873359040, -883156608, -892651904,
-901834880, -910696256, -919226432, -927416576,
-935257728, -942741568, -949859712, -956604288,
-962967872, -968943040, -974523328, -979702144,
-984473216, -988830784, -992769472, -996284160,
-999370432, -1002023936, -1004241152, -1006018624,
-1007353408, -1008243264, -1008686080, -1008680384,
-1008225216, -1007319936, -1005964352, -1004159168,
-1001904896, -999203008, -996055296, -992463936,
-988431744, -983961600, -979057152, -973723136,
-967963072, -961782272, -955188096, -948176576,
-940733120, -932871616, -924614144, -915975232,
-906960000, -897575424, -887829312, -877729344,
-867284352, -856503424, -845395648, -833970624,
-822238464, -810209472, -797894080, -785303104,
-772447680, -759339008, -745988736, -732408256,
-718609600, -704604736, -690405760, -676025024,
-661474816, -646767680, -631916032, -616932352,
-601829440, -586619776, -571316096, -555930880,
-540476864, -524966560, -509412608, -493827296,
-478223168, -462612320, -447007040, -431419360,
-415861152, -400344320, -384880608, -369481088,
-354157280, -338920384, -323781216, -308750432,
-293838528, -279055808, -264412320, -249917712,
-235581696, -221413296, -207421712, -193615632,
-180003216, -166592928, -153392432, -140409152,
-127650504, -115123088, -102833456, -90787896,
78982231, 67436503, 56152287, 45133459,
34384447, 23909225, 13711688, 3795326,
-5836509, -15181175, -24235940, -32998822,
-41467856, -49641716, -57519016, -65099300,
-72381880, -79366616, -86053888, -92443992,
-98537928, -104336768, -109842056, -115055288,
-119978936, -124614776, -128966056, -133035120,
-136825472, -140340416, -143583616, -146558944,
-149270608, -151722976, -153920640, -155868256,
-157570976, -159033728, -160262000, -161261296,
-162037200, -162595552, -162942208, -163083344,
-163025056, -162773648, -162335456, -161716896,
-160924480, -159964672, -158844224, -157569664,
-156147744, -154585104, -152888400, -151064400,
-149119760, -147060976, -144894768, -142627696,
-140266240, -137816960, -135286336, -132680216,
-130003904, -127263872, -124466480, -121617840,
-118723504, -115789008, -112819784, -109821152,
-106798304, -103756416, -100700392, -97635024,
-94564992, -91494696, -88428680, -85370960,
-82325696, -79296824, -76287928, -73302712,
-70344488, -67416584, -64522128, -61664132,
-58845164, -56067984, -53335052, -50648652,
-48010904, -45423984, -42889380, -40408892,
-37984088, -35616396, -33307162, -31057478,
-28868358, -26740700, -24675216, -22672550,
-20733178, -18857476, -17045774, -15298145,
-13614569, -11995047, -10439353, -8947174,
-7518114, -6151709, -4847411, -3604494,
-2422200, -1299721, -236167, 769579,
1718459, 2611733, 3450582, 4236234,
4969991, 5653225, 6287459, 6873702,
-7412089, -7907611, -8360065, -8771162,
-9142386, -9475263, -9771528, -10032850,
-10260773, -10457096, -10623310, -10761275,
-10872361, -10958351, -11020777, -11061291,
-11081422, -11082676, -11066606, -11034660,
-10988248, -10928770, -10857626, -10776101,
-10685411, -10586810, -10481535, -10370559,
-10254778, -10135307, -10012977, -9888702,
-9763244, -9637374, -9511811, -9387239,
-9264156, -9143165, -9024623, -8908885,
-8796288, -8687171, -8581710, -8480185,
-8382680, -8289292, -8200058, -8115010,
-8034124, -7957374, -7884576, -7815679,
-7750490, -7688897, -7630654, -7575516,
-7523270, -7473727, -7426594, -7381571,
-7338427, -7296920, -7256859, -7217828,
-7179189, -7140628, -7102109, -7063418,
-7024274, -6984400, -6943556, -6901536,
-6858122, -6813173, -6766470, -6717911,
-6667262, -6614481, -6559384, -6501888,
-6441886, -6379327, -6314134, -6246263,
-6175665, -6102323, -6026243, -5947411,
-5865812, -5781451, -5694415, -5604653,
-5512186, -5417077, -5319326, -5219017,
-5116080, -5010583, -4902647, -4792272,
-4679528, -4564441, -4447046, -4327357,
-4205414, -4081287, -3955075, -3826724,
-3696345, -3564024, -3429800, -3293731,
-3155876, -3016304, -2875162, -2732491,
-2588381, -2442967, -2296290, -2148430,
-1999480, -1849897, -1699739, -1549018,
-1397728, -1246111, -1093832, -939917,
778556, 633670, 490834, 349449,
209576, 71530, -64454, -198123,
-329178, -457378, -582481, -704169,
-822390, -936825, -1047277, -1153521,
-1255359, -1352620, -1445079, -1532594,
-1614993, -1692089, -1763764, -1829871,
-1890338, -1945039, -1993919, -2036919,
-2074025, -2105207, -2130495, -2149941,
-2163500, -2171309, -2173527, -2170200,
-2161562, -2147712, -2128894, -2105279,
-2077055, -2044537, -2007975, -1967653,
-1923884, -1876878, -1827016, -1774562,
-1719802, -1663177, -1604932, -1545319,
-1484731, -1423398, -1361702, -1299868,
-1238051, -1176780, -1116212, -1056384,
-997536, -939504, -882165, -827438,
-777438, -735452, -697878, -662420,
-629645, -599745, -572586, -548329,
-526957, -508372, -492404, -478893,
-467762, -458836, -451866, -446616,
-442807, -440258, -438674, -437773,
-437362, -437113, -436756, -436099,
-434925, -433130, -430443, -426680,
-421786, -415598, -408021, -398999,
-388431, -376383, -362797, -347658,
-331120, -313165, -293897, -273403,
-251769, -229198, -205757, -181769,
-157513, -132806, -107990, -83222,
-58701, -34960, -11777, 10610,
31691, 51648, 69941, 86451,
101251, 113633, 124105, 132033,
136030, 137372, 130665, 100784,
-853545, -1322930, -1719119, -2126782,
-2574301, -3048041, -3559191, -4107257,
-4687213, -5301343, -5945718, -6618804,
-7319246, -8042436, -8787193, -9550858,
-10329401, -11120710, -11921096, -12727691,
-13537407, -14346057, -15150853, -15948462,
-16734813, -17506682, -18260204, -18992030,
-19698524, -20375460, -21019632, -21627450,
-22194906, -22718388, -23194228, -23619058,
-23989208, -24300612, -24550210, -24734604,
-24850088, -24893120, -24860320, -24748872,
-24555020, -24275056, -23906264, -23445354,
-22888868, -22233058, -21474636, -20611186,
-19638052, -18551164, -17347894, -16023834,
-14575184, -12996252, -11282398, -9433623,
-7438163, -5292880, -3006836, -503110,
2373307, 5565520, 8966779, 12521101,
16247504, 20156977, 24254745, 28551455,
33050715, 37756963, 42677747, 47817031,
53178415, 58766175, 64583803, 70635191,
76922335, 83447527, 90213583, 97222127,
104473895, 111970231, 119711559, 127698423,
135930079, 144405983, 153125359, 162086735,
171287967, 180727023, 190401311, 200307759,
210442895, 220802799, 231383407, 242179839,
253187231, 264400207, 275813087, 287419775,
299213791, 311188447, 323336671, 335651135,
348123967, 360747487, 373513343, 386413087,
399438047, 412579327, 425827871, 439174303,
452609119, 466123039, 479705791, 493347807,
507038783, 520768895, 534527807, 548304511,
562089407, 575871167, 589638911, 603382783,
-616972224, -630561280, -644096832, -657557376,
-670928128, -684199360, -697358208, -710392320,
-723291200, -736042496, -748634432, -761055488,
-773293824, -785338560, -797177600, -808799744,
-820193728, -831348672, -842253312, -852897024,
-863268928, -873359040, -883156608, -892651904,
-901834880, -910696256, -919226432, -927416576,
-935257728, -942741568, -949859712, -956604288,
-962967872, -968943040, -974523328, -979702144,
-984473216, -988830784, -992769472, -996284160,
-999370432, -1002023936, -1004241152, -1006018624,
-1007353408, -1008243264, -1008686080, -1008680384,
-1008225216, -1007319936, -1005964352, -1004159168,
-1001904896, -999203008, -996055296, -992463936,
-988431744, -983961600, -979057152, -973723136,
-967963072, -961782272, -955188096, -948176576,
-940733120, -932871616, -924614144, -915975232,
-906960000, -897575424, -887829312, -877729344,
-867284352, -856503424, -845395648, -833970624,
-822238464, -810209472, -797894080, -785303104,
-772447680, -759339008, -745988736, -732408256,
-718609600, -704604736, -690405760, -676025024,
-661474816, -646767680, -631916032, -616932352,
-601829440, -586619776, -571316096, -555930880,
-540476864, -524966560, -509412608, -493827296,
-478223168, -462612320, -447007040, -431419360,
-415861152, -400344320, -384880608, -369481088,
-354157280, -338920384, -323781216, -308750432,
-293838528, -279055808, -264412320, -249917712,
-235581696, -221413296, -207421712, -193615632,
-180003216, -166592928, -153392432, -140409152,
-127650504, -115123088, -102833456, -90787896,
78982231, 67436503, 56152287, 45133459,
34384447, 23909225, 13711688, 3795326,
-5836509, -15181175, -24235940, -32998822,
-41467856, -49641716, -57519016, -65099300,
-72381880, -79366616, -86053888, -92443992,
-98537928, -104336768, -109842056, -115055288,
-119978936, -124614776, -128966056, -133035120,
-136825472, -140340416, -143583616, -146558944,
-149270608, -151722976, -153920640, -155868256,
-157570976, -159033728, -160262000, -161261296,
-162037200, -162595552, -162942208, -163083344,
-163025056, -162773648, -162335456, -161716896,
-160924480, -159964672, -158844224, -157569664,
-156147744, -154585104, -152888400, -151064400,
-149119760, -147060976, -144894768, -142627696,
-140266240, -137816960, -135286336, -132680216,
-130003904, -127263872, -124466480, -121617840,
-118723504, -115789008, -112819784, -109821152,
-106798304, -103756416, -100700392, -97635024,
-94564992, -91494696, -88428680, -85370960,
-82325696, -79296824, -76287928, -73302712,
-70344488, -67416584, -64522128, -61664132,
-58845164, -56067984, -53335052, -50648652,
-48010904, -45423984, -42889380, -40408892,
-37984088, -35616396, -33307162, -31057478,
-28868358, -26740700, -24675216, -22672550,
-20733178, -18857476, -17045774, -15298145,
-13614569, -11995047, -10439353, -8947174,
-7518114, -6151709, -4847411, -3604494,
-2422200, -1299721, -236167, 769579,
1718459, 2611733, 3450582, 4236234,
4969991, 5653225, 6287459, 6873702,
-7412089, -7907611, -8360065, -8771162,
-9142386, -9475263, -9771528, -10032850,
-10260773, -10457096, -10623310, -10761275,
-10872361, -10958351, -11020777, -11061291,
-11081422, -11082676, -11066606, -11034660,
-10988248, -10928770, -10857626, -10776101,
-10685411, -10586810, -10481535, -10370559,
-10254778, -10135307, -10012977, -9888702,
-9763244, -9637374, -9511811, -9387239,
-9264156, -9143165, -9024623, -8908885,
-8796288, -8687171, -8581710, -8480185,
-8382680, -8289292, -8200058, -8115010,
-8034124, -7957374, -7884576, -7815679,
-7750490, -7688897, -7630654, -7575516,
-7523270, -7473727, -7426594, -7381571,
-7338427, -7296920, -7256859, -7217828,
-7179189, -7140628, -7102109, -7063418,
-7024274, -6984400, -6943556, -6901536,
-6858122, -6813173, -6766470, -6717911,
-6667262, -6614481, -6559384, -6501888,
-6441886, -6379327, -6314134, -6246263,
-6175665, -6102323, -6026243, -5947411,
-5865812, -5781451, -5694415, -5604653,
-5512186, -5417077, -5319326, -5219017,
-5116080, -5010583, -4902647, -4792272,
-4679528, -4564441, -4447046, -4327357,
-4205414, -4081287, -3955075, -3826724,
-3696345, -3564024, -3429800, -3293731,
-3155876, -3016304, -2875162, -2732491,
-2588381, -2442967, -2296290, -2148430,
-1999480, -1849897, -1699739, -1549018,
-1397728, -1246111, -1093832, -939917,
778556, 633670, 490834, 349449,
209576, 71530, -64454, -198123,
-329178, -457378, -582481, -704169,
-822390, -936825, -1047277, -1153521,
-1255359, -1352620, -1445079, -1532594,
-1614993, -1692089, -1763764, -1829871,
-1890338, -1945039, -1993919, -2036919,
-2074025, -2105207, -2130495, -2149941,
-2163500, -2171309, -2173527, -2170200,
-2161562, -2147712, -2128894, -2105279,
-2077055, -2044537, -2007975, -1967653,
-1923884, -1876878, -1827016, -1774562,
-1719802, -1663177, -1604932, -1545319,
-1484731, -1423398, -1361702, -1299868,
-1238051, -1176780, -1116212, -1056384,
-997536, -939504, -882165, -827438,
-777438, -735452, -697878, -662420,
-629645, -599745, -572586, -548329,
-526957, -508372, -492404, -478893,
-467762, -458836, -451866, -446616,
-442807, -440258, -438674, -437773,
-437362, -437113, -436756, -436099,
-434925, -433130, -430443, -426680,
-421786, -415598, -408021, -398999,
-388431, -376383, -362797, -347658,
-331120, -313165, -293897, -273403,
-251769, -229198, -205757, -181769,
-157513, -132806, -107990, -83222,
-58701, -34960, -11777, 10610,
31691, 51648, 69941, 86451,
101251, 113633, 124105, 132033,
136030, 137372, 130665, 100784
};

View file

@ -21,7 +21,20 @@
#include <stdlib.h>
#include "ixheaacd_type_def.h"
#include "ixheaacd_bitbuffer.h"
#include "ixheaacd_defines.h"
#include "ixheaacd_aac_rom.h"
#include "ixheaacd_pulsedata.h"
#include "ixheaacd_pns.h"
#include "ixheaacd_channelinfo.h"
#include "ixheaacd_common_rom.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_env_extr_part.h"
#include "ixheaacd_sbr_rom.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_mps_interface.h"
@ -31,15 +44,15 @@
VOID ixheaacd_mps_pre_matrix_mix_matrix_smoothing(
ia_mps_dec_state_struct *self) {
int smooth_band;
WORD32 smooth_band;
FLOAT32 delta, one_minus_delta;
#ifndef MULT
#define MULT(a, b) (a * b)
#endif
int ps = 0, pb, row, col;
int res_bands = 0;
int *p_smoothing_data;
self->pre_mix_req = 0;
WORD32 ps = 0, pb, row, col;
WORD32 res_bands = 0;
WORD32 *p_smoothing_data;
if (self->residual_coding) res_bands = self->max_res_bands;
p_smoothing_data = &self->smoothing_data[ps][res_bands];
@ -126,8 +139,8 @@ VOID ixheaacd_mps_pre_matrix_mix_matrix_smoothing(
#define TWENTY_FIVE_X_PI_BY_180_Q27 (58563533)
VOID ixheaacd_mps_smoothing_opd(ia_mps_dec_state_struct *self) {
int ps, pb;
int delta, one_minus_delta;
WORD32 ps, pb;
WORD32 delta, one_minus_delta;
if (self->opd_smoothing_mode == 0) {
for (pb = 0; pb < self->bs_param_bands; pb++) {
@ -144,7 +157,7 @@ VOID ixheaacd_mps_smoothing_opd(ia_mps_dec_state_struct *self) {
return;
}
for (ps = 0; ps < self->num_parameter_sets; ps++) {
int thr = self->bs_frame.ipd_data.bs_quant_coarse_xxx[ps]
WORD32 thr = self->bs_frame.ipd_data.bs_quant_coarse_xxx[ps]
? FIFTY_X_PI_BY_180_Q27
: TWENTY_FIVE_X_PI_BY_180_Q27;
@ -152,7 +165,7 @@ VOID ixheaacd_mps_smoothing_opd(ia_mps_dec_state_struct *self) {
one_minus_delta = ONE_IN_Q30 - delta;
for (pb = 0; pb < self->bs_param_bands; pb++) {
int ltemp, rtemp, tmp;
WORD32 ltemp, rtemp, tmp;
#define Q28_FLOAT_VAL ((float)(1 << 28))
#define ONE_BY_Q28_FLOAT_VAL (1.0 / Q28_FLOAT_VAL)
ltemp = ((WORD32)(self->phase_l[ps][pb] * Q28_FLOAT_VAL)) >> 1;

View file

@ -25,7 +25,20 @@
#include "ixheaacd_type_def.h"
#include "ixheaacd_bitbuffer.h"
#include "ixheaacd_defines.h"
#include "ixheaacd_aac_rom.h"
#include "ixheaacd_pulsedata.h"
#include "ixheaacd_pns.h"
#include "ixheaacd_channelinfo.h"
#include "ixheaacd_common_rom.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_env_extr_part.h"
#include "ixheaacd_sbr_rom.h"
#include "ixheaacd_config.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_mps_interface.h"
@ -55,6 +68,7 @@
#include "ixheaacd_sbr_const.h"
#include "ixheaacd_pvc_dec.h"
#include "ixheaacd_sbr_dec.h"
#include "ixheaacd_audioobjtypes.h"
#define HP_SIZE (9)
@ -68,17 +82,17 @@
#define min(a, b) ((a < b) ? (a) : (b))
static const FLOAT32 ixheaacd_bp[BP_SIZE] = {
0.0000f, 0.0005f, 0.0092f, 0.0587f, 0.2580f, 0.7392f, 0.9791f,
0.9993f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9984f,
0.9908f, 0.9639f, 0.8952f, 0.7711f, 0.6127f, 0.4609f, 0.3391f,
0.2493f, 0.1848f, 0.1387f, 0.1053f};
0.0000f, 0.0005f, 0.0092f, 0.0587f, 0.2580f, 0.7392f, 0.9791f,
0.9993f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9984f,
0.9908f, 0.9639f, 0.8952f, 0.7711f, 0.6127f, 0.4609f, 0.3391f,
0.2493f, 0.1848f, 0.1387f, 0.1053f};
static const FLOAT32 ixheaacd_gf[BP_SIZE] = {
0.f, 0.f, 0.f, 0.f, 0.f,
0.f, 1e-008f, 8.1e-007f, 3.61e-006f, 8.41e-006f,
1.6e-005f, 2.704e-005f, 3.969e-005f, 5.625e-005f, 7.396e-005f,
9.801e-005f, 0.00012321f, 0.00015625f, 0.00019881f, 0.00024964f,
0.00032041f, 0.00041209f, 0.00053824f, 0.00070756f, 0.00094249f};
0.f, 0.f, 0.f, 0.f, 0.f,
0.f, 1e-008f, 8.1e-007f, 3.61e-006f, 8.41e-006f,
1.6e-005f, 2.704e-005f, 3.969e-005f, 5.625e-005f, 7.396e-005f,
9.801e-005f, 0.00012321f, 0.00015625f, 0.00019881f, 0.00024964f,
0.00032041f, 0.00041209f, 0.00053824f, 0.00070756f, 0.00094249f};
extern const WORD32 ixheaacd_mps_gain_set_indx[29];
@ -173,6 +187,13 @@ static VOID ixheaacd_mps_subbandtp(ia_mps_dec_state_struct* self, WORD32 ts) {
WORD32 no_scaling;
FLOAT32 temp;
const WORD32 ixheaacd_hybrid_to_qmf_map[] = {0, 0, 0, 0, 0, 0, 1, 1, 2, 2};
const WORD32 ixheaacd_hybrid_to_qmf_map_ldmps[] = {0, 1, 2};
const WORD32* ptr_ixheaacd_hybrid_to_qmf_map;
if (self->ldmps_config.ldmps_present_flag)
ptr_ixheaacd_hybrid_to_qmf_map = ixheaacd_hybrid_to_qmf_map_ldmps;
else
ptr_ixheaacd_hybrid_to_qmf_map = ixheaacd_hybrid_to_qmf_map;
ixheaacd_mps_temp_process_scale_calc(self, ts, scale);
@ -189,15 +210,26 @@ static VOID ixheaacd_mps_subbandtp(ia_mps_dec_state_struct* self, WORD32 ts) {
self->hyb_dir_out[ch][ts][n].im += self->hyb_diff_out[ch][ts][n].im;
}
} else {
for (n = 0; n < 10; n++) {
temp =
(FLOAT32)(scale[ch] * ixheaacd_bp[ixheaacd_hybrid_to_qmf_map[n]]);
self->hyb_dir_out[ch][ts][n].re +=
(self->hyb_diff_out[ch][ts][n].re * temp);
self->hyb_dir_out[ch][ts][n].im +=
(self->hyb_diff_out[ch][ts][n].im * temp);
if (self->ldmps_config.ldmps_present_flag) {
for (n = 0; n < 3; n++) {
temp = (FLOAT32)(scale[ch] *
ixheaacd_bp[ptr_ixheaacd_hybrid_to_qmf_map[n]]);
self->hyb_dir_out[ch][ts][n].re +=
(self->hyb_diff_out[ch][ts][n].re * temp);
self->hyb_dir_out[ch][ts][n].im +=
(self->hyb_diff_out[ch][ts][n].im * temp);
}
} else {
for (n = 0; n < 10; n++) {
temp = (FLOAT32)(scale[ch] *
ixheaacd_bp[ptr_ixheaacd_hybrid_to_qmf_map[n]]);
self->hyb_dir_out[ch][ts][n].re +=
(self->hyb_diff_out[ch][ts][n].re * temp);
self->hyb_dir_out[ch][ts][n].im +=
(self->hyb_diff_out[ch][ts][n].im * temp);
}
}
for (; n < HP_SIZE - 3 + 10; n++) {
for (n = 7; n < HP_SIZE - 3 + 10; n++) {
temp = (FLOAT32)(scale[ch] * ixheaacd_bp[n + 3 - 10]);
self->hyb_dir_out[ch][ts][n].re +=
(self->hyb_diff_out[ch][ts][n].re * temp);
@ -260,18 +292,26 @@ WORD32 ixheaacd_mps_temp_process(ia_mps_dec_state_struct* self) {
ixheaacd_mps_qmf_hyb_synthesis(self);
for (ch = 0; ch < self->out_ch_count; ch++) {
err = ixheaacd_sbr_dec_from_mps(&self->qmf_out_dir[ch][0][0].re,
self->p_sbr_dec[ch], self->p_sbr_frame[ch],
self->p_sbr_header[ch]);
if (err) return err;
if (self->ldmps_config.ldmps_present_flag != 1) {
for (ch = 0; ch < self->out_ch_count; ch++) {
err = ixheaacd_sbr_dec_from_mps(
&self->qmf_out_dir[ch][0][0].re, self->p_sbr_dec[ch],
self->p_sbr_frame[ch], self->p_sbr_header[ch]);
if (err) return err;
}
}
if (ptr_frame_data->mps_sbr_flag) {
self->synth_count =
if (self->object_type == AOT_ER_AAC_ELD || self->object_type == AOT_ER_AAC_LD)
self->synth_count = self->hyb_band_count[0];
else
{
if (ptr_frame_data->mps_sbr_flag) {
self->synth_count =
ptr_frame_data->pstr_sbr_header->pstr_freq_band_data->sub_band_end;
} else {
self->synth_count = self->band_count[0];
}
else {
self->synth_count = self->band_count[0];
}
}
ixheaacd_mps_synt_calc(self);

View file

@ -20,8 +20,20 @@
#include <math.h>
#include "ixheaacd_type_def.h"
#include "ixheaacd_bitbuffer.h"
#include "ixheaacd_defines.h"
#include "ixheaacd_aac_rom.h"
#include "ixheaacd_pulsedata.h"
#include "ixheaacd_pns.h"
#include "ixheaacd_channelinfo.h"
#include "ixheaacd_common_rom.h"
#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_env_extr_part.h"
#include "ixheaacd_sbr_rom.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_config.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_mps_dec.h"
@ -203,4 +215,4 @@ VOID ixheaacd_mps_time_env_shaping(ia_mps_dec_state_struct *self) {
}
}
}
}
}

View file

@ -68,6 +68,9 @@
#include "ixheaacd_latmdemux.h"
#include "ixheaacd_aacdec.h"
#include "ixheaacd_config.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_struct_def.h"
@ -142,8 +145,6 @@ IA_ERRORCODE ixheaacd_dec_coupling_channel_element(
WORD ind_sw_cce_flag, num_coupled_elements;
WORD num_gain_element_lists = 0;
WORD cc_domain;
WORD gain_element_sign;
WORD gain_element_scale;
const UWORD16 *hcod_sf =
@ -182,8 +183,8 @@ IA_ERRORCODE ixheaacd_dec_coupling_channel_element(
if ((ind_sw_cce_flag == 0) && (num_gain_element_lists > MAX_BS_ELEMENT)) {
return IA_FATAL_ERROR;
}
cc_domain = ixheaacd_read_bits_buf(bs, 1);
gain_element_sign = ixheaacd_read_bits_buf(bs, 1);
ixheaacd_read_bits_buf(bs, 1);/*cc_domain*/
ixheaacd_read_bits_buf(bs, 1);/*gain_element_sign*/
gain_element_scale = ixheaacd_read_bits_buf(bs, 2);
aac_handle->pstr_aac_dec_ch_info[0]->str_ics_info.num_swb_window = 0;
@ -278,8 +279,6 @@ void ixheaacd_dec_ind_coupling(
{
WORD c, j, k;
WORD l;
WORD coupling_channel;
WORD32 *out_samp_cc;
ia_enhaacplus_dec_ind_cc *ind_channel_info;
@ -287,8 +286,6 @@ void ixheaacd_dec_ind_coupling(
WORD32 *ptr_time_data = (WORD32 *)ptr_time_data_tmp;
{
coupling_channel = p_obj_exhaacplus_dec->aac_config.ui_coupling_channel;
ind_channel_info = &p_obj_exhaacplus_dec->p_state_aac->ind_cc_info;
out_samp_cc = coup_ch_output;

View file

@ -41,6 +41,7 @@
#include "ixheaacd_channelinfo.h"
#include "ixheaacd_channel.h"
#include "ixheaacd_sbrdecoder.h"
#include "ixheaacd_sbr_scale.h"
#include "ixheaacd_audioobjtypes.h"
#include "ixheaacd_latmdemux.h"
#include "ixheaacd_aacdec.h"
@ -48,6 +49,9 @@
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_config.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_mps_interface.h"
#include "ixheaacd_struct_def.h"
@ -98,14 +102,6 @@ VOID ixheaacd_allocate_sbr_scr(ia_sbr_scr_struct *sbr_scratch_struct,
WORD8 *p_qshift_arr, UWORD8 slot_element,
WORD32 channel);
IA_ERRORCODE ixheaacd_applysbr(
ia_handle_sbr_dec_inst_struct self,
ia_aac_dec_sbr_bitstream_struct *p_sbr_bit_stream, WORD16 *core_sample_buf,
WORD16 *codec_num_channels, FLAG frame_status, FLAG down_samp_flag,
FLAG down_mix_flag, ia_sbr_scr_struct *sbr_scratch_struct, WORD32 ps_enable,
WORD32 ch_fac, WORD32 slot_element, ia_bit_buf_struct *it_bit_buff,
ia_drc_dec_struct *pstr_drc_dec, WORD eld_sbr_flag, WORD32 object_type);
IA_ERRORCODE ixheaacd_esbr_process(ia_usac_data_struct *usac_data,
ia_bit_buf_struct *it_bit_buff,
WORD32 stereo_config_idx,
@ -139,7 +135,7 @@ IA_ERRORCODE ixheaacd_esbr_process(ia_usac_data_struct *usac_data,
err_code = ixheaacd_applysbr(self, esbr_bit_str, NULL, &num_channels, 1, 0, 0,
&sbr_scratch_struct, 0, 1, 0, it_bit_buff, NULL,
0, audio_object_type);
0, audio_object_type, 0, 0);
usac_data->sbr_mode = self->sbr_mode;
@ -181,7 +177,7 @@ static WORD32 ixheaacd_read_ext_element(
ia_usac_decoder_config_struct *pstr_usac_dec_config, WORD32 elem_idx) {
UWORD32 usac_ext_element_present;
UWORD32 usac_ext_element_use_dft_length;
UWORD32 pay_load_length, tmp;
UWORD32 pay_load_length;
WORD32 i;
usac_ext_element_present = ixheaacd_read_bits_buf(it_bit_buff, 1);
@ -203,7 +199,7 @@ static WORD32 ixheaacd_read_ext_element(
return IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES;
if (pay_load_length > 0) {
if (usac_ext_element_payload_frag)
tmp = ixheaacd_read_bits_buf(it_bit_buff, 2);
ixheaacd_read_bits_buf(it_bit_buff, 2);
if (pstr_usac_dec_config->usac_ext_ele_payload_present[elem_idx]) {
WORD32 preroll_counter = pstr_usac_dec_config->preroll_counter;

View file

@ -240,7 +240,6 @@ VOID ixheaacd_decode_ps_data(ia_ps_dec_struct *ptr_ps_dec) {
if (ptr_ps_dec->border_position[ptr_ps_dec->num_env] < MAX_NUM_COLUMNS) {
ptr_ps_dec->num_env++;
add_d(ptr_ps_dec->num_env, 1);
ptr_ps_dec->border_position[ptr_ps_dec->num_env] = MAX_NUM_COLUMNS;
memcpy(ptr_ps_dec->iid_par_table[ptr_ps_dec->num_env - 1],

View file

@ -865,8 +865,7 @@ VOID ixheaacd_apply_rot_dec(ia_ps_dec_struct *ptr_ps_dec, WORD32 *p_qmf_left_re,
WORD16 hybrid_resol;
WORD32 tmp_real, tmp_img;
WORD32 tmp_real1, tmp_img1;
WORD32 loopcnt;
WORD16 H11_H12[128 * 2];
WORD16 H11_H12[128 * 2] = {0};
usb = ptr_ps_dec->usb;
@ -938,7 +937,6 @@ VOID ixheaacd_apply_rot_dec(ia_ps_dec_struct *ptr_ps_dec, WORD32 *p_qmf_left_re,
}
}
}
loopcnt = (usb + 15) >> 4;
for (subband = 0; subband < NO_QMF_CHANNELS_IN_HYBRID; subband++) {
tmp_real = *p_hyb_left_re1++;

View file

@ -358,9 +358,133 @@ VOID ixheaacd_dct2_32(WORD32 *inp, WORD32 *out,
return;
}
VOID ixheaacd_sbr_qmfanal32_winadd_eld_mps(WORD32 *inp1, WORD32 *inp2,
const WORD32 *p_qmf1,
const WORD32 *p_qmf2,
WORD32 *p_out) {
WORD32 n;
WORD32 resolution = 64;
for (n = 0; n < 64; n += 2) {
WORD32 accu;
accu = ixheaacd_mul32_sh(inp1[n + 0], p_qmf1[(n + 0)], 31);
accu = ixheaacd_add32(accu,
ixheaacd_mul32_sh(inp1[n + 2 * resolution],
p_qmf1[(n + 2 * resolution)], 31));
accu = ixheaacd_add32(accu,
ixheaacd_mul32_sh(inp1[n + 4 * resolution],
p_qmf1[(n + 4 * resolution)], 31));
accu = ixheaacd_add32(accu,
ixheaacd_mul32_sh(inp1[n + 6 * resolution],
p_qmf1[(n + 6 * resolution)], 31));
accu = ixheaacd_add32(accu,
ixheaacd_mul32_sh(inp1[n + 8 * resolution],
p_qmf1[(n + 8 * resolution)], 31));
p_out[n] = accu;
accu = ixheaacd_mul32_sh(inp1[n + 1 + 0], p_qmf1[(n + 1 + 0)], 31);
accu = ixheaacd_add32_sat(
accu, ixheaacd_mul32_sh(inp1[n + 1 + 2 * resolution],
p_qmf1[(n + 1 + 2 * resolution)], 31));
accu = ixheaacd_add32_sat(
accu, ixheaacd_mul32_sh(inp1[n + 1 + 4 * resolution],
p_qmf1[(n + 1 + 4 * resolution)], 31));
accu = ixheaacd_add32_sat(
accu, ixheaacd_mul32_sh(inp1[n + 1 + 6 * resolution],
p_qmf1[(n + 1 + 6 * resolution)], 31));
accu = ixheaacd_add32_sat(
accu, ixheaacd_mul32_sh(inp1[n + 1 + 8 * resolution],
p_qmf1[(n + 1 + 8 * resolution)], 31));
p_out[n + 1] = accu;
accu = ixheaacd_mul32_sh(inp2[n + 0], p_qmf2[(n + 0)], 31);
accu = ixheaacd_add32(accu,
ixheaacd_mul32_sh(inp2[n + 2 * resolution],
p_qmf2[(n + 2 * resolution)], 31));
accu = ixheaacd_add32(accu,
ixheaacd_mul32_sh(inp2[n + 4 * resolution],
p_qmf2[(n + 4 * resolution)], 31));
accu = ixheaacd_add32(accu,
ixheaacd_mul32_sh(inp2[n + 6 * resolution],
p_qmf2[(n + 6 * resolution)], 31));
accu = ixheaacd_add32(accu,
ixheaacd_mul32_sh(inp2[n + 8 * resolution],
p_qmf2[(n + 8 * resolution)], 31));
p_out[n + 64] = accu;
accu = ixheaacd_mul32_sh(inp2[n + 1 + 0], p_qmf2[(n + 1 + 0)], 31);
accu = ixheaacd_add32_sat(
accu, ixheaacd_mul32_sh(inp2[n + 1 + 2 * resolution],
p_qmf2[(n + 1 + 2 * resolution)], 31));
accu = ixheaacd_add32_sat(
accu, ixheaacd_mul32_sh(inp2[n + 1 + 4 * resolution],
p_qmf2[(n + 1 + 4 * resolution)], 31));
accu = ixheaacd_add32_sat(
accu, ixheaacd_mul32_sh(inp2[n + 1 + 6 * resolution],
p_qmf2[(n + 1 + 6 * resolution)], 31));
accu = ixheaacd_add32_sat(
accu, ixheaacd_mul32_sh(inp2[n + 1 + 8 * resolution],
p_qmf2[(n + 1 + 8 * resolution)], 31));
p_out[n + 1 + 64] = accu;
}
}
VOID ixheaacd_sbr_qmfanal32_winadd_eld_32(WORD32 *inp1, WORD32 *inp2,
const WORD32 *p_qmf1,
const WORD32 *p_qmf2, WORD32 *p_out) {
WORD32 n;
for (n = 0; n < 32; n += 2) {
WORD32 accu;
accu = ixheaacd_mul32_sh(inp1[n + 0], p_qmf1[(n + 0)], 31);
accu = ixheaacd_add32(
accu, ixheaacd_mul32_sh(inp1[n + 64], p_qmf1[(n + 64)], 31));
accu = ixheaacd_add32(
accu, ixheaacd_mul32_sh(inp1[n + 128], p_qmf1[(n + 128)], 31));
accu = ixheaacd_add32(
accu, ixheaacd_mul32_sh(inp1[n + 192], p_qmf1[(n + 192)], 31));
accu = ixheaacd_add32(
accu, ixheaacd_mul32_sh(inp1[n + 256], p_qmf1[(n + 256)], 31));
p_out[n] = accu;
accu = ixheaacd_mul32_sh(inp1[n + 1 + 0], p_qmf1[(n + 1 + 0)], 31);
accu = ixheaacd_add32_sat(
accu, ixheaacd_mul32_sh(inp1[n + 1 + 64], p_qmf1[(n + 1 + 64)], 31));
accu = ixheaacd_add32_sat(
accu, ixheaacd_mul32_sh(inp1[n + 1 + 128], p_qmf1[(n + 1 + 128)], 31));
accu = ixheaacd_add32_sat(
accu, ixheaacd_mul32_sh(inp1[n + 1 + 192], p_qmf1[(n + 1 + 192)], 31));
accu = ixheaacd_add32_sat(
accu, ixheaacd_mul32_sh(inp1[n + 1 + 256], p_qmf1[(n + 1 + 256)], 31));
p_out[n + 1] = accu;
accu = ixheaacd_mul32_sh(inp2[n + 0], p_qmf2[(n + 0)], 31);
accu = ixheaacd_add32(
accu, ixheaacd_mul32_sh(inp2[n + 64], p_qmf2[(n + 64)], 31));
accu = ixheaacd_add32(
accu, ixheaacd_mul32_sh(inp2[n + 128], p_qmf2[(n + 128)], 31));
accu = ixheaacd_add32(
accu, ixheaacd_mul32_sh(inp2[n + 192], p_qmf2[(n + 192)], 31));
accu = ixheaacd_add32(
accu, ixheaacd_mul32_sh(inp2[n + 256], p_qmf2[(n + 256)], 31));
p_out[n + 32] = accu;
accu = ixheaacd_mul32_sh(inp2[n + 1 + 0], p_qmf2[(n + 1 + 0)], 31);
accu = ixheaacd_add32_sat(
accu, ixheaacd_mul32_sh(inp2[n + 1 + 64], p_qmf2[(n + 1 + 64)], 31));
accu = ixheaacd_add32_sat(
accu, ixheaacd_mul32_sh(inp2[n + 1 + 128], p_qmf2[(n + 1 + 128)], 31));
accu = ixheaacd_add32_sat(
accu, ixheaacd_mul32_sh(inp2[n + 1 + 192], p_qmf2[(n + 1 + 192)], 31));
accu = ixheaacd_add32_sat(
accu, ixheaacd_mul32_sh(inp2[n + 1 + 256], p_qmf2[(n + 1 + 256)], 31));
p_out[n + 1 + 32] = accu;
}
}
VOID ixheaacd_sbr_qmfanal32_winadd_eld(WORD16 *inp1, WORD16 *inp2,
WORD16 *p_qmf1, WORD16 *p_qmf2,
WORD32 *p_out) {
const WORD16 *p_qmf1,
const WORD16 *p_qmf2, WORD32 *p_out) {
WORD32 n;
for (n = 0; n < 32; n += 2) {
@ -715,7 +839,7 @@ VOID ixheaacd_cplx_synt_qmffilt(
WORD32 *qmf_imag_tmp = &qmf_real2[NO_SYNTHESIS_CHANNELS];
WORD32 env = 0;
WORD32 common_shift;
WORD32 common_shift = 0;
if (no_synthesis_channels == 32) {
qmf_bank->cos_twiddle =

View file

@ -64,6 +64,10 @@ typedef struct {
WORD16 *fp1_syn;
WORD16 *fp2_syn;
WORD16 sixty4;
WORD32 *core_samples_buffer_32;
WORD32 *fp1_anal_32;
WORD32 *fp2_anal_32;
WORD32 *filter_2_32;
} ia_sbr_qmf_filter_bank_struct;
@ -73,7 +77,14 @@ VOID ixheaacd_cplx_anal_qmffilt(const WORD16 *time_inp,
ia_sbr_qmf_filter_bank_struct *qmf_bank,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,
WORD ch_fac, WORD32 low_pow_flag,
WORD audio_object_type);
WORD audio_object_type, WORD32 ldmps_present);
VOID ixheaacd_cplx_anal_qmffilt_32(const WORD32 *time_inp,
ia_sbr_scale_fact_struct *sbr_scale_factor,
WORD32 **qmf_real, WORD32 **qmf_imag,
ia_sbr_qmf_filter_bank_struct *qmf_bank,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,
WORD ch_fac, WORD32 ldsbr_present);
VOID ixheaacd_cplx_synt_qmffilt(
WORD32 **qmf_real, WORD32 **qmf_im, WORD32 split_slot,
@ -119,7 +130,8 @@ VOID ixheaacd_sbr_qmfanal32_winadds_eld(WORD16 *fp1, WORD16 *fp2,
VOID ixheaacd_fwd_modulation(const WORD32 *p_time_in1, WORD32 *real_subband,
WORD32 *imag_subband,
ia_sbr_qmf_filter_bank_struct *qmf_bank,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr);
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,
WORD32 ld_mps_flag);
VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
const WORD16 *main_twidle_fwd, const WORD16 *post_tbl,
const WORD16 *w_16, const WORD32 *p_table);
@ -199,8 +211,16 @@ VOID ixheaacd_inv_emodulation(WORD32 *qmf_real,
VOID ixheaacd_pretwdct2(WORD32 *inp, WORD32 *out_fwd);
VOID ixheaacd_sbr_qmfanal32_winadd_eld(WORD16 *inp1, WORD16 *inp2,
WORD16 *p_qmf1, WORD16 *p_qmf2,
WORD32 *p_out);
const WORD16 *p_qmf1,
const WORD16 *p_qmf2, WORD32 *p_out);
VOID ixheaacd_sbr_qmfanal32_winadd_eld_32(WORD32 *inp1, WORD32 *inp2,
const WORD32 *p_qmf1,
const WORD32 *p_qmf2, WORD32 *p_out);
VOID ixheaacd_sbr_qmfanal32_winadd_eld_mps(WORD32 *inp1, WORD32 *inp2,
const WORD32 *p_qmf1,
const WORD32 *p_qmf2, WORD32 *p_out);
VOID ixheaacd_dct2_32(WORD32 *inp, WORD32 *out,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr,

View file

@ -63,11 +63,16 @@
#include "ixheaacd_latmdemux.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_config.h"
#include "ixheaacd_hybrid.h"
#include "ixheaacd_ps_dec.h"
#include "ixheaacd_qmf_dec.h"
#include "ixheaacd_mps_dec.h"
#include "ixheaacd_struct_def.h"
#include "ixheaacd_cnst.h"
#include "ixheaacd_error_standards.h"
#define RVLC_ERROR_ALL_ESCAPE_WORDS_INVALID 0x80000000
#define RVLC_ERROR_RVL_SUM_BIT_COUNTER_BELOW_ZERO_FWD 0x40000000
#define RVLC_ERROR_RVL_SUM_BIT_COUNTER_BELOW_ZERO_BWD 0x20000000
@ -699,7 +704,7 @@ static VOID ixheaacd_rvlc_decode_backward(
ia_rvlc_info_struct *ptr_rvlc,
ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info,
ia_bit_buf_struct *it_bit_buff) {
WORD16 band, group, dpcm, ixheaacd_drc_offset;
WORD16 band, group, dpcm;
WORD16 bnds = ptr_rvlc->max_sfb_transmitted - 1;
WORD16 factor = ptr_rvlc->rev_global_gain;
@ -752,10 +757,6 @@ static VOID ixheaacd_rvlc_decode_backward(
for (group = ptr_rvlc->num_wind_grps - 1; group >= 0; group--) {
for (band = ptr_rvlc->max_sfb_transmitted - 1; band >= 0; band--) {
bnds = 16 * group + band;
if ((band == 0) && (ptr_rvlc->num_wind_grps != 1))
ixheaacd_drc_offset = 16 - ptr_rvlc->max_sfb_transmitted + 1;
else
ixheaacd_drc_offset = 1;
switch (ptr_aac_dec_channel_info->ptr_code_book[bnds]) {
case ZERO_HCB:
@ -955,7 +956,7 @@ VOID ixheaacd_hcr_read(ia_bit_buf_struct *it_bit_buff,
}
}
static WORD32 ixheaacd_rvlc_init(
static IA_ERRORCODE ixheaacd_rvlc_init(
ia_rvlc_info_struct *ptr_rvlc,
ia_aac_dec_channel_info_struct *ptr_aac_dec_channel_info,
ia_bit_buf_struct *it_bit_buff) {
@ -1009,7 +1010,7 @@ static WORD32 ixheaacd_rvlc_init(
if (it_bit_buff->cnt_bits < 0) {
return IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES;
} else
return 0;
return IA_NO_ERROR;
}
VOID ixheaacd_bi_dir_est_scf_prev_frame_reference(
@ -1377,13 +1378,6 @@ VOID ixheaacd_statistical_estimation(
WORD32 sum_nrg_fwd, sum_nrg_bwd;
WORD32 sum_scf_fwd, sum_scf_bwd;
WORD32 use_fwd, use_nrg_fwd, use_scf_fwd;
WORD32 max_scf_bands;
if (ptr_aac_dec_channel_info->str_ics_info.window_sequence ==
EIGHT_SHORT_SEQUENCE)
max_scf_bands = 16;
else
max_scf_bands = 64;
sum_fwd = sum_bwd = sum_nrg_fwd = sum_nrg_bwd = sum_scf_fwd = sum_scf_bwd = 0;
use_fwd = use_nrg_fwd = use_scf_fwd = 0;
@ -1464,15 +1458,8 @@ VOID ixheaacd_predictive_interpolation(
ia_aac_dec_overlap_info *ptr_aac_dec_static_channel_info) {
ia_rvlc_info_struct *ptr_rvlc = &ptr_aac_dec_channel_info->ptr_rvlc_info;
WORD32 band, bnds, group;
WORD32 max_scf_bands;
WORD32 common_min;
if (ptr_aac_dec_channel_info->str_ics_info.window_sequence ==
EIGHT_SHORT_SEQUENCE)
max_scf_bands = 16;
else
max_scf_bands = 64;
for (group = 0; group < ptr_rvlc->num_wind_grps; group++) {
for (band = 0; band < ptr_rvlc->max_sfb_transmitted; band++) {
bnds = 16 * group + band;

File diff suppressed because it is too large Load diff

View file

@ -563,12 +563,13 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
ia_sbr_tables_struct *sbr_tables_ptr,
ixheaacd_misc_tables *pstr_common_tables, WORD ch_fac,
ia_pvc_data_struct *ptr_pvc_data, FLAG drc_on,
WORD32 drc_sbr_factors[][64],
WORD32 audio_object_type) {
WORD i;
WORD32 drc_sbr_factors[][64], WORD32 audio_object_type,
WORD32 ldmps_present) {
WORD i, j, k;
WORD slot, reserve;
WORD save_lb_scale;
WORD op_delay;
IA_ERRORCODE err_code = IA_NO_ERROR;
WORD32 *p_arr_qmf_buf_real[MAX_ENV_COLS] = {0};
WORD32 *p_arr_qmf_buf_imag[MAX_ENV_COLS] = {0};
@ -585,6 +586,7 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
WORD stereo_config_idx = ptr_frame_data->stereo_config_idx;
WORD sbr_mode = ptr_frame_data->sbr_mode;
WORD usac_flag = ptr_header_data->usac_flag;
WORD add_slot = 0;
FLOAT32 *pvc_qmf_enrg_arr = (FLOAT32 *)ptr_sbr_dec->pvc_qmf_enrg_arr;
@ -595,6 +597,9 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
} else {
op_delay = 6;
}
if (ldmps_present == 1) add_slot = SBR_HF_ADJ_OFFSET;
if (usac_flag) {
pp_qmf_buf_real = ptr_sbr_dec->pp_qmf_buf_real;
pp_qmf_buf_imag = ptr_sbr_dec->pp_qmf_buf_imag;
@ -610,7 +615,8 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
WORD32 *ptr_pers_qmf_real = ptr_sbr_dec->ptr_sbr_overlap_buf;
WORD32 *p_scr_qmf_real = ptr_work_buf_core + (2 << (6 + !low_pow_flag));
if ((no_bins < LPC_ORDER) || ((no_bins + op_delay) > MAX_ENV_COLS))
if ((no_bins < LPC_ORDER) ||
((no_bins + op_delay + add_slot) > MAX_ENV_COLS))
return -1;
if (!low_pow_flag) {
@ -622,7 +628,7 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
}
ptr = p_scr_qmf_real;
for (slot = 0; slot < op_delay + no_bins; slot++) {
for (slot = 0; slot < op_delay + no_bins + add_slot; slot++) {
p_arr_qmf_buf_real[slot] = ptr;
ptr += NO_SYNTHESIS_CHANNELS;
@ -644,7 +650,6 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
if (usac_flag) {
WORD32 num_anal_bands = ptr_sbr_dec->str_codec_qmf_bank.no_channels;
WORD32 codec_x_delay = 0;
WORD32 core_syn_ch_index = 0;
WORD32 frame_move = 288;
WORD32 core_frame_size = ptr_header_data->core_frame_size;
@ -658,12 +663,6 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
*/
if (mps_sbr_flag) op_delay = MPS_SBR_DELAY;
if (hbe_flag || mps_sbr_flag) {
core_syn_ch_index = num_anal_bands;
} else {
core_syn_ch_index = ptr_header_data->pstr_freq_band_data->sub_band_start;
}
frame_move = 9 * num_anal_bands;
memmove(ptr_sbr_dec->core_sample_buf,
@ -710,7 +709,7 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
op_delay + codec_x_delay + SBR_HF_ADJ_OFFSET);
if (hbe_flag) {
WORD32 err_code = ixheaacd_qmf_hbe_apply(
err_code = ixheaacd_qmf_hbe_apply(
ptr_sbr_dec->p_hbe_txposer,
ptr_sbr_dec->qmf_buf_real + (op_delay + SBR_HF_ADJ_OFFSET) +
ESBR_HBE_DELAY_OFFSET,
@ -733,7 +732,6 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
}
if (!mps_sbr_flag && apply_processing) {
WORD32 err_code = 0;
err_code = ixheaacd_generate_hf(
ptr_sbr_dec->qmf_buf_real + (SBR_HF_ADJ_OFFSET),
ptr_sbr_dec->qmf_buf_imag + (SBR_HF_ADJ_OFFSET),
@ -741,7 +739,8 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
ptr_sbr_dec->ph_vocod_qmf_imag + (SBR_HF_ADJ_OFFSET),
ptr_sbr_dec->sbr_qmf_out_real + (SBR_HF_ADJ_OFFSET),
ptr_sbr_dec->sbr_qmf_out_imag + (SBR_HF_ADJ_OFFSET), ptr_frame_data,
ptr_header_data);
ptr_header_data, ldmps_present,
ptr_sbr_dec->str_codec_qmf_bank.num_time_slots);
if (err_code) return err_code;
ptr_pvc_data->pvc_rate = ptr_header_data->upsamp_fac;
@ -774,7 +773,8 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
(ptr_header_data->hbe_flag == 0)
? NULL
: ptr_sbr_dec->p_hbe_txposer->x_over_qmf,
ptr_sbr_dec->scratch_buff, pvc_dec_out_buf);
ptr_sbr_dec->scratch_buff, pvc_dec_out_buf, ldmps_present);
if (err_code) return err_code;
} else {
@ -800,12 +800,39 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
return 0;
}
ixheaacd_cplx_anal_qmffilt(
ptr_time_data, &ptr_sbr_dec->str_sbr_scale_fact,
&p_arr_qmf_buf_real[op_delay], &p_arr_qmf_buf_imag[op_delay],
&ptr_sbr_dec->str_codec_qmf_bank, sbr_tables_ptr->qmf_dec_tables_ptr,
ch_fac, low_pow_flag, audio_object_type);
if (ldmps_present) {
ixheaacd_cplx_anal_qmffilt_32(
(WORD32 *)ptr_time_data, &ptr_sbr_dec->str_sbr_scale_fact,
&p_arr_qmf_buf_real[op_delay], &p_arr_qmf_buf_imag[op_delay],
&ptr_sbr_dec->str_codec_qmf_bank, sbr_tables_ptr->qmf_dec_tables_ptr,
ch_fac, 1);
} else {
ixheaacd_cplx_anal_qmffilt(
ptr_time_data, &ptr_sbr_dec->str_sbr_scale_fact,
&p_arr_qmf_buf_real[op_delay], &p_arr_qmf_buf_imag[op_delay],
&ptr_sbr_dec->str_codec_qmf_bank, sbr_tables_ptr->qmf_dec_tables_ptr,
ch_fac, low_pow_flag, audio_object_type, ldmps_present);
}
if (ldmps_present == 1) {
for (j = SBR_HF_ADJ_OFFSET;
j < ptr_sbr_dec->str_codec_qmf_bank.num_time_slots + SBR_HF_ADJ_OFFSET;
j++) {
for (k = 0; k < 64; k++) {
WORD32 scale = 7;
ptr_sbr_dec->mps_qmf_buf_real[j][k] = 0.0f;
ptr_sbr_dec->mps_qmf_buf_imag[j][k] = 0.0f;
if (k < ptr_sbr_dec->str_codec_qmf_bank.usb) {
ptr_sbr_dec->mps_qmf_buf_real[j][k] +=
(FLOAT32)(p_arr_qmf_buf_real[j][k] / (FLOAT32)(1 << scale));
ptr_sbr_dec->mps_qmf_buf_imag[j][k] +=
(FLOAT32)(p_arr_qmf_buf_imag[j][k] / (FLOAT32)(1 << scale));
}
}
}
}
/*ITTIAM : the size of real and img coeff are not same as that of the mps
* analysis.*/
{
WORD shift1, shift2;
WORD min_shift;
@ -888,7 +915,6 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
if (apply_processing) {
WORD16 degree_alias[NO_SYNTHESIS_CHANNELS];
WORD16 *border_vec = ptr_frame_data->str_frame_info_details.border_vec;
IA_ERRORCODE error_code = IA_NO_ERROR;
if (low_pow_flag) {
memset(degree_alias, 0, NO_SYNTHESIS_CHANNELS * sizeof(WORD16));
@ -915,27 +941,58 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
ptr_sbr_dec->str_sbr_scale_fact.hb_scale =
(WORD16)(com_low_band_scale - 2);
} else {
ixheaacd_hf_generator(
&ptr_sbr_dec->str_hf_generator, &ptr_sbr_dec->str_sbr_scale_fact,
p_arr_qmf_buf_real, p_arr_qmf_buf_imag, ptr_header_data->time_step,
border_vec[0],
ixheaacd_sub16_sat(
border_vec[ptr_frame_data->str_frame_info_details.num_env],
ptr_header_data->num_time_slots),
ptr_header_data->pstr_freq_band_data->num_if_bands,
ptr_frame_data->max_qmf_subband_aac, ptr_frame_data->sbr_invf_mode,
ptr_frame_data_prev->sbr_invf_mode, ptr_work_buf_core,
audio_object_type);
if (ldmps_present == 1) {
err_code = ixheaacd_generate_hf(
ptr_sbr_dec->mps_qmf_buf_real + (SBR_HF_ADJ_OFFSET),
ptr_sbr_dec->mps_qmf_buf_imag + (SBR_HF_ADJ_OFFSET),
ptr_sbr_dec->ph_vocod_qmf_real + (SBR_HF_ADJ_OFFSET),
ptr_sbr_dec->ph_vocod_qmf_imag + (SBR_HF_ADJ_OFFSET),
ptr_sbr_dec->sbr_qmf_out_real + (SBR_HF_ADJ_OFFSET),
ptr_sbr_dec->sbr_qmf_out_imag + (SBR_HF_ADJ_OFFSET), ptr_frame_data,
ptr_header_data, ldmps_present,
ptr_sbr_dec->str_codec_qmf_bank.num_time_slots);
if (err_code) return err_code;
} else {
ixheaacd_hf_generator(
&ptr_sbr_dec->str_hf_generator, &ptr_sbr_dec->str_sbr_scale_fact,
p_arr_qmf_buf_real, p_arr_qmf_buf_imag, ptr_header_data->time_step,
border_vec[0],
ixheaacd_sub16_sat(
border_vec[ptr_frame_data->str_frame_info_details.num_env],
ptr_header_data->num_time_slots),
ptr_header_data->pstr_freq_band_data->num_if_bands,
ptr_frame_data->max_qmf_subband_aac, ptr_frame_data->sbr_invf_mode,
ptr_frame_data_prev->sbr_invf_mode, ptr_work_buf_core,
audio_object_type);
}
}
if (ldmps_present == 1) {
ptr_frame_data->pstr_sbr_header = ptr_header_data;
err_code = ixheaacd_sbr_env_calc(
ptr_frame_data, ptr_sbr_dec->sbr_qmf_out_real + (SBR_HF_ADJ_OFFSET),
ptr_sbr_dec->sbr_qmf_out_imag + (SBR_HF_ADJ_OFFSET),
ptr_sbr_dec->qmf_buf_real + (SBR_HF_ADJ_OFFSET),
ptr_sbr_dec->qmf_buf_imag + (SBR_HF_ADJ_OFFSET), NULL,
ptr_sbr_dec->scratch_buff, pvc_dec_out_buf, ldmps_present);
error_code = ixheaacd_calc_sbrenvelope(
&ptr_sbr_dec->str_sbr_scale_fact, &ptr_sbr_dec->str_sbr_calc_env,
ptr_header_data, ptr_frame_data, ptr_frame_data_prev,
p_arr_qmf_buf_real, p_arr_qmf_buf_imag, degree_alias, low_pow_flag,
sbr_tables_ptr, pstr_common_tables,
ptr_work_buf_core + (LPC_ORDER << (6 + !low_pow_flag)),
audio_object_type);
if (error_code) return error_code;
for (j = 0; j < ptr_sbr_dec->str_codec_qmf_bank.num_time_slots + 2; j++) {
for (k = ptr_sbr_dec->str_codec_qmf_bank.usb; k < 64; k++) {
ptr_sbr_dec->mps_qmf_buf_real[j][k] +=
ptr_sbr_dec->sbr_qmf_out_real[j][k];
ptr_sbr_dec->mps_qmf_buf_imag[j][k] +=
ptr_sbr_dec->sbr_qmf_out_imag[j][k];
}
}
} else {
err_code = ixheaacd_calc_sbrenvelope(
&ptr_sbr_dec->str_sbr_scale_fact, &ptr_sbr_dec->str_sbr_calc_env,
ptr_header_data, ptr_frame_data, ptr_frame_data_prev,
p_arr_qmf_buf_real, p_arr_qmf_buf_imag, degree_alias, low_pow_flag,
sbr_tables_ptr, pstr_common_tables,
ptr_work_buf_core + (LPC_ORDER << (6 + !low_pow_flag)),
audio_object_type);
if (err_code) return err_code;
}
memcpy(ptr_frame_data_prev->sbr_invf_mode, ptr_frame_data->sbr_invf_mode,
ptr_header_data->pstr_freq_band_data->num_if_bands * sizeof(WORD32));
@ -1017,6 +1074,18 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
memcpy(p_loc_qmf_real, p_loc_qmf_real_1,
sizeof(WORD32) * NO_SYNTHESIS_CHANNELS * num);
if (ldmps_present == 1) {
memmove(&ptr_sbr_dec->mps_qmf_buf_real[0][0],
&ptr_sbr_dec->mps_qmf_buf_real[ptr_sbr_dec->str_codec_qmf_bank
.num_time_slots][0],
SBR_HF_ADJ_OFFSET * sizeof(FLOAT32) * 64);
memmove(&ptr_sbr_dec->mps_qmf_buf_imag[0][0],
&ptr_sbr_dec->mps_qmf_buf_imag[ptr_sbr_dec->str_codec_qmf_bank
.num_time_slots][0],
SBR_HF_ADJ_OFFSET * sizeof(FLOAT32) * 64);
}
}
ptr_sbr_dec->str_sbr_scale_fact.ov_lb_scale = save_lb_scale;
@ -1039,7 +1108,6 @@ WORD32 ixheaacd_esbr_dec(ia_sbr_dec_struct *ptr_sbr_dec,
WORD32 upsample_ratio_idx = ptr_header_data->sbr_ratio_idx;
WORD32 core_frame_size = ptr_header_data->core_frame_size;
WORD32 no_bins;
WORD32 mps_sbr_flag = ptr_frame_data->mps_sbr_flag;
WORD32 stereo_config_idx = ptr_frame_data->stereo_config_idx;
WORD32 hbe_flag = ptr_header_data->hbe_flag;
@ -1050,8 +1118,6 @@ WORD32 ixheaacd_esbr_dec(ia_sbr_dec_struct *ptr_sbr_dec,
op_delay = 2 * 6;
}
no_bins = ptr_sbr_dec->str_codec_qmf_bank.num_time_slots;
ptr_sbr_dec->str_sbr_scale_fact.lb_scale = 0;
{
WORD32 num_anal_bands = ptr_sbr_dec->str_codec_qmf_bank.no_channels;
@ -1221,7 +1287,7 @@ WORD32 ixheaacd_sbr_dec_from_mps(FLOAT32 *p_mps_qmf_output, VOID *p_sbr_dec,
ptr_sbr_dec->mps_qmf_buf_imag + SBR_HF_ADJ_OFFSET, NULL, NULL,
ptr_sbr_dec->mps_sbr_qmf_buf_real + SBR_HF_ADJ_OFFSET,
ptr_sbr_dec->mps_sbr_qmf_buf_imag + SBR_HF_ADJ_OFFSET, ptr_frame_data,
ptr_header_data);
ptr_header_data, 0, ptr_sbr_dec->str_codec_qmf_bank.num_time_slots);
if (err) return err;
ptr_frame_data->pstr_sbr_header = ptr_header_data;
@ -1234,7 +1300,7 @@ WORD32 ixheaacd_sbr_dec_from_mps(FLOAT32 *p_mps_qmf_output, VOID *p_sbr_dec,
ptr_sbr_dec->mps_qmf_buf_imag + SBR_HF_ADJ_OFFSET,
(ptr_header_data->hbe_flag == 0) ? NULL
: ptr_sbr_dec->p_hbe_txposer->x_over_qmf,
ptr_sbr_dec->scratch_buff, NULL);
ptr_sbr_dec->scratch_buff, NULL, 0);
if (err) return err;
for (i = 0; i < no_bins; i++) {

View file

@ -125,6 +125,9 @@ struct ia_sbr_dec_inst_struct {
FLAG inter_tes_flag;
FLAG aot_usac_flag;
jmp_buf *xaac_jmp_buf;
WORD8 *ptr_mps_data;
WORD32 left_mps_bits;
WORD32 mps_bits_pos;
};
typedef struct ia_sbr_pers_struct {
@ -166,14 +169,16 @@ WORD32 ixheaacd_sbr_dec(ia_sbr_dec_struct *ptr_sbr_dec, WORD16 *ptr_time_data,
ia_sbr_tables_struct *sbr_tables_ptr,
ixheaacd_misc_tables *pstr_common_tables, WORD ch_fac,
ia_pvc_data_struct *ptr_pvc_data_str, FLAG drc_on,
WORD32 drc_sbr_factors[][64], WORD32 audio_object_type);
WORD32 drc_sbr_factors[][64], WORD32 audio_object_type,
WORD32 ldmps_present);
WORD16 ixheaacd_create_sbrdec(ixheaacd_misc_tables *pstr_common_table,
ia_sbr_channel_struct *ptr_sbr_channel,
ia_sbr_header_data_struct *ptr_header_data,
WORD16 chan, FLAG down_sample_flag,
VOID *sbr_persistent_mem_v, WORD ps_enable,
WORD audio_object_type);
WORD audio_object_type, WORD32 ldmps_present,
WORD32 ldsbr_present);
#define MAX_NUM_QMF_BANDS_ESBR 128
@ -192,7 +197,8 @@ WORD32 ixheaacd_sbr_env_calc(ia_sbr_frame_info_data_struct *frame_data,
FLOAT32 input_real1[][64],
FLOAT32 input_imag1[][64],
WORD32 x_over_qmf[MAX_NUM_PATCHES],
FLOAT32 *scratch_buff, FLOAT32 *env_out);
FLOAT32 *scratch_buff, FLOAT32 *env_out,
WORD32 ldmps_present);
WORD32 ixheaacd_generate_hf(FLOAT32 ptr_src_buf_real[][64],
FLOAT32 ptr_src_buf_imag[][64],
@ -201,7 +207,8 @@ WORD32 ixheaacd_generate_hf(FLOAT32 ptr_src_buf_real[][64],
FLOAT32 ptr_dst_buf_real[][64],
FLOAT32 ptr_dst_buf_imag[][64],
ia_sbr_frame_info_data_struct *ptr_frame_data,
ia_sbr_header_data_struct *ptr_header_data);
ia_sbr_header_data_struct *ptr_header_data,
WORD32 audio_object_type, WORD32 time_slots);
VOID ixheaacd_clr_subsamples(WORD32 *ptr_qmf_buf, WORD32 num, WORD32 size);

View file

@ -726,10 +726,22 @@ const ia_qmf_dec_tables_struct ixheaacd_aac_qmf_dec_tables = {
// const WORD16 ixheaacd_sbr_alt_sin_twiddle_l32[17] =
{
//(WORD16)0x0000, (WORD16)0x7fff,
(WORD16)0x0c8c, (WORD16)0x7f62, (WORD16)0x18f9, (WORD16)0x7d8a,
(WORD16)0x2528, (WORD16)0x7a7d, (WORD16)0x30fc, (WORD16)0x7642,
(WORD16)0x3c57, (WORD16)0x70e3, (WORD16)0x471d, (WORD16)0x6a6e,
(WORD16)0x5134, (WORD16)0x62f2, (WORD16)0x5a82, (WORD16)0x5a82,
(WORD16)0x0c8c,
(WORD16)0x7f62,
(WORD16)0x18f9,
(WORD16)0x7d8a,
(WORD16)0x2528,
(WORD16)0x7a7d,
(WORD16)0x30fc,
(WORD16)0x7642,
(WORD16)0x3c57,
(WORD16)0x70e3,
(WORD16)0x471d,
(WORD16)0x6a6e,
(WORD16)0x5134,
(WORD16)0x62f2,
(WORD16)0x5a82,
(WORD16)0x5a82,
},
// const WORD16 ixheaacd_sbr_t_cos_sin_l32[32+32] = //exp[-i * pi/32* 3/4 *
@ -910,7 +922,10 @@ const ia_qmf_dec_tables_struct ixheaacd_aac_qmf_dec_tables = {
-18, -18},
{
0x00, 0x01, 0x02, 0x03,
0x00,
0x01,
0x02,
0x03,
},
// w1024[1536];
@ -1733,6 +1748,137 @@ const ia_qmf_dec_tables_struct ixheaacd_aac_qmf_dec_tables = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
},
//// WORD32 qmf_c_ldsbr_mps[640];
{-1088237, -1922950, -2811171, -3833224, -4994278,
-6282261, -7680841, -9169025, -10725055, -12324393,
-13941731, -15549657, -17120747, -18626116, -20036991,
-21323541, -22456647, -23406643, -24144909, -24642407,
-24871603, -24804595, -24415038, -23675808, -22560963,
-21042910, -19094608, -16685863, -13785718, -10358010,
-6365521, -1754973, 3969414, 10743941, 18202241,
26403100, 35403839, 45247389, 55972297, 67609496,
80184932, 93717852, 108222063, 123704992, 140168036,
157606041, 176007496, 195354540, 215622847, 236781629,
258793720, 281616437, 305201134, 329493906, 354435733,
379963218, 406008680, 432501102, 459366074, 486526787,
513903832, 541416151, 568980294, 596510842, -623766724,
-650827082, -677563723, -703875279, -729666861, -754844974,
-779316190, -802988669, -825771201, -847575157, -868313992,
-887904263, -906265555, -923321515, -938999670, -953232022,
-965955457, -977112746, -986652016, -994526811, -1000697179,
-1005129871, -1007798334, -1008683232, -1007772584, -1005061786,
-1000553966, -994259623, -986196677, -976390141, -964872677,
-951682343, -936802381, -920294698, -902267714, -882779324,
-861893900, -839683118, -816223964, -791598598, -765893362,
-739198470, -711607173, -683215384, -654121262, -624424188,
-594224613, -563623462, -532721695, -501619952, -470417748,
-439213198, -408102731, -377180844, -346538840, -316265811,
-286447164, -257165021, -228497498, -200518669, -173298068,
-146900793, -121386797, -96810678, 73209368, 50642874,
29146835, 8753507, -10508841, -28617380, -45554786,
-61309157, -75874248, -89248941, -101437348, -112448674,
-122296858, -131000586, -138582948, -145071276, -150496790,
-154894447, -158302350, -160761650, -162316373, -163012779,
-162899352, -162026175, -160444576, -158206947, -155366419,
-151976400, -148090363, -143761233, -139041601, -133983279,
-128633886, -123042159, -117256253, -111320469, -105277360,
-99167707, -93029841, -86899819, -80811262, -74795318,
-68880537, -63093129, -57456575, -51991851, -46717444,
-41649136, -36800242, -32182320, -27804529, -23673882,
-19795326, -16171959, -12804808, -9693263, -6834912,
-4225952, -1860960, 266706, 2165096, 3843408,
5311608, 6580581, -7659850, -8565613, -9308824,
-9902189, -10358934, -10692292, -10915355, -11041033,
-11082049, -11050633, -10958508, -10816863, -10636110,
-10426046, -10195042, -9950839, -9700309, -9449524,
-9203660, -8966753, -8741729, -8530947, -8335986,
-8157534, -7995749, -7850127, -7719693, -7603085,
-7498498, -7404082, -7317673, -7237343, -7159908,
-7082763, -7004337, -6922546, -6835648, -6742190,
-6640871, -6530636, -6410606, -6280198, -6138994,
-5986826, -5823631, -5649533, -5464631, -5269171,
-5063331, -4847459, -4621985, -4387201, -4143350,
-3890899, -3630184, -3361765, -3086090, -2803826,
-2515674, -2222360, -1924688, -1624378, -1321919,
-1016874, 706113, 420142, 140553, -131288,
-393278, -643324, -879607, -1100399, -1303989,
-1488836, -1653541, -1796817, -1917688, -2015419,
-2089615, -2140218, -2167404, -2171863, -2154637,
-2117086, -2060795, -1987814, -1900380, -1800788,
-1691489, -1575125, -1454064, -1330785, -1207415,
-1086298, -968520, -854801, -756445, -680148,
-614695, -560457, -517664, -485648, -463299,
-449241, -441532, -438223, -437237, -436427,
-434027, -428561, -418692, -403510, -382407,
-355227, -322142, -283650, -240483, -193762,
-145159, -95606, -46830, -583, 41669,
78196, 107442, 128069, 136701, 115724,
-1088237, -1922950, -2811171, -3833224, -4994278,
-6282261, -7680841, -9169025, -10725055, -12324393,
-13941731, -15549657, -17120747, -18626116, -20036991,
-21323541, -22456647, -23406643, -24144909, -24642407,
-24871603, -24804595, -24415038, -23675808, -22560963,
-21042910, -19094608, -16685863, -13785718, -10358010,
-6365521, -1754973, 3969414, 10743941, 18202241,
26403100, 35403839, 45247389, 55972297, 67609496,
80184932, 93717852, 108222063, 123704992, 140168036,
157606041, 176007496, 195354540, 215622847, 236781629,
258793720, 281616437, 305201134, 329493906, 354435733,
379963218, 406008680, 432501102, 459366074, 486526787,
513903832, 541416151, 568980294, 596510842, -623766724,
-650827082, -677563723, -703875279, -729666861, -754844974,
-779316190, -802988669, -825771201, -847575157, -868313992,
-887904263, -906265555, -923321515, -938999670, -953232022,
-965955457, -977112746, -986652016, -994526811, -1000697179,
-1005129871, -1007798334, -1008683232, -1007772584, -1005061786,
-1000553966, -994259623, -986196677, -976390141, -964872677,
-951682343, -936802381, -920294698, -902267714, -882779324,
-861893900, -839683118, -816223964, -791598598, -765893362,
-739198470, -711607173, -683215384, -654121262, -624424188,
-594224613, -563623462, -532721695, -501619952, -470417748,
-439213198, -408102731, -377180844, -346538840, -316265811,
-286447164, -257165021, -228497498, -200518669, -173298068,
-146900793, -121386797, -96810678, 73209368, 50642874,
29146835, 8753507, -10508841, -28617380, -45554786,
-61309157, -75874248, -89248941, -101437348, -112448674,
-122296858, -131000586, -138582948, -145071276, -150496790,
-154894447, -158302350, -160761650, -162316373, -163012779,
-162899352, -162026175, -160444576, -158206947, -155366419,
-151976400, -148090363, -143761233, -139041601, -133983279,
-128633886, -123042159, -117256253, -111320469, -105277360,
-99167707, -93029841, -86899819, -80811262, -74795318,
-68880537, -63093129, -57456575, -51991851, -46717444,
-41649136, -36800242, -32182320, -27804529, -23673882,
-19795326, -16171959, -12804808, -9693263, -6834912,
-4225952, -1860960, 266706, 2165096, 3843408,
5311608, 6580581, -7659850, -8565613, -9308824,
-9902189, -10358934, -10692292, -10915355, -11041033,
-11082049, -11050633, -10958508, -10816863, -10636110,
-10426046, -10195042, -9950839, -9700309, -9449524,
-9203660, -8966753, -8741729, -8530947, -8335986,
-8157534, -7995749, -7850127, -7719693, -7603085,
-7498498, -7404082, -7317673, -7237343, -7159908,
-7082763, -7004337, -6922546, -6835648, -6742190,
-6640871, -6530636, -6410606, -6280198, -6138994,
-5986826, -5823631, -5649533, -5464631, -5269171,
-5063331, -4847459, -4621985, -4387201, -4143350,
-3890899, -3630184, -3361765, -3086090, -2803826,
-2515674, -2222360, -1924688, -1624378, -1321919,
-1016874, 706113, 420142, 140553, -131288,
-393278, -643324, -879607, -1100399, -1303989,
-1488836, -1653541, -1796817, -1917688, -2015419,
-2089615, -2140218, -2167404, -2171863, -2154637,
-2117086, -2060795, -1987814, -1900380, -1800788,
-1691489, -1575125, -1454064, -1330785, -1207415,
-1086298, -968520, -854801, -756445, -680148,
-614695, -560457, -517664, -485648, -463299,
-449241, -441532, -438223, -437237, -436427,
-434027, -428561, -418692, -403510, -382407,
-355227, -322142, -283650, -240483, -193762,
-145159, -95606, -46830, -583, 41669,
78196, 107442, 128069, 136701, 115724},
// const WORD16 ixheaacd_sbr_synth_cos_sin_l32[64+64] = //exp[-i * pi/4* (2k
// + 1)]
{

View file

@ -92,6 +92,7 @@ typedef struct {
WORD16 qmf_c_eld2[640];
WORD16 qmf_c_eld3[640];
WORD32 qmf_c_ldsbr_mps[640];
WORD16 ixheaacd_sbr_synth_cos_sin_l32[64 + 64];

View file

@ -71,6 +71,8 @@
#include "ixheaacd_audioobjtypes.h"
extern const WORD32 ixheaacd_ldmps_polyphase_filter_coeff_fix[1280];
#define ALIGN_SIZE64(x) ((((x) + 7) >> 3) << 3)
WORD32 ixheaacd_getsize_sbr_persistent() {
@ -500,7 +502,8 @@ ia_handle_sbr_dec_inst_struct ixheaacd_init_sbr(
VOID *sbr_persistent_mem_v, WORD32 *ptr_overlap_buf, WORD32 channel,
WORD32 ps_enable, WORD32 sbr_ratio_idx, WORD32 output_frame_size,
WORD32 *use_hbe, VOID *p_usac_dflt_header,
ia_sbr_header_data_struct str_sbr_config, WORD32 audio_object_type) {
ia_sbr_header_data_struct str_sbr_config, WORD32 audio_object_type,
WORD32 ldmps_present, WORD32 ldsbr_present) {
WORD16 i;
WORD16 err;
ia_sbr_header_data_struct *ptr_header_data[MAXNRSBRCHANNELS];
@ -540,7 +543,7 @@ ia_handle_sbr_dec_inst_struct ixheaacd_init_sbr(
sbr_persistent_mem->str_sbr_dec_inst.pstr_common_tables,
sbr_persistent_mem->str_sbr_dec_inst.pstr_sbr_channel[i],
ptr_header_data[i], i, *down_sample_flag, sbr_persistent_mem, ps_enable,
audio_object_type);
audio_object_type, ldmps_present, ldsbr_present);
ptr_header_data[i]->status = 1;
ptr_sbr_dec[i]->band_count = 64;
@ -792,7 +795,7 @@ static PLATFORM_INLINE VOID ixheaacd_init_sbr_prev_framedata(
static PLATFORM_INLINE VOID
ixheaacd_create_hyb_filterbank(ia_hybrid_struct *ptr_hybrid, WORD32 **p_ptr,
ia_sbr_tables_struct *sbr_tables_ptr) {
WORD16 i, ptr_step;
WORD16 i;
WORD32 *ptr = (WORD32 *)*p_ptr;
ptr_hybrid->ptr_resol = sbr_tables_ptr->ps_tables_ptr->hyb_resol;
@ -806,7 +809,6 @@ ixheaacd_create_hyb_filterbank(ia_hybrid_struct *ptr_hybrid, WORD32 **p_ptr,
memset(ptr_hybrid->ptr_temp_re, 0,
2 * NO_HYBRID_CHANNELS_HIGH * sizeof(WORD32));
ptr_step = ixheaacd_add16(1, ptr_hybrid->ptr_qmf_buf);
ptr_hybrid->ptr_work_re = ptr;
ptr += 16;
ptr_hybrid->ptr_work_im = ptr;
@ -850,8 +852,10 @@ static PLATFORM_INLINE VOID ixheaacd_create_hf_generator(
}
for (i = 0; i < LPC_ORDER; i++) {
memset(ptr_hf_gen_str->lpc_filt_states_real[i], 0,
NO_ANALYSIS_CHANNELS * sizeof(WORD32));
if (ptr_hf_gen_str->lpc_filt_states_real[i] != NULL) {
memset(ptr_hf_gen_str->lpc_filt_states_real[i], 0,
NO_ANALYSIS_CHANNELS * sizeof(WORD32));
}
if (ps_enable)
memset(ptr_hf_gen_str->lpc_filt_states_imag[i], 0,
@ -957,19 +961,25 @@ static PLATFORM_INLINE VOID ixheaacd_create_cplx_anal_qmfbank(
ia_sbr_qmf_filter_bank_struct *ptr_sbr_qmf,
ia_sbr_scale_fact_struct *sbr_scale_factor, WORD16 no_bins, WORD16 usb,
WORD16 chan, WORD16 *sbr_qmf_analy_states, WORD32 *sbr_qmf_analy_states_32,
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr, WORD32 audio_object_type) {
ia_qmf_dec_tables_struct *qmf_dec_tables_ptr, WORD32 audio_object_type,
WORD32 ldmps_present, WORD32 no_ldsbr) {
memset(ptr_sbr_qmf, 0, sizeof(ia_sbr_qmf_filter_bank_struct));
ptr_sbr_qmf->analy_win_coeff_32 = qmf_dec_tables_ptr->esbr_qmf_c;
if (audio_object_type != AOT_ER_AAC_ELD &&
audio_object_type != AOT_ER_AAC_LD) {
ptr_sbr_qmf->analy_win_coeff = qmf_dec_tables_ptr->qmf_c;
} else {
ptr_sbr_qmf->analy_win_coeff = qmf_dec_tables_ptr->qmf_c_eld3;
if (ldmps_present == 1)
ptr_sbr_qmf->analy_win_coeff_32 = qmf_dec_tables_ptr->qmf_c_ldsbr_mps;
if (no_ldsbr == 1)
ptr_sbr_qmf->analy_win_coeff_32 =
(WORD32 *)ixheaacd_ldmps_polyphase_filter_coeff_fix;
}
ptr_sbr_qmf->analy_win_coeff_32 = qmf_dec_tables_ptr->esbr_qmf_c;
ptr_sbr_qmf->no_channels = NO_ANALYSIS_CHANNELS;
if (no_ldsbr) ptr_sbr_qmf->no_channels = 64;
ptr_sbr_qmf->num_time_slots = no_bins;
ptr_sbr_qmf->lsb = 0;
@ -988,7 +998,9 @@ static PLATFORM_INLINE VOID ixheaacd_create_cplx_anal_qmfbank(
sizeof(WORD32) * QMF_FILTER_STATE_ANA_SIZE);
ptr_sbr_qmf->core_samples_buffer = ptr_sbr_qmf->anal_filter_states;
ptr_sbr_qmf->core_samples_buffer_32 = ptr_sbr_qmf->anal_filter_states_32;
ptr_sbr_qmf->filter_pos_32 = (WORD32 *)qmf_dec_tables_ptr->esbr_qmf_c;
ptr_sbr_qmf->state_new_samples_pos_low_32 =
ptr_sbr_qmf->anal_filter_states_32;
if (audio_object_type != AOT_ER_AAC_ELD &&
@ -996,20 +1008,30 @@ static PLATFORM_INLINE VOID ixheaacd_create_cplx_anal_qmfbank(
ptr_sbr_qmf->filter_pos = (WORD16 *)qmf_dec_tables_ptr->qmf_c;
} else {
ptr_sbr_qmf->filter_pos = (WORD16 *)qmf_dec_tables_ptr->qmf_c_eld3;
if (ldmps_present == 1)
ptr_sbr_qmf->filter_pos_32 =
(WORD32 *)qmf_dec_tables_ptr->qmf_c_ldsbr_mps;
if (no_ldsbr == 1)
ptr_sbr_qmf->filter_pos_32 =
(WORD32 *)ixheaacd_ldmps_polyphase_filter_coeff_fix;
}
ptr_sbr_qmf->filter_pos_32 = (WORD32 *)qmf_dec_tables_ptr->esbr_qmf_c;
sbr_scale_factor->st_lb_scale = 0;
sbr_scale_factor->st_syn_scale = -6;
if (audio_object_type == AOT_ER_AAC_ELD ||
audio_object_type == AOT_ER_AAC_LD) {
ptr_sbr_qmf->filter_2 = ptr_sbr_qmf->filter_pos + 32;
ptr_sbr_qmf->filter_2_32 =
ptr_sbr_qmf->filter_pos_32 + ptr_sbr_qmf->no_channels;
ptr_sbr_qmf->fp1_anal_32 = ptr_sbr_qmf->anal_filter_states_32;
ptr_sbr_qmf->fp2_anal_32 =
ptr_sbr_qmf->anal_filter_states_32 + ptr_sbr_qmf->no_channels;
ptr_sbr_qmf->filter_2 = ptr_sbr_qmf->filter_pos + ptr_sbr_qmf->no_channels;
ptr_sbr_qmf->fp1_anal = ptr_sbr_qmf->anal_filter_states;
ptr_sbr_qmf->fp2_anal =
ptr_sbr_qmf->anal_filter_states + NO_ANALYSIS_CHANNELS;
ptr_sbr_qmf->anal_filter_states + ptr_sbr_qmf->no_channels;
}
return;
@ -1025,13 +1047,14 @@ static PLATFORM_INLINE VOID ixheaacd_create_cplx_synt_qmfbank(
WORD32 qmf_filter_state_size;
memset(ptr_sbr_qmf, 0, sizeof(ia_sbr_qmf_filter_bank_struct));
qmf_filter_state_size = QMF_FILTER_STATE_SYN_SIZE;
if (down_sample_flag) {
L = NO_SYNTHESIS_CHANNELS_DOWN_SAMPLED;
qmf_filter_state_size = QMF_FILTER_STATE_SYN_SIZE_DOWN_SAMPLED;
ptr_sbr_qmf->usb = NO_SYNTHESIS_CHANNELS_DOWN_SAMPLED;
} else {
L = NO_SYNTHESIS_CHANNELS;
qmf_filter_state_size = QMF_FILTER_STATE_SYN_SIZE;
ptr_sbr_qmf->usb = usb;
}
@ -1080,7 +1103,8 @@ WORD16 ixheaacd_create_sbrdec(ixheaacd_misc_tables *pstr_common_table,
ia_sbr_header_data_struct *ptr_header_data,
WORD16 chan, FLAG down_sample_flag,
VOID *sbr_persistent_mem_v, WORD ps_enable,
WORD audio_object_type)
WORD audio_object_type, WORD32 ldmps_present,
WORD32 ldsbr_present)
{
WORD16 err;
@ -1116,7 +1140,7 @@ WORD16 ixheaacd_create_sbrdec(ixheaacd_misc_tables *pstr_common_table,
sbr_persistent_mem->sbr_qmf_analy_states,
sbr_persistent_mem->sbr_qmf_analy_states_32,
sbr_persistent_mem->str_sbr_dec_inst.pstr_sbr_tables->qmf_dec_tables_ptr,
audio_object_type);
audio_object_type, ldmps_present, ldsbr_present);
ixheaacd_create_cplx_synt_qmfbank(
&hs->str_synthesis_qmf_bank, no_bins,

View file

@ -955,7 +955,8 @@ WORD32 ixheaacd_generate_hf(FLOAT32 ptr_src_buf_real[][64],
FLOAT32 ptr_dst_buf_real[][64],
FLOAT32 ptr_dst_buf_imag[][64],
ia_sbr_frame_info_data_struct *ptr_frame_data,
ia_sbr_header_data_struct *ptr_header_data) {
ia_sbr_header_data_struct *ptr_header_data,
WORD32 ldmps_present, WORD32 time_slots) {
WORD32 bw_index, i, k, k2, patch = 0;
WORD32 co_var_len;
WORD32 start_sample, end_sample, goal_sb;
@ -999,6 +1000,11 @@ WORD32 ixheaacd_generate_hf(FLOAT32 ptr_src_buf_real[][64],
FLOAT32 *bw_array_prev = ptr_frame_data->bw_array_prev;
end_slot_offs = p_frame_info->border_vec[p_frame_info->num_env] - 16;
if (ldmps_present == 1)
end_slot_offs =
p_frame_info->border_vec[p_frame_info->num_env] - time_slots;
if (is_usf_4) {
start_sample = first_slot_offset * 4;
end_sample = 64 + end_slot_offs * 4;
@ -1009,6 +1015,12 @@ WORD32 ixheaacd_generate_hf(FLOAT32 ptr_src_buf_real[][64],
co_var_len = 38;
}
if (ldmps_present == 1) {
start_sample = 0;
end_sample = time_slots;
co_var_len = time_slots;
}
if (pre_proc_flag) {
ixheaacd_pre_processing(ptr_src_buf_real, ptr_src_buf_imag, gain_vector,
f_master_tbl[0], start_sample, end_sample);

View file

@ -244,7 +244,7 @@ IA_ERRORCODE ixheaacd_applysbr(
FLAG down_mix_flag, ia_sbr_scr_struct *sbr_scratch_struct, WORD32 ps_enable,
WORD32 ch_fac, WORD32 slot_element, ia_bit_buf_struct *it_bit_buff,
ia_drc_dec_struct *pstr_drc_dec, WORD eld_sbr_flag,
WORD32 audio_object_type) {
WORD32 audio_object_type, WORD32 init_flag, WORD32 ldmps_present) {
WORD32 k;
FLAG prev_ps_flag = 0;
FLAG ps_flag = 0;
@ -258,6 +258,7 @@ IA_ERRORCODE ixheaacd_applysbr(
WORD32 ele_channels = 0;
WORD32 num_elements = p_sbr_bit_stream->no_elements;
WORD32 usac_flag = self->aot_usac_flag;
WORD32 total_bits_left = 0;
ia_sbr_channel_struct *pstr_sbr_channel[2];
ia_sbr_header_data_struct *ptr_header_data[MAXNRSBRCHANNELS];
@ -268,6 +269,7 @@ IA_ERRORCODE ixheaacd_applysbr(
(ia_sbr_header_data_struct *)(&self->str_sbr_dflt_header);
ia_sbr_frame_info_data_struct *ptr_frame_data[2];
self->ptr_mps_data = NULL;
for (k = 0; k < 2; k++) {
ptr_frame_data[k] = (ia_sbr_frame_info_data_struct *)self->frame_buffer[k];
@ -296,6 +298,11 @@ IA_ERRORCODE ixheaacd_applysbr(
}
}
if (init_flag) {
ptr_frame_data[1]->reset_flag = 1;
ptr_frame_data[0]->reset_flag = 1;
}
for (k = 0; k < *codec_num_channels; k++) {
ptr_header_data[k]->usac_flag = self->aot_usac_flag;
@ -381,6 +388,8 @@ IA_ERRORCODE ixheaacd_applysbr(
it_bit_buff = &local_bit_buf;
it_bit_buff->xaac_jmp_buf = self->xaac_jmp_buf;
total_bits_left = it_bit_buff->cnt_bits;
if (audio_object_type == AOT_ER_AAC_ELD) {
if (eld_sbr_flag != 1) {
ixheaacd_read_bits_buf(&local_bit_buf, LEN_NIBBLE);
@ -478,7 +487,7 @@ IA_ERRORCODE ixheaacd_applysbr(
WORD32 lr;
WORD32 lr1 = ps_enable ? 2 : num_channels;
for (lr = 0; lr < lr1; lr++) {
ptr_frame_data[lr]->reset_flag = 1;
if (ldmps_present != 1) ptr_frame_data[lr]->reset_flag = 1;
if (ptr_header_data[k]->status) {
err |= ixheaacd_sbr_dec_reset(
&(pstr_sbr_channel[lr]->str_sbr_dec), ptr_header_data[k],
@ -538,6 +547,12 @@ IA_ERRORCODE ixheaacd_applysbr(
}
}
}
if ((ldmps_present == 1) && (it_bit_buff)) {
WORD32 bits_decoded = (it_bit_buff->size - it_bit_buff->cnt_bits);
self->ptr_mps_data = (WORD8 *)it_bit_buff->ptr_read_next;
self->left_mps_bits = (total_bits_left - bits_decoded);
self->mps_bits_pos = it_bit_buff->bit_pos;
}
}
if (!usac_flag) {
@ -574,7 +589,7 @@ IA_ERRORCODE ixheaacd_applysbr(
(stereo || dual_mono) ? ptr_frame_data[1] : NULL,
(stereo || dual_mono) ? pstr_sbr_channel[1]->pstr_prev_frame_data
: NULL,
self->pstr_common_tables);
self->pstr_common_tables, ldmps_present);
if (err) return err;
}
@ -593,6 +608,12 @@ IA_ERRORCODE ixheaacd_applysbr(
ptr_frame_data[1]->max_qmf_subband_aac =
ptr_header_data[1]->pstr_freq_band_data->sub_band_start;
}
if (ldmps_present == 1) {
ptr_frame_data[0]->rate = 1;
if (stereo) {
ptr_frame_data[1]->rate = 1;
}
}
}
if (audio_object_type != AOT_ER_AAC_ELD) {
if ((initial_sync_state == SBR_NOT_INITIALIZED) &&
@ -668,7 +689,7 @@ IA_ERRORCODE ixheaacd_applysbr(
(ptr_header_data[0]->sync_state == SBR_ACTIVE), low_pow_flag,
sbr_scratch_struct->ptr_work_buf_core, self->pstr_sbr_tables,
self->pstr_common_tables, ch_fac, self->ptr_pvc_data_str, 0, NULL,
audio_object_type);
audio_object_type, ldmps_present);
if (err_code) return err_code;
} else {
WORD32 err_code = 0;
@ -683,7 +704,7 @@ IA_ERRORCODE ixheaacd_applysbr(
self->pstr_common_tables, ch_fac, self->ptr_pvc_data_str,
pstr_drc_dec->drc_on,
pstr_drc_dec->str_drc_channel_data[0].drc_factors_sbr,
audio_object_type);
audio_object_type, ldmps_present);
if (err_code) return err_code;
}
@ -705,7 +726,7 @@ IA_ERRORCODE ixheaacd_applysbr(
NULL, NULL, (ptr_header_data[1]->sync_state == SBR_ACTIVE),
low_pow_flag, sbr_scratch_struct->ptr_work_buf_core,
self->pstr_sbr_tables, self->pstr_common_tables, ch_fac,
self->ptr_pvc_data_str, 0, NULL, audio_object_type);
self->ptr_pvc_data_str, 0, NULL, audio_object_type, ldmps_present);
if (err_code) return err_code;
} else {
WORD32 err_code = ixheaacd_sbr_dec(
@ -717,7 +738,7 @@ IA_ERRORCODE ixheaacd_applysbr(
self->pstr_sbr_tables, self->pstr_common_tables, ch_fac,
self->ptr_pvc_data_str, pstr_drc_dec->drc_on,
pstr_drc_dec->str_drc_channel_data[1].drc_factors_sbr,
audio_object_type);
audio_object_type, ldmps_present);
if (err_code) return err_code;
}
}

View file

@ -70,7 +70,8 @@ IA_ERRORCODE ixheaacd_applysbr(
WORD16 *codec_num_channels, FLAG frame_status, FLAG down_samp_flag,
FLAG down_mix_flag, ia_sbr_scr_struct *sbr_scratch_struct, WORD32 ps_enable,
WORD32 ch_fac, WORD32 slot_element, ia_bit_buf_struct *it_bit_buff,
ia_drc_dec_struct *pstr_drc_dec, WORD eld_sbr_flag, WORD audio_object_type);
ia_drc_dec_struct *pstr_drc_dec, WORD eld_sbr_flag, WORD audio_object_type,
WORD32 init_flag, WORD32 ldmps_present);
WORD32 ixheaacd_getsize_sbr_persistent();

View file

@ -24,30 +24,10 @@
#include <stdbool.h>
#include "ixheaacd_peak_limiter_struct_def.h"
#define MAX_OUTPUT_CHANNELS (8)
#define MAX_NUM_OTT (1)
#define MAX_ARBITRARY_TREE_LEVELS (2)
#define MAX_PARAMETER_SETS (8)
#define MAX_ARBITRARY_TREE_INDEX ((1 << (MAX_ARBITRARY_TREE_LEVELS + 1)) - 1)
#define MAX_NUM_QMF_BANDS (64)
#define MAX_NUM_OTT_AT \
(MAX_OUTPUT_CHANNELS * ((1 << MAX_ARBITRARY_TREE_LEVELS) - 1))
#define MAX_PARAMETER_BANDS (28)
#define MAX_DECOR_CONFIG_IDX (2)
#define MAX_HYBRID_BANDS (MAX_NUM_QMF_BANDS - 3 + 10)
#define MAX_PARAMETER_BANDS_MPS (28)
#define MAX_TIME_SLOTS (72)
#define MAX_M2_OUTPUT (8)
#define QMF_BANDS_TO_HYBRID (3)
#define PROTO_LEN (13)
#define BUFFER_LEN_LF (PROTO_LEN - 1 + MAX_TIME_SLOTS)
#define BUFFER_LEN_HF ((PROTO_LEN - 1) / 2)
#define MAX_TIME_SLOTS (72)
#define MAX_NO_TIME_SLOTS_DELAY (14)
#define MAX_PREROLL_FRAME_OFFSET 4
// max of escapedValue(4, 4, 8) i.e. 2^4 -1 + 2^4 -1 + 2^8 -1;
#define MAX_PREROLL_SIZE 285
@ -244,6 +224,7 @@ typedef struct ia_aac_dec_state_struct {
ia_sbr_header_data_struct str_sbr_config;
jmp_buf xaac_jmp_buf;
WORD32 decode_create_done;
WORD32 ldmps_present;
WORD32 fatal_err_present;
WORD8 *pers_mem_ptr;
bool preroll_config_present;
@ -283,7 +264,7 @@ WORD32 ixheaacd_aacdec_decodeframe(
WORD32 frame_length, WORD32 frame_size, ia_drc_dec_struct *pstr_drc_dec,
WORD32 object_type, WORD32 ch_config,
ia_eld_specific_config_struct eld_specific_config, WORD16 adtsheader,
ia_drc_dec_struct *drc_dummy, UWORD8 *slot_pos);
ia_drc_dec_struct *drc_dummy, WORD32 ldmps_present, UWORD8 *slot_pos);
WORD ixheaacd_get_channel_mask(
ia_exhaacplus_dec_api_struct *p_obj_exhaacplus_dec);

View file

@ -20,6 +20,8 @@
#ifndef IXHEAACD_VEC_BAISC_OPS_H
#define IXHEAACD_VEC_BAISC_OPS_H
#define ONE_BY_TWO_POW_15 0.000030517578125
VOID ixheaacd_combine_fac(WORD32 *src1, WORD32 *src2, WORD32 *dest, WORD32 len,
WORD8 shift1, WORD8 shift2);

View file

@ -909,7 +909,7 @@ int ixheaacd_main_process(WORD32 argc, pWORD8 argv[]) {
}
/* API object requires 4 bytes (WORD32) alignment */
ui_rem = ((WORD32)g_pv_arr_alloc_memory[g_w_malloc_count] & 3);
ui_rem = ((SIZE_T)g_pv_arr_alloc_memory[g_w_malloc_count] & 3);
/* Set API object with the memory allocated */
pv_ia_process_api_obj =
(pVOID)((WORD8 *)g_pv_arr_alloc_memory[g_w_malloc_count] + 4 - ui_rem);
@ -991,7 +991,7 @@ int ixheaacd_main_process(WORD32 argc, pWORD8 argv[]) {
IA_TESTBENCH_MFMAN_FATAL_MEM_ALLOC_FAILED);
}
ui_rem = ((WORD32)g_pv_arr_alloc_memory[g_w_malloc_count] % ui_alignment);
ui_rem = ((SIZE_T)g_pv_arr_alloc_memory[g_w_malloc_count] % ui_alignment);
pv_alloc_ptr = (pVOID)((WORD8 *)g_pv_arr_alloc_memory[g_w_malloc_count] +
ui_alignment - ui_rem);
@ -1035,7 +1035,7 @@ int ixheaacd_main_process(WORD32 argc, pWORD8 argv[]) {
}
/* API object requires 4 bytes (WORD32) alignment */
ui_rem = ((WORD32)g_pv_arr_alloc_memory[g_w_malloc_count] & 3);
ui_rem = ((SIZE_T)g_pv_arr_alloc_memory[g_w_malloc_count] & 3);
/* Set pointer for process memory tables */
err_code = (*p_ia_process_api)(
@ -1104,7 +1104,7 @@ int ixheaacd_main_process(WORD32 argc, pWORD8 argv[]) {
(pWORD8) "Mem tables alloc", err_code);
}
ui_rem = ((WORD32)g_pv_arr_alloc_memory[g_w_malloc_count] % ui_alignment);
ui_rem = ((SIZE_T)g_pv_arr_alloc_memory[g_w_malloc_count] % ui_alignment);
pv_alloc_ptr = (pVOID)((WORD8 *)g_pv_arr_alloc_memory[g_w_malloc_count] +
ui_alignment - ui_rem);