History

avfilter/af_afftdn: stop producing small impulsive noise at start of output

Paul B Mahol committed 4 years ago

Commit a71a3d11 parent 19614921 file · +5 −6Browse files

Unified · Split

libavfilter/af_afftdn.c+5−6
@@ -329,13 +329,15 @@ static double limit_gain(double a, double b) · 328 unmodified lines
329329 return 1.0;
330330 }
331331
332−static void process_frame(AudioFFTDeNoiseContext *s, DeNoiseChannel *dnch,
332+static void process_frame(AVFilterContext *ctx,
333+ AudioFFTDeNoiseContext *s, DeNoiseChannel *dnch,
333334 AVComplexFloat *fft_data,
334335 double *prior, double *prior_band_excit, int track_noise)
335336 {
337+ AVFilterLink *outlink = ctx->outputs[0];
336338 const double sample_floor = s->sample_floor;
337339 const double *abs_var = dnch->abs_var;
338− const double ratio = s->ratio;
340+ const double ratio = outlink->frame_count_out ? s->ratio : 1.0;
339341 const double rratio = 1. - ratio;
340342 const int *bin2band = s->bin2band;
341343 double *band_excit = dnch->band_excit;
@@ -784,7 +786,6 @@ static int config_input(AVFilterLink *inlink) · 442 unmodified lines
784786 for (int ch = 0; ch < inlink->channels; ch++) {
785787 DeNoiseChannel *dnch = &s->dnch[ch];
786788 double *prior_band_excit = dnch->prior_band_excit;
787− double *prior = dnch->prior;
788789 double min, max;
789790 double p1, p2;
790791
@@ -828,8 +829,6 @@ static int config_input(AVFilterLink *inlink) · 37 unmodified lines
828829 dnch->band_excit[i] = av_clipd(dnch->band_excit[i], min, max);
829830 }
830831
831− for (int i = 0; i <= s->fft_length2; i++)
832− prior[i] = 1.0 - s->ratio;
833832 for (int i = 0; i < s->buffer_length; i++)
834833 dnch->out_samples[i] = 0;
835834
@@ -1067,7 +1066,7 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_job · 231 unmodified lines
10671066
10681067 dnch->tx_fn(dnch->fft, dnch->fft_out, fft_in, sizeof(float));
10691068
1070− process_frame(s, dnch, dnch->fft_out,
1069+ process_frame(ctx, s, dnch, dnch->fft_out,
10711070 dnch->prior,
10721071 dnch->prior_band_excit,
10731072 s->track_noise);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t