Skip to content

Commit ac477f1

Browse files
committed
Fixing !SMOOTH_BANDS mode
1 parent 48b1498 commit ac477f1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/denoise.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757

5858
#define SMOOTH_BANDS 1
5959

60+
#define NB_BAND_BOUNDARIES 22
61+
6062
#if SMOOTH_BANDS
6163
#define NB_BANDS 22
6264
#else
@@ -102,7 +104,7 @@ struct DenoiseState {
102104
float pitch_enh_buf[PITCH_BUF_SIZE];
103105

104106
/* Bands adjusted for the sample rate */
105-
opus_int16 band_bins[NB_BANDS];
107+
opus_int16 band_bins[NB_BAND_BOUNDARIES];
106108

107109
float last_gain;
108110
int last_period;
@@ -216,7 +218,7 @@ static void check_init(DenoiseState *st) {
216218
if (st->sample_rate <= 0) st->sample_rate = DEFAULT_SAMPLE_RATE;
217219

218220
/* Adjust the bins for the sample rate */
219-
for (i = 0; i < NB_BANDS; i++)
221+
for (i = 0; i < NB_BAND_BOUNDARIES; i++)
220222
st->band_bins[i] = (((long) eband5ms[i]) << FRAME_SIZE_SHIFT) * DEFAULT_SAMPLE_RATE / st->sample_rate;
221223

222224
/* Make sure nothing's above the Nyquist frequency */
@@ -391,7 +393,9 @@ static int compute_frame_features(DenoiseState *st, kiss_fft_cpx *X, kiss_fft_cp
391393
apply_window(st, p);
392394
forward_transform(st, P, p);
393395
compute_band_energy(st, Ep, P);
396+
#if SMOOTH_BANDS
394397
compute_band_corr(st, Exp, X, P);
398+
#endif
395399
for (i=0;i<NB_BANDS;i++) Exp[i] = Exp[i]/sqrt(.001+Ex[i]*Ep[i]);
396400
dct(st, tmp, Exp);
397401
for (i=0;i<NB_DELTA_CEPS;i++) features[NB_BANDS+2*NB_DELTA_CEPS+i] = tmp[i];

0 commit comments

Comments
 (0)