aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2020-08-27 20:32:52 +0200
committerPaul B Mahol <onemda@gmail.com>2020-08-27 20:39:33 +0200
commitf7deae72154ed18b63146fb6c362267565d1e6cd (patch)
tree66fd8e309f7fdc5c5a875a1e9a09506fd1343417
parentace1cc616308ef8f4aedc7814778b08eca2fd92b (diff)
downloadffmpeg-f7deae72154ed18b63146fb6c362267565d1e6cd.tar.gz
avfilter/af_arnndn: use memcpy for copying in compute_rnn()
-rw-r--r--libavfilter/af_arnndn.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/libavfilter/af_arnndn.c b/libavfilter/af_arnndn.c
index 123bc45157..a6e1215ac9 100644
--- a/libavfilter/af_arnndn.c
+++ b/libavfilter/af_arnndn.c
@@ -1320,21 +1320,19 @@ static void compute_rnn(AudioRNNContext *s, RNNState *rnn, float *gains, float *
compute_gru(s, rnn->model->vad_gru, rnn->vad_gru_state, dense_out);
compute_dense(rnn->model->vad_output, vad, rnn->vad_gru_state);
- for (int i = 0; i < rnn->model->input_dense_size; i++)
- noise_input[i] = dense_out[i];
- for (int i = 0; i < rnn->model->vad_gru_size; i++)
- noise_input[i + rnn->model->input_dense_size] = rnn->vad_gru_state[i];
- for (int i = 0; i < INPUT_SIZE; i++)
- noise_input[i + rnn->model->input_dense_size + rnn->model->vad_gru_size] = input[i];
+ memcpy(noise_input, dense_out, rnn->model->input_dense_size * sizeof(float));
+ memcpy(noise_input + rnn->model->input_dense_size,
+ rnn->vad_gru_state, rnn->model->vad_gru_size * sizeof(float));
+ memcpy(noise_input + rnn->model->input_dense_size + rnn->model->vad_gru_size,
+ input, INPUT_SIZE * sizeof(float));
compute_gru(s, rnn->model->noise_gru, rnn->noise_gru_state, noise_input);
- for (int i = 0; i < rnn->model->vad_gru_size; i++)
- denoise_input[i] = rnn->vad_gru_state[i];
- for (int i = 0; i < rnn->model->noise_gru_size; i++)
- denoise_input[i + rnn->model->vad_gru_size] = rnn->noise_gru_state[i];
- for (int i = 0; i < INPUT_SIZE; i++)
- denoise_input[i + rnn->model->vad_gru_size + rnn->model->noise_gru_size] = input[i];
+ memcpy(denoise_input, rnn->vad_gru_state, rnn->model->vad_gru_size * sizeof(float));
+ memcpy(denoise_input + rnn->model->vad_gru_size,
+ rnn->noise_gru_state, rnn->model->noise_gru_size * sizeof(float));
+ memcpy(denoise_input + rnn->model->vad_gru_size + rnn->model->noise_gru_size,
+ input, INPUT_SIZE * sizeof(float));
compute_gru(s, rnn->model->denoise_gru, rnn->denoise_gru_state, denoise_input);
compute_dense(rnn->model->denoise_output, gains, rnn->denoise_gru_state);