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

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/af_afftdn.c+5−6
@@ -329,13 +329,15 @@ static double limit_gain(double a, double b) · 328 unmodified lines
329 return 1.0;329 return 1.0;
330}330}
331 331
332static void process_frame(AudioFFTDeNoiseContext *s, DeNoiseChannel *dnch,332static void process_frame(AVFilterContext *ctx,
333 AudioFFTDeNoiseContext *s, DeNoiseChannel *dnch,
333 AVComplexFloat *fft_data,334 AVComplexFloat *fft_data,
334 double *prior, double *prior_band_excit, int track_noise)335 double *prior, double *prior_band_excit, int track_noise)
335{336{
337 AVFilterLink *outlink = ctx->outputs[0];
336 const double sample_floor = s->sample_floor;338 const double sample_floor = s->sample_floor;
337 const double *abs_var = dnch->abs_var;339 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;
339 const double rratio = 1. - ratio;341 const double rratio = 1. - ratio;
340 const int *bin2band = s->bin2band;342 const int *bin2band = s->bin2band;
341 double *band_excit = dnch->band_excit;343 double *band_excit = dnch->band_excit;
@@ -784,7 +786,6 @@ static int config_input(AVFilterLink *inlink) · 442 unmodified lines
784 for (int ch = 0; ch < inlink->channels; ch++) {786 for (int ch = 0; ch < inlink->channels; ch++) {
785 DeNoiseChannel *dnch = &s->dnch[ch];787 DeNoiseChannel *dnch = &s->dnch[ch];
786 double *prior_band_excit = dnch->prior_band_excit;788 double *prior_band_excit = dnch->prior_band_excit;
787 double *prior = dnch->prior;
788 double min, max;789 double min, max;
789 double p1, p2;790 double p1, p2;
790 791
@@ -828,8 +829,6 @@ static int config_input(AVFilterLink *inlink) · 37 unmodified lines
828 dnch->band_excit[i] = av_clipd(dnch->band_excit[i], min, max);829 dnch->band_excit[i] = av_clipd(dnch->band_excit[i], min, max);
829 }830 }
830 831
831 for (int i = 0; i <= s->fft_length2; i++)
832 prior[i] = 1.0 - s->ratio;
833 for (int i = 0; i < s->buffer_length; i++)832 for (int i = 0; i < s->buffer_length; i++)
834 dnch->out_samples[i] = 0;833 dnch->out_samples[i] = 0;
835 834
@@ -1067,7 +1066,7 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_job · 231 unmodified lines
1067 1066
1068 dnch->tx_fn(dnch->fft, dnch->fft_out, fft_in, sizeof(float));1067 dnch->tx_fn(dnch->fft, dnch->fft_out, fft_in, sizeof(float));
1069 1068
1070 process_frame(s, dnch, dnch->fft_out,1069 process_frame(ctx, s, dnch, dnch->fft_out,
1071 dnch->prior,1070 dnch->prior,
1072 dnch->prior_band_excit,1071 dnch->prior_band_excit,
1073 s->track_noise);1072 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