History

avfilter/af_afftdn: do not profile noise if number of sampled blocks is 0

Paul B Mahol committed 4 years ago

Commit b6af56c1 parent 28447a41 file · +6 −0Browse files

Unified · Split

libavfilter/af_afftdn.c+6−0
@@ -125,6 +125,7 @@ typedef struct AudioFFTDeNoiseContext { · 124 unmodified lines
125125
126126 int channels;
127127 int sample_noise;
128+ int sample_noise_blocks;
128129 int sample_noise_mode;
129130 float sample_rate;
130131 int buffer_length;
@@ -1039,6 +1040,7 @@ static int output_frame(AVFilterLink *inlink, AVFrame *in) · 908 unmodified lines
10391040 }
10401041 s->sample_noise_mode = SAMPLE_NONE;
10411042 s->sample_noise = 1;
1043+ s->sample_noise_blocks = 0;
10421044 }
10431045
10441046 if (s->sample_noise) {
@@ -1047,6 +1049,7 @@ static int output_frame(AVFilterLink *inlink, AVFrame *in) · 2 unmodified lines
10471049
10481050 sample_noise_block(s, dnch, s->winframe, ch);
10491051 }
1052+ s->sample_noise_blocks++;
10501053 }
10511054
10521055 if (s->sample_noise_mode == SAMPLE_STOP) {
@@ -1054,11 +1057,14 @@ static int output_frame(AVFilterLink *inlink, AVFrame *in) · 1 unmodified line
10541057 DeNoiseChannel *dnch = &s->dnch[ch];
10551058 double sample_noise[NB_PROFILE_BANDS];
10561059
1060+ if (s->sample_noise_blocks <= 0)
1061+ break;
10571062 finish_sample_noise(s, dnch, sample_noise);
10581063 set_noise_profile(s, dnch, sample_noise);
10591064 set_parameters(s, dnch, 1, 1);
10601065 }
10611066 s->sample_noise = 0;
1067+ s->sample_noise_blocks = 0;
10621068 s->sample_noise_mode = SAMPLE_NONE;
10631069 }
10641070

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