summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Ni <yangni@google.com>2016-06-28 21:16:56 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-06-28 21:16:57 +0000
commit2cb8db45d4403385e1b9bfc3dc0d94a64f895365 (patch)
tree22e9cdca5798d0058dd8a546e50ceeb21ae0ce97
parent64e87aa34257c4699808343f2f02b585d97420c4 (diff)
parentbc91299ca0380a1010d8117439d2d1ae29baad6a (diff)
downloadcts-2cb8db45d4403385e1b9bfc3dc0d94a64f895365.tar.gz
Merge "Remove data race from refocus test" into nyc-dev
-rw-r--r--tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/RefocusFilterd1new.java10
-rw-r--r--tests/tests/renderscript/src/android/renderscript/cts/refocus/layered_filter_fast_d1new.rs10
2 files changed, 11 insertions, 9 deletions
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/RefocusFilterd1new.java b/tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/RefocusFilterd1new.java
index 3942982d600..52bc4de1b80 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/RefocusFilterd1new.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/RefocusFilterd1new.java
@@ -143,8 +143,9 @@ public class RefocusFilterd1new extends
startnow = System.nanoTime();
//scriptC.forEach_MarkLayerMask(buffers.inAllocation);
- // Pass sharp meta allocation directly into the kernel
- scriptC.forEach_MarkLayerMaskPassInput(buffers.sharpActualDepthAllocation, buffers.sharpDilatedDepthAllocation);
+ // Pass the sharp actual depth allocation directly into the kernel, and modify the dilated depth
+ // allocation which is set as a global.
+ scriptC.forEach_MarkLayerMaskPassInput(buffers.sharpActualDepthAllocation);
endnow = System.nanoTime();
Log.d(myTAG, "MarkLayerMask: "+(endnow - startnow)+ " ns" );
@@ -213,8 +214,9 @@ public class RefocusFilterd1new extends
startnow = System.nanoTime();
//scriptC.forEach_MarkLayerMask(buffers.inAllocation);
- // Pass sharp meta allocation directly into the kernel
- scriptC.forEach_MarkLayerMaskPassInput(buffers.sharpActualDepthAllocation, buffers.sharpDilatedDepthAllocation);
+ // Pass the sharp actual depth allocation directly into the kernel, and modify the dilated depth
+ // allocation which is set as a global.
+ scriptC.forEach_MarkLayerMaskPassInput(buffers.sharpActualDepthAllocation);
endnow = System.nanoTime();
Log.d(myTAG, "MarkLayerMask: "+(endnow - startnow)+ " ns" );
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/refocus/layered_filter_fast_d1new.rs b/tests/tests/renderscript/src/android/renderscript/cts/refocus/layered_filter_fast_d1new.rs
index e7342c624af..e21db8aa408 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/refocus/layered_filter_fast_d1new.rs
+++ b/tests/tests/renderscript/src/android/renderscript/cts/refocus/layered_filter_fast_d1new.rs
@@ -181,8 +181,8 @@ void __attribute__((kernel)) MarkLayerMask(uchar4 in, uint32_t x, uint32_t y) {
// Another version of MarkLayerMask kernel that directly passes input allocation to kernels
// Input: g_sharp_actual_depth
// Output: g_sharp_dilated_depth
-uchar __attribute__((kernel)) MarkLayerMaskPassInput(uchar in_sharp_actual_depth, uint32_t x) {
- if (!OnTheLayer(in_sharp_actual_depth, g_target_layer_i2)) return rsGetElementAt_uchar(g_sharp_dilated_depth, x);
+void __attribute__((kernel)) MarkLayerMaskPassInput(uchar in_sharp_actual_depth, uint32_t x) {
+ if (!OnTheLayer(in_sharp_actual_depth, g_target_layer_i2)) return;
// Marks this pixel as active.
rsSetElementAt_uchar(g_sharp_active, 1, x);
@@ -209,7 +209,8 @@ uchar __attribute__((kernel)) MarkLayerMaskPassInput(uchar in_sharp_actual_depth
ValidDepthNotOnTheLayer(sharp_actual_depth, g_target_layer_i2);
if (!is_this_pixel_on_boundary) {
- return in_sharp_actual_depth;
+ rsSetElementAt_uchar(g_sharp_dilated_depth, in_sharp_actual_depth, x);
+ return;
}
// Marks pixels near the boundary of active pixels to compute matte later.
@@ -235,9 +236,8 @@ uchar __attribute__((kernel)) MarkLayerMaskPassInput(uchar in_sharp_actual_depth
}
current_meta_index += jump_to_next_row;
}
-
- return in_sharp_actual_depth;
}
+
// Distance transform in processing layers in pass one from the back-most to
// the sharp depth.
void __attribute__((kernel))