[FFmpeg-cvslog] avfilter/af_arnndn: skip array extra entries by looking for new line

Paul B Mahol git at videolan.org
Wed Feb 10 15:16:06 EET 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Feb 10 14:08:23 2021 +0100| [129978af6b6503109517777eba8890713a787cb5] | committer: Paul B Mahol

avfilter/af_arnndn: skip array extra entries by looking for new line

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=129978af6b6503109517777eba8890713a787cb5
---

 libavfilter/af_arnndn.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/libavfilter/af_arnndn.c b/libavfilter/af_arnndn.c
index 81a7f9318a..049865b589 100644
--- a/libavfilter/af_arnndn.c
+++ b/libavfilter/af_arnndn.c
@@ -187,7 +187,7 @@ static void rnnoise_model_free(RNNModel *model)
 
 static int rnnoise_model_from_file(FILE *f, RNNModel **rnn)
 {
-    RNNModel *ret;
+    RNNModel *ret = NULL;
     DenseLayer *input_dense;
     GRULayer *vad_gru;
     GRULayer *noise_gru;
@@ -277,13 +277,24 @@ static int rnnoise_model_from_file(FILE *f, RNNModel **rnn)
     } \
     } while (0)
 
+#define NEW_LINE() do { \
+    int c; \
+    while ((c = fgetc(f)) != EOF) { \
+        if (c == '\n') \
+        break; \
+    } \
+    } while (0)
+
 #define INPUT_DENSE(name) do { \
     INPUT_VAL(name->nb_inputs); \
     INPUT_VAL(name->nb_neurons); \
     ret->name ## _size = name->nb_neurons; \
     INPUT_ACTIVATION(name->activation); \
+    NEW_LINE(); \
     INPUT_ARRAY(name->input_weights, name->nb_inputs * name->nb_neurons); \
+    NEW_LINE(); \
     INPUT_ARRAY(name->bias, name->nb_neurons); \
+    NEW_LINE(); \
     } while (0)
 
 #define INPUT_GRU(name) do { \
@@ -291,9 +302,13 @@ static int rnnoise_model_from_file(FILE *f, RNNModel **rnn)
     INPUT_VAL(name->nb_neurons); \
     ret->name ## _size = name->nb_neurons; \
     INPUT_ACTIVATION(name->activation); \
+    NEW_LINE(); \
     INPUT_ARRAY3(name->input_weights, name->nb_inputs, name->nb_neurons, 3); \
+    NEW_LINE(); \
     INPUT_ARRAY3(name->recurrent_weights, name->nb_neurons, name->nb_neurons, 3); \
+    NEW_LINE(); \
     INPUT_ARRAY(name->bias, name->nb_neurons * 3); \
+    NEW_LINE(); \
     } while (0)
 
     INPUT_DENSE(input_dense);



More information about the ffmpeg-cvslog mailing list