From b5ae61d2c0ae3b7609bfc896d71b88bdba76e7b3 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Fri, 11 Jan 2019 11:23:59 +0100 Subject: [PATCH] avfilter/af_anlmdn: do not trim first samples Instead denoise from start, assumming missing samples are silence. --- libavfilter/af_anlmdn.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavfilter/af_anlmdn.c b/libavfilter/af_anlmdn.c index cc7765702b..efc261e16a 100644 --- a/libavfilter/af_anlmdn.c +++ b/libavfilter/af_anlmdn.c @@ -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;