Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/resources/audio-testing.js

Issue 2033503004: Avoid slow AudioParam automation path when possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 function writeString(s, a, offset) { 1 function writeString(s, a, offset) {
2 for (var i = 0; i < s.length; ++i) { 2 for (var i = 0; i < s.length; ++i) {
3 a[offset + i] = s.charCodeAt(i); 3 a[offset + i] = s.charCodeAt(i);
4 } 4 }
5 } 5 }
6 6
7 function writeInt16(n, a, offset) { 7 function writeInt16(n, a, offset) {
8 n = Math.floor(n); 8 n = Math.floor(n);
9 9
10 var b1 = n & 255; 10 var b1 = n & 255;
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 for (var i = 0; i < expected.length; i++) { 863 for (var i = 0; i < expected.length; i++) {
864 var diff = Math.abs(this.target[i] - expected[i]); 864 var diff = Math.abs(this.target[i] - expected[i]);
865 if (diff > Math.max(absoluteErrorThreshold, relativeErrorThreshold * Math.abs(expected[i]))) { 865 if (diff > Math.max(absoluteErrorThreshold, relativeErrorThreshold * Math.abs(expected[i]))) {
866 mismatches[i] = diff; 866 mismatches[i] = diff;
867 // Keep track of the location of the absolute max difference. 867 // Keep track of the location of the absolute max difference.
868 if (diff > maxAbsError) { 868 if (diff > maxAbsError) {
869 maxAbsErrorIndex = i; 869 maxAbsErrorIndex = i;
870 maxAbsError = diff; 870 maxAbsError = diff;
871 } 871 }
872 // Keep track of the location of the max relative error, ignorin g cases where the 872 // Keep track of the location of the max relative error, ignorin g cases where the
873 // relative error is ininfinity (because the expected value = 0) . 873 // relative error is NaN.
874 var relError = diff / Math.abs(expected[i]); 874 var relError = diff / Math.abs(expected[i]);
875 if (isFinite(relError) && relError > maxRelError) { 875 if (!isNaN(relError) && relError > maxRelError) {
876 maxRelErrorIndex = i; 876 maxRelErrorIndex = i;
877 maxRelError = relError; 877 maxRelError = relError;
878 } 878 }
879 } 879 }
880 } 880 }
881 881
882 var numberOfmismatches = Object.keys(mismatches).length; 882 var numberOfmismatches = Object.keys(mismatches).length;
883 var arrSlice = expected.slice(0, Math.min(expected.length, this.NUM_ARRA Y_LOG)); 883 var arrSlice = expected.slice(0, Math.min(expected.length, this.NUM_ARRA Y_LOG));
884 var arrStr; 884 var arrStr;
885 885
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 if (opts.hasOwnProperty('verbose')) 1057 if (opts.hasOwnProperty('verbose'))
1058 _opts.verbose = opts.verbose; 1058 _opts.verbose = opts.verbose;
1059 if (opts.hasOwnProperty('precision')) 1059 if (opts.hasOwnProperty('precision'))
1060 _opts.precision = opts.precision; 1060 _opts.precision = opts.precision;
1061 } 1061 }
1062 1062
1063 return new ShouldModel(desc, target, _opts); 1063 return new ShouldModel(desc, target, _opts);
1064 }; 1064 };
1065 1065
1066 })(); 1066 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698