function verifyPixels(
    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;
}
// (for Uint8) or 1.0 for float. See FakeVideoCaptureDevice for details.
(for Uint8) or 1.0 for float. See FakeVideoCaptureDevice for details.
( for Uint8 ) or 1 . 0 for float . See FakeVideoCaptureDevice for details .
function verifyPixels(
    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]];
  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;
}
function verifyPixels ( 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 ] ] ; 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 ; }
(for Uint8) or 1.0 for float.
( for Uint8 ) or 1 . 0 for float .
// Calculate all reference points based on top left and compare.