[Webkit-unassigned] [Bug 134060] New: Float denormal issue in JavaScript processor node in Web Audio API

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jun 19 06:53:35 PDT 2014


           Summary: Float denormal issue in JavaScript processor node in
                    Web Audio API
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Macintosh Intel
        OS/Version: Mac OS X 10.8
            Status: NEW
          Severity: Major
          Priority: P2
         Component: Web Audio
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: letz at grame.fr
                CC: crogers at google.com

We successfully compile our C++ audio processing code with emcripten in asm.js to deploy on the web using the WebAudio API , so running the resulting asm.js code in a ScriptProcessorNode in the Web Audio API. 

Our C++ code uses the following denormalized float number protection code ("protection" is needed since denormalized float number computation is awfully slow and has to be avoided): 

#ifdef __SSE__
   #include <xmmintrin.h>
   #ifdef __SSE2__
       #define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8040)
       #define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8000)

Basically we add a call at AVOIDDENORMALS before each audio  block processing. It seems this AVOIDDENORMALS is just removed by the emcripten compiler and so we get asm.js code that seems to produce denormalized floats and the speed issue occurs.

The attached "piano.html" page contains a piano physical model that is compiled in asm.js and run as a Web Audio API ScriptProcessorNode. It you hit the "gate" button a sound is played. After some seconds the CPU use (seen in activity monitor on OSX) raises to 100%.

ScriptProcessorNode node takes a lot of time to execute since float denormal issue happens

ScriptProcessorNode should probably be processes in an context where flush denormals to zero is done automatically.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list