Upgrade rnnoise to 1cbdbcf1283499bbb2230a6b0f126eb9b236defd am: 1713531765
Original change: https://android-review.googlesource.com/c/platform/external/rnnoise/+/1582213
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: If46797c3dcf3bf630ebb65aefc44edf296c4b5ac
diff --git a/METADATA b/METADATA
index 15f6208..b1cf519 100644
--- a/METADATA
+++ b/METADATA
@@ -9,11 +9,11 @@
type: GIT
value: "https://github.com/xiph/rnnoise.git"
}
- version: "125d8a56e0049728c86c9a575dab348fc9523e96"
+ version: "1cbdbcf1283499bbb2230a6b0f126eb9b236defd"
license_type: NOTICE
last_upgrade_date {
year: 2021
- month: 1
- day: 18
+ month: 2
+ day: 9
}
}
diff --git a/README b/README
index da30b69..4158a9b 100644
--- a/README
+++ b/README
@@ -12,7 +12,7 @@
provided as an example. It operates on RAW 16-bit (machine endian) mono
PCM files sampled at 48 kHz. It can be used as:
-./examples/rnnoise_demo <number of channels> <maximum attenuation> < input.raw > output.raw
+./examples/rnnoise_demo <noisy speech> <output denoised>
The output is also a 16-bit raw PCM file.
diff --git a/include/rnnoise.h b/include/rnnoise.h
index 511a976..c4215d9 100644
--- a/include/rnnoise.h
+++ b/include/rnnoise.h
@@ -51,18 +51,60 @@
typedef struct DenoiseState DenoiseState;
typedef struct RNNModel RNNModel;
+/**
+ * Return the size of DenoiseState
+ */
RNNOISE_EXPORT int rnnoise_get_size();
+/**
+ * Return the number of samples processed by rnnoise_process_frame at a time
+ */
+RNNOISE_EXPORT int rnnoise_get_frame_size();
+
+/**
+ * Initializes a pre-allocated DenoiseState
+ *
+ * If model is NULL the default model is used.
+ *
+ * See: rnnoise_create() and rnnoise_model_from_file()
+ */
RNNOISE_EXPORT int rnnoise_init(DenoiseState *st, RNNModel *model);
+/**
+ * Allocate and initialize a DenoiseState
+ *
+ * If model is NULL the default model is used.
+ *
+ * The returned pointer MUST be freed with rnnoise_destroy().
+ */
RNNOISE_EXPORT DenoiseState *rnnoise_create(RNNModel *model);
+/**
+ * Free a DenoiseState produced by rnnoise_create.
+ *
+ * The optional custom model must be freed by rnnoise_model_free() after.
+ */
RNNOISE_EXPORT void rnnoise_destroy(DenoiseState *st);
+/**
+ * Denoise a frame of samples
+ *
+ * in and out must be at least rnnoise_get_frame_size() large.
+ */
RNNOISE_EXPORT float rnnoise_process_frame(DenoiseState *st, float *out, const float *in);
+/**
+ * Load a model from a file
+ *
+ * It must be deallocated with rnnoise_model_free()
+ */
RNNOISE_EXPORT RNNModel *rnnoise_model_from_file(FILE *f);
+/**
+ * Free a custom model
+ *
+ * It must be called after all the DenoiseStates referring to it are freed.
+ */
RNNOISE_EXPORT void rnnoise_model_free(RNNModel *model);
#ifdef __cplusplus
diff --git a/src/denoise.c b/src/denoise.c
index d1c21dc..5a62844 100644
--- a/src/denoise.c
+++ b/src/denoise.c
@@ -257,6 +257,10 @@
return sizeof(DenoiseState);
}
+int rnnoise_get_frame_size() {
+ return FRAME_SIZE;
+}
+
int rnnoise_init(DenoiseState *st, RNNModel *model) {
memset(st, 0, sizeof(*st));
if (model)
diff --git a/src/rnn.h b/src/rnn.h
index 10329f5..31b962f 100644
--- a/src/rnn.h
+++ b/src/rnn.h
@@ -66,4 +66,4 @@
void compute_rnn(RNNState *rnn, float *gains, float *vad, const float *input);
-#endif /* _MLP_H_ */
+#endif /* RNN_H_ */