diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2012-09-14 15:49:18 -0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2012-09-14 15:49:18 -0400 |
commit | 027ff070f0bf322eb6f940001e7c78f10a8ee0f4 (patch) | |
tree | d7c7dede665f018290e38b888b3c616428612ee6 /src/mlp.c | |
parent | 97a48473acee2d3c2ec2f5a619dad6078874af23 (diff) | |
download | libopus-027ff070f0bf322eb6f940001e7c78f10a8ee0f4.tar.gz |
Shrinks tansig table, makes data static const
Diffstat (limited to 'src/mlp.c')
-rw-r--r-- | src/mlp.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -64,16 +64,22 @@ static inline double tansig_approx(double x) { int i; double y, dy; - if (x>=10) - return 1; - if (x<=-10) - return -1; + double sign=1; + if (x>=8) + return 1; + if (x<=-8) + return -1; + if (x<0) + { + x=-x; + sign=-1; + } i = lrint(25*x); x -= .04*i; - y = tansig_table[250+i]; + y = tansig_table[i]; dy = 1-y*y; y = y + x*dy*(1 - y*x); - return y; + return sign*y; } #endif |