[FFmpeg-cvslog] avfilter/af_aiir: fix biquads normalization
Paul B Mahol
git at videolan.org
Fri Nov 22 21:25:57 EET 2019
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Nov 22 20:24:29 2019 +0100| [f2a01b4c8bf6e40ad3b700901449338bc713bd59] | committer: Paul B Mahol
avfilter/af_aiir: fix biquads normalization
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f2a01b4c8bf6e40ad3b700901449338bc713bd59
---
libavfilter/af_aiir.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/libavfilter/af_aiir.c b/libavfilter/af_aiir.c
index e22f814cc7..55828c1a82 100644
--- a/libavfilter/af_aiir.c
+++ b/libavfilter/af_aiir.c
@@ -594,16 +594,21 @@ static int decompose_zp2biquads(AVFilterContext *ctx, int channels)
iir->ab[1][2 * nearest_zero.a] = iir->ab[1][2 * nearest_zero.a + 1] = NAN;
iir->ab[1][2 * nearest_zero.b] = iir->ab[1][2 * nearest_zero.b + 1] = NAN;
- iir->biquads[current_biquad].a[0] = a[4];
- iir->biquads[current_biquad].a[1] = a[2];
- iir->biquads[current_biquad].a[2] = a[0];
- iir->biquads[current_biquad].b[0] = b[4];
- iir->biquads[current_biquad].b[1] = b[2];
- iir->biquads[current_biquad].b[2] = b[0];
+ iir->biquads[current_biquad].a[0] = 1.;
+ iir->biquads[current_biquad].a[1] = a[2] / a[4];
+ iir->biquads[current_biquad].a[2] = a[0] / a[4];
+ iir->biquads[current_biquad].b[0] = b[4] / a[4];
+ iir->biquads[current_biquad].b[1] = b[2] / a[4];
+ iir->biquads[current_biquad].b[2] = b[0] / a[4];
factor = (iir->biquads[current_biquad].a[0] +
iir->biquads[current_biquad].a[1] +
- iir->biquads[current_biquad].a[2]) / 4;
+ iir->biquads[current_biquad].a[2]) /
+ (iir->biquads[current_biquad].b[0] +
+ iir->biquads[current_biquad].b[1] +
+ iir->biquads[current_biquad].b[2]);
+
+ av_log(ctx, AV_LOG_VERBOSE, "factor=%f\n", factor);
iir->biquads[current_biquad].b[0] *= factor;
iir->biquads[current_biquad].b[1] *= factor;
More information about the ffmpeg-cvslog
mailing list