diff options
author | 2014-02-18 14:38:22 +0000 | |
---|---|---|
committer | 2014-02-18 14:38:22 +0000 | |
commit | 4d0f008895b08a80483dde38f98f71ecb7f4f4b1 (patch) | |
tree | 0958bbd299e01f80ef6bf4c6dd51e758bb3eefc2 /gm | |
parent | 31acdeabce094e9d42f0d6db8eebcf788aaba11a (diff) |
rebaseline_server: fail fast if skpdiff binary is not available
NOTRY=True
R=rmistry@google.com
Author: epoger@google.com
Review URL: https://codereview.chromium.org/169943002
git-svn-id: http://skia.googlecode.com/svn/trunk@13484 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm')
-rw-r--r-- | gm/rebaseline_server/imagediffdb.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/gm/rebaseline_server/imagediffdb.py b/gm/rebaseline_server/imagediffdb.py index 8c010f8a2b..8cec46bc94 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 |