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

Unified Diff: tools/perf/metrics/speedindex.py

Issue 668753002: [Telemetry] Migrate bitmap.py from bitmaptools.cc to numpy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 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 | « tools/perf/measurements/screenshot.py ('k') | tools/perf/metrics/speedindex_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/metrics/speedindex.py
diff --git a/tools/perf/metrics/speedindex.py b/tools/perf/metrics/speedindex.py
index 2daff4e5b8d21d1788b40a03d59fe1b9b2cd01b5..389cd7e0c767565ab1fe4c272d7a6ce31b8e0724 100644
--- a/tools/perf/metrics/speedindex.py
+++ b/tools/perf/metrics/speedindex.py
@@ -5,7 +5,8 @@
import collections
from metrics import Metric
-from telemetry.core import bitmap
+from telemetry.image_processing import image_util
+from telemetry.image_processing import rgba_color
from telemetry.value import scalar
@@ -137,15 +138,17 @@ class SpeedIndexImpl(object):
class VideoSpeedIndexImpl(SpeedIndexImpl):
- def __init__(self):
+ def __init__(self, image_util_module=image_util):
+ # Allow image_util to be passed in so we can fake it out for testing.
super(VideoSpeedIndexImpl, self).__init__()
self._time_completeness_list = None
+ self._image_util_module = image_util_module
def Start(self, tab):
assert tab.video_capture_supported
# Blank out the current page so it doesn't count towards the new page's
# completeness.
- tab.Highlight(bitmap.WHITE)
+ tab.Highlight(rgba_color.WHITE)
# TODO(tonyg): Bitrate is arbitrary here. Experiment with screen capture
# overhead vs. speed index accuracy and set the bitrate appropriately.
tab.StartVideoCapture(min_bitrate_mbps=4)
@@ -157,9 +160,9 @@ class VideoSpeedIndexImpl(SpeedIndexImpl):
# video capture at 4mbps. We should keep this as low as possible with
# supported video compression settings.
video_capture = tab.StopVideoCapture()
- histograms = [(time, bmp.ColorHistogram(ignore_color=bitmap.WHITE,
- tolerance=8))
- for time, bmp in video_capture.GetVideoFrameIter()]
+ histograms = [(time, self._image_util_module.GetColorHistogram(
+ image, ignore_color=rgba_color.WHITE, tolerance=8))
+ for time, image in video_capture.GetVideoFrameIter()]
start_histogram = histograms[0][1]
final_histogram = histograms[-1][1]
« no previous file with comments | « tools/perf/measurements/screenshot.py ('k') | tools/perf/metrics/speedindex_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698