diff --git a/dnn/lpcnet.c b/dnn/lpcnet.c
index 82e27e1c..7eee5349 100644
--- a/dnn/lpcnet.c
+++ b/dnn/lpcnet.c
@@ -166,12 +166,12 @@ int run_sample_network(LPCNetState *lpcnet, const float *gru_a_condition, const
return sample_mdense(&lpcnet->model.dual_fc, net->gru_b_state, sampling_logit_table, rng);
}
-LPCNET_EXPORT int lpcnet_get_size()
+int lpcnet_get_size()
{
return sizeof(LPCNetState);
}
-LPCNET_EXPORT void lpcnet_reset(LPCNetState *lpcnet)
+void lpcnet_reset(LPCNetState *lpcnet)
{
const char* rng_string="LPCNet";
RNN_CLEAR((char*)&lpcnet->LPCNET_RESET_START,
@@ -181,7 +181,7 @@ LPCNET_EXPORT void lpcnet_reset(LPCNetState *lpcnet)
kiss99_srand(&lpcnet->rng, (const unsigned char *)rng_string, strlen(rng_string));
}
-LPCNET_EXPORT int lpcnet_init(LPCNetState *lpcnet)
+int lpcnet_init(LPCNetState *lpcnet)
{
int i;
int ret;
@@ -199,7 +199,7 @@ LPCNET_EXPORT int lpcnet_init(LPCNetState *lpcnet)
return ret;
}
-LPCNET_EXPORT int lpcnet_load_model(LPCNetState *st, const unsigned char *data, int len) {
+int lpcnet_load_model(LPCNetState *st, const unsigned char *data, int len) {
WeightArray *list;
int ret;
parse_weights(&list, data, len);
@@ -210,7 +210,7 @@ LPCNET_EXPORT int lpcnet_load_model(LPCNetState *st, const unsigned char *data,
}
-LPCNET_EXPORT LPCNetState *lpcnet_create()
+LPCNetState *lpcnet_create()
{
LPCNetState *lpcnet;
lpcnet = (LPCNetState *)calloc(lpcnet_get_size(), 1);
@@ -218,7 +218,7 @@ LPCNET_EXPORT LPCNetState *lpcnet_create()
return lpcnet;
}
-LPCNET_EXPORT void lpcnet_destroy(LPCNetState *lpcnet)
+void lpcnet_destroy(LPCNetState *lpcnet)
{
free(lpcnet);
}
@@ -276,6 +276,6 @@ void lpcnet_synthesize_impl(LPCNetState *lpcnet, const float *features, short *o
lpcnet_synthesize_tail_impl(lpcnet, output, N, preload);
}
-LPCNET_EXPORT void lpcnet_synthesize(LPCNetState *lpcnet, const float *features, short *output, int N) {
+void lpcnet_synthesize(LPCNetState *lpcnet, const float *features, short *output, int N) {
lpcnet_synthesize_impl(lpcnet, features, output, N, 0);
}
diff --git a/dnn/lpcnet.h b/dnn/lpcnet.h
index fc9978f5..3c1870b3 100644
--- a/dnn/lpcnet.h
+++ b/dnn/lpcnet.h
@@ -27,19 +27,6 @@
#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 20
@@ -64,7 +51,7 @@ typedef struct LPCNetPLCState LPCNetPLCState;
/** Gets the size of an LPCNetDecState
structure.
* @returns The size in bytes.
*/
-LPCNET_EXPORT int lpcnet_decoder_get_size(void);
+int lpcnet_decoder_get_size(void);
/** Initializes a previously allocated decoder state
* The memory pointed to by st must be at least the size returned by lpcnet_decoder_get_size().
@@ -73,19 +60,19 @@ LPCNET_EXPORT int lpcnet_decoder_get_size(void);
* @param [in] st LPCNetDecState*: Decoder state
* @retval 0 Success
*/
-LPCNET_EXPORT int lpcnet_decoder_init(LPCNetDecState *st);
+int lpcnet_decoder_init(LPCNetDecState *st);
-LPCNET_EXPORT void lpcnet_reset(LPCNetState *lpcnet);
+void lpcnet_reset(LPCNetState *lpcnet);
/** Allocates and initializes a decoder state.
* @returns The newly created state
*/
-LPCNET_EXPORT LPCNetDecState *lpcnet_decoder_create(void);
+LPCNetDecState *lpcnet_decoder_create(void);
/** Frees an LPCNetDecState
allocated by lpcnet_decoder_create().
* @param[in] st LPCNetDecState*: State to be freed.
*/
-LPCNET_EXPORT void lpcnet_decoder_destroy(LPCNetDecState *st);
+void lpcnet_decoder_destroy(LPCNetDecState *st);
/** Decodes a packet of LPCNET_COMPRESSED_SIZE bytes (currently 8) into LPCNET_PACKET_SAMPLES samples (currently 640).
* @param [in] st LPCNetDecState*: Decoder state
@@ -93,14 +80,14 @@ LPCNET_EXPORT void lpcnet_decoder_destroy(LPCNetDecState *st);
* @param [out] pcm short *: Decoded audio
* @retval 0 Success
*/
-LPCNET_EXPORT int lpcnet_decode(LPCNetDecState *st, const unsigned char *buf, short *pcm);
+int lpcnet_decode(LPCNetDecState *st, const unsigned char *buf, short *pcm);
/** Gets the size of an LPCNetEncState
structure.
* @returns The size in bytes.
*/
-LPCNET_EXPORT int lpcnet_encoder_get_size(void);
+int lpcnet_encoder_get_size(void);
/** Initializes a previously allocated encoder state
* The memory pointed to by st must be at least the size returned by lpcnet_encoder_get_size().
@@ -109,17 +96,17 @@ LPCNET_EXPORT int lpcnet_encoder_get_size(void);
* @param [in] st LPCNetEncState*: Encoder state
* @retval 0 Success
*/
-LPCNET_EXPORT int lpcnet_encoder_init(LPCNetEncState *st);
+int lpcnet_encoder_init(LPCNetEncState *st);
/** Allocates and initializes an encoder state.
* @returns The newly created state
*/
-LPCNET_EXPORT LPCNetEncState *lpcnet_encoder_create(void);
+LPCNetEncState *lpcnet_encoder_create(void);
/** Frees an LPCNetEncState
allocated by lpcnet_encoder_create().
* @param[in] st LPCNetEncState*: State to be freed.
*/
-LPCNET_EXPORT void lpcnet_encoder_destroy(LPCNetEncState *st);
+void lpcnet_encoder_destroy(LPCNetEncState *st);
/** Encodes LPCNET_PACKET_SAMPLES speech samples (currently 640) into a packet of LPCNET_COMPRESSED_SIZE bytes (currently 8).
* @param [in] st LPCNetDecState*: Encoder state
@@ -127,7 +114,7 @@ LPCNET_EXPORT void lpcnet_encoder_destroy(LPCNetEncState *st);
* @param [out] buf const unsigned char *: Compressed packet
* @retval 0 Success
*/
-LPCNET_EXPORT int lpcnet_encode(LPCNetEncState *st, const short *pcm, unsigned char *buf);
+int lpcnet_encode(LPCNetEncState *st, const short *pcm, unsigned char *buf);
/** Compute features on LPCNET_PACKET_SAMPLES speech samples (currently 640) and output features for 4 10-ms frames at once.
* @param [in] st LPCNetDecState*: Encoder state
@@ -135,7 +122,7 @@ LPCNET_EXPORT int lpcnet_encode(LPCNetEncState *st, const short *pcm, unsigned c
* @param [out] features float[4][NB_TOTAL_FEATURES]: Four feature vectors
* @retval 0 Success
*/
-LPCNET_EXPORT int lpcnet_compute_features(LPCNetEncState *st, const short *pcm, float features[4][NB_TOTAL_FEATURES]);
+int lpcnet_compute_features(LPCNetEncState *st, const short *pcm, float features[4][NB_TOTAL_FEATURES]);
/** Compute features on LPCNET_FRAME_SIZE speech samples (currently 160) and output features for one 10-ms frame.
* @param [in] st LPCNetDecState*: Encoder state
@@ -143,7 +130,7 @@ LPCNET_EXPORT int lpcnet_compute_features(LPCNetEncState *st, const short *pcm,
* @param [out] features float[NB_TOTAL_FEATURES]: Four feature vectors
* @retval 0 Success
*/
-LPCNET_EXPORT int lpcnet_compute_single_frame_features(LPCNetEncState *st, const short *pcm, float features[NB_TOTAL_FEATURES]);
+int lpcnet_compute_single_frame_features(LPCNetEncState *st, const short *pcm, float features[NB_TOTAL_FEATURES]);
/** Compute features on LPCNET_FRAME_SIZE speech samples (currently 160) and output features for one 10-ms frame.
@@ -152,12 +139,12 @@ LPCNET_EXPORT int lpcnet_compute_single_frame_features(LPCNetEncState *st, const
* @param [out] features float[NB_TOTAL_FEATURES]: Four feature vectors
* @retval 0 Success
*/
-LPCNET_EXPORT int lpcnet_compute_single_frame_features_float(LPCNetEncState *st, const float *pcm, float features[NB_TOTAL_FEATURES]);
+int lpcnet_compute_single_frame_features_float(LPCNetEncState *st, const float *pcm, float features[NB_TOTAL_FEATURES]);
/** Gets the size of an LPCNetState
structure.
* @returns The size in bytes.
*/
-LPCNET_EXPORT int lpcnet_get_size(void);
+int lpcnet_get_size(void);
/** Initializes a previously allocated synthesis state
* The memory pointed to by st must be at least the size returned by lpcnet_get_size().
@@ -166,17 +153,17 @@ LPCNET_EXPORT int lpcnet_get_size(void);
* @param [in] st LPCNetState*: Synthesis state
* @retval 0 Success
*/
-LPCNET_EXPORT int lpcnet_init(LPCNetState *st);
+int lpcnet_init(LPCNetState *st);
/** Allocates and initializes a synthesis state.
* @returns The newly created state
*/
-LPCNET_EXPORT LPCNetState *lpcnet_create(void);
+LPCNetState *lpcnet_create(void);
/** Frees an LPCNetState
allocated by lpcnet_create().
* @param[in] st LPCNetState*: State to be freed.
*/
-LPCNET_EXPORT void lpcnet_destroy(LPCNetState *st);
+void lpcnet_destroy(LPCNetState *st);
/** Synthesizes speech from an LPCNet feature vector.
* @param [in] st LPCNetState*: Synthesis state
@@ -185,31 +172,31 @@ LPCNET_EXPORT void lpcnet_destroy(LPCNetState *st);
* @param [in] N int: Number of samples to generate
* @retval 0 Success
*/
-LPCNET_EXPORT void lpcnet_synthesize(LPCNetState *st, const float *features, short *output, int N);
+void lpcnet_synthesize(LPCNetState *st, const float *features, short *output, int N);
#define LPCNET_PLC_CAUSAL 0
#define LPCNET_PLC_CODEC 2
-LPCNET_EXPORT int lpcnet_plc_get_size(void);
+int lpcnet_plc_get_size(void);
-LPCNET_EXPORT int lpcnet_plc_init(LPCNetPLCState *st, int options);
-LPCNET_EXPORT void lpcnet_plc_reset(LPCNetPLCState *st);
+int lpcnet_plc_init(LPCNetPLCState *st, int options);
+void lpcnet_plc_reset(LPCNetPLCState *st);
-LPCNET_EXPORT LPCNetPLCState *lpcnet_plc_create(int options);
+LPCNetPLCState *lpcnet_plc_create(int options);
-LPCNET_EXPORT void lpcnet_plc_destroy(LPCNetPLCState *st);
+void lpcnet_plc_destroy(LPCNetPLCState *st);
-LPCNET_EXPORT int lpcnet_plc_update(LPCNetPLCState *st, short *pcm);
+int lpcnet_plc_update(LPCNetPLCState *st, short *pcm);
-LPCNET_EXPORT int lpcnet_plc_conceal(LPCNetPLCState *st, short *pcm);
+int lpcnet_plc_conceal(LPCNetPLCState *st, short *pcm);
-LPCNET_EXPORT void lpcnet_plc_fec_add(LPCNetPLCState *st, const float *features);
+void lpcnet_plc_fec_add(LPCNetPLCState *st, const float *features);
-LPCNET_EXPORT void lpcnet_plc_fec_clear(LPCNetPLCState *st);
+void lpcnet_plc_fec_clear(LPCNetPLCState *st);
-LPCNET_EXPORT int lpcnet_load_model(LPCNetState *st, const unsigned char *data, int len);
-LPCNET_EXPORT int lpcnet_plc_load_model(LPCNetPLCState *st, const unsigned char *data, int len);
+int lpcnet_load_model(LPCNetState *st, const unsigned char *data, int len);
+int lpcnet_plc_load_model(LPCNetPLCState *st, const unsigned char *data, int len);
#endif
diff --git a/dnn/lpcnet_enc.c b/dnn/lpcnet_enc.c
index 90fa652f..acfaf6e0 100644
--- a/dnn/lpcnet_enc.c
+++ b/dnn/lpcnet_enc.c
@@ -45,24 +45,24 @@
#include "lpcnet.h"
-LPCNET_EXPORT int lpcnet_encoder_get_size() {
+int lpcnet_encoder_get_size() {
return sizeof(LPCNetEncState);
}
-LPCNET_EXPORT int lpcnet_encoder_init(LPCNetEncState *st) {
+int lpcnet_encoder_init(LPCNetEncState *st) {
memset(st, 0, sizeof(*st));
st->exc_mem = lin2ulaw(0.f);
return 0;
}
-LPCNET_EXPORT LPCNetEncState *lpcnet_encoder_create() {
+LPCNetEncState *lpcnet_encoder_create() {
LPCNetEncState *st;
st = malloc(lpcnet_encoder_get_size());
lpcnet_encoder_init(st);
return st;
}
-LPCNET_EXPORT void lpcnet_encoder_destroy(LPCNetEncState *st) {
+void lpcnet_encoder_destroy(LPCNetEncState *st) {
free(st);
}
diff --git a/dnn/lpcnet_plc.c b/dnn/lpcnet_plc.c
index 99605987..61d96b33 100644
--- a/dnn/lpcnet_plc.c
+++ b/dnn/lpcnet_plc.c
@@ -39,11 +39,11 @@
/* Comment this out to have LPCNet update its state on every good packet (slow). */
#define PLC_SKIP_UPDATES
-LPCNET_EXPORT int lpcnet_plc_get_size() {
+int lpcnet_plc_get_size() {
return sizeof(LPCNetPLCState);
}
-LPCNET_EXPORT void lpcnet_plc_reset(LPCNetPLCState *st) {
+void lpcnet_plc_reset(LPCNetPLCState *st) {
RNN_CLEAR((char*)&st->LPCNET_PLC_RESET_START,
sizeof(LPCNetPLCState)-
((char*)&st->LPCNET_PLC_RESET_START - (char*)st));
@@ -56,7 +56,7 @@ LPCNET_EXPORT void lpcnet_plc_reset(LPCNetPLCState *st) {
st->loss_count = 0;
}
-LPCNET_EXPORT int lpcnet_plc_init(LPCNetPLCState *st, int options) {
+int lpcnet_plc_init(LPCNetPLCState *st, int options) {
int ret;
lpcnet_init(&st->lpcnet);
lpcnet_encoder_init(&st->enc);
@@ -77,7 +77,7 @@ LPCNET_EXPORT int lpcnet_plc_init(LPCNetPLCState *st, int options) {
return ret;
}
-LPCNET_EXPORT int lpcnet_plc_load_model(LPCNetPLCState *st, const unsigned char *data, int len) {
+int lpcnet_plc_load_model(LPCNetPLCState *st, const unsigned char *data, int len) {
WeightArray *list;
int ret;
parse_weights(&list, data, len);
@@ -89,14 +89,14 @@ LPCNET_EXPORT int lpcnet_plc_load_model(LPCNetPLCState *st, const unsigned char
else return -1;
}
-LPCNET_EXPORT LPCNetPLCState *lpcnet_plc_create(int options) {
+LPCNetPLCState *lpcnet_plc_create(int options) {
LPCNetPLCState *st;
st = calloc(sizeof(*st), 1);
lpcnet_plc_init(st, options);
return st;
}
-LPCNET_EXPORT void lpcnet_plc_destroy(LPCNetPLCState *st) {
+void lpcnet_plc_destroy(LPCNetPLCState *st) {
free(st);
}