diff --git a/dnn/configure.ac b/dnn/configure.ac index ec9808b2a9efad3c26de2df7bc5dd935c538831d..262f2103b107cefd9d439e1af1d6bef8540db238 100644 --- a/dnn/configure.ac +++ b/dnn/configure.ac @@ -38,9 +38,9 @@ dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0 dnl - interfaces added -> increment AGE dnl - interfaces removed -> AGE = 0 -OP_LT_CURRENT=4 -OP_LT_REVISION=1 -OP_LT_AGE=4 +OP_LT_CURRENT=0 +OP_LT_REVISION=0 +OP_LT_AGE=0 AC_SUBST(OP_LT_CURRENT) AC_SUBST(OP_LT_REVISION) diff --git a/dnn/include/lpcnet.h b/dnn/include/lpcnet.h index afeae5bbe6448b1547c2980895e8c8aacc4761cb..df78fb9ebafbcb890d18c4b5f0c6eea773a7e2d7 100644 --- a/dnn/include/lpcnet.h +++ b/dnn/include/lpcnet.h @@ -27,6 +27,21 @@ #ifndef _LPCNET_H_ #define _LPCNET_H_ +#ifndef LPCNET_EXPORT +# if defined(WIN32) +# if defined(LPCNET_BUILD) && defined(DLL_EXPORT) +# define LPCNET_EXPORT __declspec(dllexport) +# else +# define LPCNET_EXPORT +# endif +# elif defined(__GNUC__) && defined(LPCNET_BUILD) +# define LPCNET_EXPORT __attribute__ ((visibility ("default"))) +# else +# define LPCNET_EXPORT +# endif +#endif + + #define NB_FEATURES 38 #define NB_TOTAL_FEATURES 55 diff --git a/dnn/lpcnet.c b/dnn/lpcnet.c index 349285252f6f355f5f2a80e3e3e7156667ffa397..fa5d2f5981108a3bf1f25928b1bb6aca7728fbdb 100644 --- a/dnn/lpcnet.c +++ b/dnn/lpcnet.c @@ -24,6 +24,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <math.h> #include <stdio.h> #include "nnet_data.h" @@ -89,12 +93,12 @@ void run_sample_network(NNetState *net, float *pdf, const float *condition, cons compute_mdense(&dual_fc, pdf, net->gru_b_state); } -int lpcnet_get_size() +LPCNET_EXPORT int lpcnet_get_size() { return sizeof(LPCNetState); } -int lpcnet_init(LPCNetState *lpcnet) +LPCNET_EXPORT int lpcnet_init(LPCNetState *lpcnet) { memset(lpcnet, 0, lpcnet_get_size()); lpcnet->last_exc = 128; @@ -102,7 +106,7 @@ int lpcnet_init(LPCNetState *lpcnet) } -LPCNetState *lpcnet_create() +LPCNET_EXPORT LPCNetState *lpcnet_create() { LPCNetState *lpcnet; lpcnet = (LPCNetState *)calloc(lpcnet_get_size(), 1); @@ -110,12 +114,12 @@ LPCNetState *lpcnet_create() return lpcnet; } -void lpcnet_destroy(LPCNetState *lpcnet) +LPCNET_EXPORT void lpcnet_destroy(LPCNetState *lpcnet) { free(lpcnet); } -void lpcnet_synthesize(LPCNetState *lpcnet, short *output, const float *features, int N) +LPCNET_EXPORT void lpcnet_synthesize(LPCNetState *lpcnet, short *output, const float *features, int N) { int i; float condition[FEATURE_DENSE2_OUT_SIZE]; @@ -167,19 +171,19 @@ void lpcnet_synthesize(LPCNetState *lpcnet, short *output, const float *features } -int lpcnet_decoder_get_size() +LPCNET_EXPORT int lpcnet_decoder_get_size() { return sizeof(LPCNetDecState); } -int lpcnet_decoder_init(LPCNetDecState *st) +LPCNET_EXPORT int lpcnet_decoder_init(LPCNetDecState *st) { memset(st, 0, lpcnet_decoder_get_size()); lpcnet_init(&st->lpcnet_state); return 0; } -LPCNetDecState *lpcnet_decoder_create() +LPCNET_EXPORT LPCNetDecState *lpcnet_decoder_create() { LPCNetDecState *st; st = malloc(lpcnet_decoder_get_size()); @@ -187,12 +191,12 @@ LPCNetDecState *lpcnet_decoder_create() return st; } -void lpcnet_decoder_destroy(LPCNetDecState *st) +LPCNET_EXPORT void lpcnet_decoder_destroy(LPCNetDecState *st) { free(st); } -int lpcnet_decode(LPCNetDecState *st, const unsigned char *buf, short *pcm) +LPCNET_EXPORT int lpcnet_decode(LPCNetDecState *st, const unsigned char *buf, short *pcm) { int k; float features[4][NB_TOTAL_FEATURES]; diff --git a/dnn/lpcnet_demo.c b/dnn/lpcnet_demo.c index 43dd5d558a344193fb1ca4d298ed311a3e5be9f8..18f0654239c2d144e96a5e155bba49d9983ce0bb 100644 --- a/dnn/lpcnet_demo.c +++ b/dnn/lpcnet_demo.c @@ -24,6 +24,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <math.h> #include <stdio.h> #include "arch.h" diff --git a/dnn/lpcnet_enc.c b/dnn/lpcnet_enc.c index 17852e897cba28a68ec75e3f9e4de42bed5d8847..123da9230991ea20d0373f61239972a57edf62d1 100644 --- a/dnn/lpcnet_enc.c +++ b/dnn/lpcnet_enc.c @@ -375,7 +375,7 @@ void interp_diff(float *x, float *left, float *right, float *codebook, int bits, } } -int double_interp_search(const float features[4][NB_TOTAL_FEATURES], const float *mem) { +int double_interp_search(float features[4][NB_TOTAL_FEATURES], const float *mem) { int i, j; int best_id=0; float min_dist = 1e15; @@ -462,23 +462,23 @@ void bits_pack(packer *bits, unsigned int data, int nb_bits) { } -int lpcnet_encoder_get_size() { +LPCNET_EXPORT int lpcnet_encoder_get_size() { return sizeof(LPCNetEncState); } -int lpcnet_encoder_init(LPCNetEncState *st) { +LPCNET_EXPORT int lpcnet_encoder_init(LPCNetEncState *st) { memset(st, 0, sizeof(*st)); return 0; } -LPCNetEncState *lpcnet_encoder_create() { +LPCNET_EXPORT LPCNetEncState *lpcnet_encoder_create() { LPCNetEncState *st; st = malloc(lpcnet_encoder_get_size()); lpcnet_encoder_init(st); return st; } -void lpcnet_encoder_destroy(LPCNetEncState *st) { +LPCNET_EXPORT void lpcnet_encoder_destroy(LPCNetEncState *st) { free(st); } @@ -721,7 +721,7 @@ void preemphasis(float *y, float *mem, const float *x, float coef, int N) { } } -int lpcnet_encode(LPCNetEncState *st, const short *pcm, unsigned char *buf) { +LPCNET_EXPORT int lpcnet_encode(LPCNetEncState *st, const short *pcm, unsigned char *buf) { int i, k; for (k=0;k<4;k++) { float x[FRAME_SIZE];