From 8c7c03e568ae6430018959f3f91d1f5745950069 Mon Sep 17 00:00:00 2001
From: Jean-Marc Valin <jmvalin@amazon.com>
Date: Wed, 18 Oct 2023 01:44:50 -0400
Subject: [PATCH] Don't call the libm tanh()

---
 silk/dred_coding.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/silk/dred_coding.c b/silk/dred_coding.c
index af735faf7..01792e0ae 100644
--- a/silk/dred_coding.c
+++ b/silk/dred_coding.c
@@ -37,6 +37,7 @@
 #include "os_support.h"
 #include "dred_config.h"
 #include "dred_coding.h"
+#include "vec.h"
 
 #define LATENT_DIM 80
 #define STATE_DIM 80
@@ -59,7 +60,7 @@ void dred_encode_latents(ec_enc *enc, const float *x, const opus_uint16 *scale,
         int q;
         delta = dzone[i]*(1.f/1024.f);
         xq = x[i]*scale[i]*(1.f/256.f);
-        xq = xq - delta*tanh(xq/(delta+eps));
+        xq = xq - delta*tanh_approx(xq/(delta+eps));
         q = (int)floor(.5f+xq);
         /* Make the impossible actually impossible. */
         if (r[i] == 0 || p0[i] >= 32767) q = 0;
-- 
GitLab