aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-04-06 23:08:42 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-04-06 23:08:42 +0000
commit5692ae9db32714607920555065fef07c7e3e15c3 (patch)
tree8ec69acd9f69bdd148df8cde294c3d6fb0ccb67d
parentb357111ac9f90b62982e119e5010e5a72fbcf234 (diff)
parent522ad1b4c4f6d7b7b41ccb756a98ad293f6580de (diff)
downloadlibxaac-5692ae9db32714607920555065fef07c7e3e15c3.tar.gz
Snap for 5443223 from 522ad1b4c4f6d7b7b41ccb756a98ad293f6580de to qt-release
Change-Id: I2b9d4556bba75e86bf7d024ce3561a0e314b9000
-rw-r--r--decoder/generic/ixheaacd_qmf_dec_generic.c364
-rw-r--r--decoder/ixheaacd_aac_imdct.c246
-rw-r--r--decoder/ixheaacd_aac_tns.c65
-rw-r--r--decoder/ixheaacd_aacdecoder.c10
-rw-r--r--decoder/ixheaacd_drc_data_struct.h1
-rw-r--r--decoder/ixheaacd_lpc.c46
6 files changed, 357 insertions, 375 deletions
diff --git a/decoder/generic/ixheaacd_qmf_dec_generic.c b/decoder/generic/ixheaacd_qmf_dec_generic.c
index 20e19a8..4b5120f 100644
--- a/decoder/generic/ixheaacd_qmf_dec_generic.c
+++ b/decoder/generic/ixheaacd_qmf_dec_generic.c
@@ -82,12 +82,12 @@ VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
for (n = 1; n < DCT3_LEN / 2; n++) {
temp1[0] = *ptr_forward++;
temp1[1] = *ptr_reverse--;
- temp1[0] = ixheaacd_add32(ixheaacd_shr32(temp1[0], LP_SHIFT_VAL),
+ temp1[0] = ixheaacd_add32_sat(ixheaacd_shr32(temp1[0], LP_SHIFT_VAL),
ixheaacd_shr32(temp1[1], LP_SHIFT_VAL));
temp1[2] = *(ptr_forward - 33);
temp1[3] = *(ptr_reverse - 31);
- temp1[1] = ixheaacd_sub32(ixheaacd_shr32(temp1[2], LP_SHIFT_VAL),
+ temp1[1] = ixheaacd_sub32_sat(ixheaacd_shr32(temp1[2], LP_SHIFT_VAL),
ixheaacd_shr32(temp1[3], LP_SHIFT_VAL));
twid_re = *twidle_fwd++;
@@ -107,7 +107,7 @@ VOID ixheaacd_dct3_32(WORD32 *input, WORD32 *output,
temp1[1] = *ptr_reverse--;
temp1[0] = *(ptr_reverse - 31);
- temp1[1] = ixheaacd_sub32(ixheaacd_shr32(temp1[1], LP_SHIFT_VAL),
+ temp1[1] = ixheaacd_sub32_sat(ixheaacd_shr32(temp1[1], LP_SHIFT_VAL),
ixheaacd_shr32(temp1[0], LP_SHIFT_VAL));
temp1[0] = temp1[1];
@@ -292,7 +292,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
wim = *p_sin_cos++;
wre = *p_sin_cos++;
- *psubband_t++ = ixheaacd_add32(ixheaacd_mult32x16in32(re, wre),
+ *psubband_t++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
*psubband_t++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wre),
ixheaacd_mult32x16in32(re, wim));
@@ -302,7 +302,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(ixheaacd_mult32x16in32(re, wim),
+ *psubband_t2++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
re = *psubband1--;
@@ -313,13 +313,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(ixheaacd_mult32x16in32(re, wre),
+ *psubband1_t-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
re = *psubband12--;
im = *psubband2++;
- *psubband1_t2-- = ixheaacd_add32(ixheaacd_mult32x16in32(re, wim),
+ *psubband1_t2-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
*psubband1_t2-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wim),
ixheaacd_mult32x16in32(re, wre));
@@ -330,7 +330,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
wim = *p_sin_cos++;
wre = *p_sin_cos++;
- *psubband_t++ = ixheaacd_add32(ixheaacd_mult32x16in32(re, wre),
+ *psubband_t++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
*psubband_t++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wre),
ixheaacd_mult32x16in32(re, wim));
@@ -340,7 +340,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(ixheaacd_mult32x16in32(re, wim),
+ *psubband_t2++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
re = *psubband1--;
@@ -351,14 +351,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(ixheaacd_mult32x16in32(re, wre),
+ *psubband1_t-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
re = *psubband12--;
im = *psubband2++;
;
- *psubband1_t2-- = ixheaacd_add32(ixheaacd_mult32x16in32(re, wim),
+ *psubband1_t2-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
*psubband1_t2-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wim),
ixheaacd_mult32x16in32(re, wre));
@@ -399,7 +399,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
im = *psubband1;
- *psubband1-- = ixheaacd_add32(ixheaacd_mult32x16in32(re, wre),
+ *psubband1-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
*psubband++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wre),
ixheaacd_mult32x16in32(re, wim));
@@ -417,7 +417,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
im = *psubband12;
- *psubband2++ = ixheaacd_negate32_sat(ixheaacd_add32(
+ *psubband2++ = ixheaacd_negate32_sat(ixheaacd_add32_sat(
ixheaacd_mult32x16in32(re, wre), ixheaacd_mult32x16in32(im, wim)));
*psubband12-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
@@ -429,7 +429,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
re2 = *psubband1;
- *psubband++ = ixheaacd_add32(ixheaacd_mult32x16in32(re, wim),
+ *psubband++ = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re, wim),
ixheaacd_mult32x16in32(im, wre));
*psubband1-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wim),
ixheaacd_mult32x16in32(re, wre));
@@ -440,7 +440,7 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
re3 = *psubband12;
- *psubband12-- = ixheaacd_negate32_sat(ixheaacd_add32(
+ *psubband12-- = ixheaacd_negate32_sat(ixheaacd_add32_sat(
ixheaacd_mult32x16in32(re, wim), ixheaacd_mult32x16in32(im, wre)));
*psubband2++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(re, wre),
ixheaacd_mult32x16in32(im, wim));
@@ -449,14 +449,14 @@ VOID ixheaacd_cos_sin_mod(WORD32 *subband,
wre = *p_sin++;
im = psubband1[0];
- *psubband1-- = ixheaacd_add32(ixheaacd_mult32x16in32(re2, wre),
+ *psubband1-- = ixheaacd_add32_sat(ixheaacd_mult32x16in32(re2, wre),
ixheaacd_mult32x16in32(im, wim));
*psubband++ = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(im, wre),
ixheaacd_mult32x16in32(re2, wim));
im = psubband12[0];
- *psubband2++ = ixheaacd_negate32_sat(ixheaacd_add32(
+ *psubband2++ = ixheaacd_negate32_sat(ixheaacd_add32_sat(
ixheaacd_mult32x16in32(re3, wre), ixheaacd_mult32x16in32(im, wim)));
*psubband12-- = ixheaacd_sub32_sat(ixheaacd_mult32x16in32(re3, wim),
ixheaacd_mult32x16in32(im, wre));
@@ -480,7 +480,7 @@ VOID ixheaacd_fwd_modulation(const WORD32 *p_time_in1, WORD32 *real_subband,
*t_real_subband++ = ixheaacd_sub32_sat(temp1, temp2);
- *t_imag_subband++ = ixheaacd_add32(temp1, temp2);
+ *t_imag_subband++ = ixheaacd_add32_sat(temp1, temp2);
}
ixheaacd_cos_sin_mod(real_subband, qmf_bank, qmf_dec_tables_ptr->w_16,
@@ -496,7 +496,7 @@ VOID ixheaacd_fwd_modulation(const WORD32 *p_time_in1, WORD32 *real_subband,
im = *imag_subband;
cosh = *tcos++;
sinh = *tcos++;
- *real_subband++ = ixheaacd_add32(ixheaacd_mult32x16in32_shl(re, cosh),
+ *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));
@@ -511,13 +511,13 @@ VOID ixheaacd_sbr_qmfanal32_winadd(WORD16 *inp1, WORD16 *inp2, WORD16 *p_qmf1,
WORD32 accu;
accu = ixheaacd_mult16x16in32(inp1[n + 0], p_qmf1[2 * (n + 0)]);
- accu = ixheaacd_add32(
+ accu = ixheaacd_add32_sat(
accu, ixheaacd_mult16x16in32(inp1[n + 64], p_qmf1[2 * (n + 64)]));
- accu = ixheaacd_add32(
+ accu = ixheaacd_add32_sat(
accu, ixheaacd_mult16x16in32(inp1[n + 128], p_qmf1[2 * (n + 128)]));
- accu = ixheaacd_add32(
+ accu = ixheaacd_add32_sat(
accu, ixheaacd_mult16x16in32(inp1[n + 192], p_qmf1[2 * (n + 192)]));
- accu = ixheaacd_add32(
+ accu = ixheaacd_add32_sat(
accu, ixheaacd_mult16x16in32(inp1[n + 256], p_qmf1[2 * (n + 256)]));
p_out[n] = accu;
@@ -537,13 +537,13 @@ VOID ixheaacd_sbr_qmfanal32_winadd(WORD16 *inp1, WORD16 *inp2, WORD16 *p_qmf1,
p_out[n + 1] = accu;
accu = ixheaacd_mult16x16in32(inp2[n + 0], p_qmf2[2 * (n + 0)]);
- accu = ixheaacd_add32(
+ accu = ixheaacd_add32_sat(
accu, ixheaacd_mult16x16in32(inp2[n + 64], p_qmf2[2 * (n + 64)]));
- accu = ixheaacd_add32(
+ accu = ixheaacd_add32_sat(
accu, ixheaacd_mult16x16in32(inp2[n + 128], p_qmf2[2 * (n + 128)]));
- accu = ixheaacd_add32(
+ accu = ixheaacd_add32_sat(
accu, ixheaacd_mult16x16in32(inp2[n + 192], p_qmf2[2 * (n + 192)]));
- accu = ixheaacd_add32(
+ accu = ixheaacd_add32_sat(
accu, ixheaacd_mult16x16in32(inp2[n + 256], p_qmf2[2 * (n + 256)]));
p_out[n + 32] = accu;
@@ -776,34 +776,34 @@ VOID ixheaacd_esbr_radix4bfly(const WORD32 *w, WORD32 *x, WORD32 index1,
x_l1_0 = x[l1];
x_l2_0 = x[l2];
- xh0_0 = x_0 + x_l1_0;
- xl0_0 = x_0 - x_l1_0;
+ xh0_0 = ixheaacd_add32_sat(x_0, x_l1_0);
+ xl0_0 = ixheaacd_sub32_sat(x_0, x_l1_0);
- xh20_0 = x_h2_0 + x_l2_0;
- xl20_0 = x_h2_0 - x_l2_0;
+ xh20_0 = ixheaacd_add32_sat(x_h2_0, x_l2_0);
+ xl20_0 = ixheaacd_sub32_sat(x_h2_0, x_l2_0);
- x[0] = xh0_0 + xh20_0;
- xt0_0 = xh0_0 - xh20_0;
+ x[0] = ixheaacd_add32_sat(xh0_0, xh20_0);
+ xt0_0 = ixheaacd_sub32_sat(xh0_0, xh20_0);
x_1 = x[1];
x_h2_1 = x[h2 + 1];
x_l1_1 = x[l1 + 1];
x_l2_1 = x[l2 + 1];
- xh1_0 = x_1 + x_l1_1;
- xl1_0 = x_1 - x_l1_1;
+ xh1_0 = ixheaacd_add32_sat(x_1, x_l1_1);
+ xl1_0 = ixheaacd_sub32_sat(x_1, x_l1_1);
- xh21_0 = x_h2_1 + x_l2_1;
- xl21_0 = x_h2_1 - x_l2_1;
+ xh21_0 = ixheaacd_add32_sat(x_h2_1, x_l2_1);
+ xl21_0 = ixheaacd_sub32_sat(x_h2_1, x_l2_1);
- x[1] = xh1_0 + xh21_0;
- yt0_0 = xh1_0 - xh21_0;
+ x[1] = ixheaacd_add32_sat(xh1_0, xh21_0);
+ yt0_0 = ixheaacd_sub32_sat(xh1_0, xh21_0);
- xt1_0 = xl0_0 + xl21_0;
- xt2_0 = xl0_0 - xl21_0;
+ xt1_0 = ixheaacd_add32_sat(xl0_0, xl21_0);
+ xt2_0 = ixheaacd_sub32_sat(xl0_0, xl21_0);
- yt2_0 = xl1_0 + xl20_0;
- yt1_0 = xl1_0 - xl20_0;
+ yt2_0 = ixheaacd_add32_sat(xl1_0, xl20_0);
+ yt1_0 = ixheaacd_sub32_sat(xl1_0, xl20_0);
mul_11 = ixheaacd_mult64(xt2_0, co30);
mul_3 = ixheaacd_mult64(yt2_0, si30);
@@ -873,14 +873,14 @@ VOID ixheaacd_esbr_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
x_6 = *x0++;
x_7 = *x0++;
- n00 = x_0 + x_2;
- n01 = x_1 + x_3;
- n20 = x_0 - x_2;
- n21 = x_1 - x_3;
- n10 = x_4 + x_6;
- n11 = x_5 + x_7;
- n30 = x_4 - x_6;
- n31 = x_5 - x_7;
+ n00 = ixheaacd_add32_sat(x_0, x_2);
+ n01 = ixheaacd_add32_sat(x_1, x_3);
+ n20 = ixheaacd_sub32_sat(x_0, x_2);
+ n21 = ixheaacd_sub32_sat(x_1, x_3);
+ n10 = ixheaacd_add32_sat(x_4, x_6);
+ n11 = ixheaacd_add32_sat(x_5, x_7);
+ n30 = ixheaacd_sub32_sat(x_4, x_6);
+ n31 = ixheaacd_sub32_sat(x_5, x_7);
y0[h2] = n00;
y0[h2 + 1] = n01;
@@ -900,14 +900,14 @@ VOID ixheaacd_esbr_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
x_e = *x2++;
x_f = *x2++;
- n02 = x_8 + x_a;
- n03 = x_9 + x_b;
- n22 = x_8 - x_a;
- n23 = x_9 - x_b;
- n12 = x_c + x_e;
- n13 = x_d + x_f;
- n32 = x_c - x_e;
- n33 = x_d - x_f;
+ n02 = ixheaacd_add32_sat(x_8, x_a);
+ n03 = ixheaacd_add32_sat(x_9, x_b);
+ n22 = ixheaacd_sub32_sat(x_8, x_a);
+ n23 = ixheaacd_sub32_sat(x_9, x_b);
+ n12 = ixheaacd_add32_sat(x_c, x_e);
+ n13 = ixheaacd_add32_sat(x_d, x_f);
+ n32 = ixheaacd_sub32_sat(x_c, x_e);
+ n33 = ixheaacd_sub32_sat(x_d, x_f);
y0[h2 + 2] = n02;
y0[h2 + 3] = n03;
@@ -963,23 +963,23 @@ VOID ixheaacd_esbr_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
x_6 = *x0++;
x_7 = *x0++;
- xh0_0 = x_0 + x_4;
- xh1_0 = x_1 + x_5;
- xl0_0 = x_0 - x_4;
- xl1_0 = x_1 - x_5;
- xh0_1 = x_2 + x_6;
- xh1_1 = x_3 + x_7;
- xl0_1 = x_2 - x_6;
- xl1_1 = x_3 - x_7;
-
- n00 = xh0_0 + xh0_1;
- n01 = xh1_0 + xh1_1;
- n10 = xl0_0 + xl1_1;
- n11 = xl1_0 - xl0_1;
- n20 = xh0_0 - xh0_1;
- n21 = xh1_0 - xh1_1;
- n30 = xl0_0 - xl1_1;
- n31 = xl1_0 + xl0_1;
+ xh0_0 = ixheaacd_add32_sat(x_0, x_4);
+ xh1_0 = ixheaacd_add32_sat(x_1, x_5);
+ xl0_0 = ixheaacd_sub32_sat(x_0, x_4);
+ xl1_0 = ixheaacd_sub32_sat(x_1, x_5);
+ xh0_1 = ixheaacd_add32_sat(x_2, x_6);
+ xh1_1 = ixheaacd_add32_sat(x_3, x_7);
+ xl0_1 = ixheaacd_sub32_sat(x_2, x_6);
+ xl1_1 = ixheaacd_sub32_sat(x_3, x_7);
+
+ n00 = ixheaacd_add32_sat(xh0_0, xh0_1);
+ n01 = ixheaacd_add32_sat(xh1_0, xh1_1);
+ n10 = ixheaacd_add32_sat(xl0_0, xl1_1);
+ n11 = ixheaacd_sub32_sat(xl1_0, xl0_1);
+ n20 = ixheaacd_sub32_sat(xh0_0, xh0_1);
+ n21 = ixheaacd_sub32_sat(xh1_0, xh1_1);
+ n30 = ixheaacd_sub32_sat(xl0_0, xl1_1);
+ n31 = ixheaacd_add32_sat(xl1_0, xl0_1);
y0[h2] = n00;
y0[h2 + 1] = n01;
@@ -999,23 +999,23 @@ VOID ixheaacd_esbr_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
x_e = *x2++;
x_f = *x2++;
- xh0_2 = x_8 + x_c;
- xh1_2 = x_9 + x_d;
- xl0_2 = x_8 - x_c;
- xl1_2 = x_9 - x_d;
- xh0_3 = x_a + x_e;
- xh1_3 = x_b + x_f;
- xl0_3 = x_a - x_e;
- xl1_3 = x_b - x_f;
-
- n02 = xh0_2 + xh0_3;
- n03 = xh1_2 + xh1_3;
- n12 = xl0_2 + xl1_3;
- n13 = xl1_2 - xl0_3;
- n22 = xh0_2 - xh0_3;
- n23 = xh1_2 - xh1_3;
- n32 = xl0_2 - xl1_3;
- n33 = xl1_2 + xl0_3;
+ xh0_2 = ixheaacd_add32_sat(x_8, x_c);
+ xh1_2 = ixheaacd_add32_sat(x_9, x_d);
+ xl0_2 = ixheaacd_sub32_sat(x_8, x_c);
+ xl1_2 = ixheaacd_sub32_sat(x_9, x_d);
+ xh0_3 = ixheaacd_add32_sat(x_a, x_e);
+ xh1_3 = ixheaacd_add32_sat(x_b, x_f);
+ xl0_3 = ixheaacd_sub32_sat(x_a, x_e);
+ xl1_3 = ixheaacd_sub32_sat(x_b, x_f);
+
+ n02 = ixheaacd_add32_sat(xh0_2, xh0_3);
+ n03 = ixheaacd_add32_sat(xh1_2, xh1_3);
+ n12 = ixheaacd_add32_sat(xl0_2, xl1_3);
+ n13 = ixheaacd_sub32_sat(xl1_2, xl0_3);
+ n22 = ixheaacd_sub32_sat(xh0_2, xh0_3);
+ n23 = ixheaacd_sub32_sat(xh1_2, xh1_3);
+ n32 = ixheaacd_sub32_sat(xl0_2, xl1_3);
+ n33 = ixheaacd_add32_sat(xl1_2, xl0_3);
y0[h2 + 2] = n02;
y0[h2 + 3] = n03;
@@ -1349,7 +1349,7 @@ VOID ixheaacd_esbr_fwd_modulation(
*t_real_subband++ = ixheaacd_sub32_sat(temp1, temp2);
- *t_imag_subband++ = ixheaacd_add32(temp1, temp2);
+ *t_imag_subband++ = ixheaacd_add32_sat(temp1, temp2);
}
ixheaacd_esbr_cos_sin_mod(real_subband, qmf_bank,
@@ -1386,26 +1386,26 @@ 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(syn_out,
+ syn_out = ixheaacd_add32_sat(syn_out,
ixheaacd_mult16x16in32(tmp1[0 + k], inp1[k + 0]));
- syn_out = ixheaacd_add32(
+ syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp1[256 + k], inp1[k + 128]));
- syn_out = ixheaacd_add32(
+ syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp1[512 + k], inp1[k + 256]));
- syn_out = ixheaacd_add32(
+ syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp1[768 + k], inp1[k + 384]));
- syn_out = ixheaacd_add32(
+ syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp1[1024 + k], inp1[k + 512]));
- syn_out = ixheaacd_add32(
+ syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp2[128 + k], inp1[k + 64]));
- syn_out = ixheaacd_add32(
+ syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp2[384 + k], inp1[k + 192]));
- syn_out = ixheaacd_add32(
+ syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp2[640 + k], inp1[k + 320]));
- syn_out = ixheaacd_add32(
+ syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp2[896 + k], inp1[k + 448]));
- syn_out = ixheaacd_add32(
+ syn_out = ixheaacd_add32_sat(
syn_out, ixheaacd_mult16x16in32(tmp2[1152 + k], inp1[k + 576]));
sample_buffer[ch_fac * k] = (ixheaacd_shl32_sat(syn_out, shift) >> 16);
@@ -1488,19 +1488,19 @@ VOID ixheaacd_shiftrountine_with_rnd(WORD32 *qmf_real, WORD32 *qmf_imag,
r1 = *qmf_real++;
i1 = *qmf_imag++;
- timag = ixheaacd_add32(i1, r1);
+ timag = ixheaacd_add32_sat(i1, r1);
timag = (ixheaacd_shl32_sat(timag, shift));
filter_states_rev[j] = ixheaacd_round16(timag);
- treal = ixheaacd_sub32(i2, r2);
+ treal = ixheaacd_sub32_sat(i2, r2);
treal = (ixheaacd_shl32_sat(treal, shift));
filter_states[j] = ixheaacd_round16(treal);
- treal = ixheaacd_sub32(i1, r1);
+ treal = ixheaacd_sub32_sat(i1, r1);
treal = (ixheaacd_shl32_sat(treal, shift));
*filter_states++ = ixheaacd_round16(treal);
- timag = ixheaacd_add32(i2, r2);
+ timag = ixheaacd_add32_sat(i2, r2);
;
timag = (ixheaacd_shl32_sat(timag, shift));
*filter_states_rev++ = ixheaacd_round16(timag);
@@ -1521,19 +1521,19 @@ VOID ixheaacd_shiftrountine_with_rnd_eld(WORD32 *qmf_real, WORD32 *qmf_imag,
r1 = *qmf_real++;
i1 = *qmf_imag++;
- timag = ixheaacd_negate32(ixheaacd_add32(i1, r1));
+ timag = ixheaacd_negate32(ixheaacd_add32_sat(i1, r1));
timag = (ixheaacd_shl32_sat(timag, shift));
filter_states_rev[j] = ixheaacd_round16(timag);
- treal = ixheaacd_sub32(r2, i2);
+ treal = ixheaacd_sub32_sat(r2, i2);
treal = (ixheaacd_shl32_sat(treal, shift));
filter_states[j] = ixheaacd_round16(treal);
- treal = ixheaacd_sub32(r1, i1);
+ treal = ixheaacd_sub32_sat(r1, i1);
treal = (ixheaacd_shl32_sat(treal, shift));
*filter_states++ = ixheaacd_round16(treal);
- timag = ixheaacd_negate32(ixheaacd_add32(i2, r2));
+ timag = ixheaacd_negate32(ixheaacd_add32_sat(i2, r2));
timag = (ixheaacd_shl32_sat(timag, shift));
*filter_states_rev++ = ixheaacd_round16(timag);
}
@@ -1553,19 +1553,19 @@ VOID ixheaacd_shiftrountine_with_rnd_hq(WORD32 *qmf_real, WORD32 *qmf_imag,
r1 = *qmf_real++;
i1 = *qmf_imag++;
- timag = ixheaacd_add32(i1, r1);
+ timag = ixheaacd_add32_sat(i1, r1);
timag = (ixheaacd_shl32_sat(timag, shift));
filter_states_rev[j] = timag;
- treal = ixheaacd_sub32(i2, r2);
+ treal = ixheaacd_sub32_sat(i2, r2);
treal = (ixheaacd_shl32_sat(treal, shift));
filter_states[j] = treal;
- treal = ixheaacd_sub32(i1, r1);
+ treal = ixheaacd_sub32_sat(i1, r1);
treal = (ixheaacd_shl32_sat(treal, shift));
*filter_states++ = treal;
- timag = ixheaacd_add32(i2, r2);
+ timag = ixheaacd_add32_sat(i2, r2);
timag = (ixheaacd_shl32_sat(timag, shift));
*filter_states_rev++ = timag;
}
@@ -1613,34 +1613,34 @@ VOID ixheaacd_radix4bfly(const WORD16 *w, WORD32 *x, WORD32 index1,
x_l1_0 = x[l1];
x_l2_0 = x[l2];
- xh0_0 = x_0 + x_l1_0;
- xl0_0 = x_0 - x_l1_0;
+ xh0_0 = ixheaacd_add32_sat(x_0, x_l1_0);
+ xl0_0 = ixheaacd_sub32_sat(x_0, x_l1_0);
- xh20_0 = x_h2_0 + x_l2_0;
- xl20_0 = x_h2_0 - x_l2_0;
+ xh20_0 = ixheaacd_add32_sat(x_h2_0, x_l2_0);
+ xl20_0 = ixheaacd_sub32_sat(x_h2_0, x_l2_0);
- x[0] = xh0_0 + xh20_0;
- xt0_0 = xh0_0 - xh20_0;
+ x[0] = ixheaacd_add32_sat(xh0_0, xh20_0);
+ xt0_0 = ixheaacd_sub32_sat(xh0_0, xh20_0);
x_1 = x[1];
x_h2_1 = x[h2 + 1];
x_l1_1 = x[l1 + 1];
x_l2_1 = x[l2 + 1];
- xh1_0 = x_1 + x_l1_1;
- xl1_0 = x_1 - x_l1_1;
+ xh1_0 = ixheaacd_add32_sat(x_1, x_l1_1);
+ xl1_0 = ixheaacd_sub32_sat(x_1, x_l1_1);
- xh21_0 = x_h2_1 + x_l2_1;
- xl21_0 = x_h2_1 - x_l2_1;
+ xh21_0 = ixheaacd_add32_sat(x_h2_1, x_l2_1);
+ xl21_0 = ixheaacd_sub32_sat(x_h2_1, x_l2_1);
- x[1] = xh1_0 + xh21_0;
- yt0_0 = xh1_0 - xh21_0;
+ x[1] = ixheaacd_add32_sat(xh1_0, xh21_0);
+ yt0_0 = ixheaacd_sub32_sat(xh1_0, xh21_0);
- xt1_0 = xl0_0 + xl21_0;
- xt2_0 = xl0_0 - xl21_0;
+ xt1_0 = ixheaacd_add32_sat(xl0_0, xl21_0);
+ xt2_0 = ixheaacd_sub32_sat(xl0_0, xl21_0);
- yt2_0 = xl1_0 + xl20_0;
- yt1_0 = xl1_0 - xl20_0;
+ yt2_0 = ixheaacd_add32_sat(xl1_0, xl20_0);
+ yt1_0 = ixheaacd_sub32_sat(xl1_0, xl20_0);
mul_11 = ixheaacd_mult32x16in32(xt2_0, co30);
mul_3 = ixheaacd_mult32x16in32(yt2_0, si30);
@@ -1712,23 +1712,23 @@ VOID ixheaacd_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
x_6 = *x0++;
x_7 = *x0++;
- xh0_0 = x_0 + x_4;
- xh1_0 = x_1 + x_5;
- xl0_0 = x_0 - x_4;
- xl1_0 = x_1 - x_5;
- xh0_1 = x_2 + x_6;
- xh1_1 = x_3 + x_7;
- xl0_1 = x_2 - x_6;
- xl1_1 = x_3 - x_7;
-
- n00 = xh0_0 + xh0_1;
- n01 = xh1_0 + xh1_1;
- n10 = xl0_0 + xl1_1;
- n11 = xl1_0 - xl0_1;
- n20 = xh0_0 - xh0_1;
- n21 = xh1_0 - xh1_1;
- n30 = xl0_0 - xl1_1;
- n31 = xl1_0 + xl0_1;
+ xh0_0 = ixheaacd_add32_sat(x_0, x_4);
+ xh1_0 = ixheaacd_add32_sat(x_1, x_5);
+ xl0_0 = ixheaacd_sub32_sat(x_0, x_4);
+ xl1_0 = ixheaacd_sub32_sat(x_1, x_5);
+ xh0_1 = ixheaacd_add32_sat(x_2, x_6);
+ xh1_1 = ixheaacd_add32_sat(x_3, x_7);
+ xl0_1 = ixheaacd_sub32_sat(x_2, x_6);
+ xl1_1 = ixheaacd_sub32_sat(x_3, x_7);
+
+ n00 = ixheaacd_add32_sat(xh0_0, xh0_1);
+ n01 = ixheaacd_add32_sat(xh1_0, xh1_1);
+ n10 = ixheaacd_add32_sat(xl0_0, xl1_1);
+ n11 = ixheaacd_sub32_sat(xl1_0, xl0_1);
+ n20 = ixheaacd_sub32_sat(xh0_0, xh0_1);
+ n21 = ixheaacd_sub32_sat(xh1_0, xh1_1);
+ n30 = ixheaacd_sub32_sat(xl0_0, xl1_1);
+ n31 = ixheaacd_add32_sat(xl1_0, xl0_1);
y0[h2] = n00;
y0[h2 + 1] = n01;
@@ -1748,23 +1748,23 @@ VOID ixheaacd_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
x_e = *x2++;
x_f = *x2++;
- xh0_2 = x_8 + x_c;
- xh1_2 = x_9 + x_d;
- xl0_2 = x_8 - x_c;
- xl1_2 = x_9 - x_d;
- xh0_3 = x_a + x_e;
- xh1_3 = x_b + x_f;
- xl0_3 = x_a - x_e;
- xl1_3 = x_b - x_f;
-
- n02 = xh0_2 + xh0_3;
- n03 = xh1_2 + xh1_3;
- n12 = xl0_2 + xl1_3;
- n13 = xl1_2 - xl0_3;
- n22 = xh0_2 - xh0_3;
- n23 = xh1_2 - xh1_3;
- n32 = xl0_2 - xl1_3;
- n33 = xl1_2 + xl0_3;
+ xh0_2 = ixheaacd_add32_sat(x_8, x_c);
+ xh1_2 = ixheaacd_add32_sat(x_9, x_d);
+ xl0_2 = ixheaacd_sub32_sat(x_8, x_c);
+ xl1_2 = ixheaacd_sub32_sat(x_9, x_d);
+ xh0_3 = ixheaacd_add32_sat(x_a, x_e);
+ xh1_3 = ixheaacd_add32_sat(x_b, x_f);
+ xl0_3 = ixheaacd_sub32_sat(x_a, x_e);
+ xl1_3 = ixheaacd_sub32_sat(x_b, x_f);
+
+ n02 = ixheaacd_add32_sat(xh0_2, xh0_3);
+ n03 = ixheaacd_add32_sat(xh1_2, xh1_3);
+ n12 = ixheaacd_add32_sat(xl0_2, xl1_3);
+ n13 = ixheaacd_sub32_sat(xl1_2, xl0_3);
+ n22 = ixheaacd_sub32_sat(xh0_2, xh0_3);
+ n23 = ixheaacd_sub32_sat(xh1_2, xh1_3);
+ n32 = ixheaacd_sub32_sat(xl0_2, xl1_3);
+ n33 = ixheaacd_add32_sat(xl1_2, xl0_3);
y0[h2 + 2] = n02;
y0[h2 + 3] = n03;
@@ -1816,14 +1816,14 @@ VOID ixheaacd_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
x_6 = *x0++;
x_7 = *x0++;
- n00 = x_0 + x_2;
- n01 = x_1 + x_3;
- n20 = x_0 - x_2;
- n21 = x_1 - x_3;
- n10 = x_4 + x_6;
- n11 = x_5 + x_7;
- n30 = x_4 - x_6;
- n31 = x_5 - x_7;
+ n00 = ixheaacd_add32_sat(x_0, x_2);
+ n01 = ixheaacd_add32_sat(x_1, x_3);
+ n20 = ixheaacd_sub32_sat(x_0, x_2);
+ n21 = ixheaacd_sub32_sat(x_1, x_3);
+ n10 = ixheaacd_add32_sat(x_4, x_6);
+ n11 = ixheaacd_add32_sat(x_5, x_7);
+ n30 = ixheaacd_sub32_sat(x_4, x_6);
+ n31 = ixheaacd_sub32_sat(x_5, x_7);
y0[h2] = n00;
y0[h2 + 1] = n01;
@@ -1843,14 +1843,14 @@ VOID ixheaacd_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
x_e = *x2++;
x_f = *x2++;
- n02 = x_8 + x_a;
- n03 = x_9 + x_b;
- n22 = x_8 - x_a;
- n23 = x_9 - x_b;
- n12 = x_c + x_e;
- n13 = x_d + x_f;
- n32 = x_c - x_e;
- n33 = x_d - x_f;
+ n02 = ixheaacd_add32_sat(x_8, x_a);
+ n03 = ixheaacd_add32_sat(x_9, x_b);
+ n22 = ixheaacd_sub32_sat(x_8, x_a);
+ n23 = ixheaacd_sub32_sat(x_9, x_b);
+ n12 = ixheaacd_add32_sat(x_c, x_e);
+ n13 = ixheaacd_add32_sat(x_d, x_f);
+ n32 = ixheaacd_sub32_sat(x_c, x_e);
+ n33 = ixheaacd_sub32_sat(x_d, x_f);
y0[h2 + 2] = n02;
y0[h2 + 3] = n03;
diff --git a/decoder/ixheaacd_aac_imdct.c b/decoder/ixheaacd_aac_imdct.c
index 68d5bf3..88b23eb 100644
--- a/decoder/ixheaacd_aac_imdct.c
+++ b/decoder/ixheaacd_aac_imdct.c
@@ -2246,55 +2246,59 @@ VOID ixheaacd_fft_15_ld_dec(WORD32 *inp, WORD32 *op, WORD32 *fft3out,
*buf1++ = inp[384];
*buf1++ = inp[385];
- r1 = buf1a[2] + buf1a[8];
- r4 = buf1a[2] - buf1a[8];
- r3 = buf1a[4] + buf1a[6];
- r2 = buf1a[4] - buf1a[6];
+ r1 = ixheaacd_add32_sat(buf1a[2], buf1a[8]);
+ r4 = ixheaacd_sub32_sat(buf1a[2], buf1a[8]);
+ r3 = ixheaacd_add32_sat(buf1a[4], buf1a[6]);
+ r2 = ixheaacd_sub32_sat(buf1a[4], buf1a[6]);
- t = ixheaacd_mult32_shl((r1 - r3), cos_54);
+ t = ixheaacd_mult32_shl(ixheaacd_sub32_sat(r1, r3), cos_54);
- r1 = r1 + r3;
+ r1 = ixheaacd_add32_sat(r1, r3);
- temp1 = buf1a[0] + r1;
+ temp1 = ixheaacd_add32_sat(buf1a[0], r1);
- r1 = temp1 + ((ixheaacd_mult32_shl(r1, cos_55)) << 1);
+ r1 = ixheaacd_add32_sat(
+ temp1, ixheaacd_shl32_sat((ixheaacd_mult32_shl(r1, cos_55)), 1));
- r3 = r1 - t;
- r1 = r1 + t;
+ r3 = ixheaacd_sub32_sat(r1, t);
+ r1 = ixheaacd_add32_sat(r1, t);
- t = ixheaacd_mult32_shl((r4 + r2), cos_51);
- r4 = t + (ixheaacd_mult32_shl(r4, cos_52) << 1);
- r2 = t + ixheaacd_mult32_shl(r2, cos_53);
+ t = ixheaacd_mult32_shl(ixheaacd_add32_sat(r4, r2), cos_51);
+ r4 = ixheaacd_add32_sat(
+ t, ixheaacd_shl32_sat(ixheaacd_mult32_shl(r4, cos_52), 1));
+ r2 = ixheaacd_add32_sat(t, ixheaacd_mult32_shl(r2, cos_53));
- s1 = buf1a[3] + buf1a[9];
- s4 = buf1a[3] - buf1a[9];
- s3 = buf1a[5] + buf1a[7];
- s2 = buf1a[5] - buf1a[7];
+ s1 = ixheaacd_add32_sat(buf1a[3], buf1a[9]);
+ s4 = ixheaacd_sub32_sat(buf1a[3], buf1a[9]);
+ s3 = ixheaacd_add32_sat(buf1a[5], buf1a[7]);
+ s2 = ixheaacd_sub32_sat(buf1a[5], buf1a[7]);
- t = ixheaacd_mult32_shl((s1 - s3), cos_54);
- s1 = s1 + s3;
+ t = ixheaacd_mult32_shl(ixheaacd_sub32_sat(s1, s3), cos_54);
+ s1 = ixheaacd_add32_sat(s1, s3);
- temp2 = buf1a[1] + s1;
+ temp2 = ixheaacd_add32_sat(buf1a[1], s1);
- s1 = temp2 + ((ixheaacd_mult32_shl(s1, cos_55)) << 1);
+ s1 = ixheaacd_add32_sat(
+ temp2, ixheaacd_shl32_sat((ixheaacd_mult32_shl(s1, cos_55)), 1));
- s3 = s1 - t;
- s1 = s1 + t;
+ s3 = ixheaacd_sub32_sat(s1, t);
+ s1 = ixheaacd_add32_sat(s1, t);
- t = ixheaacd_mult32_shl((s4 + s2), cos_51);
- s4 = t + ((ixheaacd_mult32_shl(s4, cos_52)) << 1);
- s2 = t + (ixheaacd_mult32_shl(s2, cos_53));
+ t = ixheaacd_mult32_shl(ixheaacd_add32_sat(s4, s2), cos_51);
+ s4 = ixheaacd_add32_sat(
+ t, ixheaacd_shl32_sat((ixheaacd_mult32_shl(s4, cos_52)), 1));
+ s2 = ixheaacd_add32_sat(t, (ixheaacd_mult32_shl(s2, cos_53)));
*buf2++ = temp1;
*buf2++ = temp2;
- *buf2++ = r1 + s2;
- *buf2++ = s1 - r2;
- *buf2++ = r3 - s4;
- *buf2++ = s3 + r4;
- *buf2++ = r3 + s4;
- *buf2++ = s3 - r4;
- *buf2++ = r1 - s2;
- *buf2++ = s1 + r2;
+ *buf2++ = ixheaacd_add32_sat(r1, s2);
+ *buf2++ = ixheaacd_sub32_sat(s1, r2);
+ *buf2++ = ixheaacd_sub32_sat(r3, s4);
+ *buf2++ = ixheaacd_add32_sat(s3, r4);
+ *buf2++ = ixheaacd_add32_sat(r3, s4);
+ *buf2++ = ixheaacd_sub32_sat(s3, r4);
+ *buf2++ = ixheaacd_sub32_sat(r1, s2);
+ *buf2++ = ixheaacd_add32_sat(s1, r2);
buf1a = buf1;
*buf1++ = inp[160];
@@ -2312,56 +2316,60 @@ VOID ixheaacd_fft_15_ld_dec(WORD32 *inp, WORD32 *op, WORD32 *fft3out,
*buf1++ = inp[64];
*buf1++ = inp[65];
- r1 = buf1a[2] + buf1a[8];
- r4 = buf1a[2] - buf1a[8];
- r3 = buf1a[4] + buf1a[6];
- r2 = buf1a[4] - buf1a[6];
+ r1 = ixheaacd_add32_sat(buf1a[2], buf1a[8]);
+ r4 = ixheaacd_sub32_sat(buf1a[2], buf1a[8]);
+ r3 = ixheaacd_add32_sat(buf1a[4], buf1a[6]);
+ r2 = ixheaacd_sub32_sat(buf1a[4], buf1a[6]);
- t = ixheaacd_mult32_shl((r1 - r3), cos_54);
+ t = ixheaacd_mult32_shl(ixheaacd_sub32_sat(r1, r3), cos_54);
- r1 = r1 + r3;
+ r1 = ixheaacd_add32_sat(r1, r3);
- temp1 = buf1a[0] + r1;
+ temp1 = ixheaacd_add32_sat(buf1a[0], r1);
- r1 = temp1 + ((ixheaacd_mult32_shl(r1, cos_55)) << 1);
+ r1 = ixheaacd_add32_sat(
+ temp1, ixheaacd_shl32_sat((ixheaacd_mult32_shl(r1, cos_55)), 1));
- r3 = r1 - t;
- r1 = r1 + t;
+ r3 = ixheaacd_sub32_sat(r1, t);
+ r1 = ixheaacd_add32_sat(r1, t);
- t = ixheaacd_mult32_shl((r4 + r2), cos_51);
- r4 = t + (ixheaacd_mult32_shl(r4, cos_52) << 1);
- r2 = t + ixheaacd_mult32_shl(r2, cos_53);
+ t = ixheaacd_mult32_shl(ixheaacd_add32_sat(r4, r2), cos_51);
+ r4 = ixheaacd_add32_sat(
+ t, ixheaacd_shl32_sat(ixheaacd_mult32_shl(r4, cos_52), 1));
+ r2 = ixheaacd_add32_sat(t, ixheaacd_mult32_shl(r2, cos_53));
- s1 = buf1a[3] + buf1a[9];
- s4 = buf1a[3] - buf1a[9];
- s3 = buf1a[5] + buf1a[7];
- s2 = buf1a[5] - buf1a[7];
+ s1 = ixheaacd_add32_sat(buf1a[3], buf1a[9]);
+ s4 = ixheaacd_sub32_sat(buf1a[3], buf1a[9]);
+ s3 = ixheaacd_add32_sat(buf1a[5], buf1a[7]);
+ s2 = ixheaacd_sub32_sat(buf1a[5], buf1a[7]);
- t = ixheaacd_mult32_shl((s1 - s3), cos_54);
+ t = ixheaacd_mult32_shl(ixheaacd_sub32_sat(s1, s3), cos_54);
- s1 = s1 + s3;
+ s1 = ixheaacd_add32_sat(s1, s3);
- temp2 = buf1a[1] + s1;
+ temp2 = ixheaacd_add32_sat(buf1a[1], s1);
- s1 = temp2 + ((ixheaacd_mult32_shl(s1, cos_55)) << 1);
+ s1 = ixheaacd_add32_sat(
+ temp2, ixheaacd_shl32_sat((ixheaacd_mult32_shl(s1, cos_55)), 1));
- s3 = s1 - t;
- s1 = s1 + t;
+ s3 = ixheaacd_sub32_sat(s1, t);
+ s1 = ixheaacd_add32_sat(s1, t);
- t = ixheaacd_mult32_shl((s4 + s2), cos_51);
- s4 = t + ((ixheaacd_mult32_shl(s4, cos_52)) << 1);
- s2 = t + (ixheaacd_mult32_shl(s2, cos_53));
+ t = ixheaacd_mult32_shl(ixheaacd_add32_sat(s4, s2), cos_51);
+ s4 = ixheaacd_add32_sat(
+ t, ixheaacd_shl32_sat((ixheaacd_mult32_shl(s4, cos_52)), 1));
+ s2 = ixheaacd_add32_sat(t, (ixheaacd_mult32_shl(s2, cos_53)));
*buf2++ = temp1;
*buf2++ = temp2;
- *buf2++ = r1 + s2;
- *buf2++ = s1 - r2;
- *buf2++ = r3 - s4;
- *buf2++ = s3 + r4;
- *buf2++ = r3 + s4;
- *buf2++ = s3 - r4;
- *buf2++ = r1 - s2;
- *buf2++ = s1 + r2;
+ *buf2++ = ixheaacd_add32_sat(r1, s2);
+ *buf2++ = ixheaacd_sub32_sat(s1, r2);
+ *buf2++ = ixheaacd_sub32_sat(r3, s4);
+ *buf2++ = ixheaacd_add32_sat(s3, r4);
+ *buf2++ = ixheaacd_add32_sat(r3, s4);
+ *buf2++ = ixheaacd_sub32_sat(s3, r4);
+ *buf2++ = ixheaacd_sub32_sat(r1, s2);
+ *buf2++ = ixheaacd_add32_sat(s1, r2);
buf1a = buf1;
;
@@ -2380,56 +2388,60 @@ VOID ixheaacd_fft_15_ld_dec(WORD32 *inp, WORD32 *op, WORD32 *fft3out,
*buf1++ = inp[224];
*buf1++ = inp[225];
- r1 = buf1a[2] + buf1a[8];
- r4 = buf1a[2] - buf1a[8];
- r3 = buf1a[4] + buf1a[6];
- r2 = buf1a[4] - buf1a[6];
+ r1 = ixheaacd_add32_sat(buf1a[2], buf1a[8]);
+ r4 = ixheaacd_sub32_sat(buf1a[2], buf1a[8]);
+ r3 = ixheaacd_add32_sat(buf1a[4], buf1a[6]);
+ r2 = ixheaacd_sub32_sat(buf1a[4], buf1a[6]);
- t = ixheaacd_mult32_shl((r1 - r3), cos_54);
+ t = ixheaacd_mult32_shl(ixheaacd_sub32_sat(r1, r3), cos_54);
- r1 = r1 + r3;
+ r1 = ixheaacd_add32_sat(r1, r3);
- temp1 = buf1a[0] + r1;
+ temp1 = ixheaacd_add32_sat(buf1a[0], r1);
- r1 = temp1 + ((ixheaacd_mult32_shl(r1, cos_55)) << 1);
+ r1 = ixheaacd_add32_sat(
+ temp1, ixheaacd_shl32_sat((ixheaacd_mult32_shl(r1, cos_55)), 1));
- r3 = r1 - t;
- r1 = r1 + t;
+ r3 = ixheaacd_sub32_sat(r1, t);
+ r1 = ixheaacd_add32_sat(r1, t);
- t = ixheaacd_mult32_shl((r4 + r2), cos_51);
- r4 = t + (ixheaacd_mult32_shl(r4, cos_52) << 1);
- r2 = t + ixheaacd_mult32_shl(r2, cos_53);
+ t = ixheaacd_mult32_shl(ixheaacd_add32_sat(r4, r2), cos_51);
+ r4 = ixheaacd_add32_sat(
+ t, ixheaacd_shl32_sat(ixheaacd_mult32_shl(r4, cos_52), 1));
+ r2 = ixheaacd_add32_sat(t, ixheaacd_mult32_shl(r2, cos_53));
- s1 = buf1a[3] + buf1a[9];
- s4 = buf1a[3] - buf1a[9];
- s3 = buf1a[5] + buf1a[7];
- s2 = buf1a[5] - buf1a[7];
+ s1 = ixheaacd_add32_sat(buf1a[3], buf1a[9]);
+ s4 = ixheaacd_sub32_sat(buf1a[3], buf1a[9]);
+ s3 = ixheaacd_add32_sat(buf1a[5], buf1a[7]);
+ s2 = ixheaacd_sub32_sat(buf1a[5], buf1a[7]);
- t = ixheaacd_mult32_shl((s1 - s3), cos_54);
+ t = ixheaacd_mult32_shl(ixheaacd_sub32_sat(s1, s3), cos_54);
- s1 = s1 + s3;
+ s1 = ixheaacd_add32_sat(s1, s3);
- temp2 = buf1a[1] + s1;
+ temp2 = ixheaacd_add32_sat(buf1a[1], s1);
- s1 = temp2 + ((ixheaacd_mult32_shl(s1, cos_55)) << 1);
+ s1 = ixheaacd_add32_sat(
+ temp2, ixheaacd_shl32_sat((ixheaacd_mult32_shl(s1, cos_55)), 1));
- s3 = s1 - t;
- s1 = s1 + t;
+ s3 = ixheaacd_sub32_sat(s1, t);
+ s1 = ixheaacd_add32_sat(s1, t);
- t = ixheaacd_mult32_shl((s4 + s2), cos_51);
- s4 = t + ((ixheaacd_mult32_shl(s4, cos_52)) << 1);
- s2 = t + (ixheaacd_mult32_shl(s2, cos_53));
+ t = ixheaacd_mult32_shl(ixheaacd_add32_sat(s4, s2), cos_51);
+ s4 = ixheaacd_add32_sat(
+ t, ixheaacd_shl32_sat((ixheaacd_mult32_shl(s4, cos_52)), 1));
+ s2 = ixheaacd_add32_sat(t, (ixheaacd_mult32_shl(s2, cos_53)));
*buf2++ = temp1;
*buf2++ = temp2;
- *buf2++ = r1 + s2;
- *buf2++ = s1 - r2;
- *buf2++ = r3 - s4;
- *buf2++ = s3 + r4;
- *buf2++ = r3 + s4;
- *buf2++ = s3 - r4;
- *buf2++ = r1 - s2;
- *buf2++ = s1 + r2;
+ *buf2++ = ixheaacd_add32_sat(r1, s2);
+ *buf2++ = ixheaacd_sub32_sat(s1, r2);
+ *buf2++ = ixheaacd_sub32_sat(r3, s4);
+ *buf2++ = ixheaacd_add32_sat(s3, r4);
+ *buf2++ = ixheaacd_add32_sat(r3, s4);
+ *buf2++ = ixheaacd_sub32_sat(s3, r4);
+ *buf2++ = ixheaacd_sub32_sat(r1, s2);
+ *buf2++ = ixheaacd_add32_sat(s1, r2);
buf1a = buf1;
;
}
@@ -2445,14 +2457,14 @@ VOID ixheaacd_fft_15_ld_dec(WORD32 *inp, WORD32 *op, WORD32 *fft3out,
xr_2 = fft3outptr[20];
xi_2 = fft3outptr[21];
- x01_real = ixheaacd_add32(xr_0, xr_1);
- x_01_imag = ixheaacd_add32(xi_0, xi_1);
+ x01_real = ixheaacd_add32_sat(xr_0, xr_1);
+ x_01_imag = ixheaacd_add32_sat(xi_0, xi_1);
- add_r = ixheaacd_add32(xr_1, xr_2);
- add_i = ixheaacd_add32(xi_1, xi_2);
+ add_r = ixheaacd_add32_sat(xr_1, xr_2);
+ add_i = ixheaacd_add32_sat(xi_1, xi_2);
- sub_r = ixheaacd_sub32(xr_1, xr_2);
- sub_i = ixheaacd_sub32(xi_1, xi_2);
+ sub_r = ixheaacd_sub32_sat(xr_1, xr_2);
+ sub_i = ixheaacd_sub32_sat(xi_1, xi_2);
p1 = add_r >> 1;
@@ -2461,21 +2473,21 @@ VOID ixheaacd_fft_15_ld_dec(WORD32 *inp, WORD32 *op, WORD32 *fft3out,
p4 = add_i >> 1;
- temp = ixheaacd_sub32(xr_0, p1);
- temp1 = ixheaacd_add32(xi_0, p3);
- temp2 = ixheaacd_sub32(xi_0, p3);
+ temp = ixheaacd_sub32_sat(xr_0, p1);
+ temp1 = ixheaacd_add32_sat(xi_0, p3);
+ temp2 = ixheaacd_sub32_sat(xi_0, p3);
idx = re_arr_tab_sml_240_ptr[n++] << 1;
- op[idx] = ixheaacd_add32(x01_real, xr_2);
- op[idx + 1] = ixheaacd_add32(x_01_imag, xi_2);
+ op[idx] = ixheaacd_add32_sat(x01_real, xr_2);
+ op[idx + 1] = ixheaacd_add32_sat(x_01_imag, xi_2);
idx = re_arr_tab_sml_240_ptr[n++] << 1;
- op[idx] = ixheaacd_add32(temp, p2);
- op[idx + 1] = ixheaacd_sub32(temp2, p4);
+ op[idx] = ixheaacd_add32_sat(temp, p2);
+ op[idx + 1] = ixheaacd_sub32_sat(temp2, p4);
idx = re_arr_tab_sml_240_ptr[n++] << 1;
- op[idx] = ixheaacd_sub32(temp, p2);
- op[idx + 1] = ixheaacd_sub32(temp1, p4);
+ op[idx] = ixheaacd_sub32_sat(temp, p2);
+ op[idx + 1] = ixheaacd_sub32_sat(temp1, p4);
fft3outptr += 2;
}
} \ No newline at end of file
diff --git a/decoder/ixheaacd_aac_tns.c b/decoder/ixheaacd_aac_tns.c
index 99f8c05..3fbaf9a 100644
--- a/decoder/ixheaacd_aac_tns.c
+++ b/decoder/ixheaacd_aac_tns.c
@@ -52,13 +52,14 @@
#include "ixheaacd_aacdec.h"
-static PLATFORM_INLINE WORD32 ixheaacd_mac32_tns(WORD32 a, WORD32 b, WORD32 c) {
+static PLATFORM_INLINE WORD32 ixheaacd_mac32_tns_sat(WORD32 a, WORD32 b,
+ WORD32 c) {
WORD32 result;
WORD64 temp_result;
temp_result = (WORD64)a * (WORD64)b;
result = (WORD32)(temp_result >> 32);
- result = ixheaacd_add32(c, result);
+ result = ixheaacd_add32_sat(c, result);
return (result);
}
@@ -225,29 +226,29 @@ VOID ixheaacd_tns_ar_filter_fixed_dec(WORD32 *spectrum, WORD32 size, WORD32 inc,
{
WORD32 temp_lo = 0;
for (i = 0; i < order; i++) {
- y = (*spectrum) << scale_spec;
+ y = ixheaacd_shl32_sat((*spectrum), scale_spec);
acc = 0;
for (j = i; j > 0; j--) {
- acc = ixheaacd_mac32_tns(state[j - 1], lpc[j], acc);
+ acc = ixheaacd_mac32_tns_sat(state[j - 1], lpc[j], acc);
state[j] = state[j - 1];
}
- y = ixheaacd_sub32(y, (acc << 1));
- state[0] = ixheaacd_shl32(y, shift_value);
+ y = ixheaacd_sub32_sat(y, ixheaacd_shl32_sat(acc, 1));
+ state[0] = ixheaacd_shl32_sat(y, shift_value);
*spectrum = y >> scale_spec;
spectrum += inc;
}
temp_lo = 0;
for (i = order; i < size; i++) {
- y = (*spectrum) << scale_spec;
+ y = ixheaacd_shl32_sat((*spectrum), scale_spec);
acc = 0;
for (j = order; j > 0; j--) {
- acc = ixheaacd_mac32_tns(state[j - 1], lpc[j], acc);
+ acc = ixheaacd_mac32_tns_sat(state[j - 1], lpc[j], acc);
state[j] = state[j - 1];
}
- y = ixheaacd_sub32(y, (acc << 1));
- state[0] = ixheaacd_shl32(y, shift_value);
+ y = ixheaacd_sub32_sat(y, ixheaacd_shl32_sat(acc, 1));
+ state[0] = ixheaacd_shl32_sat(y, shift_value);
*spectrum = y >> scale_spec;
spectrum += inc;
@@ -274,15 +275,15 @@ VOID ixheaacd_tns_ar_filter_fixed_non_neon_armv7(WORD32 *spectrum, WORD32 size,
{
WORD32 temp_lo = 0;
for (i = 0; i < order; i++) {
- y = (*spectrum) << scale_spec;
+ y = ixheaacd_shl32_sat((*spectrum), scale_spec);
acc = 0;
for (j = i; j > 0; j--) {
- acc = ixheaacd_mac32_tns(state[j - 1], lpc[j], acc);
+ acc = ixheaacd_mac32_tns_sat(state[j - 1], lpc[j], acc);
state[j] = state[j - 1];
}
- y = ixheaacd_sub32(y, (acc << 1));
- state[0] = ixheaacd_shl32(y, shift_value);
+ y = ixheaacd_sub32_sat(y, ixheaacd_shl32_sat(acc, 1));
+ state[0] = ixheaacd_shl32_sat(y, shift_value);
*spectrum = y >> scale_spec;
spectrum += inc;
@@ -291,15 +292,15 @@ VOID ixheaacd_tns_ar_filter_fixed_non_neon_armv7(WORD32 *spectrum, WORD32 size,
for (i = order; i < size; i++) {
WORD64 acc = 0;
WORD32 acc1;
- y = (*spectrum) << scale_spec;
+ y = ixheaacd_shl32_sat((*spectrum), scale_spec);
for (j = order; j > 0; j--) {
acc = mac32x32in64_dual(state[j - 1], lpc[j], acc);
state[j] = state[j - 1];
}
acc1 = (WORD32)(acc >> 32);
- y = ixheaacd_sub32(y, (acc1 << 1));
- state[0] = ixheaacd_shl32(y, shift_value);
+ y = ixheaacd_sub32_sat(y, ixheaacd_shl32_sat(acc1, 1));
+ state[0] = ixheaacd_shl32_sat(y, shift_value);
*spectrum = y >> scale_spec;
spectrum += inc;
@@ -324,15 +325,15 @@ VOID ixheaacd_tns_ar_filter_fixed_armv8(WORD32 *spectrum, WORD32 size,
{
WORD32 temp_lo = 0;
for (i = 0; i < order; i++) {
- y = (*spectrum) << scale_spec;
+ y = ixheaacd_shl32_sat((*spectrum), scale_spec);
acc = 0;
for (j = i; j > 0; j--) {
- acc = ixheaacd_mac32_tns(state[j - 1], lpc[j], acc);
+ acc = ixheaacd_mac32_tns_sat(state[j - 1], lpc[j], acc);
state[j] = state[j - 1];
}
- y = ixheaacd_sub32(y, (acc << 1));
- state[0] = ixheaacd_shl32(y, shift_value);
+ y = ixheaacd_sub32_sat(y, ixheaacd_shl32_sat(acc, 1));
+ state[0] = ixheaacd_shl32_sat(y, shift_value);
*spectrum = y >> scale_spec;
spectrum += inc;
@@ -341,15 +342,15 @@ VOID ixheaacd_tns_ar_filter_fixed_armv8(WORD32 *spectrum, WORD32 size,
for (i = order; i < size; i++) {
WORD64 acc = 0;
WORD32 acc1;
- y = (*spectrum) << scale_spec;
+ y = ixheaacd_shl32_sat((*spectrum), scale_spec);
for (j = order; j > 0; j--) {
acc = ixheaacd_mac32x32in64_dual(state[j - 1], lpc[j], acc);
state[j] = state[j - 1];
}
acc1 = (WORD32)(acc >> 32);
- y = ixheaacd_sub32(y, (acc1 << 1));
- state[0] = ixheaacd_shl32(y, shift_value);
+ y = ixheaacd_sub32(y, ixheaacd_shl32_sat(acc1, 1));
+ state[0] = ixheaacd_shl32_sat(y, shift_value);
*spectrum = y >> scale_spec;
spectrum += inc;
@@ -394,32 +395,32 @@ VOID ixheaacd_tns_ar_filter_dec(WORD32 *spectrum, WORD32 size, WORD32 inc,
}
for (i = 0; i < order; i++) {
- y = (*spectrum) << scale_spec;
+ y = ixheaacd_shl32_sat((*spectrum), scale_spec);
acc = 0;
for (j = i; j > 0; j--) {
- acc = ixheaacd_add32(
+ acc = ixheaacd_add32_sat(
acc, ixheaacd_mult32x16in32(ptr_filter_state[j - 1], lpc[j]));
ptr_filter_state[j] = ptr_filter_state[j - 1];
}
- y = ixheaacd_sub32(y, (acc << 1));
- ptr_filter_state[0] = ixheaacd_shl32(y, shift_value);
+ y = ixheaacd_sub32_sat(y, ixheaacd_shl32_sat(acc, 1));
+ ptr_filter_state[0] = ixheaacd_shl32_sat(y, shift_value);
*spectrum = y >> scale_spec;
spectrum += inc;
}
for (i = order; i < size; i++) {
- y = (*spectrum) << scale_spec;
+ y = ixheaacd_shl32_sat((*spectrum), scale_spec);
acc = 0;
for (j = order; j > 0; j--) {
- acc = ixheaacd_add32(
+ acc = ixheaacd_add32_sat(
acc, ixheaacd_mult32x16in32(ptr_filter_state[j - 1], lpc[j]));
ptr_filter_state[j] = ptr_filter_state[j - 1];
}
- y = ixheaacd_sub32(y, (acc << 1));
- ptr_filter_state[0] = ixheaacd_shl32(y, shift_value);
+ y = ixheaacd_sub32_sat(y, ixheaacd_shl32_sat(acc, 1));
+ ptr_filter_state[0] = ixheaacd_shl32_sat(y, shift_value);
*spectrum = y >> scale_spec;
spectrum += inc;
}
diff --git a/decoder/ixheaacd_aacdecoder.c b/decoder/ixheaacd_aacdecoder.c
index bd25a91..19770ad 100644
--- a/decoder/ixheaacd_aacdecoder.c
+++ b/decoder/ixheaacd_aacdecoder.c
@@ -760,16 +760,6 @@ WORD32 ixheaacd_aacdec_decodeframe(
}
}
- if (p_obj_exhaacplus_dec->aac_config.ui_drc_enable) {
- for (ch = 0; ch < num_ch; ch++) {
- pstr_drc_dec->is_longblock[*ch_idx + ch] =
- (aac_dec_handle->pstr_aac_dec_ch_info[ch]
- ->str_ics_info.window_sequence == EIGHT_SHORT_SEQUENCE)
- ? 0
- : 1;
- }
- }
-
if (object_type == AOT_ER_AAC_LD) {
for (ch = 0; ch < channel; ch++) {
aac_dec_handle->ptr_aac_dec_static_channel_info[ch]->ltp_lag =
diff --git a/decoder/ixheaacd_drc_data_struct.h b/decoder/ixheaacd_drc_data_struct.h
index 9e1980b..faf9775 100644
--- a/decoder/ixheaacd_drc_data_struct.h
+++ b/decoder/ixheaacd_drc_data_struct.h
@@ -76,7 +76,6 @@ typedef struct {
UWORD8 max_audio_channels;
UWORD8 length_history;
UWORD8 num_drc_elements;
- WORD32 is_longblock[MAX_BS_ELEMENT];
WORD32 state;
WORD32 target_ref_level;
WORD32 prog_ref_level;
diff --git a/decoder/ixheaacd_lpc.c b/decoder/ixheaacd_lpc.c
index b70b648..a1c9fb6 100644
--- a/decoder/ixheaacd_lpc.c
+++ b/decoder/ixheaacd_lpc.c
@@ -436,40 +436,22 @@ WORD32 ixheaacd_lpd_dec(ia_usac_data_struct *usac_data,
0, fac_length * sizeof(WORD32));
}
- if (mod[0] == 0 && len_subfrm != LEN_FRAME) {
- for (i = 0; i < 3 * len_subfrm; i++)
- st->fd_synth[ORDER - len_subfrm + i] = (FLOAT32)(
- (FLOAT32)usac_data
- ->overlap_data_ptr[usac_data->present_chan][i - len_subfrm] /
- 16384.0);
- num_samples = min(3 * len_subfrm, MAX_PITCH + synth_delay);
- } else {
- for (i = 0; i < 2 * len_subfrm; i++)
- st->fd_synth[ORDER + i] = (FLOAT32)(
- (FLOAT32)usac_data->overlap_data_ptr[usac_data->present_chan][i] /
- 16384.0);
- num_samples = min(2 * len_subfrm, MAX_PITCH + synth_delay);
- }
+ for (i = 0; i < 2 * len_subfrm; i++)
+ st->fd_synth[ORDER + i] = (FLOAT32)(
+ (FLOAT32)usac_data->overlap_data_ptr[usac_data->present_chan][i] /
+ 16384.0);
+ num_samples = min(2 * len_subfrm, MAX_PITCH + synth_delay);
+
ixheaacd_mem_cpy(st->fd_synth + ORDER, synth - 2 * len_subfrm,
2 * len_subfrm);
- if (mod[0] == 0 && len_subfrm != LEN_FRAME) {
- ixheaacd_preemphsis_tool_float(st->fd_synth + ORDER - len_subfrm,
- PREEMPH_FILT_FAC, 3 * len_subfrm, mem);
- } else {
- ixheaacd_preemphsis_tool_float(st->fd_synth + ORDER, PREEMPH_FILT_FAC,
- 2 * len_subfrm, mem);
- }
- if (mod[0] == 0 && len_subfrm != LEN_FRAME) {
- ixheaacd_memset(tmp - len_subfrm, ORDER);
- ixheaacd_mem_cpy(st->fd_synth + ORDER - len_subfrm,
- tmp - len_subfrm + ORDER, 3 * len_subfrm);
- tmp_start = -len_subfrm;
- } else {
- ixheaacd_memset(tmp, ORDER);
- ixheaacd_mem_cpy(st->fd_synth + ORDER, tmp + ORDER, 2 * len_subfrm);
- tmp_start = 0;
- }
+ ixheaacd_preemphsis_tool_float(st->fd_synth + ORDER, PREEMPH_FILT_FAC,
+ 2 * len_subfrm, mem);
+
+ ixheaacd_memset(tmp, ORDER);
+ ixheaacd_mem_cpy(st->fd_synth + ORDER, tmp + ORDER, 2 * len_subfrm);
+ tmp_start = 0;
+
ixheaacd_memset(ptr_tmp - len_subfrm, 3 * len_subfrm);
memset(st->fd_synth, 0, ORDER * sizeof(WORD32));
length = (2 * len_subfrm - tmp_start) / LEN_SUBFR;
@@ -480,8 +462,6 @@ WORD32 ixheaacd_lpd_dec(ia_usac_data_struct *usac_data,
if (mod[0] != 0 && (len_subfrm == LEN_FRAME || mod[1] != 0)) {
num_samples = min(len_subfrm, MAX_PITCH + INTER_LP_FIL_ORDER + 1);
- } else if (mod[0] == 0 && len_subfrm != LEN_FRAME) {
- num_samples = min(3 * len_subfrm, MAX_PITCH + INTER_LP_FIL_ORDER + 1);
} else {
num_samples = min(2 * len_subfrm, MAX_PITCH + INTER_LP_FIL_ORDER + 1);
}