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 494499 - replaygain analysis slowdown on low volume (denormals)
replaygain analysis slowdown on low volume (denormals)
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Windows
: Normal normal
: 0.10.7
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-11-07 08:45 UTC by Gabriel Bouvigne
Modified: 2007-11-13 07:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Avoid slowdown from denormals when processing near-silence input (593 bytes, patch)
2007-11-12 19:32 UTC, René Stadler
committed Details | Review

Description Gabriel Bouvigne 2007-11-07 08:45:45 UTC
The RG analysis is awfully slowing down on low volume content.
Usual case: "hidden" tracks on CDs with content after a few minutes of near-silent.

This is caused by denormal handling on x86 cpu.

Different easy fixes are possible:

#1: always add a small value to the computation, small enough to not significantly change the overall result.

This is, as an example, done in MPC and LAME:
http://svn.musepack.net/libreplaygain/src/gain_analysis.c
http://lame.cvs.sourceforge.net/lame/lame/libmp3lame/gain_analysis.c?view=markup

#2: if values are small, clear result to 0.

This is done in WavPack:
http://svn.slomosnail.de/wavpack/trunk/cli/wvgain.c

(in every source code linked, search for "denormals")
Comment 1 René Stadler 2007-11-12 07:43:07 UTC
This is a known problem, I'll provide a patch this evening.
Comment 2 René Stadler 2007-11-12 19:32:29 UTC
Created attachment 98985 [details] [review]
Avoid slowdown from denormals when processing near-silence input

        * gst/replaygain/rganalysis.c (yule_filter):
        Avoid slowdown from denormals when processing near-silence input data.
        Spotted by Gabriel Bouvigne.
Comment 3 Sebastian Dröge (slomo) 2007-11-12 21:08:32 UTC
Thanks, committed:

2007-11-12  Sebastian Dröge  <slomo@circular-chaos.org>

        Patch by: René Stadler <mail at renestadler dot de>

        * gst/replaygain/rganalysis.c: (yule_filter):
        Avoid slowdown from denormals when processing near-silence input data.
        Spotted by Gabriel Bouvigne. Fixes #494499.


PS: AFAIK one can set a FPU flag on x86 to treat denormals as zero. I'll investigate and maybe we can use this in core somewhere to prevent things like this.
Comment 4 Gabriel Bouvigne 2007-11-13 07:50:17 UTC
FPU flag: it could be done this way, but then you have to be sure that either the component is running within its own thread, or that every component is aware of the FPU being comfigured this way.

In the very specific context of this ReplayGain element, the current fix can probably be considered safe and correct, as we are using it for years within Lame.