aboutsummaryrefslogtreecommitdiffstats
path: root/libAACdec/src
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-10-22 03:10:23 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-10-22 03:10:23 +0000
commitb3ccda1719a116f649dae3316b0eb6d33c6ef8f7 (patch)
treefa7778872b05e66a9aeddce2a0fc1d7deab8c770 /libAACdec/src
parent56b78e9be81bd98878772b46510c771a5036b70d (diff)
parentfc8faa38d90380adfb61b2b280a36c73369c9aff (diff)
downloadfdk-aac-b3ccda1719a116f649dae3316b0eb6d33c6ef8f7.tar.gz
fdk-aac-b3ccda1719a116f649dae3316b0eb6d33c6ef8f7.tar.bz2
fdk-aac-b3ccda1719a116f649dae3316b0eb6d33c6ef8f7.zip
Snap for 5956624 from fc8faa38d90380adfb61b2b280a36c73369c9aff to rvc-release
Change-Id: I90c7f7de4ed5bb04e355e181028c850f6e95d8ad
Diffstat (limited to 'libAACdec/src')
-rw-r--r--libAACdec/src/usacdec_fac.cpp36
-rw-r--r--libAACdec/src/usacdec_lpd.cpp26
2 files changed, 33 insertions, 29 deletions
diff --git a/libAACdec/src/usacdec_fac.cpp b/libAACdec/src/usacdec_fac.cpp
index 0d3d844..b246171 100644
--- a/libAACdec/src/usacdec_fac.cpp
+++ b/libAACdec/src/usacdec_fac.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -344,7 +344,7 @@ INT CLpd_FAC_Mdct2Acelp(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *pFac,
/* Overlap Add */
x0 = -fMult(*pOvl--, pWindow[i].v.re);
- *pOut0 += IMDCT_SCALE_DBL(x0);
+ *pOut0 = fAddSaturate(*pOut0, IMDCT_SCALE_DBL(x0));
pOut0++;
}
} else {
@@ -354,7 +354,7 @@ INT CLpd_FAC_Mdct2Acelp(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *pFac,
/* Overlap Add */
x0 = fMult(*pOvl--, pWindow[i].v.re);
- *pOut0 += IMDCT_SCALE_DBL(x0);
+ *pOut0 = fAddSaturate(*pOut0, IMDCT_SCALE_DBL(x0));
pOut0++;
}
}
@@ -362,7 +362,7 @@ INT CLpd_FAC_Mdct2Acelp(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *pFac,
0) { /* this should only happen for ACELP -> TCX20 -> ACELP transition */
FIXP_DBL *pOut = pOut0 - fl / 2; /* fl/2 == fac_length */
for (i = 0; i < fl / 2; i++) {
- pOut[i] += IMDCT_SCALE_DBL(hMdct->pFacZir[i]);
+ pOut[i] = fAddSaturate(pOut[i], IMDCT_SCALE_DBL(hMdct->pFacZir[i]));
}
hMdct->pFacZir = NULL;
}
@@ -493,9 +493,7 @@ INT CLpd_FAC_Acelp2Mdct(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *_pSpec,
/* Div2 is compensated by table scaling */
x = fMultDiv2(pTmp2[i], FacWindowZir[w]);
x += fMultDiv2(pTmp1[-i - 1], FacWindowSynth[w]);
- x += pFAC_and_FAC_ZIR[i];
- pOut1[i] = x;
-
+ pOut1[i] = fAddSaturate(x, pFAC_and_FAC_ZIR[i]);
w++;
}
}
@@ -552,7 +550,7 @@ INT CLpd_FAC_Acelp2Mdct(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *_pSpec,
FDK_ASSERT((pOut1 >= hMdct->overlap.time &&
pOut1 < hMdct->overlap.time + hMdct->ov_size) ||
(pOut1 >= output && pOut1 < output + 1024));
- *pOut1 += IMDCT_SCALE_DBL(-x1);
+ *pOut1 = fAddSaturate(*pOut1, IMDCT_SCALE_DBL(-x1));
pOut1--;
}
@@ -578,7 +576,7 @@ INT CLpd_FAC_Acelp2Mdct(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *_pSpec,
FIXP_DBL x = -(*pCurr--);
/* 5) (item 4) Synthesis filter Zir component, FAC ZIR (another one). */
if (i < f_len) {
- x += *pF++;
+ x = fAddSaturate(x, *pF++);
}
FDK_ASSERT((pOut1 >= hMdct->overlap.time &&
@@ -668,9 +666,9 @@ INT CLpd_FAC_Acelp2Mdct(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *_pSpec,
for (i = 0; i < fl / 2; i++) {
FIXP_DBL x0, x1;
- cplxMult(&x1, &x0, *pCurr++, -*pOvl--, pWindow_prev[i]);
- *pOut0 = IMDCT_SCALE_DBL(x0);
- *pOut1 = IMDCT_SCALE_DBL(-x1);
+ cplxMultDiv2(&x1, &x0, *pCurr++, -*pOvl--, pWindow_prev[i]);
+ *pOut0 = IMDCT_SCALE_DBL_LSH1(x0);
+ *pOut1 = IMDCT_SCALE_DBL_LSH1(-x1);
pOut0++;
pOut1--;
}
@@ -680,9 +678,9 @@ INT CLpd_FAC_Acelp2Mdct(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *_pSpec,
for (i = 0; i < fl / 2; i++) {
FIXP_DBL x0, x1;
- cplxMult(&x1, &x0, *pCurr++, -*pOvl--, pWindow_prev[i]);
- *pOut0 = IMDCT_SCALE_DBL(x0);
- *pOut1 = IMDCT_SCALE_DBL(x1);
+ cplxMultDiv2(&x1, &x0, *pCurr++, -*pOvl--, pWindow_prev[i]);
+ *pOut0 = IMDCT_SCALE_DBL_LSH1(x0);
+ *pOut1 = IMDCT_SCALE_DBL_LSH1(x1);
pOut0++;
pOut1--;
}
@@ -691,9 +689,9 @@ INT CLpd_FAC_Acelp2Mdct(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *_pSpec,
for (i = 0; i < fl / 2; i++) {
FIXP_DBL x0, x1;
- cplxMult(&x1, &x0, *pCurr++, *pOvl--, pWindow_prev[i]);
- *pOut0 = IMDCT_SCALE_DBL(x0);
- *pOut1 = IMDCT_SCALE_DBL(x1);
+ cplxMultDiv2(&x1, &x0, *pCurr++, *pOvl--, pWindow_prev[i]);
+ *pOut0 = IMDCT_SCALE_DBL_LSH1(x0);
+ *pOut1 = IMDCT_SCALE_DBL_LSH1(x1);
pOut0++;
pOut1--;
}
@@ -705,7 +703,7 @@ INT CLpd_FAC_Acelp2Mdct(H_MDCT hMdct, FIXP_DBL *output, FIXP_DBL *_pSpec,
FIXP_DBL *pOut = pOut0 - fl / 2;
FDK_ASSERT(fl / 2 <= 128);
for (i = 0; i < fl / 2; i++) {
- pOut[i] += IMDCT_SCALE_DBL(hMdct->pFacZir[i]);
+ pOut[i] = fAddSaturate(pOut[i], IMDCT_SCALE_DBL(hMdct->pFacZir[i]));
}
hMdct->pFacZir = NULL;
}
diff --git a/libAACdec/src/usacdec_lpd.cpp b/libAACdec/src/usacdec_lpd.cpp
index e0a2631..de0c2de 100644
--- a/libAACdec/src/usacdec_lpd.cpp
+++ b/libAACdec/src/usacdec_lpd.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -130,9 +130,10 @@ void filtLP(const FIXP_DBL *syn, FIXP_PCM *syn_out, FIXP_DBL *noise,
for (i = 0; i < stop; i++) {
tmp = fMultDiv2(noise[i], filt[0]); // Filt in Q-1.16
for (j = 1; j <= len; j++) {
- tmp += fMultDiv2((noise[i - j] + noise[i + j]), filt[j]);
+ tmp += fMult((noise[i - j] >> 1) + (noise[i + j] >> 1), filt[j]);
}
- syn_out[i] = (FIXP_PCM)(IMDCT_SCALE(syn[i] - tmp));
+ syn_out[i] = (FIXP_PCM)(SATURATE_SHIFT(
+ (syn[i] >> 1) - (tmp >> 1), (MDCT_OUTPUT_SCALE - 1), PCM_OUT_BITS));
}
}
@@ -335,17 +336,22 @@ void bass_pf_1sf_delay(
{
for (i = 0; i < lg; i++) {
- /* scaled with SF_SYNTH + gain_sf + 1 */
+ /* scaled with SF_SYNTH + gain_sf + 1; composition of scalefactor 2:
+ * one additional shift of syn values + fMult => fMultDiv2 */
noise_in[i] =
- (fMult(gainSGL, syn[i + i_subfr] - (syn[i + i_subfr - T] >> 1) -
- (syn[i + i_subfr + T] >> 1))) >>
- s1;
+ scaleValue(fMultDiv2(gainSGL, (syn[i + i_subfr] >> 1) -
+ (syn[i + i_subfr - T] >> 2) -
+ (syn[i + i_subfr + T] >> 2)),
+ 2 - s1);
}
for (i = lg; i < L_SUBFR; i++) {
- /* scaled with SF_SYNTH + gain_sf + 1 */
+ /* scaled with SF_SYNTH + gain_sf + 1; composition of scalefactor 2:
+ * one additional shift of syn values + fMult => fMultDiv2 */
noise_in[i] =
- (fMult(gainSGL, syn[i + i_subfr] - syn[i + i_subfr - T])) >> s1;
+ scaleValue(fMultDiv2(gainSGL, (syn[i + i_subfr] >> 1) -
+ (syn[i + i_subfr - T] >> 1)),
+ 2 - s1);
}
}
} else {
@@ -1222,7 +1228,7 @@ AAC_DECODER_ERROR CLpdChannelStream_Read(
(INT)(samplingRate * PIT_MIN_12k8 + (FSCALE_DENOM / 2)) / FSCALE_DENOM -
(INT)PIT_MIN_12k8;
- if ((samplingRate < 6000) || (samplingRate > 24000)) {
+ if ((samplingRate < FAC_FSCALE_MIN) || (samplingRate > FAC_FSCALE_MAX)) {
error = AAC_DEC_PARSE_ERROR;
goto bail;
}