Title: [108726] trunk/Source/WebCore
Revision
108726
Author
[email protected]
Date
2012-02-23 21:25:31 -0800 (Thu, 23 Feb 2012)

Log Message

Use MathExtras round() in timeToSampleFrame
https://bugs.webkit.org/show_bug.cgi?id=79281

Patch by Raymond Toy <[email protected]> on 2012-02-23
Reviewed by Chris Rogers.

No new tests. Existing tests cover this change.

* platform/audio/AudioUtilities.cpp:
(WebCore::AudioUtilities::timeToSampleFrame): Use round().

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (108725 => 108726)


--- trunk/Source/WebCore/ChangeLog	2012-02-24 05:24:55 UTC (rev 108725)
+++ trunk/Source/WebCore/ChangeLog	2012-02-24 05:25:31 UTC (rev 108726)
@@ -1,3 +1,15 @@
+2012-02-23  Raymond Toy  <[email protected]>
+
+        Use MathExtras round() in timeToSampleFrame
+        https://bugs.webkit.org/show_bug.cgi?id=79281
+
+        Reviewed by Chris Rogers.
+
+        No new tests. Existing tests cover this change.
+
+        * platform/audio/AudioUtilities.cpp:
+        (WebCore::AudioUtilities::timeToSampleFrame): Use round(). 
+
 2012-02-23  Greg Billock  <[email protected]>
 
         Don't clear IntentRequest callback pointers on stop()

Modified: trunk/Source/WebCore/platform/audio/AudioUtilities.cpp (108725 => 108726)


--- trunk/Source/WebCore/platform/audio/AudioUtilities.cpp	2012-02-24 05:24:55 UTC (rev 108725)
+++ trunk/Source/WebCore/platform/audio/AudioUtilities.cpp	2012-02-24 05:25:31 UTC (rev 108726)
@@ -56,38 +56,10 @@
     return 1 - powf(1 / 2.718282f, 1 / (sampleRate * timeConstant));
 }
 
-#if OS(WINDOWS) && COMPILER(MSVC) && !_M_IX86_FP
-// When compiling with MSVC with x87 FPU instructions using 80-bit
-// floats, we want very precise control over the arithmetic so that
-// rounding is done according to the IEEE 754 specification for
-// single- and double-precision floats. We want each operation to be
-// done with specified arithmetic precision and rounding consistent
-// with gcc, not extended to 80 bits automatically.
-//
-// These pragmas are equivalent to /fp:strict flag, but we only need
-// it for the function here.  (Using fp:strict everywhere can have
-// severe impact on floating point performance.)
-#pragma float_control(push)
-#pragma float_control(precise, on)
-#pragma fenv_access(on)
-#pragma float_control(except, on)
-#endif
-
 size_t timeToSampleFrame(double time, double sampleRate)
 {
-    // DO NOT CONSOLIDATE THESE ASSIGNMENTS INTO ONE! When compiling
-    // with Visual Studio, these assignments force the rounding of
-    // each operation according to IEEE 754, instead of leaving
-    // intermediate results in 80-bit precision which is not
-    // consistent with IEEE 754 double-precision rounding.
-    double r = time * sampleRate;
-    r += 0.5;
-    return static_cast<size_t>(r);
+    return static_cast<size_t>(round(time * sampleRate));
 }
-#if OS(WINDOWS) && COMPILER(MSVC) && !_M_IX86_FP
-// Restore normal floating-point semantics.
-#pragma float_control(pop)
-#endif
 } // AudioUtilites
 
 } // WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to