After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 632664 - [0.11] audioiirfilter: nonstandard definition of 'a' and 'b' coefficients for IIR filters
[0.11] audioiirfilter: nonstandard definition of 'a' and 'b' coefficients for...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other All
: Normal enhancement
: 0.11.x
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-10-20 09:43 UTC by Leo Singer
Modified: 2012-01-11 14:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (17.80 KB, patch)
2010-10-20 09:43 UTC, Leo Singer
committed Details | Review

Description Leo Singer 2010-10-20 09:43:25 UTC
Created attachment 172821 [details] [review]
Proposed patch

audiofxbaseiirfilter and the derived elements audioiirfilter, audiochebband, and audiocheblimit, use the following convention for the definition of an IIR filter:

y[n] = a_n x[n] + a_1 x[n-1] + ... + a_M x[n-M] + b_1 y[n-1] + b_2 y[n-2] + ... + b[n-N].

The most common convention in signal processing literature, and also the convention used by MATLAB, is:

a_0 y[n] + a_1 y[n-1] + ... + a_M y[n-M] = b_0 x[n] + b_1 x[n-1] + ... + b_N x[n-N].

or, setting a_0 to 1 and moving all the terms but y[n] to the right hand side:

y[n] = b_0 x[n] + b_1 x[n-1] + ... + b_N x[n-N] - a_1 y[n-1] - a_2 y[n-2] - ... - a_M y[n-M].

So, in the more common convention, the b's are the coefficients in the nominator of the transfer function, and the a's are the coefficients in the denominator of the transfer function (with no minus sign).

This patch modifies audiofxbaseiirfilter to use the latter, more common convention, and modifies all of its derived classes accordingly.  This should make the properties of the audioiirfilter recognizable to more people, especially those who learned digital signal processing with MATLAB.
Comment 1 Sebastian Dröge (slomo) 2010-10-20 10:34:09 UTC
Yes, unfortunately you're right but it's too late to change this now for 0.10
Comment 2 René Stadler 2011-05-30 15:10:55 UTC
Probably makes sense to rename the properties. Otherwise people won't notice the change when porting to 0.11/1.0 and applications will break.
Comment 3 Leo Singer 2011-05-30 16:01:04 UTC
(In reply to comment #2)
> Probably makes sense to rename the properties. Otherwise people won't notice
> the change when porting to 0.11/1.0 and applications will break.

How about "den" and "num" or "denominator" and "numerator"?
Comment 4 Sebastian Dröge (slomo) 2012-01-11 14:24:32 UTC
commit 56353e24d2f404269c7662eb4549b4c58b449d49
Author: Leo Singer <leo.singer@ligo.org>
Date:   Wed Oct 20 02:17:43 2010 -0700

    audiofx: Use most common convention for definitions of IIR filter coefficients.
    
    Most signal processing texts, including MATLAB, use the following convention for IIR filter coefficients:
    
    a_0 y[n] + a_1 y[n-1] + ... + a_M y[n-M] = b_0 x[n] + b_1 x[n-1] + ... + b[N] x[n-N]
    
    Usually, a_0 is set to 1 because the coefficients can always be rescaled, giving
    
    y[n] = b_0 x[n] + b_1 x[n-1] + ... + b[N] x[n-N] - a_1 y[n-1] - ... - a_M y[n-M]
    
    The convention that was previously used by audiofxbaseiirfilter and derived class had the a and b coefficients swapp
    
    This change makes the audiofx plugin use the more common convention described above.