ref: 7122abde5914922c1b8ce3cdd76f854e02af5bb1
parent: 85750ce8689ade059bc754469ace2e72451fe63d
author: xnorpx <xnorpx@outlook.com>
date: Mon May 22 14:48:36 EDT 2023
Rename celt_exp to lpcnet_exp Depending on what defines are set there is collisions with the ones in Opus. To avoid these errors we rename the exp functions and macros. Signed-off-by: Jean-Marc Valin <jmvalin@amazon.com>
--- a/dnn/test_vec.c
+++ b/dnn/test_vec.c
@@ -10,7 +10,7 @@
// we need to call two versions of each functions that have the same
// name, so use #defines to temp rename them
-#define celt_exp2 celt_exp2_fast
+#define lpcnet_exp2 lpcnet_exp2_fast
#define tansig_approx tansig_approx_fast
#define sigmoid_approx sigmoid_approx_fast
#define softmax softmax_fast
@@ -34,7 +34,7 @@
#endif
-#undef celt_exp2
+#undef lpcnet_exp2
#undef tansig_approx
#undef sigmoid_approx
#undef softmax
--- a/dnn/vec.h
+++ b/dnn/vec.h
@@ -59,7 +59,7 @@
/* No AVX2/FMA support */
#ifndef LPCNET_TEST
-static inline float celt_exp2(float x)
+static inline float lpcnet_exp2(float x)
{int integer;
float frac;
@@ -77,7 +77,7 @@
res.i = (res.i + (integer<<23)) & 0x7fffffff;
return res.f;
}
-#define celt_exp(x) celt_exp2((x)*1.44269504f)
+#define lpcnet_exp(x) lpcnet_exp2((x)*1.44269504f)
static inline float tanh_approx(float x)
{@@ -107,7 +107,7 @@
{int i;
for (i=0;i<N;i++)
- y[i] = celt_exp(x[i]);
+ y[i] = lpcnet_exp(x[i]);
}
static inline void vec_tanh(float *y, const float *x, int N)
--- a/dnn/vec_avx.h
+++ b/dnn/vec_avx.h
@@ -524,7 +524,7 @@
#endif
-static inline float celt_exp(float x)
+static inline float lpcnet_exp(float x)
{float out[8];
__m256 X, Y;
@@ -545,7 +545,7 @@
_mm256_storeu_ps(&y[i], Y);
}
for (;i<N;i++)
- y[i] = celt_exp(x[i]);
+ y[i] = lpcnet_exp(x[i]);
}
#ifdef __AVX__
--- a/dnn/vec_neon.h
+++ b/dnn/vec_neon.h
@@ -110,7 +110,7 @@
return vmaxq_f32(min_out, vminq_f32(max_out, num));
}
-static inline float celt_exp(float x)
+static inline float lpcnet_exp(float x)
{float out[4];
float32x4_t X, Y;
@@ -151,7 +151,7 @@
vst1q_f32(&y[i], Y);
}
for (;i<N;i++)
- y[i] = celt_exp(x[i]);
+ y[i] = lpcnet_exp(x[i]);
}
static inline void vec_tanh(float *y, const float *x, int N)
@@ -167,7 +167,7 @@
for (;i<N;i++)
{float ex2;
- ex2 = celt_exp(2*x[i]);
+ ex2 = lpcnet_exp(2*x[i]);
y[i] = (ex2-1)/(ex2+1);
}
}
@@ -185,7 +185,7 @@
for (;i<N;i++)
{float ex;
- ex = celt_exp(x[i]);
+ ex = lpcnet_exp(x[i]);
y[i] = (ex)/(ex+1);
}
}
--
⑨