diff options
author | Fraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de> | 2018-05-24 07:24:02 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-05-24 07:24:02 -0700 |
commit | 634d4f789cc713fd374db7b9dbcaeb1d89bf2d5e (patch) | |
tree | 4f088dbfd47d22d3f90ebcbcf054a26d6e69bdce /libSBRenc/src | |
parent | 57d474b424be58783e7abba469d2f3d800094967 (diff) | |
parent | a4d1f0ad52e2cf6f168d2193216602f52033fc27 (diff) | |
download | fdk-aac-634d4f789cc713fd374db7b9dbcaeb1d89bf2d5e.tar.gz fdk-aac-634d4f789cc713fd374db7b9dbcaeb1d89bf2d5e.tar.bz2 fdk-aac-634d4f789cc713fd374db7b9dbcaeb1d89bf2d5e.zip |
FDKv2 ubsan patches
am: a4d1f0ad52
Change-Id: Ic489768836aae6a9b9cab9e866ecc8b21d819368
Diffstat (limited to 'libSBRenc/src')
-rw-r--r-- | libSBRenc/src/tran_det.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/libSBRenc/src/tran_det.cpp b/libSBRenc/src/tran_det.cpp index b6f1b9f..3b6765a 100644 --- a/libSBRenc/src/tran_det.cpp +++ b/libSBRenc/src/tran_det.cpp @@ -269,23 +269,33 @@ static FIXP_DBL addLowbandEnergies(FIXP_DBL **Energies, int *scaleEnergies, FIXP_DBL accu1 = FL2FXCONST_DBL(0.0f); FIXP_DBL accu2 = FL2FXCONST_DBL(0.0f); int tran_offdiv2 = tran_off >> nrgSzShift; + const int sc1 = + DFRACT_BITS - + fNormz((FIXP_DBL)fMax( + 1, (freqBandTable[0] * (YBufferWriteOffset - tran_offdiv2) - 1))); + const int sc2 = + DFRACT_BITS - + fNormz((FIXP_DBL)fMax( + 1, (freqBandTable[0] * + (tran_offdiv2 + (slots >> nrgSzShift) - YBufferWriteOffset) - + 1))); int ts, k; /* Sum up lowband energy from one frame at offset tran_off */ /* freqBandTable[LORES] has MAX_FREQ_COEFFS/2 +1 coeefs max. */ for (ts = tran_offdiv2; ts < YBufferWriteOffset; ts++) { for (k = 0; k < freqBandTable[0]; k++) { - accu1 += Energies[ts][k] >> 6; + accu1 += Energies[ts][k] >> sc1; } } for (; ts < tran_offdiv2 + (slots >> nrgSzShift); ts++) { for (k = 0; k < freqBandTable[0]; k++) { - accu2 += Energies[ts][k] >> 9; + accu2 += Energies[ts][k] >> sc2; } } - nrgTotal_m = fAddNorm(accu1, 1 - scaleEnergies[0], accu2, - 4 - scaleEnergies[1], &nrgTotal_e); + nrgTotal_m = fAddNorm(accu1, (sc1 - 5) - scaleEnergies[0], accu2, + (sc2 - 5) - scaleEnergies[1], &nrgTotal_e); nrgTotal_m = scaleValueSaturate(nrgTotal_m, nrgTotal_e); return (nrgTotal_m); |