Title: [98144] trunk/Source/WebCore
Revision
98144
Author
commit-qu...@webkit.org
Date
2011-10-21 14:04:43 -0700 (Fri, 21 Oct 2011)

Log Message

Flush denormals in Biquad, ZeroPole, and DynamicsCompressor.

We only flush when saving the state variables instead of in the
loops so that we don't impact performance too much when there are
no denormals.  This will at least not propagate the denormals any
further within the class.

https://bugs.webkit.org/show_bug.cgi?id=70626

Patch by Raymond Toy <r...@google.com> on 2011-10-21
Reviewed by Kenneth Russell.

* platform/audio/Biquad.cpp:
(WebCore::Biquad::process):
Flush denormals when storing the filter state back in to class
filter state.
* platform/audio/DynamicsCompressorKernel.cpp:
(WebCore::DynamicsCompressorKernel::process):
Ditto.
* platform/audio/ZeroPole.cpp:
(WebCore::ZeroPole::process):
Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (98143 => 98144)


--- trunk/Source/WebCore/ChangeLog	2011-10-21 21:01:07 UTC (rev 98143)
+++ trunk/Source/WebCore/ChangeLog	2011-10-21 21:04:43 UTC (rev 98144)
@@ -1,3 +1,27 @@
+2011-10-21  Raymond Toy  <r...@google.com>
+
+        Flush denormals in Biquad, ZeroPole, and DynamicsCompressor.
+
+        We only flush when saving the state variables instead of in the
+        loops so that we don't impact performance too much when there are
+        no denormals.  This will at least not propagate the denormals any
+        further within the class.
+        
+        https://bugs.webkit.org/show_bug.cgi?id=70626
+
+        Reviewed by Kenneth Russell.
+
+        * platform/audio/Biquad.cpp:
+        (WebCore::Biquad::process):
+        Flush denormals when storing the filter state back in to class
+        filter state.  
+        * platform/audio/DynamicsCompressorKernel.cpp:
+        (WebCore::DynamicsCompressorKernel::process):
+        Ditto.
+        * platform/audio/ZeroPole.cpp:
+        (WebCore::ZeroPole::process):
+        Ditto.
+
 2011-10-21  Vsevolod Vlasov  <vse...@chromium.org>
 
         Web Inspector: Advanced search results should be cleared on navigation.

Modified: trunk/Source/WebCore/platform/audio/Biquad.cpp (98143 => 98144)


--- trunk/Source/WebCore/platform/audio/Biquad.cpp	2011-10-21 21:01:07 UTC (rev 98143)
+++ trunk/Source/WebCore/platform/audio/Biquad.cpp	2011-10-21 21:04:43 UTC (rev 98144)
@@ -32,6 +32,7 @@
 
 #include "Biquad.h"
 
+#include "DenormalDisabler.h"
 #include <algorithm>
 #include <stdio.h>
 #include <wtf/MathExtras.h>
@@ -96,11 +97,12 @@
         y1 = y;
     }
 
-    // Local variables back to member
-    m_x1 = x1;
-    m_x2 = x2;
-    m_y1 = y1;
-    m_y2 = y2;
+    // Local variables back to member. Flush denormals here so we
+    // don't slow down the inner loop above.
+    m_x1 = DenormalDisabler::flushDenormalFloatToZero(x1);
+    m_x2 = DenormalDisabler::flushDenormalFloatToZero(x2);
+    m_y1 = DenormalDisabler::flushDenormalFloatToZero(y1);
+    m_y2 = DenormalDisabler::flushDenormalFloatToZero(y2);
 
     m_b0 = b0;
     m_b1 = b1;

Modified: trunk/Source/WebCore/platform/audio/DynamicsCompressorKernel.cpp (98143 => 98144)


--- trunk/Source/WebCore/platform/audio/DynamicsCompressorKernel.cpp	2011-10-21 21:01:07 UTC (rev 98143)
+++ trunk/Source/WebCore/platform/audio/DynamicsCompressorKernel.cpp	2011-10-21 21:04:43 UTC (rev 98144)
@@ -33,6 +33,7 @@
 #include "DynamicsCompressorKernel.h"
 
 #include "AudioUtilities.h"
+#include "DenormalDisabler.h"
 #include <algorithm>
 #include <wtf/MathExtras.h>
 
@@ -352,8 +353,8 @@
             // Locals back to member variables.
             m_preDelayReadIndex = preDelayReadIndex;
             m_preDelayWriteIndex = preDelayWriteIndex;
-            m_detectorAverage = detectorAverage;
-            m_compressorGain = compressorGain;
+            m_detectorAverage = DenormalDisabler::flushDenormalFloatToZero(detectorAverage);
+            m_compressorGain = DenormalDisabler::flushDenormalFloatToZero(compressorGain);
         }
     }
 }

Modified: trunk/Source/WebCore/platform/audio/ZeroPole.cpp (98143 => 98144)


--- trunk/Source/WebCore/platform/audio/ZeroPole.cpp	2011-10-21 21:01:07 UTC (rev 98143)
+++ trunk/Source/WebCore/platform/audio/ZeroPole.cpp	2011-10-21 21:04:43 UTC (rev 98144)
@@ -32,6 +32,8 @@
 
 #include "ZeroPole.h"
 
+#include "DenormalDisabler.h"
+
 namespace WebCore {
 
 void ZeroPole::process(float *source, float *destination, unsigned framesToProcess)
@@ -61,9 +63,10 @@
         *destination++ = output2;
     }
     
-    // Locals to member variables.
-    m_lastX = lastX;
-    m_lastY = lastY;
+    // Locals to member variables. Flush denormals here so we don't
+    // slow down the inner loop above.
+    m_lastX = DenormalDisabler::flushDenormalFloatToZero(lastX);
+    m_lastY = DenormalDisabler::flushDenormalFloatToZero(lastY);
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to