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 747005 - audioconvert: avoid floating point calculations when mixing integer-formatted channels
audioconvert: avoid floating point calculations when mixing integer-formatted...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal enhancement
: 1.5.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-03-30 09:41 UTC by Bernhard Miller
Modified: 2015-04-15 10:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
optimization patch (3.40 KB, patch)
2015-03-30 09:41 UTC, Bernhard Miller
committed Details | Review
Fixup for the above patch (1.36 KB, patch)
2015-04-15 09:30 UTC, Bernhard Miller
committed Details | Review

Description Bernhard Miller 2015-03-30 09:41:17 UTC
Created attachment 300569 [details] [review]
optimization patch

Currently, the channel mixer in the audioconvert element always uses floating point calculations. 
This patch is an optimization that uses fixed-point calculations for integer-formatted channels.
Comment 1 Sebastian Dröge (slomo) 2015-03-31 02:24:39 UTC
Review of attachment 300569 [details] [review]:

Looks good to me :) Thanks!

Do you have some numbers about how much it improves performance (on which hardware)?
Comment 2 Bernhard Miller 2015-03-31 06:31:30 UTC
I tested it on a Cortex-A8, single core, 800MHz. Input was a 96kHz flac file with 6 channels. 

The time used for my primary test case, this launch line:

gst-launch-1.0 filesrc location="flac_96000khz_16bit_6ch.flac" ! decodebin ! audioconvert dithering=0 ! "audio/x-raw,channels=2" ! fakesink sync=false

was reduced from ~29 seconds to ~9 seconds.
Comment 3 Sebastian Dröge (slomo) 2015-04-01 14:29:41 UTC
commit b2db18cda2e4e7951655cb2a34108a8523b6eca9
Author: Bernhard Miller <bernhard.miller@streamunlimited.com>
Date:   Mon Mar 30 11:24:46 2015 +0200

    audioconvert: avoid float calculations when mixing integer-formatted channels
    
    The patch calculates a second channel mixing matrix from the current one. The
    matrix contains the original values * (2^10) as integers. This matrix is used
    when integer-formatted channels are mixed.
    
    On a ARM Cortex-A8, single core, 800MHz this improves performance in a
    testcase from 29s to 9s for downmixing 6 channels to stereo.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747005
Comment 4 Bernhard Miller 2015-04-15 09:30:53 UTC
Created attachment 301601 [details] [review]
Fixup for the above patch

The previous patch is using gint and gint32 synonymously, which can cause
problems on 64bit systems.
With the fixup, the int matrix now only uses gint.
Comment 5 Sebastian Dröge (slomo) 2015-04-15 10:18:52 UTC
What problems can it cause on 64 bit systems? On all I'm aware of, gint and gint32 are actually the same type. Still is more correct :)

commit 1c01b50adaed506dbb2127590780e2eaa3fd6f0a
Author: Bernhard Miller <bernhard.miller@streamunlimited.com>
Date:   Wed Apr 15 11:24:17 2015 +0200

    audioconvert: fix mixed usage of gint and gint32 in int matrix
    
    This is a fixup for b2db18cda2e4e7951655cb2a34108a8523b6eca9
    audioconvert: avoid float calculations when mixing integer-formatted channels
    
    The int matrix was using gint and gint32 synonymously, which can theoretically
    cause problems if gint and gint32 are actually different types.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747005