avfilter/af_anlmdn: do not trim first samples

Instead denoise from start, assumming missing samples are silence.
This commit is contained in:
Paul B Mahol 2019-01-11 11:23:59 +01:00
parent 0c0fc8896c
commit b5ae61d2c0
1 changed files with 5 additions and 0 deletions

View File

@ -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;