aboutsummaryrefslogtreecommitdiffstats
path: root/libSBRdec
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2019-03-08 16:09:45 +0100
committerJean-Michel Trivi <jmtrivi@google.com>2019-05-14 09:53:45 -0700
commit69a5c189ad088715d1fac7140c57248d747d6a2a (patch)
tree8528dcb05a51c14173957c4c193642652f591218 /libSBRdec
parente51063ca54212efa9a2074ec02626999ced2fb74 (diff)
downloadfdk-aac-69a5c189ad088715d1fac7140c57248d747d6a2a.tar.gz
fdk-aac-69a5c189ad088715d1fac7140c57248d747d6a2a.tar.bz2
fdk-aac-69a5c189ad088715d1fac7140c57248d747d6a2a.zip
Improve accuracy of division in calcSubbandGain().
Bug: 132641988 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: I3beeda23355ae1200d9f55c9e8cd1cc6bc899153
Diffstat (limited to 'libSBRdec')
-rw-r--r--libSBRdec/src/env_calc.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/libSBRdec/src/env_calc.cpp b/libSBRdec/src/env_calc.cpp
index cb1474f..11b7eca 100644
--- a/libSBRdec/src/env_calc.cpp
+++ b/libSBRdec/src/env_calc.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
@@ -2325,7 +2325,15 @@ static void calcSubbandGain(
}
/* gain = nrgRef / B */
- FDK_divide_MantExp(nrgRef, nrgRef_e, b, b_e, ptrNrgGain, ptrNrgGain_e);
+ INT result_exp = 0;
+ *ptrNrgGain = fDivNorm(nrgRef, b, &result_exp);
+ *ptrNrgGain_e = (SCHAR)result_exp + (nrgRef_e - b_e);
+
+ /* There could be a one bit diffs. This is important to compensate,
+ because later in the code values are compared by exponent only. */
+ int headroom = CountLeadingBits(*ptrNrgGain);
+ *ptrNrgGain <<= headroom;
+ *ptrNrgGain_e -= headroom;
}
}