Title: [141867] trunk
Revision
141867
Author
[email protected]
Date
2013-02-05 00:39:24 -0800 (Tue, 05 Feb 2013)

Log Message

Floating point precision error in AudioPannerNode.
https://bugs.webkit.org/show_bug.cgi?id=106001

Patch by Praveen Jadhav <[email protected]> on 2013-02-05
Reviewed by Kentaro Hara.

Specifications Update:
https://dvcs.w3.org/hg/audio/rev/69a39a516e45

Source/WebCore:

Conversion from double to float and back to double
results in precision error. Avoiding these conversions
will make sure that proper values are retained in the
parameters.

* Modules/webaudio/PannerNode.h:
(WebCore::PannerNode::refDistance):
(WebCore::PannerNode::setRefDistance):
(WebCore::PannerNode::maxDistance):
(WebCore::PannerNode::setMaxDistance):
(WebCore::PannerNode::rolloffFactor):
(WebCore::PannerNode::setRolloffFactor):
(WebCore::PannerNode::coneInnerAngle):
(WebCore::PannerNode::setConeInnerAngle):
(WebCore::PannerNode::coneOuterAngle):
(WebCore::PannerNode::setConeOuterAngle):
(WebCore::PannerNode::coneOuterGain):
(WebCore::PannerNode::setConeOuterGain):
* Modules/webaudio/PannerNode.idl:

LayoutTests:

New test scenarios are added to verify precision
error issues in PannerNode.

* webaudio/pannernode-basic-expected.txt:
* webaudio/pannernode-basic.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (141866 => 141867)


--- trunk/LayoutTests/ChangeLog	2013-02-05 08:31:34 UTC (rev 141866)
+++ trunk/LayoutTests/ChangeLog	2013-02-05 08:39:24 UTC (rev 141867)
@@ -1,3 +1,19 @@
+2013-02-05  Praveen Jadhav  <[email protected]>
+
+        Floating point precision error in AudioPannerNode.
+        https://bugs.webkit.org/show_bug.cgi?id=106001
+
+        Reviewed by Kentaro Hara.
+
+        Specifications Update: 
+        https://dvcs.w3.org/hg/audio/rev/69a39a516e45
+
+        New test scenarios are added to verify precision
+        error issues in PannerNode.
+
+        * webaudio/pannernode-basic-expected.txt:
+        * webaudio/pannernode-basic.html:
+
 2013-02-05  Kent Tamura  <[email protected]>
 
         INPUT_MULTIPLE_FIELDS_UI: Use disabled attribute internally instead of readonly attribute

Modified: trunk/LayoutTests/webaudio/pannernode-basic-expected.txt (141866 => 141867)


--- trunk/LayoutTests/webaudio/pannernode-basic-expected.txt	2013-02-05 08:31:34 UTC (rev 141866)
+++ trunk/LayoutTests/webaudio/pannernode-basic-expected.txt	2013-02-05 08:39:24 UTC (rev 141867)
@@ -5,11 +5,17 @@
 PASS PannerNode has one input.
 PASS PannerNode has one output.
 PASS refDistance default value is 1.
+PASS refDistance value is set to 270.52.
 PASS maxDistance default value is 10000.
+PASS maxDistance value is set to 100.55.
 PASS rolloffFactor default value is 1.
+PASS rolloffFactor value is set to 0.83.
 PASS coneInnerAngle default value is 360.
+PASS coneInnerAngle value is set to 240.45.
 PASS coneOuterAngle default value is 360.
+PASS coneOuterAngle value is set to 166.66.
 PASS coneOuterGain default value is 0.
+PASS coneOuterGain value is set to 0.35.
 PASS PannerNode defaults to 'HRTF' panningModel.
 PASS PannerNode defaults to 'inverse' distanceModel.
 PASS panningModel: 'equalpower' is settable.

Modified: trunk/LayoutTests/webaudio/pannernode-basic.html (141866 => 141867)


--- trunk/LayoutTests/webaudio/pannernode-basic.html	2013-02-05 08:31:34 UTC (rev 141866)
+++ trunk/LayoutTests/webaudio/pannernode-basic.html	2013-02-05 08:39:24 UTC (rev 141867)
@@ -40,31 +40,67 @@
     else
         testFailed("refDistance default value should be 1.");
     
