summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2012-09-24 17:42:14 -0700
committerJason Sams <jsams@google.com>2012-09-24 17:42:14 -0700
commitae760511d866888baffdd456721b84fd95328098 (patch)
tree8f2663e05fdf1f54b291e445a66d919383c2e7f7 /tests
parent85d4955a13339054ffbd350874b1646125a6a130 (diff)
downloadframeworks_base-ae760511d866888baffdd456721b84fd95328098.zip
frameworks_base-ae760511d866888baffdd456721b84fd95328098.tar.gz
frameworks_base-ae760511d866888baffdd456721b84fd95328098.tar.bz2
Test FS getElementAt
bug 7190126 Change-Id: I1fbaa77af051cf44134f8bfe56339ce5d3b7edbb
Diffstat (limited to 'tests')
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve3x3.rs18
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve5x5.rs50
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs20
3 files changed, 44 insertions, 44 deletions
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve3x3.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve3x3.rs
index 455fcc2..9812827 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve3x3.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve3x3.rs
@@ -30,15 +30,15 @@ void root(uchar4 *out, uint32_t x, uint32_t y) {
uint32_t y1 = min((int32_t)y+1, gHeight-1);
uint32_t y2 = max((int32_t)y-1, 0);
- float4 p00 = convert_float4(((uchar4 *)rsGetElementAt(gIn, x1, y1))[0]);
- float4 p01 = convert_float4(((uchar4 *)rsGetElementAt(gIn, x, y1))[0]);
- float4 p02 = convert_float4(((uchar4 *)rsGetElementAt(gIn, x2, y1))[0]);
- float4 p10 = convert_float4(((uchar4 *)rsGetElementAt(gIn, x1, y))[0]);
- float4 p11 = convert_float4(((uchar4 *)rsGetElementAt(gIn, x, y))[0]);
- float4 p12 = convert_float4(((uchar4 *)rsGetElementAt(gIn, x2, y))[0]);
- float4 p20 = convert_float4(((uchar4 *)rsGetElementAt(gIn, x1, y2))[0]);
- float4 p21 = convert_float4(((uchar4 *)rsGetElementAt(gIn, x, y2))[0]);
- float4 p22 = convert_float4(((uchar4 *)rsGetElementAt(gIn, x2, y2))[0]);
+ float4 p00 = convert_float4(rsGetElementAt_uchar4(gIn, x1, y1));
+ float4 p01 = convert_float4(rsGetElementAt_uchar4(gIn, x, y1));
+ float4 p02 = convert_float4(rsGetElementAt_uchar4(gIn, x2, y1));
+ float4 p10 = convert_float4(rsGetElementAt_uchar4(gIn, x1, y));
+ float4 p11 = convert_float4(rsGetElementAt_uchar4(gIn, x, y));
+ float4 p12 = convert_float4(rsGetElementAt_uchar4(gIn, x2, y));
+ float4 p20 = convert_float4(rsGetElementAt_uchar4(gIn, x1, y2));
+ float4 p21 = convert_float4(rsGetElementAt_uchar4(gIn, x, y2));
+ float4 p22 = convert_float4(rsGetElementAt_uchar4(gIn, x2, y2));
p00 *= gCoeffs[0];
p01 *= gCoeffs[1];
p02 *= gCoeffs[2];
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve5x5.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve5x5.rs
index fe6cf31..e6d03c9 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve5x5.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve5x5.rs
@@ -37,35 +37,35 @@ void root(uchar4 *out, uint32_t x, uint32_t y) {
uint32_t y3 = min((int32_t)y+1, gHeight-1);
uint32_t y4 = min((int32_t)y+2, gHeight-1);
- float4 p0 = convert_float4(((uchar4 *)rsGetElementAt(gIn, x0, y0))[0]) * gCoeffs[0]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x1, y0))[0]) * gCoeffs[1]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x2, y0))[0]) * gCoeffs[2]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x3, y0))[0]) * gCoeffs[3]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x4, y0))[0]) * gCoeffs[4];
+ float4 p0 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y0)) * gCoeffs[0]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x1, y0)) * gCoeffs[1]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x2, y0)) * gCoeffs[2]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x3, y0)) * gCoeffs[3]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x4, y0)) * gCoeffs[4];
- float4 p1 = convert_float4(((uchar4 *)rsGetElementAt(gIn, x0, y1))[0]) * gCoeffs[5]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x1, y1))[0]) * gCoeffs[6]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x2, y1))[0]) * gCoeffs[7]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x3, y1))[0]) * gCoeffs[8]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x4, y1))[0]) * gCoeffs[9];
+ float4 p1 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y1)) * gCoeffs[5]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x1, y1)) * gCoeffs[6]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x2, y1)) * gCoeffs[7]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x3, y1)) * gCoeffs[8]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x4, y1)) * gCoeffs[9];
- float4 p2 = convert_float4(((uchar4 *)rsGetElementAt(gIn, x0, y2))[0]) * gCoeffs[10]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x1, y2))[0]) * gCoeffs[11]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x2, y2))[0]) * gCoeffs[12]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x3, y2))[0]) * gCoeffs[13]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x4, y2))[0]) * gCoeffs[14];
+ float4 p2 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y2)) * gCoeffs[10]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x1, y2)) * gCoeffs[11]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x2, y2)) * gCoeffs[12]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x3, y2)) * gCoeffs[13]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x4, y2)) * gCoeffs[14];
- float4 p3 = convert_float4(((uchar4 *)rsGetElementAt(gIn, x0, y3))[0]) * gCoeffs[15]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x1, y3))[0]) * gCoeffs[16]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x2, y3))[0]) * gCoeffs[17]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x3, y3))[0]) * gCoeffs[18]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x4, y3))[0]) * gCoeffs[19];
+ float4 p3 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y3)) * gCoeffs[15]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x1, y3)) * gCoeffs[16]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x2, y3)) * gCoeffs[17]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x3, y3)) * gCoeffs[18]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x4, y3)) * gCoeffs[19];
- float4 p4 = convert_float4(((uchar4 *)rsGetElementAt(gIn, x0, y4))[0]) * gCoeffs[20]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x1, y4))[0]) * gCoeffs[21]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x2, y4))[0]) * gCoeffs[22]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x3, y4))[0]) * gCoeffs[23]
- + convert_float4(((uchar4 *)rsGetElementAt(gIn, x4, y4))[0]) * gCoeffs[24];
+ float4 p4 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y4)) * gCoeffs[20]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x1, y4)) * gCoeffs[21]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x2, y4)) * gCoeffs[22]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x3, y4)) * gCoeffs[23]
+ + convert_float4(rsGetElementAt_uchar4(gIn, x4, y4)) * gCoeffs[24];
p0 = clamp(p0 + p1 + p2 + p3 + p4, 0.f, 255.f);
*out = convert_uchar4(p0);
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs
index 783bc4a..ea42524 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs
@@ -48,15 +48,15 @@ void blend9(uchar *out, uint32_t x, uint32_t y) {
uint32_t y1 = min((int32_t)y+1, (int32_t)(gHeight -1));
uint32_t y2 = max((int32_t)y-1, (int32_t)0);
- uint p00 = 56 * ((uchar *)rsGetElementAt(gBlendSource, x1, y1))[0];
- uint p01 = 114 * ((uchar *)rsGetElementAt(gBlendSource, x, y1))[0];
- uint p02 = 56 * ((uchar *)rsGetElementAt(gBlendSource, x2, y1))[0];
- uint p10 = 114 * ((uchar *)rsGetElementAt(gBlendSource, x1, y))[0];
- uint p11 = 230 * ((uchar *)rsGetElementAt(gBlendSource, x, y))[0];
- uint p12 = 114 * ((uchar *)rsGetElementAt(gBlendSource, x2, y))[0];
- uint p20 = 56 * ((uchar *)rsGetElementAt(gBlendSource, x1, y2))[0];
- uint p21 = 114 * ((uchar *)rsGetElementAt(gBlendSource, x, y2))[0];
- uint p22 = 56 * ((uchar *)rsGetElementAt(gBlendSource, x2, y2))[0];
+ uint p00 = 56 * rsGetElementAt_uchar(gBlendSource, x1, y1);
+ uint p01 = 114 * rsGetElementAt_uchar(gBlendSource, x, y1);
+ uint p02 = 56 * rsGetElementAt_uchar(gBlendSource, x2, y1);
+ uint p10 = 114 * rsGetElementAt_uchar(gBlendSource, x1, y);
+ uint p11 = 230 * rsGetElementAt_uchar(gBlendSource, x, y);
+ uint p12 = 114 * rsGetElementAt_uchar(gBlendSource, x2, y);
+ uint p20 = 56 * rsGetElementAt_uchar(gBlendSource, x1, y2);
+ uint p21 = 114 * rsGetElementAt_uchar(gBlendSource, x, y2);
+ uint p22 = 56 * rsGetElementAt_uchar(gBlendSource, x2, y2);
p00 += p01;
p02 += p10;
@@ -78,7 +78,7 @@ float gNoiseStrength;
rs_allocation gNoise;
void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {
float4 ip = convert_float4(*in);
- float pnoise = (float) ((uchar *)rsGetElementAt(gNoise, x, y))[0];
+ float pnoise = (float) rsGetElementAt_uchar(gNoise, x, y);
float energy_level = ip.r + ip.g + ip.b;
float energy_mask = (28.f - sqrt(energy_level)) * 0.03571f;