summaryrefslogtreecommitdiffstats
path: root/libFDK/src/fixpoint_math.cpp
diff options
context:
space:
mode:
authorJakub Stachowski <qbast@go2.pl>2012-08-14 21:59:32 +0200
committerMartin Storsjo <martin@martin.st>2012-09-09 22:18:09 +0300
commit923f3e95f3e332d26f03cf6782f0ab61596ceef2 (patch)
tree597ad65496c9239a8c4a0d868bf053ced928fa4c /libFDK/src/fixpoint_math.cpp
parent50b1de17ac25b03827a80754eb3b7ac24478d03c (diff)
downloadfdk-aac-923f3e95f3e332d26f03cf6782f0ab61596ceef2.tar.gz
fdk-aac-923f3e95f3e332d26f03cf6782f0ab61596ceef2.tar.bz2
fdk-aac-923f3e95f3e332d26f03cf6782f0ab61596ceef2.zip
Do schur_div with a direct 64 bit division instead of a loop on x86
This speeds up HE-AACv2 encoding from 3.85 s to 3.42 s on a Core i7.
Diffstat (limited to 'libFDK/src/fixpoint_math.cpp')
-rw-r--r--libFDK/src/fixpoint_math.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/libFDK/src/fixpoint_math.cpp b/libFDK/src/fixpoint_math.cpp
index 000820c..7d5fbb5 100644
--- a/libFDK/src/fixpoint_math.cpp
+++ b/libFDK/src/fixpoint_math.cpp
@@ -443,6 +443,15 @@ FIXP_DBL sqrtFixp(FIXP_DBL op)
*****************************************************************************/
+#if defined(__x86__)
+FIXP_DBL schur_div(FIXP_DBL num, FIXP_DBL denum, INT count)
+{
+ INT64 tmp=(INT64)num<<31;
+ LONG div=(tmp/denum)>>(DFRACT_BITS-count);
+ return (FIXP_DBL)(div) << (DFRACT_BITS-count);
+}
+
+#else
FIXP_DBL schur_div(FIXP_DBL num, FIXP_DBL denum, INT count)
{
@@ -469,6 +478,7 @@ FIXP_DBL schur_div(FIXP_DBL num, FIXP_DBL denum, INT count)
return (FIXP_DBL)(div << (DFRACT_BITS - count));
}
+#endif
#endif /* !defined(FUNCTION_schur_div) */