mirror of
https://github.com/ittiam-systems/libxaac.git
synced 2026-06-01 18:00:11 +07:00
Fix for the integer-overflow in ixheaacd_ducker_apply_71, ixheaacd_mps_fft, ixheaacd_subband_tp, ixheaacd_tp_process and ixheaacd_ducker_apply
Significance: ============= This change addresses corner case arithmetic operations involving multiplication, subtraction and addition. The change also addresses a bug found in ixheaacd_subband_tp function. Bug: ossFuzz: 457181761 Test: poc in bug
This commit is contained in:
parent
1153481333
commit
c7742ec970
3 changed files with 230 additions and 193 deletions
|
|
@ -560,8 +560,8 @@ static VOID ixheaacd_decorr_filt_apply(
|
|||
temp_1 = ixheaacd_mps_mult32_shr_14(temp5, numerator_real[0]);
|
||||
temp_2 = ixheaacd_mps_mult32_shr_14(temp6, numerator_real[0]);
|
||||
|
||||
*output_real = temp_1 + state_real[0];
|
||||
*output_imag = temp_2 + state_imag[0];
|
||||
*output_real = ixheaac_add32_sat(temp_1, state_real[0]);
|
||||
*output_imag = ixheaac_add32_sat(temp_2, state_imag[0]);
|
||||
|
||||
temp7 = *output_real;
|
||||
temp8 = *output_imag;
|
||||
|
|
@ -575,10 +575,10 @@ static VOID ixheaacd_decorr_filt_apply(
|
|||
temp4 = ixheaacd_mps_mult32x16_shr_16(temp8, denominator_real[j]);
|
||||
temp_1 -= temp_2;
|
||||
|
||||
state_real[j - 1] = state_real[j] + (temp_1 << 2);
|
||||
state_real[j - 1] = ixheaac_add32_sat(state_real[j], (temp_1 << 2));
|
||||
temp3 -= temp4;
|
||||
|
||||
state_imag[j - 1] = state_imag[j] + (temp3 << 2);
|
||||
state_imag[j - 1] = ixheaac_add32_sat(state_imag[j], (temp3 << 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -643,10 +643,10 @@ static VOID ixheaacd_ducker_apply_71(
|
|||
v4 = p_output_imag[qs];
|
||||
|
||||
pb = hybrid_2_param_28[qs];
|
||||
direct_nrg[pb] +=
|
||||
(WORD64)((WORD64)v1 * (WORD64)v1) + (WORD64)((WORD64)v2 * (WORD64)v2);
|
||||
reverb_nrg[pb] +=
|
||||
(WORD64)((WORD64)v3 * (WORD64)v3) + (WORD64)((WORD64)v4 * (WORD64)v4);
|
||||
direct_nrg[pb] = ixheaac_add64_sat(direct_nrg[pb], ixheaac_mult32x32in64(v1, v1));
|
||||
direct_nrg[pb] = ixheaac_add64_sat(direct_nrg[pb], ixheaac_mult32x32in64(v2, v2));
|
||||
reverb_nrg[pb] = ixheaac_add64_sat(reverb_nrg[pb], ixheaac_mult32x32in64(v3, v3));
|
||||
reverb_nrg[pb] = ixheaac_add64_sat(reverb_nrg[pb], ixheaac_mult32x32in64(v4, v4));
|
||||
}
|
||||
|
||||
for (; qs < num_bands_2; qs++) {
|
||||
|
|
@ -655,10 +655,10 @@ static VOID ixheaacd_ducker_apply_71(
|
|||
v3 = p_output_real[qs];
|
||||
v4 = p_output_imag[qs];
|
||||
|
||||
direct_nrg[27] +=
|
||||
(WORD64)((WORD64)v1 * (WORD64)v1) + (WORD64)((WORD64)v2 * (WORD64)v2);
|
||||
reverb_nrg[27] +=
|
||||
(WORD64)((WORD64)v3 * (WORD64)v3) + (WORD64)((WORD64)v4 * (WORD64)v4);
|
||||
direct_nrg[27] = ixheaac_add64_sat(direct_nrg[27], ixheaac_mult32x32in64(v1, v1));
|
||||
direct_nrg[27] = ixheaac_add64_sat(direct_nrg[27], ixheaac_mult32x32in64(v2, v2));
|
||||
reverb_nrg[27] = ixheaac_add64_sat(reverb_nrg[27], ixheaac_mult32x32in64(v3, v3));
|
||||
reverb_nrg[27] = ixheaac_add64_sat(reverb_nrg[27], ixheaac_mult32x32in64(v4, v4));
|
||||
}
|
||||
|
||||
for (pb = 0; pb < parameter_bands; pb++) {
|
||||
|
|
@ -813,10 +813,10 @@ static VOID ixheaacd_ducker_apply(
|
|||
v4 = p_output_imag[qs];
|
||||
|
||||
pb = hybrid_2_param_28[qs];
|
||||
direct_nrg[pb] +=
|
||||
(WORD64)((WORD64)v1 * (WORD64)v1) + (WORD64)((WORD64)v2 * (WORD64)v2);
|
||||
reverb_nrg[pb] +=
|
||||
(WORD64)((WORD64)v3 * (WORD64)v3) + (WORD64)((WORD64)v4 * (WORD64)v4);
|
||||
direct_nrg[pb] = ixheaac_add64_sat(direct_nrg[pb], ixheaac_mult32x32in64(v1, v1));
|
||||
direct_nrg[pb] = ixheaac_add64_sat(direct_nrg[pb], ixheaac_mult32x32in64(v2, v2));
|
||||
reverb_nrg[pb] = ixheaac_add64_sat(reverb_nrg[pb], ixheaac_mult32x32in64(v3, v3));
|
||||
reverb_nrg[pb] = ixheaac_add64_sat(reverb_nrg[pb], ixheaac_mult32x32in64(v4, v4));
|
||||
}
|
||||
|
||||
for (pb = 0; pb < parameter_bands; pb++) {
|
||||
|
|
|
|||
|
|
@ -435,11 +435,11 @@ VOID ixheaacd_mps_fft(complex *out, LOOPINDEX idx, WORD32 nob,
|
|||
re_temp = out2_w32[0];
|
||||
im_temp = out2_w32[1];
|
||||
|
||||
out2_w32[0] = (out1_w32[0] - re_temp);
|
||||
out2_w32[1] = (out1_w32[1] - im_temp);
|
||||
out2_w32[0] = ixheaac_sub32_sat(out1_w32[0], re_temp);
|
||||
out2_w32[1] = ixheaac_sub32_sat(out1_w32[1], im_temp);
|
||||
|
||||
out1_w32[0] = (re_temp + out1_w32[0]);
|
||||
out1_w32[1] = (im_temp + out1_w32[1]);
|
||||
out1_w32[0] = ixheaac_add32_sat(re_temp, out1_w32[0]);
|
||||
out1_w32[1] = ixheaac_add32_sat(im_temp, out1_w32[1]);
|
||||
|
||||
out1_w32 += 4;
|
||||
out2_w32 += 4;
|
||||
|
|
@ -464,8 +464,8 @@ VOID ixheaacd_mps_fft(complex *out, LOOPINDEX idx, WORD32 nob,
|
|||
re_temp = out1_w32[0];
|
||||
im_temp = out1_w32[1];
|
||||
|
||||
out1_w32[0] = (re_temp + out2_w32[0]) >> 1;
|
||||
out1_w32[1] = (im_temp + out2_w32[1]) >> 1;
|
||||
out1_w32[0] = ((WORD64)re_temp + (WORD64)out2_w32[0]) >> 1;
|
||||
out1_w32[1] = ((WORD64)im_temp + (WORD64)out2_w32[1]) >> 1;
|
||||
|
||||
out2_w32[0] = ((WORD64)re_temp - (WORD64)out2_w32[0]) >> 1;
|
||||
out2_w32[1] = ((WORD64)im_temp - (WORD64)out2_w32[1]) >> 1;
|
||||
|
|
@ -487,11 +487,11 @@ VOID ixheaacd_mps_fft(complex *out, LOOPINDEX idx, WORD32 nob,
|
|||
out1_w32[inner] >>= 1;
|
||||
out1_w32[inner + 1] >>= 1;
|
||||
|
||||
out2_w32[inner] = out1_w32[inner] - re_temp;
|
||||
out2_w32[inner + 1] = out1_w32[inner + 1] - im_temp;
|
||||
out2_w32[inner] = ixheaac_sub32_sat(out1_w32[inner], re_temp);
|
||||
out2_w32[inner + 1] = ixheaac_sub32_sat(out1_w32[inner + 1], im_temp);
|
||||
|
||||
out1_w32[inner] = (out1_w32[inner] + re_temp);
|
||||
out1_w32[inner + 1] = (out1_w32[inner + 1] + im_temp);
|
||||
out1_w32[inner] = ixheaac_add32_sat(out1_w32[inner], re_temp);
|
||||
out1_w32[inner + 1] = ixheaac_add32_sat(out1_w32[inner + 1], im_temp);
|
||||
|
||||
index1 += tab_modifier;
|
||||
}
|
||||
|
|
@ -520,8 +520,8 @@ VOID ixheaacd_8ch_filtering(const WORD32 *p_qmf_real, const WORD32 *p_qmf_imag,
|
|||
ixheaac_mult32x16in32(p_qmf_imag[12], p8_13[12])),
|
||||
1);
|
||||
|
||||
cum[5] = imag - real;
|
||||
cum[4] = -(imag + real);
|
||||
cum[5] = ixheaac_sub32_sat(imag, real);
|
||||
cum[4] = -ixheaac_add32_sat(imag, real);
|
||||
|
||||
real = ixheaac_shl32((ixheaac_mult32x16in32(p_qmf_real[3], p8_13[3]) +
|
||||
ixheaac_mult32x16in32(p_qmf_real[11], p8_13[11])),
|
||||
|
|
@ -560,8 +560,8 @@ VOID ixheaacd_8ch_filtering(const WORD32 *p_qmf_real, const WORD32 *p_qmf_imag,
|
|||
ixheaac_mult32x16in32(p_qmf_imag[8], p8_13[8])),
|
||||
1);
|
||||
|
||||
cum[7] = imag + real;
|
||||
cum[6] = imag - real;
|
||||
cum[7] = ixheaac_add32_sat(imag, real);
|
||||
cum[6] = ixheaac_sub32_sat(imag, real);
|
||||
|
||||
cum[15] = ixheaac_shl32((ixheaac_mult32x16in32(p_qmf_imag[7], p8_13[14]) +
|
||||
ixheaac_mult32x16in32(p_qmf_real[7], p8_13[13])),
|
||||
|
|
@ -605,8 +605,8 @@ VOID ixheaacd_2ch_filtering(WORD32 *p_qmf, WORD32 *m_hybrid,
|
|||
temp += (WORD64)p2_6[2] * ((WORD64)p_qmf[5] + (WORD64)p_qmf[7]);
|
||||
cum1 = (WORD32)(temp >> 16);
|
||||
|
||||
m_hybrid[0] = cum0 + cum1;
|
||||
m_hybrid[1] = cum0 - cum1;
|
||||
m_hybrid[0] = ixheaac_add32_sat(cum0, cum1);
|
||||
m_hybrid[1] = ixheaac_sub32_sat(cum0, cum1);
|
||||
}
|
||||
|
||||
WORD32 ixheaacd_get_qmf_sb(
|
||||
|
|
|
|||
|
|
@ -358,6 +358,8 @@ static VOID ixheaacd_subband_tp(ia_heaac_mps_state_struct *pstr_mps_state, WORD3
|
|||
WORD32 hybrid_bands = pstr_mps_state->hybrid_bands;
|
||||
|
||||
WORD32 tree_config = pstr_mps_state->tree_config;
|
||||
WORD64 dmx_real64 = 0;
|
||||
WORD64 dmx_imag64 = 0;
|
||||
|
||||
dry_ener = pstr_mps_state->mps_scratch_mem_v;
|
||||
q_dry_ener = (WORD16 *)pstr_mps_state->mps_scratch_mem_v +
|
||||
|
|
@ -494,8 +496,8 @@ static VOID ixheaacd_subband_tp(ia_heaac_mps_state_struct *pstr_mps_state, WORD3
|
|||
p_array_struct->hyb_output_imag_dry + ts * MAX_HYBRID_BANDS + 6;
|
||||
|
||||
for (ch = 0; ch < loop_counter; ch++) {
|
||||
*p_buffer_re++ = hyb_output_real_dry[0] + hyb_output_real_dry[1];
|
||||
*p_buffer_im++ = hyb_output_imag_dry[0] + hyb_output_imag_dry[1];
|
||||
*p_buffer_re++ = ixheaac_add32_sat(hyb_output_real_dry[0], hyb_output_real_dry[1]);
|
||||
*p_buffer_im++ = ixheaac_add32_sat(hyb_output_imag_dry[0], hyb_output_imag_dry[1]);
|
||||
|
||||
hyb_output_real_dry += TSXHB;
|
||||
hyb_output_imag_dry += TSXHB;
|
||||
|
|
@ -507,8 +509,8 @@ static VOID ixheaacd_subband_tp(ia_heaac_mps_state_struct *pstr_mps_state, WORD3
|
|||
p_array_struct->hyb_output_imag_dry + ts * MAX_HYBRID_BANDS + 8;
|
||||
|
||||
for (ch = 0; ch < loop_counter; ch++) {
|
||||
*p_buffer_re++ = hyb_output_real_dry[0] + hyb_output_real_dry[1];
|
||||
*p_buffer_im++ = hyb_output_imag_dry[0] + hyb_output_imag_dry[1];
|
||||
*p_buffer_re++ = ixheaac_add32_sat(hyb_output_real_dry[0], hyb_output_real_dry[1]);
|
||||
*p_buffer_im++ = ixheaac_add32_sat(hyb_output_imag_dry[0], hyb_output_imag_dry[1]);
|
||||
|
||||
hyb_output_real_dry += TSXHB;
|
||||
hyb_output_imag_dry += TSXHB;
|
||||
|
|
@ -537,99 +539,109 @@ static VOID ixheaacd_subband_tp(ia_heaac_mps_state_struct *pstr_mps_state, WORD3
|
|||
for (n = 1; n < BP_SIZE; n++) {
|
||||
switch (tree_config) {
|
||||
case TREE_5151:
|
||||
*dmx_real = *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
dmx_real64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_real_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
|
||||
*dmx_real = ixheaacd_mps_mult32_shr_30(*dmx_real,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_real = (WORD32)(dmx_real64 >> 30);
|
||||
dmx_real++;
|
||||
dmx_real++;
|
||||
|
||||
break;
|
||||
case TREE_5152:
|
||||
*dmx_real = *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
|
||||
*dmx_real = ixheaacd_mps_mult32_shr_30(*dmx_real,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_real_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_real = (WORD32)(dmx_real64 >> 30);
|
||||
dmx_real++;
|
||||
dmx_real++;
|
||||
|
||||
break;
|
||||
case TREE_525:
|
||||
*dmx_real = *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
*dmx_real = ixheaacd_mps_mult32_shr_30(*dmx_real,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_real_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_real = (WORD32)(dmx_real64 >> 30);
|
||||
dmx_real++;
|
||||
|
||||
*dmx_real = *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
*dmx_real = ixheaacd_mps_mult32_shr_30(*dmx_real,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_real_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_real = (WORD32)(dmx_real64 >> 30);
|
||||
dmx_real++;
|
||||
|
||||
break;
|
||||
case TREE_7271:
|
||||
case TREE_7272:
|
||||
*dmx_real = *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
|
||||
*dmx_real = ixheaacd_mps_mult32_shr_30(*dmx_real,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_real_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_real = (WORD32)(dmx_real64 >> 30);
|
||||
dmx_real++;
|
||||
|
||||
*dmx_real = *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
|
||||
*dmx_real = ixheaacd_mps_mult32_shr_30(*dmx_real,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_real_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_real = (WORD32)(dmx_real64 >> 30);
|
||||
dmx_real++;
|
||||
|
||||
break;
|
||||
case TREE_7571:
|
||||
|
||||
*dmx_real = *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
|
||||
dmx_real64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_real_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
qmf_output_real_dry++;
|
||||
|
||||
*dmx_real = ixheaacd_mps_mult32_shr_30(*dmx_real,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_real = (WORD32)(dmx_real64 >> 30);
|
||||
|
||||
dmx_real++;
|
||||
|
||||
*dmx_real = *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
|
||||
*dmx_real = ixheaacd_mps_mult32_shr_30(*dmx_real,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_real_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_real = (WORD32)(dmx_real64 >> 30);
|
||||
dmx_real++;
|
||||
|
||||
break;
|
||||
case TREE_7572:
|
||||
qmf_output_real_dry++;
|
||||
*dmx_real = *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
|
||||
dmx_real64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_real_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
qmf_output_real_dry++;
|
||||
*dmx_real = ixheaacd_mps_mult32_shr_30(*dmx_real,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_real = (WORD32)(dmx_real64 >> 30);
|
||||
dmx_real++;
|
||||
|
||||
*dmx_real = *qmf_output_real_dry++;
|
||||
*dmx_real += *qmf_output_real_dry++;
|
||||
|
||||
*dmx_real = ixheaacd_mps_mult32_shr_30(*dmx_real,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_real_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_real64 = ixheaac_mac32x32in64(dmx_real64, *qmf_output_real_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_real = (WORD32)(dmx_real64 >> 30);
|
||||
dmx_real++;
|
||||
|
||||
break;
|
||||
|
|
@ -642,96 +654,109 @@ static VOID ixheaacd_subband_tp(ia_heaac_mps_state_struct *pstr_mps_state, WORD3
|
|||
for (n = 1; n < BP_SIZE; n++) {
|
||||
switch (tree_config) {
|
||||
case TREE_5151:
|
||||
*dmx_imag = *qmf_output_imag_dry++;
|
||||
*dmx_imag += *qmf_output_imag_dry++;
|
||||
*dmx_imag += *qmf_output_imag_dry++;
|
||||
|
||||
dmx_imag64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_imag_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
qmf_output_imag_dry++;
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_imag = (WORD32)(dmx_imag64 >> 30);
|
||||
dmx_imag++;
|
||||
dmx_imag++;
|
||||
|
||||
*dmx_imag += *qmf_output_imag_dry++;
|
||||
*dmx_imag++ += *qmf_output_imag_dry++;
|
||||
|
||||
dmx_imag++;
|
||||
|
||||
dmx_imag[0] = ixheaacd_mps_mult32_shr_30(
|
||||
dmx_imag[0], tp_process_table_ptr->bpxgf[n]);
|
||||
break;
|
||||
case TREE_5152:
|
||||
|
||||
*dmx_imag = *qmf_output_imag_dry++;
|
||||
*dmx_imag += *qmf_output_imag_dry++;
|
||||
*dmx_imag += *qmf_output_imag_dry++;
|
||||
|
||||
*dmx_imag += *qmf_output_imag_dry++;
|
||||
*dmx_imag++ += *qmf_output_imag_dry++;
|
||||
|
||||
dmx_imag64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_imag_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_imag = (WORD32)(dmx_imag64 >> 30);
|
||||
dmx_imag++;
|
||||
|
||||
dmx_imag[0] = ixheaacd_mps_mult32_shr_30(
|
||||
dmx_imag[0], tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag++;
|
||||
|
||||
break;
|
||||
case TREE_525:
|
||||
*dmx_imag = *qmf_output_imag_dry++;
|
||||
*dmx_imag += *qmf_output_imag_dry++;
|
||||
*dmx_imag = ixheaacd_mps_mult32_shr_30(dmx_imag[0],
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_imag_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_imag = (WORD32)(dmx_imag64 >> 30);
|
||||
dmx_imag++;
|
||||
|
||||
*dmx_imag = *qmf_output_imag_dry++;
|
||||
*dmx_imag += *qmf_output_imag_dry++;
|
||||
*dmx_imag = ixheaacd_mps_mult32_shr_30(*dmx_imag,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_imag_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_imag = (WORD32)(dmx_imag64 >> 30);
|
||||
dmx_imag++;
|
||||
break;
|
||||
case TREE_7271:
|
||||
case TREE_7272:
|
||||
*dmx_imag = *qmf_output_imag_dry++;
|
||||
*dmx_imag += *qmf_output_imag_dry++;
|
||||
*dmx_imag += *qmf_output_imag_dry++;
|
||||
*dmx_imag = ixheaacd_mps_mult32_shr_30(*dmx_imag,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_imag_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_imag = (WORD32)(dmx_imag64 >> 30);
|
||||
dmx_imag++;
|
||||
|
||||
*dmx_imag = *qmf_output_imag_dry++;
|
||||
*dmx_imag += *qmf_output_imag_dry++;
|
||||
*dmx_imag += *qmf_output_imag_dry++;
|
||||
|
||||
*dmx_imag = ixheaacd_mps_mult32_shr_30(*dmx_imag,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_imag_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_imag = (WORD32)(dmx_imag64 >> 30);
|
||||
dmx_imag++;
|
||||
|
||||
break;
|
||||
case TREE_7571:
|
||||
*dmx_imag = *qmf_output_imag_dry++;
|
||||
*dmx_imag += *qmf_output_imag_dry++;
|
||||
dmx_imag64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_imag_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
qmf_output_imag_dry++;
|
||||
*dmx_imag = ixheaacd_mps_mult32_shr_30(*dmx_imag,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_imag = (WORD32)(dmx_imag64 >> 30);
|
||||
|
||||
dmx_imag++;
|
||||
|
||||
*dmx_imag = *qmf_output_imag_dry++;
|
||||
*dmx_imag += *qmf_output_imag_dry++;
|
||||
*dmx_imag = ixheaacd_mps_mult32_shr_30(*dmx_imag,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_imag_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_imag = (WORD32)(dmx_imag64 >> 30);
|
||||
dmx_imag++;
|
||||
|
||||
|
||||
break;
|
||||
case TREE_7572:
|
||||
qmf_output_imag_dry++;
|
||||
|
||||
*dmx_imag = *qmf_output_imag_dry++;
|
||||
*dmx_imag += *qmf_output_imag_dry++;
|
||||
|
||||
dmx_imag64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_imag_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
qmf_output_imag_dry++;
|
||||
|
||||
*dmx_imag = ixheaacd_mps_mult32_shr_30(*dmx_imag,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_imag = (WORD32)(dmx_imag64 >> 30);
|
||||
dmx_imag++;
|
||||
|
||||
*dmx_imag = *qmf_output_imag_dry++;
|
||||
*dmx_imag += *qmf_output_imag_dry++;
|
||||
*dmx_imag = ixheaacd_mps_mult32_shr_30(*dmx_imag,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 =
|
||||
ixheaac_mult32x32in64(*qmf_output_imag_dry++, tp_process_table_ptr->bpxgf[n]);
|
||||
dmx_imag64 = ixheaac_mac32x32in64(dmx_imag64, *qmf_output_imag_dry++,
|
||||
tp_process_table_ptr->bpxgf[n]);
|
||||
*dmx_imag = (WORD32)(dmx_imag64 >> 30);
|
||||
dmx_imag++;
|
||||
|
||||
break;
|
||||
|
|
@ -1121,7 +1146,7 @@ static VOID ixheaacd_subband_tp(ia_heaac_mps_state_struct *pstr_mps_state, WORD3
|
|||
temp_1 = ixheaacd_mps_mult32_shr_15(STP_LPF_COEFF2_FIX, scale[ch]);
|
||||
temp_2 =
|
||||
ixheaacd_mps_mult32_shr_15(ONE_MINUS_STP_LPF_COEFF2, prev_tp_scale[ch]);
|
||||
scale[ch] = temp_1 + temp_2;
|
||||
scale[ch] = ixheaac_add32_sat(temp_1, temp_2);
|
||||
prev_tp_scale[ch] = scale[ch];
|
||||
}
|
||||
|
||||
|
|
@ -1155,41 +1180,41 @@ static VOID ixheaacd_subband_tp(ia_heaac_mps_state_struct *pstr_mps_state, WORD3
|
|||
|
||||
if (no_scaling == 1) {
|
||||
for (n = HYBRID_BAND_BORDER; n < (HP_SIZE + QMF_TO_HYB_OFFSET); n++) {
|
||||
*p_buf_re++ = *hyb_output_real_dry++ + *p_buffer_re++;
|
||||
*p_buf_re++ = ixheaac_add32_sat(*hyb_output_real_dry++, *p_buffer_re++);
|
||||
|
||||
*p_buf_im++ = *hyb_output_imag_dry++ + *p_buffer_im++;
|
||||
*p_buf_im++ = ixheaac_add32_sat(*hyb_output_imag_dry++, *p_buffer_im++);
|
||||
}
|
||||
|
||||
for (; n < hybrid_bands; n++, k++) {
|
||||
temp = (no_scaling ? ONE_IN_Q15 : scale[ch]);
|
||||
|
||||
*p_buf_re++ = *hyb_output_real_dry++ + *p_buffer_re++;
|
||||
*p_buf_re++ = ixheaac_add32_sat(*hyb_output_real_dry++, *p_buffer_re++);
|
||||
|
||||
*p_buf_im++ = *hyb_output_imag_dry++ + *p_buffer_im++;
|
||||
*p_buf_im++ = ixheaac_add32_sat(*hyb_output_imag_dry++, *p_buffer_im++);
|
||||
}
|
||||
} else {
|
||||
for (n = HYBRID_BAND_BORDER; n < (HP_SIZE + QMF_TO_HYB_OFFSET); n++) {
|
||||
temp = ixheaacd_mps_mult32_shr_30(
|
||||
scale[ch], tp_process_table_ptr->bp[n - QMF_TO_HYB_OFFSET]);
|
||||
|
||||
*p_buf_re++ = *hyb_output_real_dry++ +
|
||||
ixheaacd_mps_mult32_shr_15(temp, *p_buffer_re);
|
||||
*p_buf_re++ = ixheaac_add32_sat(*hyb_output_real_dry++,
|
||||
ixheaacd_mps_mult32_shr_15(temp, *p_buffer_re));
|
||||
p_buffer_re++;
|
||||
|
||||
*p_buf_im++ = *hyb_output_imag_dry++ +
|
||||
ixheaacd_mps_mult32_shr_15(temp, *p_buffer_im);
|
||||
*p_buf_im++ = ixheaac_add32_sat(*hyb_output_imag_dry++,
|
||||
ixheaacd_mps_mult32_shr_15(temp, *p_buffer_im));
|
||||
p_buffer_im++;
|
||||
}
|
||||
|
||||
for (; n < hybrid_bands; n++, k++) {
|
||||
temp = (no_scaling ? ONE_IN_Q15 : scale[ch]);
|
||||
|
||||
*p_buf_re++ = *hyb_output_real_dry++ +
|
||||
ixheaacd_mps_mult32_shr_15(temp, *p_buffer_re);
|
||||
*p_buf_re++ = ixheaac_add32_sat(*hyb_output_real_dry++,
|
||||
ixheaacd_mps_mult32_shr_15(temp, *p_buffer_re));
|
||||
p_buffer_re++;
|
||||
|
||||
*p_buf_im++ = *hyb_output_imag_dry++ +
|
||||
ixheaacd_mps_mult32_shr_15(temp, *p_buffer_im);
|
||||
*p_buf_im++ = ixheaac_add32_sat(*hyb_output_imag_dry++,
|
||||
ixheaacd_mps_mult32_shr_15(temp, *p_buffer_im));
|
||||
p_buffer_im++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1259,35 +1284,41 @@ VOID ixheaacd_tp_process(ia_heaac_mps_state_struct *pstr_mps_state) {
|
|||
buf_real = p_buf_re;
|
||||
buf_imag = p_buf_im;
|
||||
|
||||
temp_1 = *hyb_output_real_dry++ + *hyb_output_real_wet++;
|
||||
temp_2 = *hyb_output_imag_dry++ + *hyb_output_imag_wet++;
|
||||
temp_1 = ixheaac_add32_sat(*hyb_output_real_dry++, *hyb_output_real_wet++);
|
||||
temp_2 = ixheaac_add32_sat(*hyb_output_imag_dry++, *hyb_output_imag_wet++);
|
||||
for (n = 1; n < 6; n++) {
|
||||
temp_1 += *hyb_output_real_dry++ + *hyb_output_real_wet++;
|
||||
temp_2 += *hyb_output_imag_dry++ + *hyb_output_imag_wet++;
|
||||
temp_1 = ixheaac_add32_sat(temp_1, *hyb_output_real_dry++);
|
||||
temp_1 = ixheaac_add32_sat(temp_1, *hyb_output_real_wet++);
|
||||
temp_2 = ixheaac_add32_sat(temp_2, *hyb_output_imag_dry++);
|
||||
temp_2 = ixheaac_add32_sat(temp_2, *hyb_output_imag_wet++);
|
||||
}
|
||||
|
||||
*buf_real++ = temp_1;
|
||||
*buf_imag++ = temp_2;
|
||||
|
||||
temp = *hyb_output_real_dry++ + *hyb_output_real_wet++;
|
||||
*buf_real = temp + *hyb_output_real_dry++ + *hyb_output_real_wet++;
|
||||
temp = *hyb_output_imag_dry++ + *hyb_output_imag_wet++;
|
||||
*buf_imag = temp + *hyb_output_imag_dry++ + *hyb_output_imag_wet++;
|
||||
temp = ixheaac_add32_sat(*hyb_output_real_dry++, *hyb_output_real_wet++);
|
||||
*buf_real = ixheaac_add32_sat(temp, *hyb_output_real_dry++);
|
||||
*buf_real = ixheaac_add32_sat(*buf_real, *hyb_output_real_wet++);
|
||||
temp = ixheaac_add32_sat(*hyb_output_imag_dry++, *hyb_output_imag_wet++);
|
||||
*buf_imag = ixheaac_add32_sat(temp, *hyb_output_imag_dry++);
|
||||
*buf_imag = ixheaac_add32_sat(*buf_imag, *hyb_output_imag_wet++);
|
||||
|
||||
buf_real++;
|
||||
buf_imag++;
|
||||
|
||||
temp = *hyb_output_real_dry++ + *hyb_output_real_wet++;
|
||||
*buf_real = temp + *hyb_output_real_dry++ + *hyb_output_real_wet++;
|
||||
temp = *hyb_output_imag_dry++ + *hyb_output_imag_wet++;
|
||||
*buf_imag = temp + *hyb_output_imag_dry++ + *hyb_output_imag_wet++;
|
||||
temp = ixheaac_add32_sat(*hyb_output_real_dry++, *hyb_output_real_wet++);
|
||||
*buf_real = ixheaac_add32_sat(temp, *hyb_output_real_dry++);
|
||||
*buf_real = ixheaac_add32_sat(*buf_real, *hyb_output_real_wet++);
|
||||
temp = ixheaac_add32_sat(*hyb_output_imag_dry++, *hyb_output_imag_wet++);
|
||||
*buf_imag = ixheaac_add32_sat(temp, *hyb_output_imag_dry++);
|
||||
*buf_imag = ixheaac_add32_sat(*buf_imag, *hyb_output_imag_wet++);
|
||||
|
||||
buf_real++;
|
||||
buf_imag++;
|
||||
|
||||
for (n = 0; n < qmf_bands; n++) {
|
||||
*buf_real++ = *hyb_output_real_dry++ + *hyb_output_real_wet++;
|
||||
*buf_imag++ = *hyb_output_imag_dry++ + *hyb_output_imag_wet++;
|
||||
*buf_real++ = ixheaac_add32_sat(*hyb_output_real_dry++, *hyb_output_real_wet++);
|
||||
*buf_imag++ = ixheaac_add32_sat(*hyb_output_imag_dry++, *hyb_output_imag_wet++);
|
||||
}
|
||||
|
||||
p_buffer_re += MAX_HYBRID_BANDS;
|
||||
|
|
@ -1328,36 +1359,42 @@ VOID ixheaacd_tp_process(ia_heaac_mps_state_struct *pstr_mps_state) {
|
|||
buf_real = p_buf_re;
|
||||
buf_imag = p_buf_im;
|
||||
|
||||
temp_1 = *hyb_output_real_dry++ + *hyb_output_real_wet++;
|
||||
temp_2 = *hyb_output_imag_dry++ + *hyb_output_imag_wet++;
|
||||
temp_1 = ixheaac_add32_sat(*hyb_output_real_dry++, *hyb_output_real_wet++);
|
||||
temp_2 = ixheaac_add32_sat(*hyb_output_imag_dry++, *hyb_output_imag_wet++);
|
||||
for (n = 1; n < 6; n++) {
|
||||
temp_1 += *hyb_output_real_dry++ + *hyb_output_real_wet++;
|
||||
temp_2 += *hyb_output_imag_dry++ + *hyb_output_imag_wet++;
|
||||
temp_1 = ixheaac_add32_sat(temp_1, *hyb_output_real_dry++);
|
||||
temp_1 = ixheaac_add32_sat(temp_1, *hyb_output_real_wet++);
|
||||
temp_2 = ixheaac_add32_sat(temp_2, *hyb_output_imag_dry++);
|
||||
temp_2 = ixheaac_add32_sat(temp_2, *hyb_output_imag_wet++);
|
||||
}
|
||||
|
||||
*buf_real++ = temp_1;
|
||||
*buf_imag++ = temp_2;
|
||||
|
||||
*buf_real = *hyb_output_real_dry++ + *hyb_output_real_wet++;
|
||||
*buf_real += *hyb_output_real_dry++ + *hyb_output_real_wet++;
|
||||
*buf_real = ixheaac_add32_sat(*hyb_output_real_dry++, *hyb_output_real_wet++);
|
||||
*buf_real = ixheaac_add32_sat(*buf_real, *hyb_output_real_dry++);
|
||||
*buf_real = ixheaac_add32_sat(*buf_real, *hyb_output_real_wet++);
|
||||
|
||||
*buf_imag = *hyb_output_imag_dry++ + *hyb_output_imag_wet++;
|
||||
*buf_imag += *hyb_output_imag_dry++ + *hyb_output_imag_wet++;
|
||||
*buf_imag = ixheaac_add32_sat(*hyb_output_imag_dry++, *hyb_output_imag_wet++);
|
||||
*buf_imag = ixheaac_add32_sat(*buf_imag, *hyb_output_imag_dry++);
|
||||
*buf_imag = ixheaac_add32_sat(*buf_imag, *hyb_output_imag_wet++);
|
||||
|
||||
buf_real++;
|
||||
buf_imag++;
|
||||
|
||||
*buf_real = *hyb_output_real_dry++ + *hyb_output_real_wet++;
|
||||
*buf_real += *hyb_output_real_dry++ + *hyb_output_real_wet++;
|
||||
*buf_imag = *hyb_output_imag_dry++ + *hyb_output_imag_wet++;
|
||||
*buf_imag += *hyb_output_imag_dry++ + *hyb_output_imag_wet++;
|
||||
*buf_real = ixheaac_add32_sat(*hyb_output_real_dry++, *hyb_output_real_wet++);
|
||||
*buf_real = ixheaac_add32_sat(*buf_real, *hyb_output_real_dry++);
|
||||
*buf_real = ixheaac_add32_sat(*buf_real, *hyb_output_real_wet++);
|
||||
*buf_imag = ixheaac_add32_sat(*hyb_output_imag_dry++, *hyb_output_imag_wet++);
|
||||
*buf_imag = ixheaac_add32_sat(*buf_imag, *hyb_output_imag_dry++);
|
||||
*buf_imag = ixheaac_add32_sat(*buf_imag, *hyb_output_imag_wet++);
|
||||
|
||||
buf_real++;
|
||||
buf_imag++;
|
||||
|
||||
for (hyb = 3; hyb < tp_hyb_band_border - QMF_TO_HYB_OFFSET; hyb++) {
|
||||
*buf_real++ = *hyb_output_real_dry++ + *hyb_output_real_wet++;
|
||||
*buf_imag++ = *hyb_output_imag_dry++ + *hyb_output_imag_wet++;
|
||||
*buf_real++ = ixheaac_add32_sat(*hyb_output_real_dry++, *hyb_output_real_wet++);
|
||||
*buf_imag++ = ixheaac_add32_sat(*hyb_output_imag_dry++, *hyb_output_imag_wet++);
|
||||
}
|
||||
p_buffer_re += MAX_HYBRID_BANDS;
|
||||
p_buffer_im += MAX_HYBRID_BANDS;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue