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

Unified Diff: content/test/data/media/depth_stream_test_utilities.js

Issue 2556943002: WebGL2 & 16-bit depth capture: Upload video to GL_RED float texture. (Closed)
Patch Set: --enable-es3-apis is required for WebGL2 on Android. Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/test/data/media/getusermedia-depth-capture.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/data/media/depth_stream_test_utilities.js
diff --git a/content/test/data/media/depth_stream_test_utilities.js b/content/test/data/media/depth_stream_test_utilities.js
index 44c51c72a64e3e5c3ab8206e7be826123631c589..0aa763e90882d24b512c42812a71123748c7775b 100644
--- a/content/test/data/media/depth_stream_test_utilities.js
+++ b/content/test/data/media/depth_stream_test_utilities.js
@@ -72,4 +72,34 @@ function verifyPixels(
}
}
return true;
+}
+
+// Although RED texture is bound to framebuffer, we read RGBA pixels to |data|.
+// Value at point (row, column) is calculated as
+// (top_left_value + (row + column) * step) % wrap_around. wrap_around is 255
+// (for Uint8) or 1.0 for float. See FakeVideoCaptureDevice for details.
+function verifyPixelsRed(
+ data, width, height, flip_y, step, wrap_around, tolerance, test_name) {
+ var rowsColumnsToCheck = [[1, 1],
+ [0, width - 1],
+ [height - 1, 0],
+ [height - 1, width - 1],
+ [height - 3, width - 3]];
+
+ // Calculate all reference points based on top left and compare.
+ for (var j = 0; j < rowsColumnsToCheck.length; ++j) {
+ var row = rowsColumnsToCheck[j][0];
+ var column = rowsColumnsToCheck[j][1];
+ var i = (width * row + column) * 4;
+ var calculated = (data[0] + wrap_around +
+ step * ((flip_y ? -row : row) + column)) % wrap_around;
+ if (Math.abs(calculated - data[i]) > tolerance) {
+ return Promise.reject(test_name + ": reference value " + data[i] +
+ " differs from calculated: " + calculated +
+ " at index (row, column) " + i + " (" + row + ", " + column +
+ "). TopLeft value:" + data[0] + ", step:" + step + ", flip_y:" +
+ flip_y);
+ }
+ }
+ return true;
}
« no previous file with comments | « no previous file | content/test/data/media/getusermedia-depth-capture.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698