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

Unified Diff: gm/rebaseline_server/imagediffdb.py

Issue 169943002: rebaseline_server: fail fast if skpdiff binary is not available (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: retry after "error: old chunk mismatch" Created 6 years, 10 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: gm/rebaseline_server/imagediffdb.py
diff --git a/gm/rebaseline_server/imagediffdb.py b/gm/rebaseline_server/imagediffdb.py
index 8c010f8a2bbf364e010153a393cd15c5b03267af..8cec46bc9434fcb74ee7d1b1d2619e0411704618 100644
--- a/gm/rebaseline_server/imagediffdb.py
+++ b/gm/rebaseline_server/imagediffdb.py
@@ -31,7 +31,7 @@ sys.path.append(
'tools'))
import find_run_binary
-SKPDIFF_BINARY_NAME = 'skpdiff'
+SKPDIFF_BINARY = find_run_binary.find_path_to_program('skpdiff')
DEFAULT_IMAGE_SUFFIX = '.png'
DEFAULT_IMAGES_SUBDIR = 'images'
@@ -115,13 +115,12 @@ class DiffRecord(object):
skpdiff_csv_dir = tempfile.mkdtemp()
try:
skpdiff_csv_output = os.path.join(skpdiff_csv_dir, 'skpdiff-output.csv')
- skpdiff_binary = find_run_binary.find_path_to_program(SKPDIFF_BINARY_NAME)
expected_img = os.path.join(storage_root, expected_images_subdir,
str(expected_image_locator) + image_suffix)
actual_img = os.path.join(storage_root, actual_images_subdir,
str(actual_image_locator) + image_suffix)
find_run_binary.run_command(
- [skpdiff_binary, '-p', expected_img, actual_img,
+ [SKPDIFF_BINARY, '-p', expected_img, actual_img,
'--csv', skpdiff_csv_output, '-d', 'perceptual'])
with contextlib.closing(open(skpdiff_csv_output)) as csv_file:
for row in csv.DictReader(csv_file):
@@ -172,7 +171,10 @@ class DiffRecord(object):
def get_weighted_diff_measure(self):
"""Returns a weighted measure of image diffs, as a float between 0 and 100
- (inclusive)."""
+ (inclusive).
+
+ TODO(epoger): Delete this function, now that we have perceptual diff?
+ """
return self._weighted_diff_measure
def get_max_diff_per_channel(self):
@@ -265,6 +267,8 @@ def _calculate_weighted_diff_metric(histogram, num_pixels):
pixel between two images), calculate the weighted diff metric (a
stab at how different the two images really are).
+ TODO(epoger): Delete this function, now that we have perceptual diff?
+
Args:
histogram: PIL histogram of a per-channel diff between two images
num_pixels: integer; the total number of pixels in the diff image
@@ -274,8 +278,6 @@ def _calculate_weighted_diff_metric(histogram, num_pixels):
# TODO(epoger): As a wild guess at an appropriate metric, weight each
# different pixel by the square of its delta value. (The more different
# a pixel is from its expectation, the more we care about it.)
- # In the long term, we will probably use some metric generated by
- # skpdiff anyway.
assert(len(histogram) % VALUES_PER_BAND == 0)
num_bands = len(histogram) / VALUES_PER_BAND
max_diff = num_pixels * num_bands * (VALUES_PER_BAND - 1)**2
« 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