summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/colormatrix.fs (renamed from tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/colormatrix.rs)6
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve3x3.fs (renamed from tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve3x3.rs)4
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve5x5.fs (renamed from tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve5x5.rs)4
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/copy.fs (renamed from tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/copy.rs)4
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye.rsh10
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx.rsh10
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx_relaxed.fs (renamed from tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx_relaxed.rs)0
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_relaxed.fs (renamed from tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_relaxed.rs)0
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.fs (renamed from tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs)14
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/greyscale.fs (renamed from tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/greyscale.rs)6
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels.rsh16
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels_relaxed.fs (renamed from tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels_relaxed.rs)0
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/mandelbrot.fs (renamed from tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/mandelbrot.rs)16
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/threshold.fs (renamed from tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/threshold.rs)42
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh12
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx.rsh10
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx_relaxed.fs (renamed from tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx_relaxed.rs)0
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_relaxed.fs (renamed from tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_relaxed.rs)0
18 files changed, 77 insertions, 77 deletions
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/colormatrix.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/colormatrix.fs
index a83e819..ba8711b 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/colormatrix.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/colormatrix.fs
@@ -29,10 +29,10 @@ void setMatrix(rs_matrix4x4 m) {
Mat = m;
}
-void root(const uchar4 *in, uchar4 *out) {
- float4 f = convert_float4(*in);
+uchar4 __attribute__((kernel)) root(uchar4 in) {
+ float4 f = convert_float4(in);
f = rsMatrixMultiply(&Mat, f);
f = clamp(f, 0.f, 255.f);
- *out = convert_uchar4(f);
+ return convert_uchar4(f);
}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve3x3.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve3x3.fs
index 9812827..772503f 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve3x3.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve3x3.fs
@@ -24,7 +24,7 @@ rs_allocation gIn;
float gCoeffs[9];
-void root(uchar4 *out, uint32_t x, uint32_t y) {
+uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
uint32_t x1 = min((int32_t)x+1, gWidth-1);
uint32_t x2 = max((int32_t)x-1, 0);
uint32_t y1 = min((int32_t)y+1, gHeight-1);
@@ -61,7 +61,7 @@ void root(uchar4 *out, uint32_t x, uint32_t y) {
p20 += p02;
p20 = clamp(p20, 0.f, 255.f);
- *out = convert_uchar4(p20);
+ return convert_uchar4(p20);
}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve5x5.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve5x5.fs
index e6d03c9..a916bfb 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve5x5.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve5x5.fs
@@ -24,7 +24,7 @@ rs_allocation gIn;
float gCoeffs[25];
-void root(uchar4 *out, uint32_t x, uint32_t y) {
+uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
uint32_t x0 = max((int32_t)x-2, 0);
uint32_t x1 = max((int32_t)x-1, 0);
uint32_t x2 = x;
@@ -68,7 +68,7 @@ void root(uchar4 *out, uint32_t x, uint32_t y) {
+ convert_float4(rsGetElementAt_uchar4(gIn, x4, y4)) * gCoeffs[24];
p0 = clamp(p0 + p1 + p2 + p3 + p4, 0.f, 255.f);
- *out = convert_uchar4(p0);
+ return convert_uchar4(p0);
}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/copy.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/copy.fs
index 9eb5d43..5f03483 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/copy.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/copy.fs
@@ -17,8 +17,8 @@
#pragma version(1)
#pragma rs java_package_name(com.android.rs.image)
-void root(const uchar4 *v_in, uchar4 *v_out) {
- *v_out = *v_in;
+uchar4 __attribute__((kernel)) root(uchar4 v_in) {
+ return v_in;
}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye.rsh b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye.rsh
index 3809912..2eacb7d 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye.rsh
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye.rsh
@@ -26,7 +26,7 @@ void init_filter(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y,
neg_center = -center;
inv_dimensions.x = 1.f / (float)dim_x;
inv_dimensions.y = 1.f / (float)dim_y;
- alpha = k * 2.0 + 0.75;
+ alpha = k * 2.0f + 0.75f;
axis_scale = (float2)1.f;
if (dim_x > dim_y)
@@ -34,15 +34,15 @@ void init_filter(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y,
else
axis_scale.x = (float)dim_x / (float)dim_y;
- const float bound2 = 0.25 * (axis_scale.x*axis_scale.x + axis_scale.y*axis_scale.y);
+ const float bound2 = 0.25f * (axis_scale.x*axis_scale.x + axis_scale.y*axis_scale.y);
const float bound = sqrt(bound2);
- const float radius = 1.15 * bound;
+ const float radius = 1.15f * bound;
radius2 = radius*radius;
const float max_radian = M_PI_2 - atan(alpha / bound * sqrt(radius2 - bound2));
factor = bound / max_radian;
}
-void root(uchar4 *out, uint32_t x, uint32_t y) {
+uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
// Convert x and y to floating point coordinates with center as origin
const float2 inCoord = {(float)x, (float)y};
const float2 coord = mad(inCoord, inv_dimensions, neg_center);
@@ -53,6 +53,6 @@ void root(uchar4 *out, uint32_t x, uint32_t y) {
const float scalar = radian * factor * inv_dist;
const float2 new_coord = mad(coord, scalar, center);
const float4 fout = rsSample(in_alloc, sampler, new_coord);
- *out = rsPackColorTo8888(fout);
+ return rsPackColorTo8888(fout);
}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx.rsh b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx.rsh
index 08b4126..fcf0a3d 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx.rsh
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx.rsh
@@ -26,7 +26,7 @@ void init_filter(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y,
neg_center = -center;
inv_dimensions.x = 1.f / (float)dim_x;
inv_dimensions.y = 1.f / (float)dim_y;
- alpha = k * 2.0 + 0.75;
+ alpha = k * 2.0f + 0.75f;
axis_scale = (float2)1.f;
if (dim_x > dim_y)
@@ -34,15 +34,15 @@ void init_filter(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y,
else
axis_scale.x = (float)dim_x / (float)dim_y;
- const float bound2 = 0.25 * (axis_scale.x*axis_scale.x + axis_scale.y*axis_scale.y);
+ const float bound2 = 0.25f * (axis_scale.x*axis_scale.x + axis_scale.y*axis_scale.y);
const float bound = sqrt(bound2);
- const float radius = 1.15 * bound;
+ const float radius = 1.15f * bound;
radius2 = radius*radius;
const float max_radian = M_PI_2 - atan(alpha / bound * sqrt(radius2 - bound2));
factor = bound / max_radian;
}
-void root(uchar4 *out, uint32_t x, uint32_t y) {
+uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
// Convert x and y to floating point coordinates with center as origin
const float2 inCoord = {(float)x, (float)y};
const float2 coord = mad(inCoord, inv_dimensions, neg_center);
@@ -53,6 +53,6 @@ void root(uchar4 *out, uint32_t x, uint32_t y) {
const float scalar = radian * factor * inv_dist;
const float2 new_coord = mad(coord, scalar, center);
const float4 fout = rsSample(in_alloc, sampler, new_coord);
- *out = rsPackColorTo8888(fout);
+ return rsPackColorTo8888(fout);
}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx_relaxed.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx_relaxed.fs
index 3e76368..3e76368 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx_relaxed.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx_relaxed.fs
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_relaxed.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_relaxed.fs
index dc3ffcb..dc3ffcb 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_relaxed.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_relaxed.fs
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.fs
index c8531f3..4ae095d 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.fs
@@ -18,8 +18,8 @@
#pragma rs java_package_name(com.android.rs.image)
#pragma rs_fp_relaxed
-void genRand(uchar *out) {
- *out = (uchar)rsRand(0xff);
+uchar __attribute__((kernel)) genRand() {
+ return (uchar)rsRand(0xff);
}
/*
@@ -42,7 +42,7 @@ int32_t gWMask;
int32_t gHMask;
rs_allocation gBlendSource;
-void blend9(uchar *out, uint32_t x, uint32_t y) {
+uchar __attribute__((kernel)) blend9(uint32_t x, uint32_t y) {
uint32_t x1 = (x-1) & gWMask;
uint32_t x2 = (x+1) & gWMask;
uint32_t y1 = (y-1) & gHMask;
@@ -70,14 +70,14 @@ void blend9(uchar *out, uint32_t x, uint32_t y) {
p20 += p02;
p20 = min(p20 >> 10, (uint)255);
- *out = (uchar)p20;
+ return (uchar)p20;
}
float gNoiseStrength;
rs_allocation gNoise;
-void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {
- float4 ip = convert_float4(*in);
+uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) {
+ float4 ip = convert_float4(in);
float pnoise = (float) rsGetElementAt_uchar(gNoise, x & gWMask, y & gHMask);
float energy_level = ip.r + ip.g + ip.b;
@@ -89,5 +89,5 @@ void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {
uchar4 p = convert_uchar4(ip);
p.a = 0xff;
- *out = p;
+ return p;
}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/greyscale.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/greyscale.fs
index c420cac..90ba058 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/greyscale.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/greyscale.fs
@@ -20,11 +20,11 @@
const static float3 gMonoMult = {0.299f, 0.587f, 0.114f};
-void root(const uchar4 *v_in, uchar4 *v_out) {
- float4 f4 = rsUnpackColor8888(*v_in);
+uchar4 __attribute__((kernel)) root(uchar4 v_in) {
+ float4 f4 = rsUnpackColor8888(v_in);
float3 mono = dot(f4.rgb, gMonoMult);
- *v_out = rsPackColorTo8888(mono);
+ return rsPackColorTo8888(mono);
}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels.rsh b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels.rsh
index 7c5d930..e289906 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels.rsh
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels.rsh
@@ -21,24 +21,26 @@ float outWMinOutB;
float overInWMinInB;
rs_matrix3x3 colorMat;
-void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {
- float3 pixel = convert_float4(in[0]).rgb;
+uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) {
+ uchar4 out;
+ float3 pixel = convert_float4(in).rgb;
pixel = rsMatrixMultiply(&colorMat, pixel);
pixel = clamp(pixel, 0.f, 255.f);
pixel = (pixel - inBlack) * overInWMinInB;
pixel = pixel * outWMinOutB + outBlack;
pixel = clamp(pixel, 0.f, 255.f);
- out->xyz = convert_uchar3(pixel);
- out->w = 0xff;
+ out.xyz = convert_uchar3(pixel);
+ out.w = 0xff;
+ return out;
}
-void root4(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {
- float4 pixel = convert_float4(in[0]);
+uchar4 __attribute__((kernel)) root4(uchar4 in, uint32_t x, uint32_t y) {
+ float4 pixel = convert_float4(in);
pixel.rgb = rsMatrixMultiply(&colorMat, pixel.rgb);
pixel = clamp(pixel, 0.f, 255.f);
pixel = (pixel - inBlack) * overInWMinInB;
pixel = pixel * outWMinOutB + outBlack;
pixel = clamp(pixel, 0.f, 255.f);
- out->xyzw = convert_uchar4(pixel);
+ return convert_uchar4(pixel);
}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels_relaxed.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels_relaxed.fs
index b115445..b115445 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels_relaxed.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels_relaxed.fs
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/mandelbrot.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/mandelbrot.fs
index da81d2e..ac2061b 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/mandelbrot.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/mandelbrot.fs
@@ -23,7 +23,7 @@ float lowerBoundX = -2.f;
float lowerBoundY = -2.f;
float scaleFactor = 4.f;
-void root(uchar4 *v_out, uint32_t x, uint32_t y) {
+uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
float2 p;
p.x = lowerBoundX + ((float)x / gDimX) * scaleFactor;
p.y = lowerBoundY + ((float)y / gDimY) * scaleFactor;
@@ -41,16 +41,16 @@ void root(uchar4 *v_out, uint32_t x, uint32_t y) {
if(iter >= gMaxIteration) {
// write a non-transparent black pixel
- *v_out = (uchar4){0, 0, 0, 0xff};
+ return (uchar4){0, 0, 0, 0xff};
} else {
- float mi3 = gMaxIteration / 3.;
+ float mi3 = gMaxIteration / 3.f;
if (iter <= (gMaxIteration / 3))
- *v_out = (uchar4){0xff * (iter / mi3), 0, 0, 0xff};
+ return (uchar4){0xff * (iter / mi3), 0, 0, 0xff};
else if (iter <= (((gMaxIteration / 3) * 2)))
- *v_out = (uchar4){0xff - (0xff * ((iter - mi3) / mi3)),
- (0xff * ((iter - mi3) / mi3)), 0, 0xff};
+ return (uchar4){0xff - (0xff * ((iter - mi3) / mi3)),
+ (0xff * ((iter - mi3) / mi3)), 0, 0xff};
else
- *v_out = (uchar4){0, 0xff - (0xff * ((iter - (mi3 * 2)) / mi3)),
- (0xff * ((iter - (mi3 * 2)) / mi3)), 0xff};
+ return (uchar4){0, 0xff - (0xff * ((iter - (mi3 * 2)) / mi3)),
+ (0xff * ((iter - (mi3 * 2)) / mi3)), 0xff};
}
}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/threshold.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/threshold.fs
index 3dfa94b..86e155a 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/threshold.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/threshold.fs
@@ -56,51 +56,49 @@ void setRadius(int rad) {
}
}
-void copyIn(const uchar4 *in, float4 *out) {
- *out = convert_float4(*in);
+float4 __attribute__((kernel)) copyIn(uchar4 in) {
+ return convert_float4(in);
}
-void vert(uchar4 *out, uint32_t x, uint32_t y) {
+uchar4 __attribute__((kernel)) vert(uint32_t x, uint32_t y) {
float3 blurredPixel = 0;
- const float *gPtr = gaussian;
+ int gi = 0;
+ uchar4 out;
if ((y > radius) && (y < (height - radius))) {
for (int r = -radius; r <= radius; r ++) {
- const float4 *i = (const float4 *)rsGetElementAt(ScratchPixel2, x, y + r);
- blurredPixel += i->xyz * gPtr[0];
- gPtr++;
+ float4 i = rsGetElementAt_float4(ScratchPixel2, x, y + r);
+ blurredPixel += i.xyz * gaussian[gi++];
}
} else {
for (int r = -radius; r <= radius; r ++) {
int validH = rsClamp((int)y + r, (int)0, (int)(height - 1));
- const float4 *i = (const float4 *)rsGetElementAt(ScratchPixel2, x, validH);
- blurredPixel += i->xyz * gPtr[0];
- gPtr++;
+ float4 i = rsGetElementAt_float4(ScratchPixel2, x, validH);
+ blurredPixel += i.xyz * gaussian[gi++];
}
}
- out->xyz = convert_uchar3(clamp(blurredPixel, 0.f, 255.f));
- out->w = 0xff;
+ out.xyz = convert_uchar3(clamp(blurredPixel, 0.f, 255.f));
+ out.w = 0xff;
+ return out;
}
-void horz(float4 *out, uint32_t x, uint32_t y) {
- float3 blurredPixel = 0;
- const float *gPtr = gaussian;
+float4 __attribute__((kernel)) horz(uint32_t x, uint32_t y) {
+ float4 blurredPixel = 0;
+ int gi = 0;
if ((x > radius) && (x < (width - radius))) {
for (int r = -radius; r <= radius; r ++) {
- const float4 *i = (const float4 *)rsGetElementAt(ScratchPixel1, x + r, y);
- blurredPixel += i->xyz * gPtr[0];
- gPtr++;
+ float4 i = rsGetElementAt_float4(ScratchPixel1, x + r, y);
+ blurredPixel += i * gaussian[gi++];
}
} else {
for (int r = -radius; r <= radius; r ++) {
// Stepping left and right away from the pixel
int validX = rsClamp((int)x + r, (int)0, (int)(width - 1));
- const float4 *i = (const float4 *)rsGetElementAt(ScratchPixel1, validX, y);
- blurredPixel += i->xyz * gPtr[0];
- gPtr++;
+ float4 i = rsGetElementAt_float4(ScratchPixel1, validX, y);
+ blurredPixel += i * gaussian[gi++];
}
}
- out->xyz = blurredPixel;
+ return blurredPixel;
}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh
index a1e4ae5..04ca1f1 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh
@@ -31,29 +31,29 @@ void init_vignette(uint32_t dim_x, uint32_t dim_y, float center_x, float center_
else
axis_scale.x = (float)dim_x / (float)dim_y;
- const float max_dist = 0.5 * length(axis_scale);
+ const float max_dist = 0.5f * length(axis_scale);
sloped_inv_max_dist = desired_slope * 1.f/max_dist;
// Range needs to be between 1.3 to 0.6. When scale is zero then range is
// 1.3 which means no vignette at all because the luminousity difference is
// less than 1/256. Expect input scale to be between 0.0 and 1.0.
- const float neg_range = 0.7*sqrt(desired_scale) - 1.3;
+ const float neg_range = 0.7f*sqrt(desired_scale) - 1.3f;
sloped_neg_range = exp(neg_range * desired_slope);
shade = desired_shade;
opp_shade = 1.f - desired_shade;
}
-void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {
+uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) {
// Convert x and y to floating point coordinates with center as origin
- const float4 fin = convert_float4(*in);
+ const float4 fin = convert_float4(in);
const float2 inCoord = {(float)x, (float)y};
const float2 coord = mad(inCoord, inv_dimensions, neg_center);
const float sloped_dist_ratio = length(axis_scale * coord) * sloped_inv_max_dist;
- const float lumen = opp_shade + shade / ( 1.0 + sloped_neg_range * exp(sloped_dist_ratio) );
+ const float lumen = opp_shade + shade / ( 1.0f + sloped_neg_range * exp(sloped_dist_ratio) );
float4 fout;
fout.rgb = fin.rgb * lumen;
fout.w = fin.w;
- *out = convert_uchar4(fout);
+ return convert_uchar4(fout);
}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx.rsh b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx.rsh
index 7f7bdcf..05a5929 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx.rsh
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx.rsh
@@ -31,22 +31,22 @@ void init_vignette(uint32_t dim_x, uint32_t dim_y, float center_x, float center_
else
axis_scale.x = (float)dim_x / (float)dim_y;
- const float max_dist = 0.5 * length(axis_scale);
+ const float max_dist = 0.5f * length(axis_scale);
sloped_inv_max_dist = desired_slope * 1.f/max_dist;
// Range needs to be between 1.3 to 0.6. When scale is zero then range is
// 1.3 which means no vignette at all because the luminousity difference is
// less than 1/256. Expect input scale to be between 0.0 and 1.0.
- const float neg_range = 0.7*sqrt(desired_scale) - 1.3;
+ const float neg_range = 0.7f*sqrt(desired_scale) - 1.3f;
sloped_neg_range = exp(neg_range * desired_slope);
shade = desired_shade;
opp_shade = 1.f - desired_shade;
}
-void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {
+uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) {
// Convert x and y to floating point coordinates with center as origin
- const float4 fin = convert_float4(*in);
+ const float4 fin = convert_float4(in);
const float2 inCoord = {(float)x, (float)y};
const float2 coord = mad(inCoord, inv_dimensions, neg_center);
const float sloped_dist_ratio = fast_length(axis_scale * coord) * sloped_inv_max_dist;
@@ -55,6 +55,6 @@ void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {
float4 fout;
fout.rgb = fin.rgb * lumen;
fout.w = fin.w;
- *out = convert_uchar4(fout);
+ return convert_uchar4(fout);
}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx_relaxed.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx_relaxed.fs
index 9120612..9120612 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx_relaxed.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx_relaxed.fs
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_relaxed.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_relaxed.fs
index 8e47ea9..8e47ea9 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_relaxed.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_relaxed.fs