aboutsummaryrefslogtreecommitdiffstats
path: root/libFDK/include
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-01-17 04:06:03 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-01-17 04:06:03 +0000
commit2dc3e5c1f26f578d4c09590cf3f1e01ec8c68105 (patch)
treed8d44cea21a91be5298acac5dd6439d5cea71b90 /libFDK/include
parent29c3f50d140d9cb10ed40aa39ce5057bfe1f2f32 (diff)
parent1020e48d6e76506ac85a7678fe950ce7245d3aea (diff)
downloadfdk-aac-2dc3e5c1f26f578d4c09590cf3f1e01ec8c68105.tar.gz
fdk-aac-2dc3e5c1f26f578d4c09590cf3f1e01ec8c68105.tar.bz2
fdk-aac-2dc3e5c1f26f578d4c09590cf3f1e01ec8c68105.zip
Snap for 6142138 from 1020e48d6e76506ac85a7678fe950ce7245d3aea to rvc-release
Change-Id: Icb323d1007194553c9b7494024ae7fab252696ee
Diffstat (limited to 'libFDK/include')
-rw-r--r--libFDK/include/fixpoint_math.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/libFDK/include/fixpoint_math.h b/libFDK/include/fixpoint_math.h
index 93aea19..373eec1 100644
--- a/libFDK/include/fixpoint_math.h
+++ b/libFDK/include/fixpoint_math.h
@@ -171,6 +171,19 @@ extern const FIXP_DBL invSqrtTab[SQRT_VALUES];
* \return non-zero if (a_m*2^a_e) < (b_m*2^b_e), 0 otherwise
*/
FDK_INLINE INT fIsLessThan(FIXP_DBL a_m, INT a_e, FIXP_DBL b_m, INT b_e) {
+ INT n;
+
+ n = fixnorm_D(a_m);
+ a_m <<= n;
+ a_e -= n;
+
+ n = fixnorm_D(b_m);
+ b_m <<= n;
+ b_e -= n;
+
+ if (a_m == (FIXP_DBL)0) a_e = b_e;
+ if (b_m == (FIXP_DBL)0) b_e = a_e;
+
if (a_e > b_e) {
return ((b_m >> fMin(a_e - b_e, DFRACT_BITS - 1)) > a_m);
} else {
@@ -179,6 +192,19 @@ FDK_INLINE INT fIsLessThan(FIXP_DBL a_m, INT a_e, FIXP_DBL b_m, INT b_e) {
}
FDK_INLINE INT fIsLessThan(FIXP_SGL a_m, INT a_e, FIXP_SGL b_m, INT b_e) {
+ INT n;
+
+ n = fixnorm_S(a_m);
+ a_m <<= n;
+ a_e -= n;
+
+ n = fixnorm_S(b_m);
+ b_m <<= n;
+ b_e -= n;
+
+ if (a_m == (FIXP_SGL)0) a_e = b_e;
+ if (b_m == (FIXP_SGL)0) b_e = a_e;
+
if (a_e > b_e) {
return ((b_m >> fMin(a_e - b_e, FRACT_BITS - 1)) > a_m);
} else {