diff options
author | Martin Storsjo <martin@martin.st> | 2016-08-25 22:12:15 +0300 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2016-08-25 22:12:15 +0300 |
commit | f9d0f65e6578592149c01d8417197896283a821f (patch) | |
tree | b6293c11023d196ed31b9c6ef765d645d872db49 /libFDK/include | |
parent | 15b128dd826ba86ee962d86b0b06966a25ed9158 (diff) | |
parent | 00fc1c66d5a524c6961db04d05e1076b18003231 (diff) | |
download | fdk-aac-f9d0f65e6578592149c01d8417197896283a821f.tar.gz fdk-aac-f9d0f65e6578592149c01d8417197896283a821f.tar.bz2 fdk-aac-f9d0f65e6578592149c01d8417197896283a821f.zip |
Merge remote-tracking branch 'aosp/master'
Diffstat (limited to 'libFDK/include')
-rw-r--r-- | libFDK/include/fixpoint_math.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/libFDK/include/fixpoint_math.h b/libFDK/include/fixpoint_math.h index fcc6b5a..0d50f0a 100644 --- a/libFDK/include/fixpoint_math.h +++ b/libFDK/include/fixpoint_math.h @@ -2,7 +2,7 @@ /* ----------------------------------------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2014 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. +© Copyright 1995 - 2015 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -94,6 +94,35 @@ amm-info@iis.fraunhofer.de #include "common_fix.h" +#if !defined(FUNCTION_fIsLessThan) +/** + * \brief Compares two fixpoint values incl. scaling. + * \param a_m mantissa of the first input value. + * \param a_e exponent of the first input value. + * \param b_m mantissa of the second input value. + * \param b_e exponent of the second input value. + * \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) +{ + if (a_e > b_e) { + return (b_m >> fMin(a_e-b_e, DFRACT_BITS-1) > a_m); + } else { + return (a_m >> fMin(b_e-a_e, DFRACT_BITS-1) < b_m); + } +} + +FDK_INLINE INT fIsLessThan(FIXP_SGL a_m, INT a_e, FIXP_SGL b_m, INT b_e) +{ + if (a_e > b_e) { + return (b_m >> fMin(a_e-b_e, FRACT_BITS-1) > a_m); + } else { + return (a_m >> fMin(b_e-a_e, FRACT_BITS-1) < b_m); + } +} +#endif + + #define LD_DATA_SCALING (64.0f) #define LD_DATA_SHIFT 6 /* pow(2, LD_DATA_SHIFT) = LD_DATA_SCALING */ |