Commit b5ae61d2 authored by Paul B Mahol's avatar Paul B Mahol

avfilter/af_anlmdn: do not trim first samples

Instead denoise from start, assumming missing samples are silence.
parent 0c0fc889
......@@ -135,6 +135,7 @@ static int config_output(AVFilterLink *outlink)
{
AVFilterContext *ctx = outlink->src;
AudioNLMeansContext *s = ctx->priv;
int ret;
s->K = av_rescale(s->pd, outlink->sample_rate, AV_TIME_BASE);
s->S = av_rescale(s->rd, outlink->sample_rate, AV_TIME_BASE);
......@@ -159,6 +160,10 @@ static int config_output(AVFilterLink *outlink)
if (!s->fifo)
return AVERROR(ENOMEM);
ret = av_audio_fifo_write(s->fifo, (void **)s->in->extended_data, s->K + s->S);
if (ret < 0)
return ret;
s->pdiff_lut_scale = 1.f / MAX_DIFF * WEIGHT_LUT_SIZE;
for (int i = 0; i < WEIGHT_LUT_SIZE; i++) {
float w = -i / s->pdiff_lut_scale;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment