Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> | 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> |
| 4 <script type="text/javascript"> | 4 <script type="text/javascript"> |
| 5 $ = function(id) { | 5 $ = function(id) { |
| 6 return document.getElementById(id); | 6 return document.getElementById(id); |
| 7 }; | 7 }; |
| 8 | 8 |
| 9 setAllEventsOccuredHandler(function() { | 9 setAllEventsOccuredHandler(function() { |
| 10 reportTestSuccess(); | 10 reportTestSuccess(); |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 476 // We are interested in a window starting from the center of the image | 476 // We are interested in a window starting from the center of the image |
| 477 // where we expect the circle from the fake video capture to be rolling. | 477 // where we expect the circle from the fake video capture to be rolling. |
| 478 var pixels = context.getImageData(width / 2, height / 2, | 478 var pixels = context.getImageData(width / 2, height / 2, |
| 479 aperture, aperture); | 479 aperture, aperture); |
| 480 | 480 |
| 481 var lightGreenPixelsX = 0; | 481 var lightGreenPixelsX = 0; |
| 482 var lightGreenPixelsY = 0; | 482 var lightGreenPixelsY = 0; |
| 483 | 483 |
| 484 // Walk horizontally counting light green pixels. | 484 // Walk horizontally counting light green pixels. |
| 485 for (var x = 0; x < aperture; ++x) { | 485 for (var x = 0; x < aperture; ++x) { |
| 486 if (pixels.data[4 * x + 1] != COLOR_BACKGROUND_GREEN) | 486 if (Math.abs(pixels.data[4 * x + 1] - COLOR_BACKGROUND_GREEN) > |
| 487 COLOR_BACKGROUND_GREEN_THRESHOLD) | |
|
phoglund_chromium
2015/10/13 08:07:01
I think you might as well inline the threshold con
emircan
2015/10/13 18:12:27
Done.
| |
| 487 lightGreenPixelsX++; | 488 lightGreenPixelsX++; |
| 488 } | 489 } |
| 489 // Walk vertically counting light green pixels. | 490 // Walk vertically counting light green pixels. |
| 490 for (var y = 0; y < aperture; ++y) { | 491 for (var y = 0; y < aperture; ++y) { |
| 491 if (pixels.data[4 * y * aperture + 1] != COLOR_BACKGROUND_GREEN) | 492 if (Math.abs(pixels.data[4 * y * aperture + 1] - |
| 493 COLOR_BACKGROUND_GREEN) > COLOR_BACKGROUND_GREEN_THRESHOLD) | |
| 492 lightGreenPixelsY++; | 494 lightGreenPixelsY++; |
| 493 } | 495 } |
| 494 if (lightGreenPixelsX > maxLightGreenPixelsX) | 496 if (lightGreenPixelsX > maxLightGreenPixelsX) |
| 495 maxLightGreenPixelsX = lightGreenPixelsX; | 497 maxLightGreenPixelsX = lightGreenPixelsX; |
| 496 if (lightGreenPixelsY > maxLightGreenPixelsY) | 498 if (lightGreenPixelsY > maxLightGreenPixelsY) |
| 497 maxLightGreenPixelsY = lightGreenPixelsY; | 499 maxLightGreenPixelsY = lightGreenPixelsY; |
| 498 | 500 |
| 499 // Allow maxLightGreenPixelsY = maxLightGreenPixelsX +-1 due to | 501 // Allow maxLightGreenPixelsY = maxLightGreenPixelsX +-1 due to |
| 500 // possible subpixel rendering on Mac and Android. | 502 // possible subpixel rendering on Mac and Android. |
| 501 if (maxLightGreenPixelsY > maxLightGreenPixelsX + 1 || | 503 if (maxLightGreenPixelsY > maxLightGreenPixelsX + 1 || |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 </tr> | 535 </tr> |
| 534 <tr> | 536 <tr> |
| 535 <td><video id="local-view-2" width="320" height="240" autoplay | 537 <td><video id="local-view-2" width="320" height="240" autoplay |
| 536 style="display:none"></video></td> | 538 style="display:none"></video></td> |
| 537 <td><canvas id="local-view-2-canvas" width="320" height="240" | 539 <td><canvas id="local-view-2-canvas" width="320" height="240" |
| 538 style="display:none"></canvas></td> | 540 style="display:none"></canvas></td> |
| 539 </tr> | 541 </tr> |
| 540 </table> | 542 </table> |
| 541 </body> | 543 </body> |
| 542 </html> | 544 </html> |
| OLD | NEW |