Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@amazon.com>2023-10-15 00:21:30 +0300
committerJean-Marc Valin <jmvalin@amazon.com>2023-10-15 00:21:30 +0300
commit0b7c02caf4548e3bd90c39c13913146358e4de8b (patch)
treed8ca760afbdeb657125051b2d1bb68e0e84ca75b
parentc0f94366230d14e88b6aa8cf5ec05c1d5a0f49ce (diff)
Remove LPCNet from the build
-rw-r--r--dnn/lpcnet_demo.c23
-rw-r--r--dnn/nnet.c53
-rw-r--r--lpcnet_headers.mk2
-rw-r--r--lpcnet_sources.mk3
4 files changed, 2 insertions, 79 deletions
diff --git a/dnn/lpcnet_demo.c b/dnn/lpcnet_demo.c
index 3dac10c4..67df63bc 100644
--- a/dnn/lpcnet_demo.c
+++ b/dnn/lpcnet_demo.c
@@ -82,7 +82,7 @@ void free_blob(unsigned char *blob, int len) {
#endif
#define MODE_FEATURES 2
-#define MODE_SYNTHESIS 3
+/*#define MODE_SYNTHESIS 3*/
#define MODE_PLC 4
#define MODE_ADDLPC 5
#define MODE_FWGAN_SYNTHESIS 6
@@ -90,7 +90,7 @@ void free_blob(unsigned char *blob, int len) {
void usage(void) {
fprintf(stderr, "usage: lpcnet_demo -features <input.pcm> <features.f32>\n");
- fprintf(stderr, " lpcnet_demo -synthesis <features.f32> <output.pcm>\n");
+ fprintf(stderr, " lpcnet_demo -fargan_synthesis <features.f32> <output.pcm>\n");
fprintf(stderr, " lpcnet_demo -plc <plc_options> <percent> <input.pcm> <output.pcm>\n");
fprintf(stderr, " lpcnet_demo -plc_file <plc_options> <percent> <input.pcm> <output.pcm>\n");
fprintf(stderr, " lpcnet_demo -addlpc <features_without_lpc.f32> <features_with_lpc.lpc>\n\n");
@@ -114,7 +114,6 @@ int main(int argc, char **argv) {
#endif
if (argc < 4) usage();
if (strcmp(argv[1], "-features") == 0) mode=MODE_FEATURES;
- else if (strcmp(argv[1], "-synthesis") == 0) mode=MODE_SYNTHESIS;
else if (strcmp(argv[1], "-fargan-synthesis") == 0) mode=MODE_FARGAN_SYNTHESIS;
else if (strcmp(argv[1], "-plc") == 0) {
mode=MODE_PLC;
@@ -170,24 +169,6 @@ int main(int argc, char **argv) {
fwrite(features, sizeof(float), NB_TOTAL_FEATURES, fout);
}
lpcnet_encoder_destroy(net);
- } else if (mode == MODE_SYNTHESIS) {
- LPCNetState *net;
- net = lpcnet_create();
-#ifdef USE_WEIGHTS_FILE
- lpcnet_load_model(net, data, len);
-#endif
- while (1) {
- float in_features[NB_TOTAL_FEATURES];
- float features[NB_FEATURES];
- opus_int16 pcm[LPCNET_FRAME_SIZE];
- size_t ret;
- ret = fread(in_features, sizeof(features[0]), NB_TOTAL_FEATURES, fin);
- if (feof(fin) || ret != NB_TOTAL_FEATURES) break;
- OPUS_COPY(features, in_features, NB_FEATURES);
- lpcnet_synthesize(net, features, pcm, LPCNET_FRAME_SIZE);
- fwrite(pcm, sizeof(pcm[0]), LPCNET_FRAME_SIZE, fout);
- }
- lpcnet_destroy(net);
} else if (mode == MODE_FARGAN_SYNTHESIS) {
FARGANState fargan;
size_t ret, i;
diff --git a/dnn/nnet.c b/dnn/nnet.c
index d17ff9ba..65c99101 100644
--- a/dnn/nnet.c
+++ b/dnn/nnet.c
@@ -218,59 +218,6 @@ void _lpcnet_compute_dense(const DenseLayer *layer, float *output, const float *
compute_activation(output, output, layer->nb_neurons, layer->activation);
}
-int sample_mdense(const MDenseLayer *layer, const float *input, const float *sampling_logit_table, kiss99_ctx *rng)
-{
- int b, j, N, M, C, stride;
- int val=0;
- float thresholds[8];
- M = layer->nb_inputs;
- N = layer->nb_neurons;
- C = layer->nb_channels;
- celt_assert(N*C <= MAX_MDENSE_TMP);
- stride = M*C;
-
- celt_assert(N <= DUAL_FC_OUT_SIZE);
-
- /* Computing all the random thresholds in advance. These thresholds are directly
- based on the logit to avoid computing the sigmoid.*/
- for (b=0;b<8;b+=4) {
- uint32_t r = kiss99_rand(rng);
- thresholds[b] = sampling_logit_table[r&0xFF];
- thresholds[b+1] = sampling_logit_table[(r>>8)&0xFF];
- thresholds[b+2] = sampling_logit_table[(r>>16)&0xFF];
- thresholds[b+3] = sampling_logit_table[(r>>24)&0xFF];
- }
-
- for (b=0;b<8;b++)
- {
- int bit;
- int i;
- float sum1, sum2;
-
- i = (1<<b) | val;
-
- sum1 = layer->bias[i];
- sum2 = layer->bias[i + N];
- for (j=0;j<M;j++) {
- sum1 += layer->input_weights[i*stride + j]*input[j];
- sum2 += layer->input_weights[i*stride + j + M]*input[j];
- }
- sum1 = layer->factor[i]*tanh_approx(sum1);
- sum2 = layer->factor[N + i]*tanh_approx(sum2);
- sum1 += sum2;
- /*sum1 = 1.f/(1 + exp(-sum1));*/
-#if 1 /* Sample the decision based on the logit. */
- bit = thresholds[b] < sum1;
-#else
- sum1 = sigmoid_approx(sum1);
- bit = .025+.95*((rand()+.5f)/(RAND_MAX+1.f)) < sum1;
-#endif
- val = (val << 1) | bit;
- }
- return val;
-
-}
-
#ifdef USE_SU_BIAS
#define bias_type subias
#else
diff --git a/lpcnet_headers.mk b/lpcnet_headers.mk
index b699a33d..f09adf16 100644
--- a/lpcnet_headers.mk
+++ b/lpcnet_headers.mk
@@ -10,9 +10,7 @@ dnn/common.h \
dnn/freq.h \
dnn/fargan.h \
dnn/fargan_data.h \
-dnn/kiss99.h \
dnn/lpcnet_private.h \
-dnn/nnet_data.h \
dnn/nnet.h \
dnn/plc_data.h \
dnn/tansig_table.h \
diff --git a/lpcnet_sources.mk b/lpcnet_sources.mk
index 6950be8c..416b946c 100644
--- a/lpcnet_sources.mk
+++ b/lpcnet_sources.mk
@@ -3,13 +3,10 @@ dnn/burg.c \
dnn/freq.c \
dnn/fargan.c \
dnn/fargan_data.c \
-dnn/kiss99.c \
-dnn/lpcnet.c \
dnn/lpcnet_enc.c \
dnn/lpcnet_plc.c \
dnn/lpcnet_tables.c \
dnn/nnet.c \
-dnn/nnet_data.c \
dnn/plc_data.c \
dnn/parse_lpcnet_weights.c \
dnn/dred_rdovae.c \