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

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

Issue 1132333006: Try switching black frame algorithm to a luma-based algorithm. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/data/media/webrtc_test_utilities.js
diff --git a/content/test/data/media/webrtc_test_utilities.js b/content/test/data/media/webrtc_test_utilities.js
index 5fd38113882b7c6bf7f9db219850291da9e4d2c6..3e623df4a12ad9e770ec081dc230ebb446800382 100644
--- a/content/test/data/media/webrtc_test_utilities.js
+++ b/content/test/data/media/webrtc_test_utilities.js
@@ -187,13 +187,14 @@ function isVideoPlaying(pixels, previousPixels) {
}
function isVideoBlack(pixels) {
- for (var i = 0; i < pixels.length; i++) {
- // |pixels| is in RGBA. Ignore the alpha channel.
- // We allow it to be off by 1, to account for rounding errors in YUV
- // conversion.
- if (pixels[i] != 0 && pixels[i] != 1 && (i + 1) % 4 != 0) {
+ var threshold = 20;
+ var accumulatedLuma = 0;
+ for (var i = 4; i < pixels.length; i += 4) {
kjellander_chromium 2015/05/19 08:08:54 Please keep the comment about that |pixels| is in
phoglund_chromium 2015/05/19 09:01:19 Done.
+ // Use Luma as in Rec. 709: Y′709 = 0.21R + 0.72G + 0.07B;
kjellander_chromium 2015/05/19 08:08:54 I'm new to color space standards, but according to
phoglund_chromium 2015/05/19 09:01:20 Done.
+ accumulatedLuma +=
+ 0.21 * pixels[i] + 0.72 * pixels[i + 1] + 0.07 * pixels[i + 2];
kjellander_chromium 2015/05/19 08:08:54 Can you extract what's after += to a function?
phoglund_chromium 2015/05/19 09:01:19 Done.
+ if (accumulatedLuma > threshold * i / 4)
return false;
- }
}
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698