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

Side by Side Diff: content/test/data/media/depth_stream_test_utilities.js

Issue 2767063002: 16-bit video upload to float: intermediate R16_EXT and copy to float. (Closed)
Patch Set: Nit. Created 3 years, 7 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 function getConstraintsForDevice(deviceLabel) { 5 function getConstraintsForDevice(deviceLabel) {
6 return new Promise(function(resolve, reject) { 6 return new Promise(function(resolve, reject) {
7 navigator.mediaDevices.enumerateDevices() 7 navigator.mediaDevices.enumerateDevices()
8 .then(function(devices) { 8 .then(function(devices) {
9 for (var i = 0; i < devices.length; ++i) { 9 for (var i = 0; i < devices.length; ++i) {
10 if (deviceLabel == devices[i].label) { 10 if (deviceLabel == devices[i].label) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // (top_left_value + (row + column) * step) % wrap_around. wrap_around is 255 47 // (top_left_value + (row + column) * step) % wrap_around. wrap_around is 255
48 // (for Uint8) or 1.0 for float. See FakeVideoCaptureDevice for details. 48 // (for Uint8) or 1.0 for float. See FakeVideoCaptureDevice for details.
49 function verifyPixels( 49 function verifyPixels(
50 data, width, height, flip_y, step, wrap_around, tolerance, test_name) { 50 data, width, height, flip_y, step, wrap_around, tolerance, test_name) {
51 var rowsColumnsToCheck = [[1, 1], 51 var rowsColumnsToCheck = [[1, 1],
52 [0, width - 1], 52 [0, width - 1],
53 [height - 1, 0], 53 [height - 1, 0],
54 [height - 1, width - 1], 54 [height - 1, width - 1],
55 [height - 3, width - 3]]; 55 [height - 3, width - 3]];
56 56
57 // Same value is expected for all color components.
58 if (data[0] != data[1] || data[0] != data[2]) {
59 return Promise.reject(test_name + ": values " + data[0] + ", " + data[1] +
60 ", " + data[2] + " differ at top left.");
61 }
62
63 // Calculate all reference points based on top left and compare. 57 // Calculate all reference points based on top left and compare.
64 for (var j = 0; j < rowsColumnsToCheck.length; ++j) { 58 for (var j = 0; j < rowsColumnsToCheck.length; ++j) {
65 var row = rowsColumnsToCheck[j][0]; 59 var row = rowsColumnsToCheck[j][0];
66 var column = rowsColumnsToCheck[j][1]; 60 var column = rowsColumnsToCheck[j][1];
67 var i = (width * row + column) * 4; 61 var i = (width * row + column) * 4;
68 if (data[i] != data[i + 1] || data[i] != data[i + 2]) {
69 return Promise.reject(test_name + ": values " + data[i] + ", " +
70 data[i + 1] + ", " + data[i + 2] +
71 " differ at index " + i);
72 }
73 var calculated = (data[0] + wrap_around + 62 var calculated = (data[0] + wrap_around +
74 step * ((flip_y ? -row : row) + column)) % wrap_around; 63 step * ((flip_y ? -row : row) + column)) % wrap_around;
75 if (Math.abs(calculated - data[i]) > tolerance) { 64 if (Math.abs(calculated - data[i]) > tolerance) {
76 return Promise.reject(test_name + ": reference value " + data[i] + 65 return Promise.reject(test_name + ": reference value " + data[i] +
77 " differs from calculated: " + calculated + 66 " differs from calculated: " + calculated +
78 " at index (row, column) " + i + " (" + row + ", " + column + 67 " at index (row, column) " + i + " (" + row + ", " + column +
79 "). TopLeft value:" + data[0] + ", step:" + step + ", flip_y:" + 68 "). TopLeft value:" + data[0] + ", step:" + step + ", flip_y:" +
80 flip_y); 69 flip_y);
81 } 70 }
82 } 71 }
83 return true; 72 return true;
84 } 73 }
85
86 // Although RED texture is bound to framebuffer, we read RGBA pixels to |data|.
87 // Value at point (row, column) is calculated as
88 // (top_left_value + (row + column) * step) % wrap_around. wrap_around is 255
89 // (for Uint8) or 1.0 for float. See FakeVideoCaptureDevice for details.
90 function verifyPixelsRed(
91 data, width, height, flip_y, step, wrap_around, tolerance, test_name) {
92 var rowsColumnsToCheck = [[1, 1],
93 [0, width - 1],
94 [height - 1, 0],
95 [height - 1, width - 1],
96 [height - 3, width - 3]];
97
98 // Calculate all reference points based on top left and compare.
99 for (var j = 0; j < rowsColumnsToCheck.length; ++j) {
100 var row = rowsColumnsToCheck[j][0];
101 var column = rowsColumnsToCheck[j][1];
102 var i = (width * row + column) * 4;
103 var calculated = (data[0] + wrap_around +
104 step * ((flip_y ? -row : row) + column)) % wrap_around;
105 if (Math.abs(calculated - data[i]) > tolerance) {
106 return Promise.reject(test_name + ": reference value " + data[i] +
107 " differs from calculated: " + calculated +
108 " at index (row, column) " + i + " (" + row + ", " + column +
109 "). TopLeft value:" + data[0] + ", step:" + step + ", flip_y:" +
110 flip_y);
111 }
112 }
113 return true;
114 }
OLDNEW
« no previous file with comments | « content/renderer/media/webmediaplayer_ms.cc ('k') | content/test/data/media/getusermedia-depth-capture.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698