add skpdiff tool to compare bitmaps
- start framework for pluggable algorithms
- implement simple number of pixels different OpenCL algo
R=djsollen@google.com, bsalomon@google.com, jvanverth@google.com
Author: zachr@google.com
Review URL: https://chromiumcodereview.appspot.com/16284007
git-svn-id: http://skia.googlecode.com/svn/trunk@9616 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/skpdiff/diff_pixels.cl b/experimental/skpdiff/diff_pixels.cl
new file mode 100644
index 0000000..c1ecb52
--- /dev/null
+++ b/experimental/skpdiff/diff_pixels.cl
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#pragma OPENCL_EXTENSION cl_khr_global_int32_base_atomics
+
+const sampler_t gInSampler = CLK_NORMALIZED_COORDS_FALSE |
+ CLK_ADDRESS_CLAMP_TO_EDGE |
+ CLK_FILTER_NEAREST;
+
+__kernel void diff(read_only image2d_t baseline, read_only image2d_t test, __global int* result) {
+ int2 coord = (int2)(get_global_id(0), get_global_id(1));
+ uint4 baselinePixel = read_imageui(baseline, gInSampler, coord);
+ uint4 testPixel = read_imageui(test, gInSampler, coord);
+ int4 pixelCompare = baselinePixel == testPixel;
+ if (baselinePixel.x != testPixel.x ||
+ baselinePixel.y != testPixel.y ||
+ baselinePixel.z != testPixel.z ||
+ baselinePixel.w != testPixel.w) {
+
+ atom_inc(result);
+ }
+}
\ No newline at end of file