aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-01-11 11:23:59 +0100
committerPaul B Mahol <onemda@gmail.com>2019-01-11 11:23:59 +0100
commitb5ae61d2c0ae3b7609bfc896d71b88bdba76e7b3 (patch)
treeae2aef52d4d4148dab89c893c90d515206a721ef
parent0c0fc8896cdda530ec0989ee45a905d5d48db1a1 (diff)
downloadffmpeg-b5ae61d2c0ae3b7609bfc896d71b88bdba76e7b3.tar.gz
avfilter/af_anlmdn: do not trim first samples
Instead denoise from start, assumming missing samples are silence.
-rw-r--r--libavfilter/af_anlmdn.c5
1 files changed, 5 insertions, 0 deletions
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;