+    panner.refDistance = 270.52
+    if (panner.refDistance === 270.52)
+        testPassed("refDistance value is set to 270.52.");
+    else
+        testFailed("refDistance value should be set to 270.52.");
+    
     if (panner.maxDistance === 10000)
         testPassed("maxDistance default value is 10000.");
     else
         testFailed("maxDistance default value should be 10000.");
     
+    panner.maxDistance = 100.55
+    if (panner.maxDistance === 100.55)
+        testPassed("maxDistance value is set to 100.55.");
+    else
+        testFailed("maxDistance value should be set to 100.55.");
+    
     if (panner.rolloffFactor === 1)
         testPassed("rolloffFactor default value is 1.");
     else
         testFailed("rolloffFactor default value should be 1.");
     
+    panner.rolloffFactor = 0.83
+    if (panner.rolloffFactor === 0.83)
+        testPassed("rolloffFactor value is set to 0.83.");
+    else
+        testFailed("rolloffFactor value should be set to 0.83.");
+    
     if (panner.coneInnerAngle === 360)
         testPassed("coneInnerAngle default value is 360.");
     else
         testFailed("coneInnerAngle default value should be 360.");
     
+    panner.coneInnerAngle = 240.45
+    if (panner.coneInnerAngle === 240.45)
+        testPassed("coneInnerAngle value is set to 240.45.");
+    else
+        testFailed("coneInnerAngle value should be set to 240.45.");
+    
     if (panner.coneOuterAngle === 360)
         testPassed("coneOuterAngle default value is 360.");
     else
         testFailed("coneOuterAngle default value should be 360.");
     
+    panner.coneOuterAngle = 166.66
+    if (panner.coneOuterAngle === 166.66)
+        testPassed("coneOuterAngle value is set to 166.66.");
+    else
+        testFailed("coneOuterAngle value should be set to 166.66.");
+    
     if (panner.coneOuterGain === 0)
         testPassed("coneOuterGain default value is 0.");
     else
         testFailed("coneOuterGain default value should be 0.");
 
+    panner.coneOuterGain = 0.35
+    if (panner.coneOuterGain === 0.35)
+        testPassed("coneOuterGain value is set to 0.35.");
+    else
+        testFailed("coneOuterGain value should be set to 0.35.");
+
     if (panner.panningModel === "HRTF")
         testPassed("PannerNode defaults to 'HRTF' panningModel.");
     else

Modified: trunk/Source/WebCore/ChangeLog (141866 => 141867)


--- trunk/Source/WebCore/ChangeLog	2013-02-05 08:31:34 UTC (rev 141866)
+++ trunk/Source/WebCore/ChangeLog	2013-02-05 08:39:24 UTC (rev 141867)
@@ -1,3 +1,33 @@
+2013-02-05  Praveen Jadhav  <[email protected]>
+
+        Floating point precision error in AudioPannerNode.
+        https://bugs.webkit.org/show_bug.cgi?id=106001
+
+        Reviewed by Kentaro Hara.
+
+        Specifications Update: 
+        https://dvcs.w3.org/hg/audio/rev/69a39a516e45
+
+        Conversion from double to float and back to double
+        results in precision error. Avoiding these conversions
+        will make sure that proper values are retained in the
+        parameters.
+
+        * Modules/webaudio/PannerNode.h:
+        (WebCore::PannerNode::refDistance):
+        (WebCore::PannerNode::setRefDistance):
+        (WebCore::PannerNode::maxDistance):
+        (WebCore::PannerNode::setMaxDistance):
+        (WebCore::PannerNode::rolloffFactor):
+        (WebCore::PannerNode::setRolloffFactor):
+        (WebCore::PannerNode::coneInnerAngle):
+        (WebCore::PannerNode::setConeInnerAngle):
+        (WebCore::PannerNode::coneOuterAngle):
+        (WebCore::PannerNode::setConeOuterAngle):
+        (WebCore::PannerNode::coneOuterGain):
+        (WebCore::PannerNode::setConeOuterGain):
+        * Modules/webaudio/PannerNode.idl:
+
 2013-02-05  Kent Tamura  <[email protected]>
 
         INPUT_MULTIPLE_FIELDS_UI: Use disabled attribute internally instead of readonly attribute

