Commit 89aa1342 authored by Paul B Mahol's avatar Paul B Mahol

avfilter/af_aiir: normalize biquads only if divisor is big enough

parent f46b04c4
...@@ -601,6 +601,9 @@ static int decompose_zp2biquads(AVFilterContext *ctx, int channels) ...@@ -601,6 +601,9 @@ static int decompose_zp2biquads(AVFilterContext *ctx, int channels)
iir->biquads[current_biquad].b[1] = b[2] / a[4]; iir->biquads[current_biquad].b[1] = b[2] / a[4];
iir->biquads[current_biquad].b[2] = b[0] / a[4]; iir->biquads[current_biquad].b[2] = b[0] / a[4];
if (fabs(iir->biquads[current_biquad].b[0] +
iir->biquads[current_biquad].b[1] +
iir->biquads[current_biquad].b[2]) > 1e-6) {
factor = (iir->biquads[current_biquad].a[0] + factor = (iir->biquads[current_biquad].a[0] +
iir->biquads[current_biquad].a[1] + iir->biquads[current_biquad].a[1] +
iir->biquads[current_biquad].a[2]) / iir->biquads[current_biquad].a[2]) /
...@@ -613,6 +616,7 @@ static int decompose_zp2biquads(AVFilterContext *ctx, int channels) ...@@ -613,6 +616,7 @@ static int decompose_zp2biquads(AVFilterContext *ctx, int channels)
iir->biquads[current_biquad].b[0] *= factor; iir->biquads[current_biquad].b[0] *= factor;
iir->biquads[current_biquad].b[1] *= factor; iir->biquads[current_biquad].b[1] *= factor;
iir->biquads[current_biquad].b[2] *= factor; iir->biquads[current_biquad].b[2] *= factor;
}
iir->biquads[current_biquad].b[0] *= (current_biquad ? 1.0 : iir->g); iir->biquads[current_biquad].b[0] *= (current_biquad ? 1.0 : iir->g);
iir->biquads[current_biquad].b[1] *= (current_biquad ? 1.0 : iir->g); iir->biquads[current_biquad].b[1] *= (current_biquad ? 1.0 : iir->g);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment