avfilter/af_arnndn: unbreak filtering

This commit is contained in:
Paul B Mahol 2023-01-17 17:43:54 +01:00
parent 180a7d2d6c
commit 11b02fc675

View File

@ -373,14 +373,15 @@ static int config_input(AVFilterLink *inlink)
for (int i = 0; i < s->channels; i++) {
DenoiseState *st = &s->st[i];
float scale = 1.f;
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)
return ret;
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)
return ret;
}
@ -416,7 +417,7 @@ static void forward_transform(DenoiseState *st, AVComplexFloat *out, const float
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);
}
@ -433,7 +434,7 @@ static void inverse_transform(DenoiseState *st, float *out, const AVComplexFloat
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++)
out[i] = y[i].re / WINDOW_SIZE;