diff options
author | Muhammad Faiz <mfcc64@gmail.com> | 2017-08-25 17:36:04 +0700 |
---|---|---|
committer | Muhammad Faiz <mfcc64@gmail.com> | 2017-08-25 17:36:04 +0700 |
commit | 3ddd10290afb88ffbb25d15863076002cfca4827 (patch) | |
tree | c9d2814dc966fd534cf0ee7179e7c6bb77fdbf88 | |
parent | 48ddd8ddec3587453dffcfaa4130698d99228937 (diff) | |
download | ffmpeg-3ddd10290afb88ffbb25d15863076002cfca4827.tar.gz |
avfilter/af_firequalizer: fix minval on cepstrum calculation
The impulse response is scaled with 2/rdft_len.
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
-rw-r--r-- | libavfilter/af_firequalizer.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c index 2b6245c698..00ddc87341 100644 --- a/libavfilter/af_firequalizer.c +++ b/libavfilter/af_firequalizer.c @@ -554,6 +554,7 @@ static void generate_min_phase_kernel(FIREqualizerContext *s, float *rdft_buf) { int k, cepstrum_len = s->cepstrum_len, rdft_len = s->rdft_len; double norm = 2.0 / cepstrum_len; + double minval = 1e-7 / rdft_len; memset(s->cepstrum_buf, 0, cepstrum_len * sizeof(*s->cepstrum_buf)); memcpy(s->cepstrum_buf, rdft_buf, rdft_len/2 * sizeof(*rdft_buf)); @@ -561,11 +562,11 @@ static void generate_min_phase_kernel(FIREqualizerContext *s, float *rdft_buf) av_rdft_calc(s->cepstrum_rdft, s->cepstrum_buf); - s->cepstrum_buf[0] = log(FFMAX(s->cepstrum_buf[0], 1e-10)); - s->cepstrum_buf[1] = log(FFMAX(s->cepstrum_buf[1], 1e-10)); + s->cepstrum_buf[0] = log(FFMAX(s->cepstrum_buf[0], minval)); + s->cepstrum_buf[1] = log(FFMAX(s->cepstrum_buf[1], minval)); for (k = 2; k < cepstrum_len; k += 2) { - s->cepstrum_buf[k] = log(FFMAX(s->cepstrum_buf[k], 1e-10)); + s->cepstrum_buf[k] = log(FFMAX(s->cepstrum_buf[k], minval)); s->cepstrum_buf[k+1] = 0; } |