Modified: trunk/Source/WebCore/Modules/webaudio/PannerNode.h (141866 => 141867)


--- trunk/Source/WebCore/Modules/webaudio/PannerNode.h	2013-02-05 08:31:34 UTC (rev 141866)
+++ trunk/Source/WebCore/Modules/webaudio/PannerNode.h	2013-02-05 08:39:24 UTC (rev 141867)
@@ -100,24 +100,24 @@
     bool setDistanceModel(unsigned); // Returns true on success.
     void setDistanceModel(const String&);
 
-    float refDistance() { return static_cast<float>(m_distanceEffect.refDistance()); }
-    void setRefDistance(float refDistance) { m_distanceEffect.setRefDistance(refDistance); }
+    double refDistance() { return m_distanceEffect.refDistance(); }
+    void setRefDistance(double refDistance) { m_distanceEffect.setRefDistance(refDistance); }
 
-    float maxDistance() { return static_cast<float>(m_distanceEffect.maxDistance()); }
-    void setMaxDistance(float maxDistance) { m_distanceEffect.setMaxDistance(maxDistance); }
+    double maxDistance() { return m_distanceEffect.maxDistance(); }
+    void setMaxDistance(double maxDistance) { m_distanceEffect.setMaxDistance(maxDistance); }
 
-    float rolloffFactor() { return static_cast<float>(m_distanceEffect.rolloffFactor()); }
-    void setRolloffFactor(float rolloffFactor) { m_distanceEffect.setRolloffFactor(rolloffFactor); }
+    double rolloffFactor() { return m_distanceEffect.rolloffFactor(); }
+    void setRolloffFactor(double rolloffFactor) { m_distanceEffect.setRolloffFactor(rolloffFactor); }
 
     // Sound cones - angles in degrees
-    float coneInnerAngle() const { return static_cast<float>(m_coneEffect.innerAngle()); }
-    void setConeInnerAngle(float angle) { m_coneEffect.setInnerAngle(angle); }
+    double coneInnerAngle() const { return m_coneEffect.innerAngle(); }
+    void setConeInnerAngle(double angle) { m_coneEffect.setInnerAngle(angle); }
 
-    float coneOuterAngle() const { return static_cast<float>(m_coneEffect.outerAngle()); }
-    void setConeOuterAngle(float angle) { m_coneEffect.setOuterAngle(angle); }
+    double coneOuterAngle() const { return m_coneEffect.outerAngle(); }
+    void setConeOuterAngle(double angle) { m_coneEffect.setOuterAngle(angle); }
 
-    float coneOuterGain() const { return static_cast<float>(m_coneEffect.outerGain()); }
-    void setConeOuterGain(float angle) { m_coneEffect.setOuterGain(angle); }
+    double coneOuterGain() const { return m_coneEffect.outerGain(); }
+    void setConeOuterGain(double angle) { m_coneEffect.setOuterGain(angle); }
 
     void getAzimuthElevation(double* outAzimuth, double* outElevation);
     float dopplerRate();

Modified: trunk/Source/WebCore/Modules/webaudio/PannerNode.idl (141866 => 141867)


--- trunk/Source/WebCore/Modules/webaudio/PannerNode.idl	2013-02-05 08:31:34 UTC (rev 141866)
+++ trunk/Source/WebCore/Modules/webaudio/PannerNode.idl	2013-02-05 08:39:24 UTC (rev 141867)
@@ -47,12 +47,12 @@
     // Distance model
     [CustomSetter] attribute DOMString distanceModel;
 
-    attribute float refDistance;
-    attribute float maxDistance;
-    attribute float rolloffFactor;
+    attribute double refDistance;
+    attribute double maxDistance;
+    attribute double rolloffFactor;
 
     // Directional sound cone
-    attribute float coneInnerAngle;
-    attribute float coneOuterAngle;
-    attribute float coneOuterGain;
+    attribute double coneInnerAngle;
+    attribute double coneOuterAngle;
+    attribute double coneOuterGain;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to