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

Unified Diff: experimental/skpdiff/diff_pixels.cl

Issue 16284007: add skpdiff tool to compare bitmaps (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 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
Index: experimental/skpdiff/diff_pixels.cl
diff --git a/experimental/skpdiff/diff_pixels.cl b/experimental/skpdiff/diff_pixels.cl
new file mode 100644
index 0000000000000000000000000000000000000000..95a627ecbf0bb33af55481c3caab7c98a6ba2b91
--- /dev/null
+++ b/experimental/skpdiff/diff_pixels.cl
@@ -0,0 +1,19 @@
+#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);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698