avfilter/af_arnndn: unbreak filtering

pull/388/head
Paul B Mahol 2 years ago
parent 180a7d2d6c
commit 11b02fc675
  1. 9
      libavfilter/af_arnndn.c

@ -373,14 +373,15 @@ static int config_input(AVFilterLink *inlink)
for (int i = 0; i < s->channels; i++) { for (int i = 0; i < s->channels; i++) {
DenoiseState *st = &s->st[i]; DenoiseState *st = &s->st[i];
float scale = 1.f;
if (!st->tx) if (!st->tx)
ret = av_tx_init(&st->tx, &st->tx_fn, AV_TX_FLOAT_FFT, 0, WINDOW_SIZE, NULL, 0); ret = av_tx_init(&st->tx, &st->tx_fn, AV_TX_FLOAT_FFT, 0, WINDOW_SIZE, &scale, 0);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (!st->txi) if (!st->txi)
ret = av_tx_init(&st->txi, &st->txi_fn, AV_TX_FLOAT_FFT, 1, WINDOW_SIZE, NULL, 0); ret = av_tx_init(&st->txi, &st->txi_fn, AV_TX_FLOAT_FFT, 1, WINDOW_SIZE, &scale, 0);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
@ -416,7 +417,7 @@ static void forward_transform(DenoiseState *st, AVComplexFloat *out, const float
x[i].im = 0; x[i].im = 0;
} }
st->tx_fn(st->tx, y, x, sizeof(float)); st->tx_fn(st->tx, y, x, sizeof(AVComplexFloat));
RNN_COPY(out, y, FREQ_SIZE); RNN_COPY(out, y, FREQ_SIZE);
} }
@ -433,7 +434,7 @@ static void inverse_transform(DenoiseState *st, float *out, const AVComplexFloat
x[i].im = -x[WINDOW_SIZE - i].im; x[i].im = -x[WINDOW_SIZE - i].im;
} }
st->txi_fn(st->txi, y, x, sizeof(float)); st->txi_fn(st->txi, y, x, sizeof(AVComplexFloat));
for (int i = 0; i < WINDOW_SIZE; i++) for (int i = 0; i < WINDOW_SIZE; i++)
out[i] = y[i].re / WINDOW_SIZE; out[i] = y[i].re / WINDOW_SIZE;

Loading…
Cancel
Save