1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

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>
This commit is contained in:
Muhammad Faiz 2017-08-25 17:36:04 +07:00
parent 48ddd8ddec
commit 3ddd10290a

View File

@ -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;
}