am 3986d5e3: Update ApiLevel-18 reference images to CtsThemeHostTestCases and delete CtsHoloTestCases
* commit '3986d5e3a1b71843a982ece781251f40ccdf840d':
Update ApiLevel-18 reference images to CtsThemeHostTestCases and delete CtsHoloTestCases
diff --git a/CtsCoverage.mk b/CtsCoverage.mk
index 8d67a99..4689bae 100644
--- a/CtsCoverage.mk
+++ b/CtsCoverage.mk
@@ -78,8 +78,6 @@
$(hide) echo $(1): file://$(ANDROID_BUILD_TOP)/$(coverage_out)/$(5)
endef
-# classes.dex is stripped from package.apk if dex-preopt is enabled,
-# so we use the copy that definitely includes classes.dex.
define add-testcase-apk
- $(1) += $(call intermediates-dir-for,APPS,$(2))/package.apk.unaligned
+ $(1) += $(call intermediates-dir-for,APPS,$(2))/package.apk
endef
diff --git a/apps/CtsVerifier/Android.mk b/apps/CtsVerifier/Android.mk
index 3b1674e..834320b 100644
--- a/apps/CtsVerifier/Android.mk
+++ b/apps/CtsVerifier/Android.mk
@@ -32,6 +32,8 @@
LOCAL_SDK_VERSION := current
+LOCAL_DEX_PREOPT := false
+
include $(BUILD_PACKAGE)
# Builds and launches CTS Verifier on a device.
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/location/GpsTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/location/GpsTestActivity.java
index da1ee88..4909497 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/location/GpsTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/location/GpsTestActivity.java
@@ -155,6 +155,12 @@
@Override
public void pass() {
log("OK!\n", Color.GREEN);
+ try {
+ Thread.sleep(2000);
+ log("(Sleep 2 second) \n", Color.GREEN);
+ } catch (InterruptedException e) {
+ fail("unexpected InterruptedException when sleep");
+ }
mLocationVerifier = null;
nextTest();
}
diff --git a/suite/audio_quality/client/Android.mk b/suite/audio_quality/client/Android.mk
index 090c758..6d60541 100644
--- a/suite/audio_quality/client/Android.mk
+++ b/suite/audio_quality/client/Android.mk
@@ -30,4 +30,6 @@
# intentional to keep compatibility with ICS
LOCAL_SDK_VERSION := 15
+LOCAL_DEX_PREOPT := false
+
include $(BUILD_PACKAGE)
diff --git a/tests/ProcessTest/Android.mk b/tests/ProcessTest/Android.mk
index ba58e87..4f23fac 100644
--- a/tests/ProcessTest/Android.mk
+++ b/tests/ProcessTest/Android.mk
@@ -28,6 +28,8 @@
LOCAL_PACKAGE_NAME := ProcessTests
+LOCAL_DEX_PREOPT := false
+
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/ProcessTest/NoShareUidApp/Android.mk b/tests/ProcessTest/NoShareUidApp/Android.mk
index 66bf8ce..c57d71d 100644
--- a/tests/ProcessTest/NoShareUidApp/Android.mk
+++ b/tests/ProcessTest/NoShareUidApp/Android.mk
@@ -26,5 +26,6 @@
LOCAL_PACKAGE_NAME := NoShareUidApp
LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_DEX_PREOPT := false
include $(BUILD_PACKAGE)
diff --git a/tests/ProcessTest/ShareUidApp/Android.mk b/tests/ProcessTest/ShareUidApp/Android.mk
index aeb4661..131f768 100644
--- a/tests/ProcessTest/ShareUidApp/Android.mk
+++ b/tests/ProcessTest/ShareUidApp/Android.mk
@@ -26,5 +26,6 @@
LOCAL_PACKAGE_NAME := ShareUidApp
LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_DEX_PREOPT := false
include $(BUILD_PACKAGE)
diff --git a/tests/SignatureTest/tests/Android.mk b/tests/SignatureTest/tests/Android.mk
index b458aad..bdd0a90 100644
--- a/tests/SignatureTest/tests/Android.mk
+++ b/tests/SignatureTest/tests/Android.mk
@@ -17,4 +17,6 @@
LOCAL_PROGUARD_FLAGS := -ignorewarnings
+LOCAL_DEX_PREOPT := false
+
include $(BUILD_PACKAGE)
diff --git a/tests/core/ctscore.mk b/tests/core/ctscore.mk
index 1e4e017..95f4634 100644
--- a/tests/core/ctscore.mk
+++ b/tests/core/ctscore.mk
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-LOCAL_JAVA_LIBRARIES := android.test.runner bouncycastle
+LOCAL_JAVA_LIBRARIES := android.test.runner bouncycastle conscrypt
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_DEX_PREOPT := false
diff --git a/tests/src/android/renderscript/cts/acos_f32.rs b/tests/src/android/renderscript/cts/acos_f32.rs
new file mode 100644
index 0000000..4bc948b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/acos_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void acos_f32_1 (const float* in, float* out) {
+ *out = acos(*in);
+}
+
+void acos_f32_2 (const float2* in, float2* out) {
+ *out = acos(*in);
+}
+
+void acos_f32_3 (const float3* in, float3* out) {
+ *out = acos(*in);
+}
+
+void acos_f32_4 (const float4* in , float4* out) {
+ *out = acos(*in);
+}
diff --git a/tests/src/android/renderscript/cts/acosh_f32.rs b/tests/src/android/renderscript/cts/acosh_f32.rs
new file mode 100644
index 0000000..8784b02
--- /dev/null
+++ b/tests/src/android/renderscript/cts/acosh_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void acosh_f32_1 (const float* in, float* out) {
+ *out = acosh(*in);
+}
+
+void acosh_f32_2 (const float2* in, float2* out) {
+ *out = acosh(*in);
+}
+
+void acosh_f32_3 (const float3* in, float3* out) {
+ *out = acosh(*in);
+}
+
+void acosh_f32_4 (const float4* in , float4* out) {
+ *out = acosh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/acospi_f32.rs b/tests/src/android/renderscript/cts/acospi_f32.rs
new file mode 100644
index 0000000..66d89eb
--- /dev/null
+++ b/tests/src/android/renderscript/cts/acospi_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void acospi_f32_1 (const float* in, float* out) {
+ *out = acospi(*in);
+}
+
+void acospi_f32_2 (const float2* in, float2* out) {
+ *out = acospi(*in);
+}
+
+void acospi_f32_3 (const float3* in, float3* out) {
+ *out = acospi(*in);
+}
+
+void acospi_f32_4 (const float4* in, float4* out) {
+ *out = acospi(*in);
+}
diff --git a/tests/src/android/renderscript/cts/allocationCopy2DRange.rs b/tests/src/android/renderscript/cts/allocationCopy2DRange.rs
new file mode 100644
index 0000000..79aa552
--- /dev/null
+++ b/tests/src/android/renderscript/cts/allocationCopy2DRange.rs
@@ -0,0 +1,14 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+uint32_t width;
+uint32_t height;
+
+rs_allocation mIn;
+rs_allocation mOut;
+
+void testAllocationCopy2DRange() {
+ rsAllocationCopy2DRange(mOut, 0, 0, 0, RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X,
+ width, height, mIn, 0, 0, 0,
+ RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X);
+}
diff --git a/tests/src/android/renderscript/cts/allocation_resize.rs b/tests/src/android/renderscript/cts/allocation_resize.rs
new file mode 100644
index 0000000..0c85d9d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/allocation_resize.rs
@@ -0,0 +1,7 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+
+void root(const int *in, int *out) {
+ *out = *in;
+}
diff --git a/tests/src/android/renderscript/cts/asin_f32.rs b/tests/src/android/renderscript/cts/asin_f32.rs
new file mode 100644
index 0000000..5f062f9
--- /dev/null
+++ b/tests/src/android/renderscript/cts/asin_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void asin_f32_1 (const float* in, float* out) {
+ *out = asin(*in);
+}
+
+void asin_f32_2 (const float2* in, float2* out) {
+ *out = asin(*in);
+}
+
+void asin_f32_3 (const float3* in, float3* out) {
+ *out = asin(*in);
+}
+
+void asin_f32_4 (const float4* in , float4* out) {
+ *out = asin (*in) ;
+}
diff --git a/tests/src/android/renderscript/cts/asinh_f32.rs b/tests/src/android/renderscript/cts/asinh_f32.rs
new file mode 100644
index 0000000..8252507
--- /dev/null
+++ b/tests/src/android/renderscript/cts/asinh_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void asinh_f32_1 (const float* in, float* out) {
+ *out = asinh(*in);
+}
+
+void asinh_f32_2 (const float2* in, float2* out) {
+ *out = asinh(*in);
+}
+
+void asinh_f32_3 (const float3* in, float3* out) {
+ *out = asinh(*in);
+}
+
+void asinh_f32_4 (const float4* in, float4* out) {
+ *out = asinh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/asinpi_f32.rs b/tests/src/android/renderscript/cts/asinpi_f32.rs
new file mode 100644
index 0000000..66bf1d7
--- /dev/null
+++ b/tests/src/android/renderscript/cts/asinpi_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void asinpi_f32_1 (const float* in, float* out) {
+ *out = asinpi(*in);
+}
+
+void asinpi_f32_2 (const float2* in, float2* out) {
+ *out = asinpi(*in);
+}
+
+void asinpi_f32_3 (const float3* in, float3* out) {
+ *out = asinpi(*in);
+}
+
+void asinpi_f32_4 (const float4* in, float4* out) {
+ *out = asinpi(*in);
+}
diff --git a/tests/src/android/renderscript/cts/atan2_f32.rs b/tests/src/android/renderscript/cts/atan2_f32.rs
new file mode 100644
index 0000000..e1bab48
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atan2_f32.rs
@@ -0,0 +1,38 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct atan2_f32_in {
+ float first;
+ float second;
+} input;
+
+void atan2_f32_1(const input* in, float* out){
+ *out = atan2(in->first, in->second);
+}
+
+typedef struct atan2_f32_2_in {
+ float2 first;
+ float2 second;
+} input2;
+
+void atan2_f32_2(const input2* in, float2* out){
+ *out = atan2(in->first, in->second);
+}
+
+typedef struct atan2_f32_3_in {
+ float3 first;
+ float3 second;
+} input3;
+
+void atan2_f32_3(const input3* in, float3* out){
+ *out = atan2(in->first, in->second);
+}
+
+typedef struct atan2_f32_4_in {
+ float4 first;
+ float4 second;
+} input4;
+
+void atan2_f32_4(const input4* in, float4* out){
+ *out = atan2(in->first, in->second);
+}
diff --git a/tests/src/android/renderscript/cts/atan2pi_f32.rs b/tests/src/android/renderscript/cts/atan2pi_f32.rs
new file mode 100644
index 0000000..2fe52d8
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atan2pi_f32.rs
@@ -0,0 +1,38 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct atan2pi_float_input {
+ float x;
+ float y;
+};
+
+void atan2pi_f32_1 (const struct atan2pi_float_input* in, float* out) {
+ *out = atan2pi(in->x, in->y);
+}
+
+struct atan2pi_float2_input {
+ float2 x;
+ float2 y;
+};
+
+void atan2pi_f32_2 (const struct atan2pi_float2_input* in, float2* out) {
+ *out = atan2pi(in->x, in->y);
+}
+
+struct atan2pi_float3_input {
+ float3 x;
+ float3 y;
+};
+
+void atan2pi_f32_3 (const struct atan2pi_float3_input* in, float3* out) {
+ *out = atan2pi(in->x, in->y);
+}
+
+struct atan2pi_float4_input {
+ float4 x;
+ float4 y;
+};
+
+void atan2pi_f32_4 (const struct atan2pi_float4_input* in, float4* out) {
+ *out = atan2pi(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/atan_f32.rs b/tests/src/android/renderscript/cts/atan_f32.rs
new file mode 100644
index 0000000..65a5ab5
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atan_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void atan_f32_1 (const float* in, float* out) {
+ *out = atan(*in);
+}
+
+void atan_f32_2 (const float2* in, float2* out) {
+ *out = atan(*in);
+}
+
+void atan_f32_3 (const float3* in, float3* out) {
+ *out = atan(*in);
+}
+
+void atan_f32_4 (const float4* in, float4* out) {
+ *out =atan(*in);
+}
diff --git a/tests/src/android/renderscript/cts/atanh_f32.rs b/tests/src/android/renderscript/cts/atanh_f32.rs
new file mode 100644
index 0000000..1f61e5e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atanh_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void atanh_f32_1 (const float* in, float* out) {
+ *out = atanh(*in);
+}
+
+void atanh_f32_2 (const float2* in, float2* out) {
+ *out = atanh(*in);
+}
+
+void atanh_f32_3 (const float3* in, float3* out) {
+ *out = atanh(*in);
+}
+
+void atanh_f32_4 (const float4* in, float4* out) {
+ *out = atanh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/atanpi_f32.rs b/tests/src/android/renderscript/cts/atanpi_f32.rs
new file mode 100644
index 0000000..182a43c
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atanpi_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void atanpi_f32_1 (const float* in, float* out) {
+ *out = atanpi(*in);
+}
+
+void atanpi_f32_2 (const float2* in, float2* out) {
+ *out = atanpi(*in);
+}
+
+void atanpi_f32_3 (const float3* in, float3* out) {
+ *out = atanpi(*in);
+}
+
+void atanpi_f32_4 (const float4* in, float4* out) {
+ *out = atanpi(*in);
+}
diff --git a/tests/src/android/renderscript/cts/cbrt_f32.rs b/tests/src/android/renderscript/cts/cbrt_f32.rs
new file mode 100644
index 0000000..273e8a4
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cbrt_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void cbrt_f32_1(const float *in, float *out) {
+ *out = cbrt(*in);
+}
+
+void cbrt_f32_2(const float2 *in, float2 *out) {
+ *out = cbrt(*in);
+}
+
+void cbrt_f32_3(const float3 *in, float3 *out) {
+ *out = cbrt(*in);
+}
+
+void cbrt_f32_4(const float4 *in, float4 *out) {
+ *out = cbrt(*in);
+}
diff --git a/tests/src/android/renderscript/cts/ceil_f32.rs b/tests/src/android/renderscript/cts/ceil_f32.rs
new file mode 100644
index 0000000..c0817e2
--- /dev/null
+++ b/tests/src/android/renderscript/cts/ceil_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void ceil_f32_1(const float *in, float *out) {
+ *out = ceil(*in);
+}
+
+void ceil_f32_2(const float2 *in, float2 *out) {
+ *out = ceil(*in);
+}
+
+void ceil_f32_3(const float3 *in, float3 *out) {
+ *out = ceil(*in);
+}
+
+void ceil_f32_4(const float4 *in, float4 *out) {
+ *out = ceil(*in);
+}
diff --git a/tests/src/android/renderscript/cts/clear_object.rs b/tests/src/android/renderscript/cts/clear_object.rs
new file mode 100644
index 0000000..0bee38b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/clear_object.rs
@@ -0,0 +1,42 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_allocation allocation;
+
+void clear_allocation(int *out)
+{
+ rsClearObject( &allocation );
+ *out = ( NULL == allocation.p ? 1 : 0 );
+}
+
+rs_element element;
+
+void clear_element(int *out)
+{
+ rsClearObject( &element );
+ *out = ( NULL == element.p ? 1 : 0 );
+}
+
+rs_sampler sampler;
+
+void clear_sampler(int *out)
+{
+ rsClearObject( &sampler );
+ *out = ( NULL == sampler.p ? 1 : 0 );
+}
+
+rs_script script;
+
+void clear_script(int *out)
+{
+ rsClearObject( &script );
+ *out = ( NULL == script.p ? 1 : 0 );
+}
+
+rs_type type;
+
+void clear_type(int *out)
+{
+ rsClearObject( &type );
+ *out = ( NULL == type.p ? 1 : 0 );
+}
diff --git a/tests/src/android/renderscript/cts/copysign_f32.rs b/tests/src/android/renderscript/cts/copysign_f32.rs
new file mode 100644
index 0000000..b0b300d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/copysign_f32.rs
@@ -0,0 +1,38 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct copysign_f32_input {
+ float x;
+ float y;
+};
+
+void copysign_f32_1(const struct copysign_f32_input *in, float *out) {
+ *out = copysign(in->x, in->y);
+}
+
+struct copysign_f32_2_input {
+ float2 x;
+ float2 y;
+};
+
+void copysign_f32_2(const struct copysign_f32_2_input *in, float2 *out) {
+ *out = copysign(in->x, in->y);
+}
+
+struct copysign_f32_3_input {
+ float3 x;
+ float3 y;
+};
+
+void copysign_f32_3(const struct copysign_f32_3_input *in, float3 *out) {
+ *out = copysign(in->x, in->y);
+}
+
+struct copysign_f32_4_input {
+ float4 x;
+ float4 y;
+};
+
+void copysign_f32_4(const struct copysign_f32_4_input *in, float4 *out) {
+ *out = copysign(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/cos_f32.rs b/tests/src/android/renderscript/cts/cos_f32.rs
new file mode 100644
index 0000000..fd061dc
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cos_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void cos_f32_1(const float *in, float *out) {
+ *out = cos(*in);
+}
+
+void cos_f32_2(const float2 *in, float2 *out) {
+ *out = cos(*in);
+}
+
+void cos_f32_3(const float3 *in, float3 *out) {
+ *out = cos(*in);
+}
+
+void cos_f32_4(const float4 *in, float4 *out) {
+ *out = cos(*in);
+}
diff --git a/tests/src/android/renderscript/cts/cosh_f32.rs b/tests/src/android/renderscript/cts/cosh_f32.rs
new file mode 100644
index 0000000..0f2ab0f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cosh_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void cosh_f32_1(const float *in, float *out) {
+ *out = cosh(*in);
+}
+
+void cosh_f32_2(const float2 *in, float2 *out) {
+ *out = cosh(*in);
+}
+
+void cosh_f32_3(const float3 *in, float3 *out) {
+ *out = cosh(*in);
+}
+
+void cosh_f32_4(const float4 *in, float4 *out) {
+ *out = cosh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/cross_f32.rs b/tests/src/android/renderscript/cts/cross_f32.rs
new file mode 100644
index 0000000..e996e5f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cross_f32.rs
@@ -0,0 +1,19 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+typedef struct _cross_f32_3_struct {
+ float3 low;
+ float3 high;
+} cross_f32_3_struct;
+
+void cross_f32_3(const cross_f32_3_struct *in, float3 *out) {
+ *out = cross(in->low, in->high);
+}
+
+typedef struct _cross_f32_4_struct {
+ float4 low;
+ float4 high;
+} cross_f32_4_struct;
+
+void cross_f32_4(const cross_f32_4_struct *in, float4 *out) {
+ *out = cross(in->low, in->high);
+}
diff --git a/tests/src/android/renderscript/cts/degrees_f32.rs b/tests/src/android/renderscript/cts/degrees_f32.rs
new file mode 100644
index 0000000..e571246
--- /dev/null
+++ b/tests/src/android/renderscript/cts/degrees_f32.rs
@@ -0,0 +1,21 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void degrees_f32_1(const float* in, float* out) {
+ *out = degrees(*in);
+}
+
+void degrees_f32_2(const float2* in, float2* out) {
+ *out = degrees (*in);
+
+}
+
+void degrees_f32_3(const float3* in, float3* out) {
+ *out = degrees(*in);
+
+}
+
+void degrees_f32_4(const float4* in, float4* out) {
+ *out = degrees(*in);
+
+}
diff --git a/tests/src/android/renderscript/cts/exp10_f32.rs b/tests/src/android/renderscript/cts/exp10_f32.rs
new file mode 100644
index 0000000..67f5c26
--- /dev/null
+++ b/tests/src/android/renderscript/cts/exp10_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void exp10_f32_1(const float *in, float *out) {
+ *out = exp10(*in);
+}
+
+void exp10_f32_2(const float2 *in, float2 *out) {
+ *out = exp10(*in);
+}
+
+void exp10_f32_3(const float3 *in, float3 *out) {
+ *out = exp10(*in);
+}
+
+void exp10_f32_4(const float4 *in, float4 *out) {
+ *out = exp10(*in);
+}
diff --git a/tests/src/android/renderscript/cts/exp2_f32.rs b/tests/src/android/renderscript/cts/exp2_f32.rs
new file mode 100644
index 0000000..9095bf3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/exp2_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void exp2_f32_1(const float *in, float *out) {
+ *out = exp2(*in);
+}
+
+void exp2_f32_2(const float2 *in, float2 *out) {
+ *out = exp2(*in);
+}
+
+void exp2_f32_3(const float3 *in, float3 *out) {
+ *out = exp2(*in);
+}
+
+void exp2_f32_4(const float4 *in, float4 *out) {
+ *out = exp2(*in);
+}
diff --git a/tests/src/android/renderscript/cts/exp_f32.rs b/tests/src/android/renderscript/cts/exp_f32.rs
new file mode 100644
index 0000000..036c490
--- /dev/null
+++ b/tests/src/android/renderscript/cts/exp_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void exp_f32_1(const float *in, float *out) {
+ *out = exp(*in);
+}
+
+void exp_f32_2(const float2 *in, float2 *out) {
+ *out = exp(*in);
+}
+
+void exp_f32_3(const float3 *in, float3 *out) {
+ *out = exp(*in);
+}
+
+void exp_f32_4(const float4 *in, float4 *out) {
+ *out = exp(*in);
+}
diff --git a/tests/src/android/renderscript/cts/expm1_f32.rs b/tests/src/android/renderscript/cts/expm1_f32.rs
new file mode 100644
index 0000000..1950131
--- /dev/null
+++ b/tests/src/android/renderscript/cts/expm1_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void expm1_f32_1(const float *in, float *out) {
+ *out = expm1(*in);
+}
+
+void expm1_f32_2(const float2 *in, float2 *out) {
+ *out = expm1(*in);
+}
+
+void expm1_f32_3(const float3 *in, float3 *out) {
+ *out = expm1(*in);
+}
+
+void expm1_f32_4(const float4 *in, float4 *out) {
+ *out = expm1(*in);
+}
diff --git a/tests/src/android/renderscript/cts/fabs_f32.rs b/tests/src/android/renderscript/cts/fabs_f32.rs
new file mode 100644
index 0000000..1567e4d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fabs_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void fabs_f32_1(const float *in, float *out) {
+ *out = fabs(*in);
+}
+
+void fabs_f32_2(const float2 *in, float2 *out) {
+ *out = fabs(*in);
+}
+
+void fabs_f32_3(const float3 *in, float3 *out) {
+ *out = fabs(*in);
+}
+
+void fabs_f32_4(const float4 *in, float4 *out) {
+ *out = fabs(*in);
+}
diff --git a/tests/src/android/renderscript/cts/fdim_f32.rs b/tests/src/android/renderscript/cts/fdim_f32.rs
new file mode 100644
index 0000000..e2c5fb1
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fdim_f32.rs
@@ -0,0 +1,38 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct fdim_f32_input {
+ float x;
+ float y;
+};
+
+void fdim_f32_1(const struct fdim_f32_input *in, float *out) {
+ *out = fdim(in->x, in->y);
+}
+
+struct fdim_f32_2_input {
+ float2 x;
+ float2 y;
+};
+
+void fdim_f32_2(const struct fdim_f32_2_input *in, float2 *out) {
+ *out = fdim(in->x, in->y);
+}
+
+struct fdim_f32_3_input {
+ float3 x;
+ float3 y;
+};
+
+void fdim_f32_3(const struct fdim_f32_3_input *in, float3 *out) {
+ *out = fdim(in->x, in->y);
+}
+
+struct fdim_f32_4_input {
+ float4 x;
+ float4 y;
+};
+
+void fdim_f32_4(const struct fdim_f32_4_input *in, float4 *out) {
+ *out = fdim(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/floor_f32.rs b/tests/src/android/renderscript/cts/floor_f32.rs
new file mode 100644
index 0000000..2300dab
--- /dev/null
+++ b/tests/src/android/renderscript/cts/floor_f32.rs
@@ -0,0 +1,17 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void floor_f32_1(const float *in, float *out) {
+ *out = floor(*in);
+}
+
+void floor_f32_2(const float2 *in, float2 *out) {
+ *out = floor(*in);
+}
+
+void floor_f32_3(const float3 *in, float3 *out) {
+ *out = floor(*in);
+}
+
+void floor_f32_4(const float4 *in, float4 *out) {
+ *out = floor(*in);
+}
diff --git a/tests/src/android/renderscript/cts/fma_f32.rs b/tests/src/android/renderscript/cts/fma_f32.rs
new file mode 100644
index 0000000..36257a5
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fma_f32.rs
@@ -0,0 +1,42 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct Floats {
+ float fa;
+ float fb;
+ float fc;
+} Floats;
+
+void fma_f32_1(const Floats *in, float *out) {
+ *out = fma(in->fa, in->fb, in->fc);
+}
+
+typedef struct Floats2 {
+ float2 fa;
+ float2 fb;
+ float2 fc;
+} Floats2;
+
+void fma_f32_2(const Floats2 *in, float2 *out) {
+ *out = fma(in->fa, in->fb, in->fc);
+}
+
+typedef struct Floats3 {
+ float3 fa;
+ float3 fb;
+ float3 fc;
+} Floats3;
+
+void fma_f32_3(const Floats3 *in, float3 *out) {
+ *out = fma(in->fa, in->fb, in->fc);
+}
+
+typedef struct Floats4 {
+ float4 fa;
+ float4 fb;
+ float4 fc;
+} Floats4;
+
+void fma_f32_4(const Floats4 *in, float4 *out) {
+ *out = fma(in->fa, in->fb, in->fc);
+}
diff --git a/tests/src/android/renderscript/cts/fmax_f32.rs b/tests/src/android/renderscript/cts/fmax_f32.rs
new file mode 100644
index 0000000..e03f258
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fmax_f32.rs
@@ -0,0 +1,38 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct fmax_f32_in {
+ float first;
+ float second;
+} input1;
+
+void fmax_f32_1(const input1* in, float* out){
+ *out = fmax(in->first, in->second);
+}
+
+typedef struct fmax_f32_2_in {
+ float2 first;
+ float2 second;
+} input2;
+
+void fmax_f32_2(const input2* in, float2* out){
+ *out = fmax(in->first, in->second);
+}
+
+typedef struct fmax_f32_3_in {
+ float3 first;
+ float3 second;
+} input3;
+
+void fmax_f32_3(const input3* in, float3* out){
+ *out = fmax(in->first, in->second);
+}
+
+typedef struct fmax_f32_4_in {
+ float4 first;
+ float4 second;
+} input4;
+
+void fmax_f32_4(const input4* in, float4* out){
+ *out = fmax(in->first, in->second);
+}
diff --git a/tests/src/android/renderscript/cts/fmin_f32.rs b/tests/src/android/renderscript/cts/fmin_f32.rs
new file mode 100644
index 0000000..49033f0
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fmin_f32.rs
@@ -0,0 +1,38 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct fmin_f32_in {
+ float first;
+ float second;
+} input1;
+
+void fmin_f32_1(const input1* in, float* out){
+ *out = fmin(in->first, in->second);
+}
+
+typedef struct fmin_f32_2_in {
+ float2 first;
+ float2 second;
+} input2;
+
+void fmin_f32_2(const input2* in, float2* out){
+ *out = fmin(in->first, in->second);
+}
+
+typedef struct fmin_f32_3_in {
+ float3 first;
+ float3 second;
+} input3;
+
+void fmin_f32_3(const input3* in, float3* out){
+ *out = fmin(in->first, in->second);
+}
+
+typedef struct fmin_f32_4_in {
+ float4 first;
+ float4 second;
+} input4;
+
+void fmin_f32_4(const input4* in, float4* out){
+ *out = fmin(in->first, in->second);
+}
diff --git a/tests/src/android/renderscript/cts/fmod_f32.rs b/tests/src/android/renderscript/cts/fmod_f32.rs
new file mode 100644
index 0000000..ca8b282
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fmod_f32.rs
@@ -0,0 +1,38 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct fmod_input_f32 {
+ float param1;
+ float param2;
+};
+
+void fmod_f32_1(const struct fmod_input_f32 *in, float *out) {
+ *out = fmod(in->param1, in->param2);
+}
+
+struct fmod_input_f32_2 {
+ float2 param1;
+ float2 param2;
+};
+
+void fmod_f32_2(const struct fmod_input_f32_2 *in, float2 *out) {
+ *out = fmod(in->param1, in->param2);
+}
+
+struct fmod_input_f32_3 {
+ float3 param1;
+ float3 param2;
+};
+
+void fmod_f32_3(const struct fmod_input_f32_3 *in, float3 *out) {
+ *out = fmod(in->param1, in->param2);
+}
+
+struct fmod_input_f32_4 {
+ float4 param1;
+ float4 param2;
+};
+
+void fmod_f32_4(const struct fmod_input_f32_4 *in, float4 *out) {
+ *out = fmod(in->param1, in->param2);
+}
diff --git a/tests/src/android/renderscript/cts/get_allocation.rs b/tests/src/android/renderscript/cts/get_allocation.rs
new file mode 100644
index 0000000..0149e6c
--- /dev/null
+++ b/tests/src/android/renderscript/cts/get_allocation.rs
@@ -0,0 +1,16 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+const int* pointer;
+rs_script script;
+rs_allocation alloc_in;
+rs_allocation alloc_out;
+
+void root(const int* in, int *out) {
+ *out = *in;
+}
+
+void start() {
+ alloc_in = rsGetAllocation(pointer);
+ rsForEach(script, alloc_in, alloc_out);
+}
diff --git a/tests/src/android/renderscript/cts/get_element_at_x.rs b/tests/src/android/renderscript/cts/get_element_at_x.rs
new file mode 100644
index 0000000..8d6ef8f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/get_element_at_x.rs
@@ -0,0 +1,9 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_allocation gIn;
+
+void root(uint32_t *out, uint32_t x) {
+ const uint32_t * tm = rsGetElementAt (gIn, x);
+ *out = *tm;
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/get_element_at_x_y.rs b/tests/src/android/renderscript/cts/get_element_at_x_y.rs
new file mode 100644
index 0000000..2a978c3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/get_element_at_x_y.rs
@@ -0,0 +1,9 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_allocation gIn;
+
+void root(uint32_t *out, uint32_t x, uint32_t y) {
+ const uint32_t * tm = rsGetElementAt (gIn, x, y);
+ *out = *tm;
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/hypot_f32.rs b/tests/src/android/renderscript/cts/hypot_f32.rs
new file mode 100644
index 0000000..4f9159c
--- /dev/null
+++ b/tests/src/android/renderscript/cts/hypot_f32.rs
@@ -0,0 +1,38 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct hypot_f32_in {
+ float x;
+ float y;
+} hypot_input_f32;
+
+void hypot_f32_1(const hypot_input_f32 *in, float *out) {
+ *out = hypot(in->x, in->y);
+}
+
+typedef struct hypot_f32_2_in {
+ float2 x;
+ float2 y;
+} hypot_input_f32_2;
+
+void hypot_f32_2(const hypot_input_f32_2 *in, float2 *out) {
+ *out = hypot(in->x, in->y);
+}
+
+typedef struct hypot_f32_3_in {
+ float3 x;
+ float3 y;
+} hypot_input_f32_3;
+
+void hypot_f32_3(const hypot_input_f32_3 *in, float3 *out) {
+ *out = hypot(in->x, in->y);
+}
+
+typedef struct hypot_f32_4_in {
+ float4 x;
+ float4 y;
+} hypot_input_f32_4;
+
+void hypot_f32_4(const hypot_input_f32_4 *in, float4 *out) {
+ *out = hypot(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/init_test.rs b/tests/src/android/renderscript/cts/init_test.rs
new file mode 100644
index 0000000..f89c979
--- /dev/null
+++ b/tests/src/android/renderscript/cts/init_test.rs
@@ -0,0 +1,13 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+float a;
+
+void init()
+{
+ a = 2.f;
+}
+
+void root(const float *in, float *out) {
+ *out = a;
+}
diff --git a/tests/src/android/renderscript/cts/is_object.rs b/tests/src/android/renderscript/cts/is_object.rs
new file mode 100644
index 0000000..da28240
--- /dev/null
+++ b/tests/src/android/renderscript/cts/is_object.rs
@@ -0,0 +1,47 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct _object_allocation_input {
+ rs_allocation allocation;
+} object_allocation_input;
+
+void is_object_allocation( const object_allocation_input *in, int *out)
+{
+ *out = rsIsObject(in->allocation)==false ? 0 : 1;
+}
+
+typedef struct _object_element_input {
+ rs_element element;
+} object_element_input;
+
+void is_object_element( const object_element_input *in, int *out)
+{
+ *out = rsIsObject(in->element)==false ? 0 : 1;
+}
+
+typedef struct _object_sampler_input {
+ rs_sampler sampler;
+} object_sampler_input;
+
+void is_object_sampler( const object_sampler_input *in, int *out)
+{
+ *out = rsIsObject(in->sampler)==false ? 0 : 1;
+}
+
+typedef struct _object_script_input {
+ rs_script script;
+} object_script_input;
+
+void is_object_script( const object_script_input *in, int *out)
+{
+ *out = rsIsObject(in->script)==false ? 0 : 1;
+}
+
+typedef struct _object_type_input {
+ rs_type type;
+} object_type_input;
+
+void is_object_type( const object_type_input *in, int *out)
+{
+ *out = rsIsObject(in->type)==false ? 0 : 1;
+}
diff --git a/tests/src/android/renderscript/cts/log10_f32.rs b/tests/src/android/renderscript/cts/log10_f32.rs
new file mode 100644
index 0000000..dbb5150
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log10_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void log10_f32_1 (const float* in, float* out) {
+ *out = log10(*in);
+}
+
+void log10_f32_2 (const float2* in, float2* out) {
+ *out = log10(*in);
+}
+
+void log10_f32_3 (const float3* in, float3* out) {
+ *out = log10(*in);
+}
+
+void log10_f32_4 (const float4* in, float4* out) {
+ *out = log10(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log1p_f32.rs b/tests/src/android/renderscript/cts/log1p_f32.rs
new file mode 100644
index 0000000..3c725fe
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log1p_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void log1p_f32_1 (const float* in, float* out) {
+ *out = log1p(*in);
+}
+
+void log1p_f32_2 (const float2* in, float2* out) {
+ *out = log1p(*in);
+}
+
+void log1p_f32_3 (const float3* in, float3* out) {
+ *out = log1p(*in);
+}
+
+void log1p_f32_4 (const float4* in, float4* out) {
+ *out = log1p(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log2_f32.rs b/tests/src/android/renderscript/cts/log2_f32.rs
new file mode 100644
index 0000000..2ed2b98
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log2_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void log2_f32_1 (const float* in, float* out) {
+ *out = log2(*in);
+}
+
+void log2_f32_2 (const float2* in, float2* out) {
+ *out = log2(*in);
+}
+
+void log2_f32_3 (const float3* in, float3* out) {
+ *out = log2(*in);
+}
+
+void log2_f32_4 (const float4* in, float4* out) {
+ *out = log2(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log_f32.rs b/tests/src/android/renderscript/cts/log_f32.rs
new file mode 100644
index 0000000..14052a2
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void log_f32_1 (const float* in, float* out) {
+ *out = log(*in);
+}
+
+void log_f32_2 (const float2* in, float2* out) {
+ *out = log(*in);
+}
+
+void log_f32_3 (const float3* in, float3* out) {
+ *out = log(*in);
+}
+
+void log_f32_4 (const float4* in, float4* out) {
+ *out = log(*in);
+}
diff --git a/tests/src/android/renderscript/cts/logb_f32.rs b/tests/src/android/renderscript/cts/logb_f32.rs
new file mode 100644
index 0000000..1b3acfa
--- /dev/null
+++ b/tests/src/android/renderscript/cts/logb_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void logb_f32_1 (const float* in, float* out) {
+ *out = logb(*in);
+}
+
+void logb_f32_2 (const float2* in, float2* out) {
+ *out = logb(*in);
+}
+
+void logb_f32_3 (const float3* in, float3* out) {
+ *out = logb(*in);
+}
+
+void logb_f32_4 (const float4* in, float4* out) {
+ *out = logb(*in);
+}
diff --git a/tests/src/android/renderscript/cts/mad_f32.rs b/tests/src/android/renderscript/cts/mad_f32.rs
new file mode 100644
index 0000000..fc5081b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/mad_f32.rs
@@ -0,0 +1,42 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct mad_input_f32 {
+ float x;
+ float y;
+ float z;
+};
+
+void mad_f32_1(const struct mad_input_f32 *param, float *out) {
+ *out = mad(param->x, param->y, param->z);
+}
+
+struct mad_input_f32_2 {
+ float2 x;
+ float2 y;
+ float2 z;
+};
+
+void mad_f32_2(const struct mad_input_f32_2 *param, float2 *out) {
+ *out = mad(param->x, param->y, param->z);
+}
+
+struct mad_input_f32_3 {
+ float3 x;
+ float3 y;
+ float3 z;
+};
+
+void mad_f32_3(const struct mad_input_f32_3 *param, float3 *out) {
+ *out = mad(param->x, param->y, param->z);
+}
+
+struct mad_input_f32_4 {
+ float4 x;
+ float4 y;
+ float4 z;
+};
+
+void mad_f32_4(const struct mad_input_f32_4 *param, float4 *out) {
+ *out = mad(param->x, param->y, param->z);
+}
diff --git a/tests/src/android/renderscript/cts/nextafter_f32.rs b/tests/src/android/renderscript/cts/nextafter_f32.rs
new file mode 100644
index 0000000..04ce73a4
--- /dev/null
+++ b/tests/src/android/renderscript/cts/nextafter_f32.rs
@@ -0,0 +1,38 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct InputData {
+ float a;
+ float b;
+} InputData;
+
+void nextafter_f32_1(const InputData *in, float *out) {
+ *out = nextafter (in->a, in->b);
+}
+
+typedef struct InputData_2 {
+ float2 a;
+ float2 b;
+} InputData_2;
+
+void nextafter_f32_2(const InputData_2 *in, float2 *out) {
+ *out = nextafter (in->a, in->b);
+}
+
+typedef struct InputData_3 {
+ float3 a;
+ float3 b;
+} InputData_3;
+
+void nextafter_f32_3(const InputData_3 *in, float3 *out) {
+ *out = nextafter (in->a, in->b);
+}
+
+typedef struct InputData_4 {
+ float4 a;
+ float4 b;
+} InputData_4;
+
+void nextafter_f32_4(const InputData_4 *in, float4 *out) {
+ *out = nextafter (in->a, in->b);
+}
diff --git a/tests/src/android/renderscript/cts/pow_f32.rs b/tests/src/android/renderscript/cts/pow_f32.rs
new file mode 100644
index 0000000..426d4b1
--- /dev/null
+++ b/tests/src/android/renderscript/cts/pow_f32.rs
@@ -0,0 +1,38 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct PowInputData {
+ float base;
+ float expo;
+} PowInputData;
+
+void pow_f32_1(const PowInputData *in, float *out) {
+ *out = pow(in->base, in->expo);
+}
+
+typedef struct PowInputData_2 {
+ float2 base;
+ float2 expo;
+} PowInputData_2;
+
+void pow_f32_2(const PowInputData_2 *in, float2 *out) {
+ *out = pow(in->base, in->expo);
+}
+
+typedef struct PowInputData_3 {
+ float3 base;
+ float3 expo;
+} PowInputData_3;
+
+void pow_f32_3(const PowInputData_3 *in, float3 *out) {
+ *out = pow(in->base, in->expo);
+}
+
+typedef struct PowInputData_4 {
+ float4 base;
+ float4 expo;
+} PowInputData_4;
+
+void pow_f32_4(const PowInputData_4 *in, float4 *out) {
+ *out = pow(in->base, in->expo);
+}
diff --git a/tests/src/android/renderscript/cts/pown_f32.rs b/tests/src/android/renderscript/cts/pown_f32.rs
new file mode 100644
index 0000000..fa066d0
--- /dev/null
+++ b/tests/src/android/renderscript/cts/pown_f32.rs
@@ -0,0 +1,26 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_allocation n1;
+
+void pown_f32_1(const float *in, float *out, uint32_t x) {
+ *out = pown(*in, *(int *)rsGetElementAt(n1,x));
+}
+
+rs_allocation n2;
+
+void pown_f32_2(const float2 *in, float2 *out, uint32_t x) {
+ *out = pown(*in, *(int2 *)rsGetElementAt(n2,x));
+}
+
+rs_allocation n3;
+
+void pown_f32_3(const float3 *in, float3 *out, uint32_t x) {
+ *out = pown(*in, *(int3 *)rsGetElementAt(n3,x));
+}
+
+rs_allocation n4;
+
+void pown_f32_4(const float4 *in, float4 *out, uint32_t x) {
+ *out = pown(*in, *(int4 *)rsGetElementAt(n4,x));
+}
diff --git a/tests/src/android/renderscript/cts/powr_f32.rs b/tests/src/android/renderscript/cts/powr_f32.rs
new file mode 100644
index 0000000..6eb36b0
--- /dev/null
+++ b/tests/src/android/renderscript/cts/powr_f32.rs
@@ -0,0 +1,38 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct PowInputData {
+ float base;
+ float expo;
+} PowInputData;
+
+void powr_f32_1(const PowInputData *in, float *out) {
+ *out = powr(in->base, in->expo);
+}
+
+typedef struct PowInputData_2 {
+ float2 base;
+ float2 expo;
+} PowInputData_2;
+
+void powr_f32_2(const PowInputData_2 *in, float2 *out) {
+ *out = powr(in->base, in->expo);
+}
+
+typedef struct PowInputData_3 {
+ float3 base;
+ float3 expo;
+} PowInputData_3;
+
+void powr_f32_3(const PowInputData_3 *in, float3 *out) {
+ *out = powr(in->base, in->expo);
+}
+
+typedef struct PowInputData_4 {
+ float4 base;
+ float4 expo;
+} PowInputData_4;
+
+void powr_f32_4(const PowInputData_4 *in, float4 *out) {
+ *out = powr(in->base, in->expo);
+}
diff --git a/tests/src/android/renderscript/cts/radians_f32.rs b/tests/src/android/renderscript/cts/radians_f32.rs
new file mode 100644
index 0000000..1aa743e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/radians_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void radians_f32_1(const float* in, float* out) {
+ *out = radians (*in);
+}
+
+void radians_f32_2(const float2* in, float2* out) {
+ *out = radians(*in);
+}
+
+void radians_f32_3(const float3* in, float3* out) {
+ *out = radians(*in);
+}
+
+void radians_f32_4(const float4* in, float4* out) {
+ *out = radians(*in);
+}
diff --git a/tests/src/android/renderscript/cts/remainder_f32.rs b/tests/src/android/renderscript/cts/remainder_f32.rs
new file mode 100644
index 0000000..d08a034
--- /dev/null
+++ b/tests/src/android/renderscript/cts/remainder_f32.rs
@@ -0,0 +1,38 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct remainder_f32 {
+ float num;
+ float den;
+};
+
+void remainder_f32_1 (const struct remainder_f32* in, float* out) {
+ *out = remainder(in->num, in->den);
+}
+
+struct remainder_f32_2 {
+ float2 num;
+ float2 den;
+};
+
+void remainder_f32_2 (const struct remainder_f32_2* in, float2* out) {
+ *out = remainder(in->num, in->den);
+}
+
+struct remainder_f32_3 {
+ float3 num;
+ float3 den;
+};
+
+void remainder_f32_3 (const struct remainder_f32_3* in, float3* out) {
+ *out = remainder(in->num, in->den);
+}
+
+struct remainder_f32_4 {
+ float4 num;
+ float4 den;
+};
+
+void remainder_f32_4 (const struct remainder_f32_4* in, float4* out) {
+ *out = remainder(in->num, in->den);
+}
diff --git a/tests/src/android/renderscript/cts/rint_f32.rs b/tests/src/android/renderscript/cts/rint_f32.rs
new file mode 100644
index 0000000..46ef8b1
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rint_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void rint_f32_1 (const float* in, float* out) {
+ *out = rint(*in);
+}
+
+void rint_f32_2 (const float2* in, float2* out) {
+ *out = rint(*in);
+}
+
+void rint_f32_3 (const float3* in, float3* out) {
+ *out = rint(*in);
+}
+
+void rint_f32_4 (const float4* in, float4* out) {
+ *out = rint(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rootn_f32.rs b/tests/src/android/renderscript/cts/rootn_f32.rs
new file mode 100644
index 0000000..1c60ea9
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rootn_f32.rs
@@ -0,0 +1,26 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_allocation n1;
+
+void rootn_f32_1(const float *in, float *out, uint32_t x) {
+ *out = rootn(*in, *(int *)rsGetElementAt(n1,x));
+}
+
+rs_allocation n2;
+
+void rootn_f32_2(const float2 *in, float2 *out, uint32_t x) {
+ *out = rootn(*in, *(int2 *)rsGetElementAt(n2,x));
+}
+
+rs_allocation n3;
+
+void rootn_f32_3(const float3 *in, float3 *out, uint32_t x) {
+ *out = rootn(*in, *(int3 *)rsGetElementAt(n3,x));
+}
+
+rs_allocation n4;
+
+void rootn_f32_4(const float4 *in, float4 *out, uint32_t x) {
+ *out = rootn(*in, *(int4 *)rsGetElementAt(n4,x));
+}
diff --git a/tests/src/android/renderscript/cts/round_f32.rs b/tests/src/android/renderscript/cts/round_f32.rs
new file mode 100644
index 0000000..60b5e8d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/round_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void round_f32_1 (const float* in, float* out) {
+ *out = round(*in);
+}
+
+void round_f32_2 (const float2* in , float2* out) {
+ *out = round(*in);
+}
+
+void round_f32_3 (const float3* in, float3* out) {
+ *out = round(*in);
+}
+
+void round_f32_4 (const float4* in , float4* out) {
+ *out = round(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rs_frac_f32.rs b/tests/src/android/renderscript/cts/rs_frac_f32.rs
new file mode 100644
index 0000000..3e0e49a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rs_frac_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float *in, float *out) {
+ *out = rsFrac(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rs_pack_color_to_8888.rs b/tests/src/android/renderscript/cts/rs_pack_color_to_8888.rs
new file mode 100644
index 0000000..415e2df
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rs_pack_color_to_8888.rs
@@ -0,0 +1,17 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void pack_color_to_8888_rgb (const float3* in, uchar4* out) {
+ *out = rsPackColorTo8888(in->r, in->g, in->b);
+}
+
+void pack_color_to_8888_rgba (const float4* in, uchar4* out) {
+ *out = rsPackColorTo8888(in->r, in->g, in->b, in->a);
+}
+void pack_color_to_8888_f32_3 (const float3* in, uchar4* out) {
+ *out = rsPackColorTo8888(*in);
+}
+
+void pack_color_to_8888_f32_4 (const float4* in, uchar4* out) {
+ *out = rsPackColorTo8888(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rs_unpack_color_8888.rs b/tests/src/android/renderscript/cts/rs_unpack_color_8888.rs
new file mode 100644
index 0000000..b0dafa5
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rs_unpack_color_8888.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const uchar4* in, float4* out) {
+ *out = rsUnpackColor8888(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rsqrt_f32.rs b/tests/src/android/renderscript/cts/rsqrt_f32.rs
new file mode 100644
index 0000000..1e8f5a2
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rsqrt_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void Rsqrt_f32_1 (const float* in, float* out) {
+ *out = rsqrt(*in);
+}
+
+void Rsqrt_f32_2 (const float2* in, float2* out) {
+ *out = rsqrt(*in);
+}
+
+void Rsqrt_f32_3 (const float3* in, float3* out) {
+ *out = rsqrt(*in);
+}
+
+void Rsqrt_f32_4 (const float4* in, float4* out) {
+ *out = rsqrt(*in);
+}
diff --git a/tests/src/android/renderscript/cts/sendToClientBlocking.rs b/tests/src/android/renderscript/cts/sendToClientBlocking.rs
new file mode 100644
index 0000000..3f4a419
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sendToClientBlocking.rs
@@ -0,0 +1,13 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+int ID;
+int data;
+
+void callBack1Params() {
+ rsSendToClientBlocking(ID);
+}
+
+void callBack3Params() {
+ rsSendToClientBlocking(ID, &data, sizeof(data));
+}
diff --git a/tests/src/android/renderscript/cts/send_to_client.rs b/tests/src/android/renderscript/cts/send_to_client.rs
new file mode 100644
index 0000000..12c963e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/send_to_client.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const int4* in) {
+ int id = in->x;
+ int data[4];
+ data[0] = in->y;
+ data[1] = in->z;
+ data[2] = in->w;
+ rsSendToClient(id, data, sizeof(data));
+}
diff --git a/tests/src/android/renderscript/cts/send_to_client_1.rs b/tests/src/android/renderscript/cts/send_to_client_1.rs
new file mode 100644
index 0000000..24c7222
--- /dev/null
+++ b/tests/src/android/renderscript/cts/send_to_client_1.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void callback(int id){
+ rsSendToClient(id);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/set_object.rs b/tests/src/android/renderscript/cts/set_object.rs
new file mode 100644
index 0000000..6a7ba95
--- /dev/null
+++ b/tests/src/android/renderscript/cts/set_object.rs
@@ -0,0 +1,57 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct _set_object_allocation_input {
+ rs_allocation allocation;
+} set_object_allocation_input;
+
+void set_object_allocation(const set_object_allocation_input *in, int *out)
+{
+ rs_allocation dst;
+ rsSetObject(&dst,in->allocation);
+ *out = ( dst.p == in->allocation.p ? 1 : 0 );
+}
+
+typedef struct _set_object_element_input {
+ rs_element element;
+} set_object_element_input;
+
+void set_object_element(const set_object_element_input *in, int *out)
+{
+ rs_element dst;
+ rsSetObject(&dst,in->element);
+ *out = ( dst.p == in->element.p ? 1 : 0 );
+}
+
+typedef struct _set_object_sampler_input {
+ rs_sampler sampler;
+} set_object_sampler_input;
+
+void set_object_sampler(const set_object_sampler_input *in, int *out)
+{
+ rs_sampler dst;
+ rsSetObject(&dst,in->sampler);
+ *out = ( dst.p == in->sampler.p ? 1 : 0 );
+}
+
+typedef struct _set_object_script_input {
+ rs_script script;
+} set_object_script_input;
+
+void set_object_script(const set_object_script_input *in, int *out)
+{
+ rs_script dst;
+ rsSetObject(&dst,in->script);
+ *out = ( dst.p == in->script.p ? 1 : 0 );
+}
+
+typedef struct _set_object_type_input {
+ rs_type type;
+} set_object_type_input;
+
+void set_object_type(const set_object_type_input *in, int *out)
+{
+ rs_type dst;
+ rsSetObject(&dst,in->type);
+ *out = ( dst.p == in->type.p ? 1 : 0 );
+}
diff --git a/tests/src/android/renderscript/cts/sign_f32.rs b/tests/src/android/renderscript/cts/sign_f32.rs
new file mode 100644
index 0000000..f9edb90
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sign_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void sign_f32_1(const float *in, float *out) {
+ *out = sign (*in);
+}
+
+void sign_f32_2(const float2 *in, float2 *out) {
+ *out = sign (*in);
+}
+
+void sign_f32_3(const float3 *in, float3 *out) {
+ *out = sign (*in);
+}
+
+void sign_f32_4(const float4 *in, float4 *out) {
+ *out = sign (*in);
+}
diff --git a/tests/src/android/renderscript/cts/sin_f32.rs b/tests/src/android/renderscript/cts/sin_f32.rs
new file mode 100644
index 0000000..91652bb
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sin_f32.rs
@@ -0,0 +1,17 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void sin_f32_1(const float *in, float *out) {
+ *out = sin(*in);
+}
+
+void sin_f32_2(const float2 *in, float2 *out) {
+ *out = sin(*in);
+}
+
+void sin_f32_3(const float3 *in, float3 *out) {
+ *out = sin(*in);
+}
+
+void sin_f32_4(const float4 *in, float4 *out) {
+ *out = sin(*in);
+}
diff --git a/tests/src/android/renderscript/cts/sinh_f32.rs b/tests/src/android/renderscript/cts/sinh_f32.rs
new file mode 100644
index 0000000..b785399
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sinh_f32.rs
@@ -0,0 +1,17 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void sinh_f32_1(const float *in, float *out) {
+ *out = sinh(*in);
+}
+
+void sinh_f32_2(const float2 *in, float2 *out) {
+ *out = sinh(*in);
+}
+
+void sinh_f32_3(const float3 *in, float3 *out) {
+ *out = sinh(*in);
+}
+
+void sinh_f32_4(const float4 *in, float4 *out) {
+ *out = sinh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/sqrt_f32.rs b/tests/src/android/renderscript/cts/sqrt_f32.rs
new file mode 100644
index 0000000..253f1c0
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sqrt_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void sqrt_f32_1 (const float* in, float* out) {
+ *out = sqrt(*in);
+}
+
+void sqrt_f32_2 (const float2* in, float2* out) {
+ *out = sqrt(*in);
+}
+
+void sqrt_f32_3 (const float3* in, float3* out) {
+ *out = sqrt(*in);
+}
+
+void sqrt_f32_4 (const float4* in, float4* out) {
+ *out = sqrt(*in);
+}
diff --git a/tests/src/android/renderscript/cts/step_f32.rs b/tests/src/android/renderscript/cts/step_f32.rs
new file mode 100644
index 0000000..d2261b3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/step_f32.rs
@@ -0,0 +1,38 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct step_input {
+ float x;
+ float y;
+};
+
+void step_f32_1(const struct step_input *in, float *out) {
+ *out = step(in->x, in->y);
+}
+
+struct step_2_input {
+ float2 x;
+ float2 y;
+};
+
+void step_f32_2(const struct step_2_input *in, float2 *out) {
+ *out = step(in->x, in->y);
+}
+
+struct step_3_input {
+ float3 x;
+ float3 y;
+};
+
+void step_f32_3(const struct step_3_input *in, float3 *out) {
+ *out = step(in->x, in->y);
+}
+
+struct step_4_input {
+ float4 x;
+ float4 y;
+};
+
+void step_f32_4(const struct step_4_input *in, float4 *out) {
+ *out = step(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/tan_f32.rs b/tests/src/android/renderscript/cts/tan_f32.rs
new file mode 100644
index 0000000..35ee971
--- /dev/null
+++ b/tests/src/android/renderscript/cts/tan_f32.rs
@@ -0,0 +1,17 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void tan_f32_1(const float *in, float *out) {
+ *out = tan(*in);
+}
+
+void tan_f32_2(const float2 *in, float2 *out) {
+ *out = tan(*in);
+}
+
+void tan_f32_3(const float3 *in, float3 *out) {
+ *out = tan(*in);
+}
+
+void tan_f32_4(const float4 *in, float4 *out) {
+ *out = tan(*in);
+}
diff --git a/tests/src/android/renderscript/cts/tanh_f32.rs b/tests/src/android/renderscript/cts/tanh_f32.rs
new file mode 100644
index 0000000..2b0782e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/tanh_f32.rs
@@ -0,0 +1,17 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void tanh_f32_1(const float *in, float *out) {
+ *out = tanh(*in);
+}
+
+void tanh_f32_2(const float2 *in, float2 *out) {
+ *out = tanh(*in);
+}
+
+void tanh_f32_3(const float3 *in, float3 *out) {
+ *out = tanh(*in);
+}
+
+void tanh_f32_4(const float4 *in, float4 *out) {
+ *out = tanh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/trunc_f32.rs b/tests/src/android/renderscript/cts/trunc_f32.rs
new file mode 100644
index 0000000..a464086
--- /dev/null
+++ b/tests/src/android/renderscript/cts/trunc_f32.rs
@@ -0,0 +1,18 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void trunc_f32_1 (const float* in, float* out) {
+ *out = trunc(*in);
+}
+
+void trunc_f32_2 (const float2* in, float2* out) {
+ *out = trunc(*in);
+}
+
+void trunc_f32_3 (const float3* in, float3* out) {
+ *out = trunc(*in);
+}
+
+void trunc_f32_4 (const float4* in, float4* out) {
+ *out = trunc(*in);
+}
diff --git a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
index 055b763..3cc71fa 100644
--- a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
@@ -412,7 +412,7 @@
}
public void testSetMaxFileSize() throws Exception {
- if (!hasMicrophone()) {
+ if (!hasMicrophone() || !hasCamera()) {
return;
}
testSetMaxFileSize(512 * 1024, 50 * 1024);
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AcosPiTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AcosPiTest.java
new file mode 100644
index 0000000..859f235
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AcosPiTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AcosPiTest extends RSBaseCompute {
+ private ScriptC_acospi_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_acospi_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_acospi_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_acospi_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_acospi_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_acospi_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.acos((double)in[idx])/Math.PI);
+ }
+ }
+ return ref;
+ }
+
+ public void testAcosPiF32() {
+ doF32(0xe1, 5);
+ }
+
+ public void testAcosPiF32_2() {
+ doF32_2(0xa123, 5);
+ }
+
+ public void testAcosPiF32_3() {
+ doF32_3(0x123, 5);
+ }
+
+ public void testAcosPiF32_4() {
+ doF32_4(0x123ef, 5);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AcosTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AcosTest.java
new file mode 100644
index 0000000..0553aa5
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AcosTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AcosTest extends RSBaseCompute {
+ private ScriptC_acos_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_acos_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_acos_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_acos_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_acos_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_acos_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.acos((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testAcosF32() {
+ doF32(0x123e, 4);
+ }
+
+ public void testAcosF32_2() {
+ doF32_2(0x1e, 4);
+ }
+
+ public void testAcosF32_3() {
+ doF32_3(0xeaf, 4);
+ }
+
+ public void testAcosF32_4() {
+ doF32_4(0x123, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AcoshTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AcoshTest.java
new file mode 100644
index 0000000..86755b0
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AcoshTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AcoshTest extends RSBaseCompute {
+ private ScriptC_acosh_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_acosh_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_acosh_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_acosh_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_acosh_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_acosh_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ double x = (double)in[idx];
+ ref[idxRef] = (float)(2*Math.log(Math.sqrt((x+1)/2) + Math.sqrt((x-1)/2)));
+ }
+ }
+ return ref;
+ }
+
+ public void testAcoshF32() {
+ doF32(0x12345678, 4);
+ }
+
+ public void testAcoshF32_2() {
+ doF32_2(0x1234ac, 4);
+ }
+
+ public void testAcoshF32_3() {
+ doF32_3(0x123fc78, 4);
+ }
+
+ public void testAcoshF32_4() {
+ doF32_4(0x12def8, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AllocationCopy2DRangeTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AllocationCopy2DRangeTest.java
new file mode 100644
index 0000000..b032fd4
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AllocationCopy2DRangeTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.Type;
+import java.util.Random;
+import com.android.cts.stub.R;
+
+public class AllocationCopy2DRangeTest extends RSBaseCompute {
+ private Allocation mInAllocation;
+ private Allocation mOutAllocation;
+
+ public void testAllocationCopy2DRange() {
+ ScriptC_allocationCopy2DRange mScript =
+ new ScriptC_allocationCopy2DRange(mRS, mRes, R.raw.allocationcopy2drange);
+ Random random = new Random(0x172d8ab9);
+ int width = random.nextInt(512);
+ int height = random.nextInt(512);
+
+ int[] inArray = new int[width * height];
+ int[] outArray = new int[width * height];
+
+ for (int i = 0; i < width * height; i++) {
+ inArray[i] = random.nextInt();
+ }
+
+ // Create 2D data.
+ Type.Builder typeBuilder = new Type.Builder(mRS, Element.I32(mRS));
+ typeBuilder.setX(width).setY(height);
+ mInAllocation = Allocation.createTyped(mRS, typeBuilder.create());
+ mOutAllocation = Allocation.createTyped(mRS, mInAllocation.getType());
+ mInAllocation.copy2DRangeFrom(0, 0, width, height, inArray);
+
+ mScript.set_height(height);
+ mScript.set_width(width);
+ mScript.set_mIn(mInAllocation);
+ mScript.set_mOut(mOutAllocation);
+
+ mScript.invoke_testAllocationCopy2DRange();
+ mOutAllocation.copyTo(outArray);
+ assertTrue("testAllocationCopy2DRange failed, output array does not match input",
+ compareTwoArrays(inArray, outArray, width*height));
+ }
+
+ private boolean compareTwoArrays(int[] src, int[] dest, int size) {
+ boolean result = true;
+ for (int i = 0; i < size; i++) {
+ if (src[i] != dest[i]) {
+ result = false;
+ break;
+ }
+ }
+ return result;
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AllocationResize.java b/tests/tests/renderscript/src/android/renderscript/cts/AllocationResize.java
new file mode 100644
index 0000000..b6d9a1a
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AllocationResize.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+import java.util.Random;
+
+public class AllocationResize extends RSBaseCompute {
+ private Allocation mIn;
+ private Allocation mOut;
+ private ScriptC_allocation_resize mScript;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ mScript.forEach_root(mIn, mOut);
+ }
+
+ public void testResize() {
+ mScript = new ScriptC_allocation_resize(mRS, mRes, R.raw.allocation_resize);
+ mIn = Allocation.createSized(mRS, Element.I32(mRS), INPUTSIZE/2);
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), INPUTSIZE*2);
+ mIn.resize(INPUTSIZE);
+ mOut.resize(INPUTSIZE);
+
+ Random random = new Random(0x12345678);
+ int[] outArray = new int[INPUTSIZE];
+ int[] inArray = new int[INPUTSIZE];
+ for (int i = 0; i < INPUTSIZE; i++) {
+ inArray[i] = random.nextInt();
+ }
+ mIn.copy1DRangeFrom(0, INPUTSIZE, inArray);
+
+ try {
+ RSUtils.forEach(this, 0, mIn, mOut);
+ } catch (RSRuntimeException e) {
+ }
+
+ mOut.copyTo(outArray);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ assertEquals("Incorrect value @ idx = " + i + " | ", inArray[i], outArray[i]);
+ }
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AsinPiTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AsinPiTest.java
new file mode 100644
index 0000000..d0ce9ea
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AsinPiTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AsinPiTest extends RSBaseCompute {
+ private ScriptC_asinpi_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_asinpi_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_asinpi_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_asinpi_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_asinpi_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_asinpi_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.asin((double)in[idx])/Math.PI);
+ }
+ }
+ return ref;
+ }
+
+ public void testAsinPiF32() {
+ doF32(0xa, 5);
+ }
+
+ public void testAsinPiF32_2() {
+ doF32_2(0xe, 5);
+ }
+
+ public void testAsinPiF32_3() {
+ doF32_3(0x1234, 5);
+ }
+
+ public void testAsinPiF32_4() {
+ doF32_4(0xaf, 5);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AsinTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AsinTest.java
new file mode 100644
index 0000000..a47e034
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AsinTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AsinTest extends RSBaseCompute {
+ private ScriptC_asin_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_asin_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_asin_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_asin_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_asin_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_asin_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.asin((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testAsinF32() {
+ doF32(0x12efa, 4);
+ }
+
+ public void testAsinF32_2() {
+ doF32_2(0x34ef, 4);
+ }
+
+ public void testAsinF32_3() {
+ doF32_3(0xae31, 4);
+ }
+
+ public void testAsinF32_4() {
+ doF32_4(0x341, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AsinhTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AsinhTest.java
new file mode 100644
index 0000000..7292626
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AsinhTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AsinhTest extends RSBaseCompute {
+ private ScriptC_asinh_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_asinh_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_asinh_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_asinh_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_asinh_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_asinh_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ double x = (double)in[idx];
+ ref[idxRef] = (float)(Math.log(x+Math.sqrt(1+Math.pow(x, 2))));
+ }
+ }
+ return ref;
+ }
+
+ public void testAsinhF32() {
+ doF32(0x12, 4);
+ }
+
+ public void testAsinhF32_2() {
+ doF32_2(0xead, 4);
+ }
+
+ public void testAsinhF32_3() {
+ doF32_3(0xabc, 4);
+ }
+
+ public void testAsinhF32_4() {
+ doF32_4(0xfea, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Atan2PiTest.java b/tests/tests/renderscript/src/android/renderscript/cts/Atan2PiTest.java
new file mode 100644
index 0000000..ef821c7
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/Atan2PiTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class Atan2PiTest extends RSBaseCompute {
+ private ScriptC_atan2pi_f32 script_f32;
+ private Allocation mIn;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_atan2pi_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_atan2pi_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_atan2pi_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_atan2pi_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_atan2pi_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = (float)(Math.atan2((double)in[idx],(double)in[idx+stride]) / Math.PI);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testAtan2PiF32() {
+ ScriptField_atan2pi_float_input in = new ScriptField_atan2pi_float_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x12678, 6);
+ }
+
+ public void testAtan2PiF32_2() {
+ ScriptField_atan2pi_float2_input in = new ScriptField_atan2pi_float2_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x1af45, 6);
+ }
+
+ public void testAtan2PiF32_3() {
+ ScriptField_atan2pi_float3_input in = new ScriptField_atan2pi_float3_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x1cd345, 6);
+ }
+
+ public void testAtan2PiF32_4() {
+ ScriptField_atan2pi_float4_input in = new ScriptField_atan2pi_float4_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0x1ca45, 6);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Atan2Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Atan2Test.java
new file mode 100644
index 0000000..93f2527
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/Atan2Test.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class Atan2Test extends RSBaseCompute {
+ private ScriptC_atan2_f32 script_f32;
+ private Allocation mIn;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_atan2_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_atan2_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_atan2_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_atan2_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_atan2_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = (float)Math.atan2((double)in[idx],(double)in[idx+stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testAtan2F32() {
+ ScriptField_atan2_f32_in in = new ScriptField_atan2_f32_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x12678, 6);
+ }
+
+ public void testAtan2F32_2() {
+ ScriptField_atan2_f32_2_in in = new ScriptField_atan2_f32_2_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x1af45, 6);
+ }
+
+ public void testAtan2F32_3() {
+ ScriptField_atan2_f32_3_in in = new ScriptField_atan2_f32_3_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x1cd345, 6);
+ }
+
+ public void testAtan2F32_4() {
+ ScriptField_atan2_f32_4_in in = new ScriptField_atan2_f32_4_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0x1ca45, 6);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AtanPiTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AtanPiTest.java
new file mode 100644
index 0000000..de22780
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AtanPiTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AtanPiTest extends RSBaseCompute {
+ private ScriptC_atanpi_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_atanpi_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_atanpi_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_atanpi_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_atanpi_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_atanpi_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.atan((double)in[idx])/Math.PI);
+ }
+ }
+ return ref;
+ }
+
+ public void testAtanPiF32() {
+ doF32(0x123, 5);
+ }
+
+ public void testAtanPiF32_2() {
+ doF32_2(0x12, 5);
+ }
+
+ public void testAtanPiF32_3() {
+ doF32_3(0x847, 5);
+ }
+
+ public void testAtanPiF32_4() {
+ doF32_4(0xfa2, 5);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AtanTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AtanTest.java
new file mode 100644
index 0000000..d91b6e5
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AtanTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AtanTest extends RSBaseCompute {
+ private ScriptC_atan_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_atan_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_atan_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_atan_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_atan_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_atan_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.atan((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testAtanF32() {
+ doF32(0x12a, 5);
+ }
+
+ public void testAtanF32_2() {
+ doF32_2(0xad, 5);
+ }
+
+ public void testAtanF32_3() {
+ doF32_3(0xafe, 5);
+ }
+
+ public void testAtanF32_4() {
+ doF32_4(0x1238, 5);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AtanhTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AtanhTest.java
new file mode 100644
index 0000000..25fa859
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AtanhTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AtanhTest extends RSBaseCompute {
+ private ScriptC_atanh_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_atanh_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_atanh_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_atanh_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_atanh_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_atanh_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ double x = (double)in[idx];
+ ref[idxRef] = (float)((Math.log(1+x) - Math.log(1-x))/2);
+ }
+ }
+ return ref;
+ }
+
+ public void testAtanhF32() {
+ doF32(0xace, 5);
+ }
+
+ public void testAtanhF32_2() {
+ doF32_2(0xdae, 5);
+ }
+
+ public void testAtanhF32_3() {
+ doF32_3(0x123, 5);
+ }
+
+ public void testAtanhF32_4() {
+ doF32_4(0x6480, 5);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CbrtTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CbrtTest.java
new file mode 100644
index 0000000..15a509d
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/CbrtTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class CbrtTest extends RSBaseCompute {
+ private ScriptC_cbrt_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_cbrt_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_cbrt_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_cbrt_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_cbrt_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_cbrt_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.cbrt((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testCbrtF32() {
+ doF32(0xabe, 2);
+ }
+
+ public void testCbrtF32_2() {
+ doF32_2(0x78, 2);
+ }
+
+ public void testCbrtF32_3() {
+ doF32_3(0x1e, 2);
+ }
+
+ public void testCbrtF32_4() {
+ doF32_4(0xfe2, 2);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CeilTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CeilTest.java
new file mode 100644
index 0000000..4ee2ade
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/CeilTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class CeilTest extends RSBaseCompute {
+ private ScriptC_ceil_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_ceil_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_ceil_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_ceil_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_ceil_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_ceil_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.ceil((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testCeilF32() {
+ doF32(0x12345ace, 0);
+ }
+
+ public void testCeilF32_2() {
+ doF32_2(0x1ac478, 0);
+ }
+
+ public void testCeilF32_3() {
+ doF32_3(0xacef, 0);
+ }
+
+ public void testCeilF32_4() {
+ doF32_4(0xef12, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/ClearObjectTest.java b/tests/tests/renderscript/src/android/renderscript/cts/ClearObjectTest.java
new file mode 100644
index 0000000..64deb33
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/ClearObjectTest.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.Type;
+import android.renderscript.Sampler;
+import android.renderscript.Script;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class ClearObjectTest extends RSBaseCompute {
+ int ObjectNum = 1;
+ static final int TEST_ID_ELEMENT = 0;
+ static final int TEST_ID_TYPE = 1;
+ static final int TEST_ID_ALLOCATION = 2;
+ static final int TEST_ID_SAMPLER = 3;
+ static final int TEST_ID_SCRIPT = 4;
+ private ScriptC_clear_object ms_clear;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ ms_clear = new ScriptC_clear_object(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_ID_ELEMENT:
+ ms_clear.forEach_clear_element(mOut);
+ break;
+ case TEST_ID_TYPE:
+ ms_clear.forEach_clear_type(mOut);
+ break;
+ case TEST_ID_ALLOCATION:
+ ms_clear.forEach_clear_allocation(mOut);
+ break;
+ case TEST_ID_SAMPLER:
+ ms_clear.forEach_clear_sampler(mOut);
+ break;
+ case TEST_ID_SCRIPT:
+ ms_clear.forEach_clear_script(mOut);
+ break;
+ }
+ }
+
+ public void testClearObjectElement() {
+ Element element = Element.BOOLEAN(mRS);
+ Allocation mIn = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ Allocation mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ms_clear.set_element(element);
+ try {
+ RSUtils.forEach(this, TEST_ID_ELEMENT, mIn, mOut);
+ } catch (RSRuntimeException e) {
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ for(int i = 0; i < ObjectNum; i++)
+ assertEquals(tmpArray[i], 1);
+ }
+
+ public void testclearObjectType() {
+ Type type= new Type.Builder(mRS, Element.I8(mRS)).setX(1).create();
+ Allocation mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ Allocation mIn = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ms_clear.set_type(type);
+
+ try {
+ RSUtils.forEach(this, TEST_ID_TYPE, mIn, mOut);
+ } catch (RSRuntimeException e) {
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ for(int i = 0; i < ObjectNum; i++)
+ assertEquals(tmpArray[i], 1);
+ }
+
+ public void testclearObjectAllocation() {
+ Allocation mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ Allocation mIn = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ Allocation allocation = Allocation.createTyped(mRS, mIn.getType());
+ ms_clear.set_allocation(allocation);
+ try {
+ RSUtils.forEach(this, TEST_ID_ALLOCATION, mIn, mOut);
+ } catch (RSRuntimeException e) {
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ for(int i = 0; i < ObjectNum; i++)
+ assertEquals(tmpArray[i], 1);
+ }
+
+ public void testclearObjectSampler() {
+ Sampler sampler = new Sampler.Builder(mRS).create();
+ Allocation mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ Allocation mIn = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ms_clear.set_sampler(sampler);
+ try {
+ RSUtils.forEach(this, TEST_ID_SAMPLER, mIn, mOut);
+ } catch (RSRuntimeException e) {
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ for(int i = 0; i < ObjectNum; i++)
+ assertEquals(tmpArray[i], 1);
+ }
+
+ public void testclearObjectScript() {
+ Script script = new ScriptC_clear_object(mRS);
+ Allocation mIn = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ Allocation mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ms_clear.set_script(script);
+ try {
+ RSUtils.forEach(this, TEST_ID_SCRIPT, mIn, mOut);
+ } catch (RSRuntimeException e) {
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ for(int i = 0; i < ObjectNum; i++)
+ assertEquals(tmpArray[i], 1);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CopysignTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CopysignTest.java
new file mode 100644
index 0000000..5601e46
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/CopysignTest.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class CopysignTest extends RSBaseCompute {
+ private ScriptC_copysign_f32 script_f32;
+ private Allocation mIn;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_copysign_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_copysign_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_copysign_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_copysign_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_copysign_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ int vec_size = stride - skip;
+ float[] ref = new float[vec_size * input_size];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < vec_size; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i*vec_size + j] = Math.copySign(in[idx], in[idx + stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ /**
+ * Tests copysign(float, float).
+ */
+ public void testCopysignF32() {
+ ScriptField_copysign_f32_input in = new ScriptField_copysign_f32_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x12ac5678, 0);
+ }
+
+ /**
+ * Tests copysign(float2, float2).
+ */
+ public void testCopysignF32_2() {
+ ScriptField_copysign_f32_2_input in =
+ new ScriptField_copysign_f32_2_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x12fe5678, 0);
+ }
+
+ /**
+ * Tests copysign(float3, float3).
+ */
+ public void testCopysignF32_3() {
+ ScriptField_copysign_f32_3_input in =
+ new ScriptField_copysign_f32_3_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x1c345678, 0);
+ }
+
+ /**
+ * Tests copysign(float4, float4).
+ */
+ public void testCopysignF32_4() {
+ ScriptField_copysign_f32_4_input in =
+ new ScriptField_copysign_f32_4_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0x123a5f7d, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CosTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CosTest.java
new file mode 100644
index 0000000..ebf4940
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/CosTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class CosTest extends RSBaseCompute {
+ private ScriptC_cos_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_cos_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_cos_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_cos_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_cos_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_cos_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.cos((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testCosF32() {
+ doF32(0xe, 4);
+ }
+
+ public void testCosF32_2() {
+ doF32_2(0xb, 4);
+ }
+
+ public void testCosF32_3() {
+ doF32_3(0x12a, 4);
+ }
+
+ public void testCosF32_4() {
+ doF32_4(0x98a, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CoshTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CoshTest.java
new file mode 100644
index 0000000..7e46b4c
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/CoshTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import com.android.cts.stub.R;
+import android.renderscript.RSRuntimeException;
+
+public class CoshTest extends RSBaseCompute {
+
+ private ScriptC_cosh_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_cosh_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_cosh_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_cosh_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_cosh_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_cosh_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.cosh((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testCoshF32() {
+ doF32(0xfe, 4);
+ }
+
+ public void testCoshF32_2() {
+ doF32_2(0x71, 4);
+ }
+
+ public void testCoshF32_3() {
+ doF32_3(0xa, 4);
+ }
+
+ public void testCoshF32_4() {
+ doF32_4(0xabe, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CrossTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CrossTest.java
new file mode 100644
index 0000000..a32eafd
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/CrossTest.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+
+public class CrossTest extends RSBaseCompute {
+ private ScriptC_cross_f32 script_f32;
+ private Allocation mIn;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_cross_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32_3:
+ script_f32.forEach_cross_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_cross_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ int idx= i * stride * 2;
+ int idxRef = i * (stride - skip);
+ ref[idxRef + 0] = in[idx+1] * in[idx+2+stride] - in[idx+2] * in[idx+1+stride];
+ ref[idxRef + 1] = in[idx+2] * in[idx+0+stride] - in[idx+0] * in[idx+2+stride];
+ ref[idxRef + 2] = in[idx+0] * in[idx+1+stride] - in[idx+1] * in[idx+0+stride];
+ if (skip == 1)
+ ref[idxRef + 3] = 0.f;
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ /**
+ * cross test for float3
+ */
+ public void testCrossF32_3() {
+ ScriptField__cross_f32_3_struct in = new ScriptField__cross_f32_3_struct(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x12345678, 0);
+ }
+
+ /**
+ * cross test for float4
+ */
+ public void testCrossF32_4() {
+ ScriptField__cross_f32_4_struct in = new ScriptField__cross_f32_4_struct(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0x12ac5678, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/DegreesTest.java b/tests/tests/renderscript/src/android/renderscript/cts/DegreesTest.java
new file mode 100644
index 0000000..bb6e18d
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/DegreesTest.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class DegreesTest extends RSBaseCompute {
+ private ScriptC_degrees_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_degrees_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_degrees_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_degrees_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_degrees_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_degrees_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ double val = (double)in[idx] * (180.0 / Math.PI);
+ ref[idxRef] = (float)val;
+ }
+ }
+ return ref;
+ }
+
+ /**
+ * degrees test for float
+ */
+ public void testDegreesF32() {
+ doF32(0x12345678, 3);
+ }
+
+ /**
+ * degrees test for float2
+ */
+ public void testDegreesF32_2() {
+ doF32_2(0x12353678, 3);
+ }
+
+ /**
+ * degrees test for float3
+ */
+ public void testDegreesF32_3() {
+ doF32_3(0x12312678, 3);
+ }
+
+ /**
+ * degrees test for float4
+ */
+ public void testDegreesF32_4() {
+ doF32_4(0x12675678, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Exp10Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Exp10Test.java
new file mode 100644
index 0000000..6359765
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/Exp10Test.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class Exp10Test extends RSBaseCompute {
+ private ScriptC_exp10_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_exp10_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_exp10_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_exp10_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_exp10_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_exp10_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.pow(10, (double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testExp10F32() {
+ doF32(0x81, 3);
+ }
+
+ public void testExp10F32_2() {
+ doF32_2(0xa42, 3);
+ }
+
+ public void testExp10F32_3() {
+ doF32_3(0xace2, 3);
+ }
+
+ public void testExp10F32_4() {
+ doF32_4(0x918, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Exp2Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Exp2Test.java
new file mode 100644
index 0000000..4f9335e
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/Exp2Test.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class Exp2Test extends RSBaseCompute {
+ private ScriptC_exp2_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_exp2_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_exp2_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_exp2_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_exp2_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_exp2_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.pow(2, (double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testExp2F32() {
+ doF32(0xa6, 3);
+ }
+
+ public void testExp2F32_2() {
+ doF32_2(0xab2, 3);
+ }
+
+ public void testExp2F32_3() {
+ doF32_3(0x617a, 3);
+ }
+
+ public void testExp2F32_4() {
+ doF32_4(0xabc3, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/ExpTest.java b/tests/tests/renderscript/src/android/renderscript/cts/ExpTest.java
new file mode 100644
index 0000000..3542f6f
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/ExpTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class ExpTest extends RSBaseCompute {
+ private ScriptC_exp_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_exp_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_exp_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_exp_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_exp_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_exp_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.exp((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testExpF32() {
+ doF32(0xa28, 3);
+ }
+
+ public void testExpF32_2() {
+ doF32_2(0xfeb4, 3);
+ }
+
+ public void testExpF32_3() {
+ doF32_3(0xab2, 3);
+ }
+
+ public void testExpF32_4() {
+ doF32_4(0x7a6, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Expm1Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Expm1Test.java
new file mode 100644
index 0000000..f501c39
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/Expm1Test.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class Expm1Test extends RSBaseCompute {
+ private ScriptC_expm1_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_expm1_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_expm1_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_expm1_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_expm1_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_expm1_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.expm1((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testExpm1F32() {
+ doF32(0xa29, 3);
+ }
+
+ public void testExpm1F32_2() {
+ doF32_2(0x8a2, 3);
+ }
+
+ public void testExpm1F32_3() {
+ doF32_3(0xa7c, 3);
+ }
+
+ public void testExpm1F32_4() {
+ doF32_4(0x81a, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FabsTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FabsTest.java
new file mode 100644
index 0000000..a50162c
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/FabsTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class FabsTest extends RSBaseCompute {
+ private ScriptC_fabs_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_fabs_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_fabs_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_fabs_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_fabs_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_fabs_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = Math.abs(in[idx]);
+ }
+ }
+ return ref;
+ }
+
+ public void testfabsF32() {
+ doF32(0xa, 0);
+ }
+
+ public void testfabsF32_2() {
+ doF32_2(0xb, 0);
+ }
+
+ public void testfabsF32_3() {
+ doF32_3(0xc, 0);
+ }
+
+ public void testfabsF32_4() {
+ doF32_4(0xd, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FdimTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FdimTest.java
new file mode 100644
index 0000000..099ca3d
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/FdimTest.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class FdimTest extends RSBaseCompute {
+ private ScriptC_fdim_f32 script_f32;
+ private Allocation mIn;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_fdim_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_fdim_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_fdim_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_fdim_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_fdim_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = (float)(Math.max(0.0, (double)in[idx] - (double)in[idx+stride]));
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testfdimF32() {
+ ScriptField_fdim_f32_input floatArray = new ScriptField_fdim_f32_input(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32(0x12678, 0);
+ }
+
+ public void testfdimF32_2() {
+ ScriptField_fdim_f32_2_input floatArray = new ScriptField_fdim_f32_2_input(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_2(0x1af45, 0);
+ }
+
+ public void testfdimF32_3() {
+ ScriptField_fdim_f32_3_input floatArray = new ScriptField_fdim_f32_3_input(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_3(0x1cd345, 0);
+ }
+
+ public void testfdimF32_4() {
+ ScriptField_fdim_f32_4_input floatArray = new ScriptField_fdim_f32_4_input(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_4(0x1ca45, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FloorTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FloorTest.java
new file mode 100644
index 0000000..78b819b
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/FloorTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class FloorTest extends RSBaseCompute {
+ private ScriptC_floor_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_floor_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_floor_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_floor_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_floor_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_floor_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.floor((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testfloorF32() {
+ doF32(0xa, 0);
+ }
+
+ public void testfloorF32_2() {
+ doF32_2(0xb, 0);
+ }
+
+ public void testfloorF32_3() {
+ doF32_3(0xef1, 0);
+ }
+
+ public void testfloorF32_4() {
+ doF32_4(0xefa12, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FmaTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FmaTest.java
new file mode 100644
index 0000000..2fb29b7
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/FmaTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class FmaTest extends RSBaseCompute {
+ private ScriptC_fma_f32 script_f32;
+ private Allocation mIn;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_fma_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_fma_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_fma_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_fma_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_fma_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 3 + j;
+ ref[i * (stride - skip) + j] = (float)((double)in[idx] * (double)in[idx+stride] + (double)in[idx+stride*2]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*3];
+ }
+
+ public void testFmaF32() {
+ ScriptField_Floats floatArray = new ScriptField_Floats(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32(0xea1, 0);
+ }
+
+ public void testFmaF32_2() {
+ ScriptField_Floats2 floatArray = new ScriptField_Floats2(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_2(0x12a, 0);
+ }
+
+ public void testFmaF32_3() {
+ ScriptField_Floats3 floatArray = new ScriptField_Floats3(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_3(0xfae, 0);
+ }
+
+ public void testFmaF32_4() {
+ ScriptField_Floats4 floatArray = new ScriptField_Floats4(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_4(0x87a, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FmaxTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FmaxTest.java
new file mode 100644
index 0000000..eca16a0
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/FmaxTest.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class FmaxTest extends RSBaseCompute {
+ private ScriptC_fmax_f32 script_f32;
+ private Allocation mIn;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_fmax_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation max, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_fmax_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_fmax_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_fmax_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_fmax_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = Math.max(in[idx], in[idx+stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testfmaxF32() {
+ ScriptField_fmax_f32_in in = new ScriptField_fmax_f32_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x12678, 0);
+ }
+
+ public void testfmaxF32_2() {
+ ScriptField_fmax_f32_2_in in = new ScriptField_fmax_f32_2_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x12ace, 0);
+ }
+
+ public void testfmaxF32_3() {
+ ScriptField_fmax_f32_3_in in = new ScriptField_fmax_f32_3_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x12e8, 0);
+ }
+
+ public void testfmaxF32_4() {
+ ScriptField_fmax_f32_4_in in = new ScriptField_fmax_f32_4_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0xeac, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FminTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FminTest.java
new file mode 100644
index 0000000..da90e14
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/FminTest.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class FminTest extends RSBaseCompute {
+ private ScriptC_fmin_f32 script_f32;
+ private Allocation mIn;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_fmin_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_fmin_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_fmin_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_fmin_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_fmin_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = Math.min(in[idx], in[idx+stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testfminF32() {
+ ScriptField_fmin_f32_in in = new ScriptField_fmin_f32_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x12678, 0);
+ }
+
+ public void testfminF32_2() {
+ ScriptField_fmin_f32_2_in in = new ScriptField_fmin_f32_2_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x12ace, 0);
+ }
+
+ public void testfminF32_3() {
+ ScriptField_fmin_f32_3_in in = new ScriptField_fmin_f32_3_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x12e8, 0);
+ }
+
+ public void testfminF32_4() {
+ ScriptField_fmin_f32_4_in in = new ScriptField_fmin_f32_4_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0xeac, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FmodTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FmodTest.java
new file mode 100644
index 0000000..47fe202
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/FmodTest.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class FmodTest extends RSBaseCompute {
+ private ScriptC_fmod_f32 script_f32;
+ private Allocation mIn;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_fmod_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_fmod_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_fmod_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_fmod_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_fmod_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = (float)((double)in[idx] % (double)in[idx+stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ /**
+ * This method is used for testing the fmod() function with F32
+ */
+ public void testfmodF32() {
+ ScriptField_fmod_input_f32 floatArray = new ScriptField_fmod_input_f32(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32(0x12345678, 0);
+ }
+
+ /**
+ * This method is used for testing the fmod() function with F32_2
+ */
+ public void testfmodF32_2() {
+ ScriptField_fmod_input_f32_2 floatArray = new ScriptField_fmod_input_f32_2(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_2(0x12345, 0);
+ }
+
+ /**
+ * This method is used for testing the fmod() function with F32_3
+ */
+ public void testfmodF32_3() {
+ ScriptField_fmod_input_f32_3 floatArray = new ScriptField_fmod_input_f32_3(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_3(0x12345, 0);
+ }
+
+ /**
+ * This method is used for testing the fmod() function with F32_4
+ */
+ public void testfmodF32_4() {
+ ScriptField_fmod_input_f32_4 floatArray = new ScriptField_fmod_input_f32_4(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_4(0x12345, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/GetAllocationTest.java b/tests/tests/renderscript/src/android/renderscript/cts/GetAllocationTest.java
new file mode 100644
index 0000000..e447224
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/GetAllocationTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+import java.util.Random;
+
+public class GetAllocationTest extends RSBaseCompute {
+
+ public void testGetAllocation () {
+ Random random = new Random(0x827492ab);
+ int[] tempArray = new int[INPUTSIZE];
+ for (int i = 0; i < INPUTSIZE; ++i) {
+ tempArray[i] = random.nextInt();
+ }
+ ScriptC_get_allocation ms =
+ new ScriptC_get_allocation(mRS, mRes, R.raw.get_allocation);
+
+ Allocation mTemp = Allocation.createSized(mRS, Element.I32(mRS), INPUTSIZE);
+ mTemp.copyFrom(tempArray);
+ Allocation mOut = Allocation.createTyped(mRS, mTemp.getType());
+
+ ms.bind_pointer(mTemp);
+ ms.set_script(ms);
+ ms.set_alloc_out(mOut);
+ ms.invoke_start();
+
+ int [] out = new int[INPUTSIZE];
+ mOut.copyTo(out);
+ for (int i = 0; i < tempArray.length; i++) {
+ assertEquals("Incorrect value @ idx = " + i + " | ",
+ tempArray[i],
+ out[i]);
+ }
+ }
+
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/GetElementAt.java b/tests/tests/renderscript/src/android/renderscript/cts/GetElementAt.java
new file mode 100644
index 0000000..a9be1bc
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/GetElementAt.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.Type;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+import java.util.Random;
+
+public class GetElementAt extends RSBaseCompute {
+ static final int TEST_ID_X = 0;
+ static final int TEST_ID_XY = 1;
+ private Allocation mOut;
+ private Allocation gIn;
+ private int[] in;
+ private int[] out;
+ ScriptC_get_element_at_x script_x;
+ ScriptC_get_element_at_x_y script_xy;
+
+ @Override
+ public void forEach(int testId, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_ID_X:
+ script_x.forEach_root(mOut);
+ break;
+ case TEST_ID_XY:
+ script_xy.forEach_root(mOut);
+ break;
+ }
+ }
+
+ private void setupArrays(int size) {
+ Random random = new Random(0x12345678);
+ in = new int[size];
+ for (int i = 0; i < size; ++i) {
+ in[i] = random.nextInt(100);
+ }
+ out = new int[size];
+ }
+
+ public void testX () {
+ setupArrays(INPUTSIZE);
+ script_x = new ScriptC_get_element_at_x(mRS, mRes, R.raw.get_element_at_x);
+ gIn = Allocation.createSized(mRS, Element.U32(mRS), INPUTSIZE);
+ gIn.copyFrom(in);
+ mOut = Allocation.createTyped(mRS, gIn.getType());
+ script_x.set_gIn(gIn);
+ try {
+ RSUtils.forEach(this, TEST_ID_X, mOut);
+ } catch (RSRuntimeException e) {
+ }
+ mOut.copyTo(out);
+ for (int k = 0; k < INPUTSIZE; ++k) {
+ assertEquals("idx = " + k, in[k], out[k]);
+ }
+ }
+
+ public void testXY () {
+ setupArrays(INPUTSIZE*INPUTSIZE);
+ script_xy = new ScriptC_get_element_at_x_y(mRS, mRes, R.raw.get_element_at_x_y);
+ Type.Builder builder = new Type.Builder(mRS, Element.U32(mRS));
+ builder.setX(INPUTSIZE);
+ builder.setY(INPUTSIZE);
+ Type type = builder.create();
+ gIn = Allocation.createTyped(mRS, type);
+ gIn.copyFrom(in);
+ mOut = Allocation.createTyped(mRS, gIn.getType());
+ script_xy.set_gIn(gIn);
+ try {
+ RSUtils.forEach(this, TEST_ID_XY, mOut);
+ } catch (RSRuntimeException e) {
+ }
+ mOut.copyTo(out);
+ for (int k = 0; k < INPUTSIZE*INPUTSIZE; ++k) {
+ assertEquals("idx = " + k, in[k], out[k]);
+ }
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/HypotTest.java b/tests/tests/renderscript/src/android/renderscript/cts/HypotTest.java
new file mode 100644
index 0000000..f6a280f
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/HypotTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class HypotTest extends RSBaseCompute {
+ private ScriptC_hypot_f32 script_f32;
+ private Allocation mIn;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_hypot_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_hypot_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_hypot_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_hypot_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_hypot_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = (float)Math.hypot((double)in[idx], (double)in[idx+stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testHypotF32() {
+ ScriptField_hypot_f32_in in = new ScriptField_hypot_f32_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x123678, 4);
+ }
+
+ public void testHypotF32_2() {
+ ScriptField_hypot_f32_2_in in = new ScriptField_hypot_f32_2_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x1234a5, 4);
+ }
+
+ public void testHypotF32_3() {
+ ScriptField_hypot_f32_3_in in = new ScriptField_hypot_f32_3_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x1af345, 4);
+ }
+
+ public void testHypotF32_4() {
+ ScriptField_hypot_f32_4_in in = new ScriptField_hypot_f32_4_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0x12ce45, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/InitTest.java b/tests/tests/renderscript/src/android/renderscript/cts/InitTest.java
new file mode 100644
index 0000000..ef36927
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/InitTest.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class InitTest extends RSBaseCompute {
+ private Allocation mIn;
+ private Allocation mOut;
+ private ScriptC_init_test script;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ script.forEach_root(mIn, mOut);
+ }
+
+ public void testInitTest() {
+ script = new ScriptC_init_test(mRS, mRes, R.raw.init_test);
+ float[] ref = new float[INPUTSIZE];
+ float[] in = new float[INPUTSIZE];
+ float[] out = new float[INPUTSIZE];
+ mIn = Allocation.createSized(mRS, Element.F32(mRS), INPUTSIZE);
+ mOut= Allocation.createSized(mRS, Element.F32(mRS), INPUTSIZE);
+ for (int i = 0 ;i < INPUTSIZE; i++) {
+ ref[i] = 2.0f;
+ in[i] = 0;
+ }
+
+ mIn.copy1DRangeFrom(0, INPUTSIZE, in);
+
+ try {
+ RSUtils.forEach(this, 0, mIn, mOut);
+ } catch (RSRuntimeException e) {
+ }
+ mOut.copyTo(out);
+ checkArray(ref, out, INPUTSIZE, 1, 1, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/IsObjectTest.java b/tests/tests/renderscript/src/android/renderscript/cts/IsObjectTest.java
new file mode 100644
index 0000000..58ae448
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/IsObjectTest.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.*;
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.util.Log;
+import android.view.SurfaceHolder;
+import com.android.cts.stub.R;
+
+import junit.framework.Assert;
+
+public class IsObjectTest extends RSBaseCompute {
+ int ObjectNum = 1;
+ private Allocation mIn;
+ private Allocation mOut;
+
+ Element element;
+ Type type;
+ Allocation allocation;
+ Sampler sampler;
+ Script script;
+
+ private ScriptC_is_object ms_is_object;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ element = Element.BOOLEAN(mRS);
+
+ type = new Type.Builder(mRS, Element.I8(mRS)).setX(1).create();
+ allocation = Allocation.createTyped(mRS, type);
+ sampler = new Sampler.Builder(mRS).create();
+ script = new ScriptC_is_object(mRS);
+ ms_is_object = new ScriptC_is_object(mRS);
+ }
+
+ /**
+ * is object test
+ */
+ public void testIsObjectElement() {
+ ScriptField__object_element_input filed = new ScriptField__object_element_input(
+ mRS, 1);
+ ScriptField__object_element_input.Item mItem =
+ new ScriptField__object_element_input.Item();
+ mItem.element = element;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ try {
+ ms_is_object.forEach_is_object_element(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsIsObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue("rsIsObject element test fail: " + "Expect 1;value "
+ + tmpArray[0], tmpArray[0] == 1);
+ }
+
+ public void testIsObjectType() {
+ ScriptField__object_type_input filed = new ScriptField__object_type_input(mRS, 1);
+ ScriptField__object_type_input.Item mItem = new ScriptField__object_type_input.Item();
+ mItem.type = type;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+
+ try {
+ ms_is_object.forEach_is_object_type(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsIsObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue(
+ "rsIsObject type test fail: " + "Expect 1;value " + tmpArray[0],
+ tmpArray[0] == 1);
+ }
+
+ public void testIsObjectAllocation() {
+ ScriptField__object_allocation_input filed = new ScriptField__object_allocation_input(
+ mRS, 1);
+ ScriptField__object_allocation_input.Item mItem =
+ new ScriptField__object_allocation_input.Item();
+ mItem.allocation = allocation;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+
+ try {
+ ms_is_object.forEach_is_object_allocation(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsIsObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue("rsIsObject allocation test fail: " + "Expect 1;value "
+ + tmpArray[0], tmpArray[0] == 1);
+ }
+
+ public void testIsObjectSampler() {
+ ScriptField__object_sampler_input filed = new ScriptField__object_sampler_input(
+ mRS, 1);
+ ScriptField__object_sampler_input.Item mItem =
+ new ScriptField__object_sampler_input.Item();
+ mItem.sampler = sampler;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+
+ try {
+ ms_is_object.forEach_is_object_sampler(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsIsObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue("rsIsObject sampler test fail: " + "Expect 1;value "
+ + tmpArray[0], tmpArray[0] == 1);
+ }
+
+ public void testIsObjectScript() {
+ ScriptField__object_script_input filed = new ScriptField__object_script_input(
+ mRS, 1);
+ ScriptField__object_script_input.Item mItem = new ScriptField__object_script_input.Item();
+ mItem.script = script;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+
+ try {
+ ms_is_object.forEach_is_object_script(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsIsObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue("rsIsObject script test fail: " + "Expect 1;value "
+ + tmpArray[0], tmpArray[0] == 1);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Log10Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Log10Test.java
new file mode 100644
index 0000000..823366b
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/Log10Test.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class Log10Test extends RSBaseCompute {
+ private ScriptC_log10_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_log10_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_log10_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_log10_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_log10_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_log10_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.log10((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testLog10F32() {
+ doF32(0x13, 3);
+ }
+
+ public void testLog10F32_2() {
+ doF32_2(0xf, 3);
+ }
+
+ public void testLog10F32_3() {
+ doF32_3(0xa, 3);
+ }
+
+ public void testLog10F32_4() {
+ doF32_4(0xf3, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Log1PTest.java b/tests/tests/renderscript/src/android/renderscript/cts/Log1PTest.java
new file mode 100644
index 0000000..55e98de
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/Log1PTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class Log1PTest extends RSBaseCompute {
+ private ScriptC_log1p_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_log1p_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_log1p_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_log1p_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_log1p_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_log1p_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.log1p((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testLog1PF32() {
+ doF32(0xab, 2);
+ }
+
+ public void testLog1PF32_2() {
+ doF32_2(0x12, 2);
+ }
+
+ public void testLog1PF32_3() {
+ doF32_3(0xa1, 2);
+ }
+
+ public void testLog1PF32_4() {
+ doF32_4(0xbae, 2);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Log2Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Log2Test.java
new file mode 100644
index 0000000..9bbd3fb
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/Log2Test.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class Log2Test extends RSBaseCompute {
+ private ScriptC_log2_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_log2_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_log2_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_log2_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_log2_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_log2_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.log10((double)in[idx])/Math.log10(2.0));
+ }
+ }
+ return ref;
+ }
+
+ public void testLog2F32() {
+ doF32(0x18a, 3);
+ }
+
+ public void testLog2F32_2() {
+ doF32_2(0xfa, 3);
+ }
+
+ public void testLog2F32_3() {
+ doF32_3(0xaef, 3);
+ }
+
+ public void testLog2F32_4() {
+ doF32_4(0xae62, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/LogTest.java b/tests/tests/renderscript/src/android/renderscript/cts/LogTest.java
new file mode 100644
index 0000000..462f682
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/LogTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class LogTest extends RSBaseCompute {
+ private ScriptC_log_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_log_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_log_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_log_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_log_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_log_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.log((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testLogF32() {
+ doF32(0xfae, 3);
+ }
+
+ public void testLogF32_2() {
+ doF32_2(0x123, 3);
+ }
+
+ public void testLogF32_3() {
+ doF32_3(0xab4, 3);
+ }
+
+ public void testLogF32_4() {
+ doF32_4(0xfa3, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/LogbTest.java b/tests/tests/renderscript/src/android/renderscript/cts/LogbTest.java
new file mode 100644
index 0000000..1be03fb
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/LogbTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class LogbTest extends RSBaseCompute {
+ private ScriptC_logb_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_logb_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_logb_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_logb_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_logb_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_logb_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = ((Float.floatToIntBits(in[idx]) >> 23) & 0xFF) - 127.0f;
+ }
+ }
+ return ref;
+ }
+
+ public void testLogbF32() {
+ doF32(0xe, 0);
+ }
+
+ public void testLogbF32_2() {
+ doF32_2(0xa1, 0);
+ }
+
+ public void testLogbF32_3() {
+ doF32_3(0xab2, 0);
+ }
+
+ public void testLogbF32_4() {
+ doF32_4(0xaa2, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/MadTest.java b/tests/tests/renderscript/src/android/renderscript/cts/MadTest.java
new file mode 100644
index 0000000..8ab3db2
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/MadTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class MadTest extends RSBaseCompute {
+ private ScriptC_mad_f32 script_f32;
+ private Allocation mIn;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_mad_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_mad_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_mad_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_mad_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_mad_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 3 + j;
+ ref[i * (stride - skip) + j] = (float)((double)in[idx] * (double)in[idx+stride] + (double)in[idx+stride*2]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*3];
+ }
+
+ public void testMadF32() {
+ ScriptField_mad_input_f32 in = new ScriptField_mad_input_f32(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x123678, 4);
+ }
+
+ public void testMadF32_2() {
+ ScriptField_mad_input_f32_2 in = new ScriptField_mad_input_f32_2(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x1234a5, 4);
+ }
+
+ public void testMadF32_3() {
+ ScriptField_mad_input_f32_3 in = new ScriptField_mad_input_f32_3(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x1af345, 4);
+ }
+
+ public void testMadF32_4() {
+ ScriptField_mad_input_f32_4 in = new ScriptField_mad_input_f32_4(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0x12ce45, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/NextafterTest.java b/tests/tests/renderscript/src/android/renderscript/cts/NextafterTest.java
new file mode 100644
index 0000000..a36aa0e
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/NextafterTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class NextafterTest extends RSBaseCompute {
+ private ScriptC_nextafter_f32 script_f32;
+ private Allocation mIn;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_nextafter_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_nextafter_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_nextafter_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_nextafter_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_nextafter_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = Math.nextAfter(in[idx],(double)in[idx+stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testNextafterF32() {
+ ScriptField_InputData inputDataArray = new ScriptField_InputData(mRS, INPUTSIZE);
+ mIn = inputDataArray.getAllocation();
+ doF32(0x12678, 0);
+ }
+
+ public void testNextafterF32_2() {
+ ScriptField_InputData_2 inputDataArray = new ScriptField_InputData_2(mRS, INPUTSIZE);
+ mIn = inputDataArray.getAllocation();
+ doF32_2(0x1af45, 0);
+ }
+
+ public void testNextafterF32_3() {
+ ScriptField_InputData_3 inputDataArray = new ScriptField_InputData_3(mRS, INPUTSIZE);
+ mIn = inputDataArray.getAllocation();
+ doF32_3(0x1cd345, 0);
+ }
+
+ public void testNextafterF32_4() {
+ ScriptField_InputData_4 inputDataArray = new ScriptField_InputData_4(mRS, INPUTSIZE);
+ mIn = inputDataArray.getAllocation();
+ doF32_4(0x1ca45, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/PowTest.java b/tests/tests/renderscript/src/android/renderscript/cts/PowTest.java
new file mode 100644
index 0000000..b5ea9fa
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/PowTest.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class PowTest extends RSBaseCompute {
+ private ScriptC_pow_f32 script_f32;
+ private Allocation mIn;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_pow_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_pow_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_pow_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_pow_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_pow_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride * 2 + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)Math.pow((double)in[idx], (double)in[idx+stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ @Override
+ protected void fillRandom(long seed, int fact, int offset, float[] inArray, int rStride, int rSkip) {
+ RSUtils.genRandom(seed, 32, -16, inArray, rStride, rSkip);
+ }
+
+ public void testPowF32() {
+ ScriptField_PowInputData in = new ScriptField_PowInputData(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x12345678, 16);
+ }
+
+ public void testPowF32_2() {
+ ScriptField_PowInputData_2 in = new ScriptField_PowInputData_2(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x12ab78, 16);
+ }
+
+ public void testPowF32_3() {
+ ScriptField_PowInputData_3 in = new ScriptField_PowInputData_3(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x1f5678, 16);
+ }
+
+ public void testPowF32_4() {
+ ScriptField_PowInputData_4 in = new ScriptField_PowInputData_4(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0xc678, 16);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/PownTest.java b/tests/tests/renderscript/src/android/renderscript/cts/PownTest.java
new file mode 100644
index 0000000..b149347
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/PownTest.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class PownTest extends RSBaseCompute {
+ private ScriptC_pown_f32 script_f32;
+ private int[] n;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_pown_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_pown_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_pown_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_pown_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_pown_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)Math.pow((double)in[idx], (double)n[idx]);
+ }
+ }
+ return ref;
+ }
+
+ public void testPownF32() {
+ Allocation nAlloc = Allocation.createSized(mRS, Element.I32(mRS), INPUTSIZE);
+
+ n = new int[INPUTSIZE];
+ RSUtils.genRandom(0x12345678, 32, 1, -16, n);
+ nAlloc.copyFrom(n);
+ script_f32.set_n1(nAlloc);
+
+ doF32(0x716acd, 16);
+ }
+
+ public void testPownF32_2() {
+ Allocation nAlloc = Allocation.createSized(mRS, Element.I32_2(mRS), INPUTSIZE);
+
+ n = new int[INPUTSIZE*2];
+ RSUtils.genRandom(0xacdef1, 32, 1, -16, n);
+ nAlloc.copyFrom(n);
+ script_f32.set_n2(nAlloc);
+
+ doF32_2(0xacdef1, 16);
+ }
+
+ public void testPownF32_3() {
+ Allocation nAlloc = Allocation.createSized(mRS, Element.I32_3(mRS), INPUTSIZE);
+
+ n = new int[INPUTSIZE*4];
+ RSUtils.genRandom(0xa123f1, 32, 1, -16, n, 4, 1);
+ nAlloc.copyFrom(n);
+ script_f32.set_n3(nAlloc);
+
+ doF32_3(0xaac3f1, 16);
+ }
+
+ public void testPownF32_4() {
+ Allocation nAlloc = Allocation.createSized(mRS, Element.I32_4(mRS), INPUTSIZE);
+
+ n = new int[INPUTSIZE*4];
+ RSUtils.genRandom(0x4323ca, 32, 1, -16, n);
+ nAlloc.copyFrom(n);
+ script_f32.set_n4(nAlloc);
+
+ doF32_4(0xaa12f1, 16);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/PowrTest.java b/tests/tests/renderscript/src/android/renderscript/cts/PowrTest.java
new file mode 100644
index 0000000..5c75a04
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/PowrTest.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class PowrTest extends RSBaseCompute {
+ private ScriptC_powr_f32 script_f32;
+ private Allocation mIn;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_powr_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_powr_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_powr_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_powr_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_powr_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride * 2 + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)Math.pow((double)in[idx], (double)in[idx+stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ @Override
+ protected void fillRandom(long seed, int fact, int offset, float[] inArray, int rStride, int rSkip) {
+ RSUtils.genRandom(seed, 64, 0, inArray, rStride, rSkip);
+ }
+
+ public void testPowrF32() {
+ ScriptField_PowInputData in = new ScriptField_PowInputData(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x12345678, 16);
+ }
+
+ public void testPowrF32_2() {
+ ScriptField_PowInputData_2 in = new ScriptField_PowInputData_2(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x12ab78, 16);
+ }
+
+ public void testPowrF32_3() {
+ ScriptField_PowInputData_3 in = new ScriptField_PowInputData_3(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x1f5678, 16);
+ }
+
+ public void testPowrF32_4() {
+ ScriptField_PowInputData_4 in = new ScriptField_PowInputData_4(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0xc678, 16);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RSBaseCompute.java b/tests/tests/renderscript/src/android/renderscript/cts/RSBaseCompute.java
index 3278113..d02e28b 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/RSBaseCompute.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RSBaseCompute.java
@@ -17,6 +17,9 @@
package android.renderscript.cts;
import android.renderscript.RenderScript;
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
/**
* Base RenderScript test class. This class provides a message handler and a
@@ -25,6 +28,12 @@
class RSBaseCompute extends RSBase {
RenderScript mRS;
+ static final int TEST_F32 = 0;
+ static final int TEST_F32_2 = 1;
+ static final int TEST_F32_3 = 2;
+ static final int TEST_F32_4 = 3;
+ protected int INPUTSIZE = 512;
+
@Override
protected void setUp() throws Exception {
super.setUp();
@@ -41,4 +50,110 @@
super.tearDown();
}
+ public void checkArray(float[] ref, float[] out, int height, int refStride,
+ int outStride, float ulpCount) {
+ int minStride = refStride > outStride ? outStride : refStride;
+ for (int i = 0; i < height; i++) {
+ for (int j = 0; j < minStride; j++) {
+ int refIdx = i * refStride + j;
+ int outIdx = i * outStride + j;
+ float ulp = Math.ulp(ref[refIdx]) * ulpCount;
+ assertEquals("Incorrect value @ idx = " + i + " |",
+ ref[refIdx],
+ out[outIdx],
+ ulp);
+ }
+ }
+ }
+
+ public void checkArray(int[] ref, int[] out, int height, int refStride,
+ int outStride) {
+ int minStride = refStride > outStride ? outStride : refStride;
+ for (int i = 0; i < height; i++) {
+ for (int j = 0; j < minStride; j++) {
+ int refIdx = i * refStride + j;
+ int outIdx = i * outStride + j;
+ assertEquals("Incorrect value @ idx = " + i + " |",
+ ref[refIdx],
+ out[outIdx]);
+ }
+ }
+ }
+
+ private void baseTestHelper(int testid, Element inElement, Element outElement, long seed, int fact,
+ int offset, int rStride, int rSkip, int refStride, int outStride,
+ int inStride, int skip, int ulp) {
+ float[] inArray = makeInArray(INPUTSIZE * inStride);
+ fillRandom(seed, fact, offset, inArray, rStride, rSkip);
+ float[] refArray = getRefArray(inArray, INPUTSIZE, inStride, skip);
+
+ Allocation mAllocationIn = setInAlloc(inElement);
+ fillInAlloc(mAllocationIn, inArray);
+
+ Allocation mAllocationOut = setOutAlloc(outElement);
+ try {
+ RSUtils.forEach(this, testid, mAllocationIn, mAllocationOut);
+ } catch (RSRuntimeException e) {
+ }
+ float[] outArray = makeOutArray(INPUTSIZE * outStride);
+ mAllocationOut.copyTo(outArray);
+ checkArray(refArray, outArray, INPUTSIZE, refStride, outStride, ulp);
+ }
+
+ public void baseTest(int testid, long seed, int refStride, int outStride, int inStride, int skip, int ulp) {
+ baseTestHelper(testid, null, null, seed, 1, 0, 1, 0, refStride, outStride, inStride, skip, ulp);
+ }
+
+ public void doF32(long seed, int ulp) {
+ baseTestHelper(TEST_F32, Element.F32(mRS), Element.F32(mRS), seed, 1, 0, 1, 0, 1, 1, 1, 0, ulp);
+ }
+
+ public void doF32_2(long seed, int ulp) {
+ baseTestHelper(TEST_F32_2, Element.F32_2(mRS), Element.F32_2(mRS), seed, 1, 0, 1, 0, 2, 2, 2, 0, ulp);
+ }
+
+ public void doF32_3(long seed, int ulp) {
+ baseTestHelper(TEST_F32_3, Element.F32_3(mRS), Element.F32_3(mRS), seed, 1, 0, 4, 1, 3, 4, 4, 1, ulp);
+ }
+
+ public void doF32_4(long seed, int ulp) {
+ baseTestHelper(TEST_F32_4, Element.F32_4(mRS), Element.F32_4(mRS), seed, 1, 0, 1, 0, 4, 4, 4, 0, ulp);
+ }
+
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ // Intentionally empty... subclass will likely define only one, but not both
+ }
+
+ public void forEach(int testId, Allocation mIn) throws RSRuntimeException {
+ // Intentionally empty... subclass will likely define only one, but not both
+ }
+
+ //These are default actions for these functions, specific tests overload them
+ protected float[] getRefArray(float[] inArray, int size, int stride, int skip) {
+ return null;
+ }
+
+ protected Allocation setInAlloc(Element e) {
+ return Allocation.createSized(mRS, e, INPUTSIZE);
+ }
+
+ protected Allocation setOutAlloc(Element e) {
+ return Allocation.createSized(mRS, e, INPUTSIZE);
+ }
+
+ protected float[] makeInArray(int size) {
+ return new float[size];
+ }
+
+ protected float[] makeOutArray(int size) {
+ return new float[size];
+ }
+
+ protected void fillRandom(long seed, int fact, int offset, float[] inArray, int rStride, int rSkip) {
+ RSUtils.genRandom(seed, fact, offset, inArray, rStride, rSkip);
+ }
+
+ protected void fillInAlloc(Allocation mIn, float[] inArray) {
+ mIn.copy1DRangeFromUnchecked(0, INPUTSIZE, inArray);
+ }
}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RSUtils.java b/tests/tests/renderscript/src/android/renderscript/cts/RSUtils.java
new file mode 100644
index 0000000..8c81e3d
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RSUtils.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.content.res.Resources;
+import java.util.Random;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+/**
+ * This class supplies some utils for renderscript tests
+ */
+public class RSUtils {
+
+ public static void genRandom(long seed, int factor, int offset, float array[]) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length; i++) {
+ array[i] = r.nextFloat() * factor + offset;
+ }
+ }
+
+ public static void genRandom(long seed, int factor, int offset, float array[],
+ int stride, int skip) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length / stride; i++) {
+ for (int j = 0; j < stride; j++) {
+ if (j >= stride - skip)
+ array[i * stride + j] = 0;
+ else
+ array[i * stride + j] = r.nextFloat() * factor + offset;
+ }
+ }
+ }
+
+ public static void genRandom(long seed, int max, int factor, int offset, int array[]) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length; i++) {
+ array[i] = (r.nextInt(max) * factor + offset);
+ }
+ }
+
+ public static void genRandom(long seed, int factor, int offset, int array[],
+ int stride, int skip) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length / stride; i++) {
+ for (int j = 0; j < stride; j++) {
+ if (j >= stride - skip)
+ array[i * stride + j] = 0;
+ else
+ array[i * stride + j] = r.nextInt() * factor + offset;
+ }
+ }
+ }
+
+ public static void genRandom(long seed, int max, int factor, int offset, int array[],
+ int stride, int skip) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length / stride; i++) {
+ for (int j = 0; j < stride; j++) {
+ if (j >= stride - skip)
+ array[i * stride + j] = 0;
+ else
+ array[i * stride + j] = r.nextInt(max) * factor + offset;
+ }
+ }
+ }
+
+ public static void forEach(RSBaseCompute base, int testId, Allocation in) throws RSRuntimeException {
+ base.forEach(testId, in);
+ }
+
+ public static void forEach(RSBaseCompute base, int testId, Allocation in, Allocation out)
+ throws RSRuntimeException {
+ base.forEach(testId, in,out);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RadiansTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RadiansTest.java
new file mode 100644
index 0000000..f8a6936
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RadiansTest.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class RadiansTest extends RSBaseCompute {
+ private ScriptC_radians_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_radians_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_radians_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_radians_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_radians_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_radians_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ double val = (double)in[idx] * (Math.PI / 180.0);
+ ref[idxRef] = (float)val;
+ }
+ }
+ return ref;
+ }
+
+ /**
+ * radians test for float
+ */
+ public void testRadiansF32() {
+ doF32(0x1234f678, 3);
+ }
+
+ /**
+ * radians test for float2
+ */
+ public void testRadiansF32_2() {
+ doF32_2(0x12345678, 3);
+ }
+
+ /**
+ * radians test for float3
+ */
+ public void testRadiansF32_3() {
+ doF32_3(0x123d5678, 3);
+ }
+
+ /**
+ * radians test for float4
+ */
+ public void testRadiansF32_4() {
+ doF32_4(0x123a5678, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RemainderTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RemainderTest.java
new file mode 100644
index 0000000..8abdafe
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RemainderTest.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class RemainderTest extends RSBaseCompute {
+ private ScriptC_remainder_f32 script_f32;
+ private Allocation mIn;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_remainder_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_remainder_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_remainder_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_remainder_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_remainder_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ double num = (double)in[idx];
+ double den = (double)in[idx+stride];
+ ref[i * (stride - skip) + j] = (float)(num - Math.round(num / den) * den);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testRemainderF32() {
+ ScriptField_remainder_f32 in = new ScriptField_remainder_f32(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x123678, 0);
+ }
+
+ public void testRemainderF32_2() {
+ ScriptField_remainder_f32_2 in = new ScriptField_remainder_f32_2(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x1234a5, 0);
+ }
+
+ public void testRemainderF32_3() {
+ ScriptField_remainder_f32_3 in = new ScriptField_remainder_f32_3(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x1af345, 0);
+ }
+
+ public void testRemainderF32_4() {
+ ScriptField_remainder_f32_4 in = new ScriptField_remainder_f32_4(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0x12ce45, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RintTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RintTest.java
new file mode 100644
index 0000000..2efef44
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RintTest.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class RintTest extends RSBaseCompute {
+ private ScriptC_rint_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_rint_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut)
+ throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_rint_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_rint_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_rint_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_rint_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] inArray, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * (stride - skip)];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idxIn = i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float) Math.rint(inArray[idxIn]);
+ }
+ }
+ return ref;
+ }
+
+ /**
+ * rint test for float
+ */
+ public void testRintF32() {
+ doF32(0x12345678, 0);
+ }
+
+ /**
+ * rint test for float2
+ */
+ public void testRintF32_2() {
+ doF32_2(0x12ab5678, 0);
+ }
+
+ /**
+ * rint test for float3
+ */
+ public void testRintF32_3() {
+ doF32_3(0x123ac678, 0);
+ }
+
+ /**
+ * rint test for float4
+ */
+ public void testRintF32_4() {
+ doF32_4(0x1f345678, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RootnTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RootnTest.java
new file mode 100644
index 0000000..1b2c46b
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RootnTest.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class RootnTest extends RSBaseCompute {
+ private ScriptC_rootn_f32 script_f32;
+ private int[] n;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_rootn_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_rootn_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_rootn_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_rootn_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_rootn_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)Math.pow((double)in[idx], 1.0/(double)n[idx]);
+ }
+ }
+ return ref;
+ }
+
+ public void testRootnF32() {
+ Allocation nAlloc = Allocation.createSized(mRS, Element.I32(mRS), INPUTSIZE);
+
+ n = new int[INPUTSIZE];
+ RSUtils.genRandom(0x12345678, 32, 1, 1, n);
+ nAlloc.copyFrom(n);
+ script_f32.set_n1(nAlloc);
+
+ doF32(0x716acd, 16);
+ }
+
+ public void testRootnF32_2() {
+ Allocation nAlloc = Allocation.createSized(mRS, Element.I32_2(mRS), INPUTSIZE);
+
+ n = new int[INPUTSIZE*2];
+ RSUtils.genRandom(0xacdef1, 32, 1, 1, n);
+ nAlloc.copyFrom(n);
+ script_f32.set_n2(nAlloc);
+
+ doF32_2(0xacdef1, 16);
+ }
+
+ public void testRootnF32_3() {
+ Allocation nAlloc = Allocation.createSized(mRS, Element.I32_3(mRS), INPUTSIZE);
+
+ n = new int[INPUTSIZE*4];
+ RSUtils.genRandom(0xa123f1, 32, 1, 1, n, 4, 1);
+ nAlloc.copyFrom(n);
+ script_f32.set_n3(nAlloc);
+
+ doF32_3(0xaac3f1, 16);
+ }
+
+ public void testRootnF32_4() {
+ Allocation nAlloc = Allocation.createSized(mRS, Element.I32_4(mRS), INPUTSIZE);
+
+ n = new int[INPUTSIZE*4];
+ RSUtils.genRandom(0x4323ca, 32, 1, 1, n);
+ nAlloc.copyFrom(n);
+ script_f32.set_n4(nAlloc);
+
+ doF32_4(0xaa12f1, 16);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RoundTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RoundTest.java
new file mode 100644
index 0000000..90f155b
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RoundTest.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class RoundTest extends RSBaseCompute {
+ private ScriptC_round_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_round_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut)
+ throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_round_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_round_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_round_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_round_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] inArray, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * (stride - skip)];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idxIn = i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ int res = ((Float.floatToIntBits(inArray[idxIn]) >> 31) & 0x01);
+ float roundValue = (float) Math.round(inArray[idxIn]);
+ float expective = roundValue;
+ if ((roundValue - inArray[idxIn]) == 0.5f && res == 1)
+ expective -= 1;
+ if (res == 1 && expective == +0.0f) {
+ expective = -0.0f;
+ }
+ ref[idxRef] = expective;
+ }
+ }
+ return ref;
+ }
+
+ /**
+ * round test for float
+ */
+ public void testRoundF32() {
+ doF32(0x12345678, 0);
+ }
+
+ /**
+ * round test for float2
+ */
+ public void testRoundF32_2() {
+ doF32_2(0x123a5678, 0);
+ }
+
+ /**
+ * round test for float3
+ */
+ public void testRoundF32_3() {
+ doF32_3(0x1af45678, 0);
+ }
+
+ /**
+ * round test for float4
+ */
+ public void testRoundF32_4() {
+ doF32_4(0x1f345678, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RsFracTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RsFracTest.java
new file mode 100644
index 0000000..74c9425
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RsFracTest.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright (C) 2012 The Android Open Source Project
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class RsFracTest extends RSBaseCompute {
+ private ScriptC_rs_frac_f32 mScript;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut)
+ throws RSRuntimeException {
+ mScript.forEach_root(mIn, mOut);
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = Math.min(in[idx] - (float)Math.floor((double)in[idx]), 0x1.fffffep-1f);
+ }
+ }
+ return ref;
+ }
+
+ public void testRsFrac() {
+ mScript = new ScriptC_rs_frac_f32(mRS, mRes, R.raw.rs_frac_f32);
+ doF32(0x12, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RsPackColorTo8888Test.java b/tests/tests/renderscript/src/android/renderscript/cts/RsPackColorTo8888Test.java
new file mode 100644
index 0000000..0b008a7
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RsPackColorTo8888Test.java
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.Float3;
+import android.renderscript.Float4;
+import android.renderscript.RSRuntimeException;
+
+public class RsPackColorTo8888Test extends RSBaseCompute {
+ private ScriptC_rs_pack_color_to_8888 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_rs_pack_color_to_8888(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case 0:
+ script_f32.forEach_pack_color_to_8888_rgb(mIn, mOut);
+ break;
+ case 1:
+ script_f32.forEach_pack_color_to_8888_rgba(mIn, mOut);
+ break;
+ case 2:
+ script_f32.forEach_pack_color_to_8888_f32_3(mIn, mOut);
+ break;
+ case 3:
+ script_f32.forEach_pack_color_to_8888_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ public void testRsPackColorTo8888RGB() {
+ float3input(0x17abc72, 0);
+ }
+
+ public void testRsPackColorTo8888RGBA() {
+ float4input(0x76a6b, 1);
+ }
+
+ public void testRsPackColorTo8888F32_3() {
+ float3input(0x17abc72, 2);
+ }
+
+ public void testRsPackColorTo8888F32_4() {
+ float4input(0xabc72, 3);
+ }
+
+ private void float3input(long seed, int testId) {
+ Allocation mAllocationIn = Allocation.createSized(mRS, Element.F32_3(mRS), INPUTSIZE);
+ Allocation mAllocationOut = Allocation.createSized(mRS, Element.U8_4(mRS), INPUTSIZE);
+ float[] inArray = new float[INPUTSIZE * 4];
+ byte[] outArray = new byte[INPUTSIZE * 4];
+ byte[] refArray = new byte[INPUTSIZE * 4];
+ RSUtils.genRandom(seed, 1, 0, inArray, 4, 1);
+ mAllocationIn.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ try {
+ RSUtils.forEach(this, testId, mAllocationIn, mAllocationOut);
+ } catch (RSRuntimeException e) {
+ }
+ mAllocationOut.copyTo(outArray);
+ for (int i = 0; i < outArray.length; i += 4) {
+ int offset = i;
+ Float3 inValues = new Float3(inArray[offset], inArray[offset + 1], inArray[offset + 2]);
+ byte[] cValue = rs_PackColorTo8888(inValues);
+ refArray[i] = cValue[0];
+ refArray[i + 1] = cValue[1];
+ refArray[i + 2] = cValue[2];
+ refArray[i + 3] = cValue[3];
+ for (int j = 0; j < 4; j++){
+ assertEquals(refArray[i+j] & 0xff, outArray[i+j] & 0xff);
+ }
+ }
+ }
+
+ private void float4input(long seed, int testId) {
+ Allocation mAllocationIn = Allocation.createSized(mRS, Element.F32_4(mRS), INPUTSIZE);
+ Allocation mAllocationOut = Allocation.createSized(mRS, Element.U8_4(mRS), INPUTSIZE);
+ float[] inArray = new float[INPUTSIZE * 4];
+ byte[] outArray = new byte[INPUTSIZE * 4];
+ byte[] refArray = new byte[INPUTSIZE * 4];
+ RSUtils.genRandom(seed, 1, 0, inArray);
+ mAllocationIn.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ try {
+ RSUtils.forEach(this, testId, mAllocationIn, mAllocationOut);
+ } catch (RSRuntimeException e) {
+ }
+ mAllocationOut.copyTo(outArray);
+ for (int i = 0; i < outArray.length; i += 4) {
+ int offset = i;
+ Float4 inValues = new Float4( inArray[offset],inArray[offset + 1],inArray[offset + 2],inArray[offset + 3]);
+ byte[] cValue = rs_PackColorTo8888(inValues);
+ refArray[i] = cValue[0];
+ refArray[i + 1] = cValue[1];
+ refArray[i + 2] = cValue[2];
+ refArray[i + 3] = cValue[3];
+ for (int j = 0; j < 4; j++){
+ assertEquals(refArray[i+j] & 0xff, outArray[i+j] & 0xff);
+ }
+ }
+ }
+
+ private byte[] rs_PackColorTo8888(Float3 color) {
+ color.x *= 255.f;
+ color.y *= 255.f;
+ color.z *= 255.f;
+ color.x += 0.5f;
+ color.y += 0.5f;
+ color.z += 0.5f;
+ byte[] c = {
+ (byte) color.x, (byte) color.y, (byte) color.z, (byte) 255
+ };
+ return c;
+ }
+
+ private byte[] rs_PackColorTo8888(Float4 color) {
+ color.x *= 255.f;
+ color.y *= 255.f;
+ color.z *= 255.f;
+ color.x += 0.5f;
+ color.y += 0.5f;
+ color.z += 0.5f;
+ color.w *= 255.f;
+ color.w += 0.5f;
+ byte[] c = {
+ (byte) color.x, (byte) color.y, (byte) color.z, (byte) color.w
+ };
+ return c;
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RsUnpackColor8888Test.java b/tests/tests/renderscript/src/android/renderscript/cts/RsUnpackColor8888Test.java
new file mode 100644
index 0000000..4df1169
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RsUnpackColor8888Test.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.Float4;
+import android.renderscript.RSRuntimeException;
+import java.util.Random;
+
+public class RsUnpackColor8888Test extends RSBaseCompute {
+ private ScriptC_rs_unpack_color_8888 script;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ script.forEach_root(mIn, mOut);
+ }
+
+ public void testRsUnpackColor8888RGB() {
+ script = new ScriptC_rs_unpack_color_8888(mRS, mRes, R.raw.rs_unpack_color_8888);
+ Allocation mAllocationIn = Allocation.createSized(mRS, Element.U8_4(mRS), INPUTSIZE);
+ Allocation mAllocationOut = Allocation.createSized(mRS, Element.F32_4(mRS), INPUTSIZE);
+ byte[] inArray = new byte[INPUTSIZE * 4];
+ float[] outArray = new float[INPUTSIZE * 4];
+ float[] refArray = new float[INPUTSIZE * 4];
+
+ Random r = new Random(0x128fa817);
+ r.nextBytes(inArray);
+
+ mAllocationIn.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ try {
+ RSUtils.forEach(this, 0, mAllocationIn, mAllocationOut);
+ } catch (RSRuntimeException e) {
+ }
+ mAllocationOut.copyTo(outArray);
+
+ for (int i = 0; i < outArray.length; i += 4) {
+ byte[] inValues = {inArray[i], inArray[i+1], inArray[i+2], inArray[i+3]};
+ Float4 c = rs_UnpackColor8888(inValues);
+ refArray[i] = c.x;
+ refArray[i + 1] = c.y;
+ refArray[i + 2] = c.z;
+ refArray[i + 3] = c.w;
+ for (int j = 0; j < 4; j++){
+ assertEquals(refArray[i+j], outArray[i+j]);
+ }
+ }
+ }
+
+ private static Float4 rs_UnpackColor8888(byte[] c) {
+ Float4 ret = new Float4(0.003921569f, 0.003921569f, 0.003921569f, 0.003921569f);
+ ret.x *= (c[0] & 0xff);
+ ret.y *= (c[1] & 0xff);
+ ret.z *= (c[2] & 0xff);
+ ret.w *= (c[3] & 0xff);
+ return ret;
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RsqrtTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RsqrtTest.java
new file mode 100644
index 0000000..13f4817
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RsqrtTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class RsqrtTest extends RSBaseCompute {
+ private ScriptC_rsqrt_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_rsqrt_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_Rsqrt_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_Rsqrt_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_Rsqrt_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_Rsqrt_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)Math.pow((double)in[idx], -0.5);
+ }
+ }
+ return ref;
+ }
+
+ public void testRsqrtF32() {
+ doF32(0x12345678, 2);
+ }
+
+ public void testRsqrtF32_2() {
+ doF32_2(0x12ae4567, 2);
+ }
+
+ public void testRsqrtF32_3() {
+ doF32_3(0x12cf8, 2);
+ }
+
+ public void testRsqrtF32_4() {
+ doF32_4(0x12abc8, 2);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SendToClient.java b/tests/tests/renderscript/src/android/renderscript/cts/SendToClient.java
new file mode 100644
index 0000000..56961a9
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SendToClient.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.renderscript.cts;
+
+import java.util.Random;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RenderScript.RSMessageHandler;
+import com.android.cts.stub.R;
+
+public class SendToClient extends RSBaseCompute {
+ private Allocation mInAllocation;
+ private static Random random = new Random();
+
+ int outArray[] = new int[4];
+ RSMessageHandlerForTest mRsMessage = new RSMessageHandlerForTest() {
+ public void run() {
+ switch (mID) {
+ default:
+ outArray[0] = mID;
+ outArray[1] = mData[0];
+ outArray[2] = mData[1];
+ outArray[3] = mData[2];
+ try {
+ releaseForTest();
+ } catch (Exception e) {
+ //TODO: handle exception
+ }
+ return;
+ }
+ }
+ };
+
+ /*
+ * test rsSendToClient(int cmdID, const void* data, uint len);
+ */
+ public void testSendToClient() {
+ int[] inArray = new int[4];
+ for (int i=0; i<4; i++) {
+ inArray[i] = random.nextInt(1000);
+ }
+ mInAllocation = Allocation.createSized(mRS, Element.I32_4(mRS), 1);
+ mInAllocation.copyFrom(inArray);
+ ScriptC_send_to_client mScript;
+ mRS.setMessageHandler(mRsMessage);
+ mScript = new ScriptC_send_to_client(mRS,mRes,R.raw.send_to_client);
+ mScript.forEach_root(mInAllocation);
+ try {
+ mRsMessage.waitForTest();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ for (int i=0; i<inArray.length; i++) {
+ assertEquals(createErrorMsgF(i, inArray[i], outArray[i]),
+ inArray[i], outArray[i]);
+ }
+ }
+
+ /*
+ * test rsSendToClient(int cmdID)
+ */
+ public void testSendToClient1(){
+ outArray[0] = 0;
+ int Id = random.nextInt(100);
+ mRS.setMessageHandler(mRsMessage);
+ ScriptC_send_to_client_1 mScript;
+ mScript = new ScriptC_send_to_client_1(mRS,mRes,R.raw.send_to_client_1);
+ mScript.invoke_callback(Id);
+ try {
+ mRsMessage.waitForTest();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertEquals(createErrorMsgF(1, Id, outArray[0]), Id, outArray[0]);
+ }
+
+ private String createErrorMsgF(int i, int in, int temp) {
+ StringBuffer bf = new StringBuffer();
+ bf.append("[Wrong value]");
+ bf.append("; i = " + i);
+ bf.append("; InValue = " + in);
+ bf.append("; exceptValue = " + temp);
+ return bf.toString();
+ }
+
+ class RSMessageHandlerForTest extends RSMessageHandler {
+ public synchronized void waitForTest() throws InterruptedException {
+ wait();
+ }
+ public synchronized void releaseForTest() throws InterruptedException {
+ notify();
+ }
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SendToClientBlockingTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SendToClientBlockingTest.java
new file mode 100644
index 0000000..5083f87
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SendToClientBlockingTest.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.RenderScript.RSMessageHandler;
+
+import java.util.Random;
+
+import com.android.cts.stub.R;
+
+public class SendToClientBlockingTest extends RSBaseCompute {
+
+ private ScriptC_sendToClientBlocking mScript;
+ private Random random;
+
+ private int resultId = 0;
+ private int resultData = 0;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ random = new Random();
+ }
+
+ RSMessageHandlerForTest mRsMessageForTest = new RSMessageHandlerForTest() {
+ public void run() {
+ switch (mID) {
+ default:
+ resultId = mID;
+ resultData = mData[0];
+ try {
+ releaseForTest();
+ } catch (Exception e) {
+ // TODO: handle exception
+ }
+ return;
+ }
+ }
+ };
+
+ public void testSendToClientBlocking1Params() {
+
+ int id = random.nextInt(10);
+ mRS.setMessageHandler(mRsMessageForTest);
+ mScript = new ScriptC_sendToClientBlocking(mRS, mRes,
+ R.raw.sendtoclientblocking);
+ mScript.set_ID(id);
+ // Log.i("testSendToClientBlocking1Params", "==" + id);
+ mScript.invoke_callBack1Params();
+ try {
+ mRsMessageForTest.waitForTest();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue("testSendToClientBlocking1Params fail the result is:" + resultId,
+ resultId == id);
+ }
+
+ public void testSendToClientBlocking3Params() {
+
+ int id = random.nextInt(10);
+ int data = random.nextInt();
+ mRS.setMessageHandler(mRsMessageForTest);
+ mScript = new ScriptC_sendToClientBlocking(mRS, mRes,
+ R.raw.sendtoclientblocking);
+ mScript.set_ID(id);
+ mScript.set_data(data);
+ // Log.i("testSendToClientBlocking3Params", data + "==" + id);
+ mScript.invoke_callBack3Params();
+ try {
+ mRsMessageForTest.waitForTest();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue("testSendToClientBlocking3Params fail the ID is:" + resultId +
+ "The data is:" + data, resultId == id && resultData == data);
+ }
+
+}
+
+/** This class is used to wait callback. */
+class RSMessageHandlerForTest extends RSMessageHandler {
+
+ public synchronized void waitForTest() throws InterruptedException {
+ wait();
+ }
+
+ public synchronized void releaseForTest() throws InterruptedException {
+ notify();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SetObjectTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SetObjectTest.java
new file mode 100644
index 0000000..a6626ee
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SetObjectTest.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.*;
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.util.Log;
+import com.android.cts.stub.R;
+
+import junit.framework.Assert;
+
+public class SetObjectTest extends RSBaseCompute {
+ int ObjectNum = 1;
+ private Allocation mIn;
+ private Allocation mOut;
+
+ Element element;
+ Type type;
+ Allocation allocation;
+ Sampler sampler;
+ Script script;
+
+ private ScriptC_set_object ms_set;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ element = Element.BOOLEAN(mRS);
+
+ type = new Type.Builder(mRS, Element.I8(mRS)).setX(1).create();
+ allocation = Allocation.createTyped(mRS, type);
+ sampler = new Sampler.Builder(mRS).create();
+ script = new ScriptC_set_object(mRS);
+
+ ms_set = new ScriptC_set_object(mRS);
+ }
+
+ /**
+ * rsSetObject test
+ */
+ public void testSetObjectElement() {
+ ScriptField__set_object_element_input filed = new ScriptField__set_object_element_input(
+ mRS, 1);
+ ScriptField__set_object_element_input.Item mItem = new ScriptField__set_object_element_input.Item();
+ mItem.element = element;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ try {
+ ms_set.forEach_set_object_element(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsSetObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue("rsSetObject element test fail: " + "Expect 1;value "
+ + tmpArray[0], tmpArray[0] == 1);
+ }
+
+ public void testSetObjectType() {
+ ScriptField__set_object_type_input filed = new ScriptField__set_object_type_input(mRS, 1);
+ ScriptField__set_object_type_input.Item mItem = new ScriptField__set_object_type_input.Item();
+ mItem.type = type;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+
+ try {
+ ms_set.forEach_set_object_type(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsSetObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue(
+ "rsSetObject type test fail: " + "Expect 1;value " + tmpArray[0],
+ tmpArray[0] == 1);
+ }
+
+ public void testSetObjectAllocation() {
+ ScriptField__set_object_allocation_input filed = new ScriptField__set_object_allocation_input(
+ mRS, 1);
+ ScriptField__set_object_allocation_input.Item mItem = new ScriptField__set_object_allocation_input.Item();
+ mItem.allocation = allocation;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+
+ try {
+ ms_set.forEach_set_object_allocation(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsSetObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue("rsSetObject allocation test fail: " + "Expect 1;value "
+ + tmpArray[0], tmpArray[0] == 1);
+ }
+
+ public void testSetObjectSampler() {
+ ScriptField__set_object_sampler_input filed = new ScriptField__set_object_sampler_input(
+ mRS, 1);
+ ScriptField__set_object_sampler_input.Item mItem = new ScriptField__set_object_sampler_input.Item();
+ mItem.sampler = sampler;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+
+ try {
+ ms_set.forEach_set_object_sampler(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsSetObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue("rsSetObject sampler test fail: " + "Expect 1;value "
+ + tmpArray[0], tmpArray[0] == 1);
+ }
+
+ public void testSetObjectScript() {
+ ScriptField__set_object_script_input filed = new ScriptField__set_object_script_input(
+ mRS, 1);
+ ScriptField__set_object_script_input.Item mItem = new ScriptField__set_object_script_input.Item();
+ mItem.script = script;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+
+ try {
+ ms_set.forEach_set_object_script(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsSetObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue("rsSetObject script test fail: " + "Expect 1;value "
+ + tmpArray[0], tmpArray[0] == 1);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SignTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SignTest.java
new file mode 100644
index 0000000..9329d01
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SignTest.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class SignTest extends RSBaseCompute {
+ private ScriptC_sign_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_sign_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_sign_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_sign_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_sign_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_sign_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idxIn = i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = in[idxIn] > 0.f ? 1.f : -1.f;
+ }
+ }
+ return ref;
+ }
+
+ /**
+ * This method is used for sign() function with f32
+ */
+ public void testSignF32() {
+ doF32(0x12345678, 0);
+ }
+
+ public void testSignF32_2() {
+ doF32_2(0x12a45678, 0);
+ }
+
+ /**
+ * This method is used for sign() function with f32_3
+ */
+ public void testSignF32_3() {
+ doF32_3(0x123c5678, 0);
+ }
+
+ /**
+ * This method is used for sign() function with f32_4
+ */
+ public void testSignF32_4() {
+ doF32_4(0x123d678, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SinTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SinTest.java
new file mode 100644
index 0000000..2d57219
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SinTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class SinTest extends RSBaseCompute {
+ private ScriptC_sin_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_sin_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_sin_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_sin_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_sin_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_sin_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.sin((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testSinF32() {
+ doF32(0xba, 4);
+ }
+
+ public void testSinF32_2() {
+ doF32_2(0xbaa, 4);
+ }
+
+ public void testSinF32_3() {
+ doF32_3(0xca, 4);
+ }
+
+ public void testSinF32_4() {
+ doF32_4(0xda, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SinhTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SinhTest.java
new file mode 100644
index 0000000..c88bd42
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SinhTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class SinhTest extends RSBaseCompute {
+ private ScriptC_sinh_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_sinh_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_sinh_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_sinh_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_sinh_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_sinh_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.sinh((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testSinhF32() {
+ doF32(0x32a, 4);
+ }
+
+ public void testSinhF32_2() {
+ doF32_2(0xba35, 4);
+ }
+
+ public void testSinhF32_3() {
+ doF32_3(0xacc3, 4);
+ }
+
+ public void testSinhF32_4() {
+ doF32_4(0xaa, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SqrtTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SqrtTest.java
new file mode 100644
index 0000000..300a519
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SqrtTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class SqrtTest extends RSBaseCompute {
+ private ScriptC_sqrt_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_sqrt_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_sqrt_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_sqrt_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_sqrt_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_sqrt_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.sqrt((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testSqrtF32() {
+ doF32(0xab3, 3);
+ }
+
+ public void testSqrtF32_2() {
+ doF32_2(0xa1, 3);
+ }
+
+ public void testSqrtF32_3() {
+ doF32_3(0xbae7, 3);
+ }
+
+ public void testSqrtF32_4() {
+ doF32_4(0xbac361, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/StepTest.java b/tests/tests/renderscript/src/android/renderscript/cts/StepTest.java
new file mode 100644
index 0000000..a1ffda3
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/StepTest.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class StepTest extends RSBaseCompute {
+ private ScriptC_step_f32 script_f32;
+ private Allocation mIn;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_step_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_step_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_step_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_step_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_step_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = in[idx+stride] < in[idx] ? 0.0f : 1.0f;
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testStepF32() {
+ ScriptField_step_input in = new ScriptField_step_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x12678, 0);
+ }
+
+ public void testStepF32_2() {
+ ScriptField_step_2_input in = new ScriptField_step_2_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x1ace8, 0);
+ }
+
+ public void testStepF32_3() {
+ ScriptField_step_3_input in = new ScriptField_step_3_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0xa2ce8, 0);
+ }
+
+ public void testStepF32_4() {
+ ScriptField_step_4_input in = new ScriptField_step_4_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0x1ee8, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TanTest.java b/tests/tests/renderscript/src/android/renderscript/cts/TanTest.java
new file mode 100644
index 0000000..f237c40
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TanTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class TanTest extends RSBaseCompute {
+ private ScriptC_tan_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_tan_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_tan_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_tan_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_tan_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_tan_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.tan((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testTanF32() {
+ doF32(0xabe, 5);
+ }
+
+ public void testTanF32_2() {
+ doF32_2(0x29, 5);
+ }
+
+ public void testTanF32_3() {
+ doF32_3(0x9a, 5);
+ }
+
+ public void testTanF32_4() {
+ doF32_4(0xac3, 5);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TanhTest.java b/tests/tests/renderscript/src/android/renderscript/cts/TanhTest.java
new file mode 100644
index 0000000..070fa20
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TanhTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class TanhTest extends RSBaseCompute {
+ private ScriptC_tanh_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_tanh_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_tanh_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_tanh_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_tanh_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_tanh_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.tanh((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testTanhF32() {
+ doF32(0xab61, 5);
+ }
+
+ public void testTanhF32_2() {
+ doF32_2(0xa301, 5);
+ }
+
+ public void testTanhF32_3() {
+ doF32_3(0x918, 5);
+ }
+
+ public void testTanhF32_4() {
+ doF32_4(0x81, 5);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TruncTest.java b/tests/tests/renderscript/src/android/renderscript/cts/TruncTest.java
new file mode 100644
index 0000000..15878ba
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TruncTest.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class TruncTest extends RSBaseCompute {
+ private ScriptC_trunc_f32 script_f32;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script_f32 = new ScriptC_trunc_f32(mRS);
+ }
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_trunc_f32_1(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32.forEach_trunc_f32_2(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32.forEach_trunc_f32_3(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32.forEach_trunc_f32_4(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] inArray, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idxSrc = i * stride + j;
+ int idxDst = i * (stride - skip) + j;
+ int sign = ((Float.floatToIntBits(inArray[idxSrc]) >> 31) & 0x01);
+ float trunc = (int)inArray[idxSrc];
+ if (sign == 1 && trunc == +0.0f) {
+ trunc = -0.0f;
+ }
+ ref[idxDst] = trunc;
+ }
+ }
+ return ref;
+ }
+
+ /**
+ * trunc test for float
+ */
+ public void testTruncF32() {
+ doF32(0x12345678, 0);
+ }
+
+ /**
+ * trunc test for float2
+ */
+ public void testTruncF32_2() {
+ doF32_2(0x12345a78, 0);
+ }
+
+ /**
+ * trunc test for float3
+ */
+ public void testTruncF32_3() {
+ doF32_3(0x12f45678, 0);
+ }
+
+ /**
+ * trunc test for float4
+ */
+ public void testTruncF32_4() {
+ doF32_4(0x123c5678, 0);
+ }
+}
diff --git a/tests/tests/text/src/android/text/format/cts/DateUtilsTest.java b/tests/tests/text/src/android/text/format/cts/DateUtilsTest.java
index 14e01e8..0e8f73e 100644
--- a/tests/tests/text/src/android/text/format/cts/DateUtilsTest.java
+++ b/tests/tests/text/src/android/text/format/cts/DateUtilsTest.java
@@ -162,8 +162,7 @@
assertEquals(expected, sb.toString());
}
- @SuppressWarnings("deprecation")
- public void testFormatMethods() {
+ public void testFormatSameDayTime() {
if (!LocaleUtils.isCurrentLocale(mContext, Locale.US)) {
return;
}
@@ -199,59 +198,20 @@
fixedTime, java.text.DateFormat.FULL, java.text.DateFormat.MEDIUM));
assertEquals("5:30 AM", DateUtils.formatSameDayTime(fixedTime + HOUR_DURATION,
fixedTime, java.text.DateFormat.FULL, java.text.DateFormat.SHORT));
+ }
- long noonDuration = (8 * 60 + 30) * 60 * 1000 - 15 * 1000;
- long midnightDuration = (3 * 60 + 30) * 60 * 1000 + 15 * 1000;
- long integralDuration = 30 * 60 * 1000 + 15 * 1000;
- assertEquals("Monday", DateUtils.formatDateRange(mContext, fixedTime, fixedTime
- + HOUR_DURATION, DateUtils.FORMAT_SHOW_WEEKDAY));
- assertEquals("January 19", DateUtils.formatDateRange(mContext, timeWithCurrentYear,
- timeWithCurrentYear + HOUR_DURATION, DateUtils.FORMAT_SHOW_DATE));
- assertEquals("3:30AM", DateUtils.formatDateRange(mContext, fixedTime, fixedTime,
- DateUtils.FORMAT_SHOW_TIME));
- assertEquals("January 19, 2009", DateUtils.formatDateRange(mContext, fixedTime,
- fixedTime + HOUR_DURATION, DateUtils.FORMAT_SHOW_YEAR));
- assertEquals("January 19", DateUtils.formatDateRange(mContext, timeWithCurrentYear,
- timeWithCurrentYear + HOUR_DURATION, DateUtils.FORMAT_NO_YEAR));
- assertEquals("January", DateUtils.formatDateRange(mContext, timeWithCurrentYear,
- timeWithCurrentYear + HOUR_DURATION, DateUtils.FORMAT_NO_MONTH_DAY));
- assertEquals("3:30AM", DateUtils.formatDateRange(mContext, fixedTime, fixedTime,
- DateUtils.FORMAT_12HOUR | DateUtils.FORMAT_SHOW_TIME));
- assertEquals("03:30", DateUtils.formatDateRange(mContext, fixedTime, fixedTime,
- DateUtils.FORMAT_24HOUR | DateUtils.FORMAT_SHOW_TIME));
- assertEquals("3:30AM", DateUtils.formatDateRange(mContext, fixedTime, fixedTime,
- DateUtils.FORMAT_12HOUR | DateUtils.FORMAT_CAP_AMPM | DateUtils.FORMAT_SHOW_TIME));
- assertEquals("noon", DateUtils.formatDateRange(mContext, fixedTime + noonDuration,
- fixedTime + noonDuration, DateUtils.FORMAT_12HOUR | DateUtils.FORMAT_SHOW_TIME));
- assertEquals("Noon", DateUtils.formatDateRange(mContext, fixedTime + noonDuration,
- fixedTime + noonDuration,
- DateUtils.FORMAT_12HOUR | DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_CAP_NOON));
- assertEquals("12:00PM", DateUtils.formatDateRange(mContext, fixedTime + noonDuration,
- fixedTime + noonDuration,
- DateUtils.FORMAT_12HOUR | DateUtils.FORMAT_NO_NOON | DateUtils.FORMAT_SHOW_TIME));
- assertEquals("12:00AM", DateUtils.formatDateRange(mContext, fixedTime - midnightDuration,
- fixedTime - midnightDuration,
- DateUtils.FORMAT_12HOUR | DateUtils.FORMAT_SHOW_TIME
- | DateUtils.FORMAT_NO_MIDNIGHT));
- assertEquals("3:30AM", DateUtils.formatDateRange(mContext, fixedTime, fixedTime,
- DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_UTC));
- assertEquals("3am", DateUtils.formatDateRange(mContext, fixedTime - integralDuration,
- fixedTime - integralDuration,
- DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_TIME));
- assertEquals("Mon", DateUtils.formatDateRange(mContext, fixedTime,
- fixedTime + HOUR_DURATION,
- DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_ABBREV_WEEKDAY));
- assertEquals("Jan 19", DateUtils.formatDateRange(mContext, timeWithCurrentYear,
- timeWithCurrentYear + HOUR_DURATION,
- DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_MONTH));
- assertEquals("Jan 19", DateUtils.formatDateRange(mContext, timeWithCurrentYear,
- timeWithCurrentYear + HOUR_DURATION,
- DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL));
- String actual = DateUtils.formatDateRange(mContext, fixedTime,
- fixedTime + HOUR_DURATION,
- DateUtils.FORMAT_SHOW_YEAR | DateUtils.FORMAT_NUMERIC_DATE);
- // accept with leading zero or without
- assertTrue("1/19/2009".equals(actual) || "01/19/2009".equals(actual));
+ // This is just to exercise the wrapper that calls the libcore/icu4c implementation.
+ // Full testing, in multiple locales, is in libcore's CTS tests.
+ public void testFormatDateRange() {
+ if (!LocaleUtils.isCurrentLocale(mContext, Locale.US)) {
+ return;
+ }
+
+ Date date = new Date(109, 0, 19, 3, 30, 15);
+ long fixedTime = date.getTime();
+ final long HOUR_DURATION = 2 * 60 * 60 * 1000;
+ assertEquals("Monday", DateUtils.formatDateRange(mContext, fixedTime,
+ fixedTime + HOUR_DURATION, DateUtils.FORMAT_SHOW_WEEKDAY));
}
public void testIsToday() {
diff --git a/tests/uiautomator/test-apps/CtsUiAutomatorApp/Android.mk b/tests/uiautomator/test-apps/CtsUiAutomatorApp/Android.mk
index fe4342a..90bdb61 100644
--- a/tests/uiautomator/test-apps/CtsUiAutomatorApp/Android.mk
+++ b/tests/uiautomator/test-apps/CtsUiAutomatorApp/Android.mk
@@ -28,4 +28,6 @@
LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_DEX_PREOPT := false
+
include $(BUILD_PACKAGE)
diff --git a/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java b/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java
index 20429f0..9d4bbed 100644
--- a/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java
+++ b/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java
@@ -16,7 +16,7 @@
package util.build;
-import com.android.dx.util.FileUtils;
+import com.android.dex.util.FileUtils;
import dot.junit.AllTests;