Unified · Split
| @@ -329,13 +329,15 @@ static double limit_gain(double a, double b) · 328 unmodified lines | ||
| 329 | 329 | return 1.0; |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | −static void process_frame(AudioFFTDeNoiseContext *s, DeNoiseChannel *dnch, | |
| 332 | +static void process_frame(AVFilterContext *ctx, | |
| 333 | + AudioFFTDeNoiseContext *s, DeNoiseChannel *dnch, | |
| 333 | 334 | AVComplexFloat *fft_data, |
| 334 | 335 | double *prior, double *prior_band_excit, int track_noise) |
| 335 | 336 | { |
| 337 | + AVFilterLink *outlink = ctx->outputs[0]; | |
| 336 | 338 | const double sample_floor = s->sample_floor; |
| 337 | 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 | 341 | const double rratio = 1. - ratio; |
| 340 | 342 | const int *bin2band = s->bin2band; |
| 341 | 343 | double *band_excit = dnch->band_excit; |
| @@ -784,7 +786,6 @@ static int config_input(AVFilterLink *inlink) · 442 unmodified lines | ||
| 784 | 786 | for (int ch = 0; ch < inlink->channels; ch++) { |
| 785 | 787 | DeNoiseChannel *dnch = &s->dnch[ch]; |
| 786 | 788 | double *prior_band_excit = dnch->prior_band_excit; |
| 787 | − double *prior = dnch->prior; | |
| 788 | 789 | double min, max; |
| 789 | 790 | double p1, p2; |
| 790 | 791 | |
| @@ -828,8 +829,6 @@ static int config_input(AVFilterLink *inlink) · 37 unmodified lines | ||
| 828 | 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 | 832 | for (int i = 0; i < s->buffer_length; i++) |
| 834 | 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 | 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 | 1070 | dnch->prior, |
| 1072 | 1071 | dnch->prior_band_excit, |
| 1073 | 1072 | s->track_noise); |