diff options
author | Jason Sams <jsams@google.com> | 2012-09-28 18:17:47 -0700 |
---|---|---|
committer | Jason Sams <jsams@google.com> | 2012-09-28 18:17:47 -0700 |
commit | 1ebb7202b68d18025de8755d4f1df0c6544397e3 (patch) | |
tree | 316f64306f0d671066dd985a1f7af6464552bf9f /tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs | |
parent | 47c52a873e78d78a73abe85bb5491701a7b39feb (diff) | |
download | frameworks_base-1ebb7202b68d18025de8755d4f1df0c6544397e3.zip frameworks_base-1ebb7202b68d18025de8755d4f1df0c6544397e3.tar.gz frameworks_base-1ebb7202b68d18025de8755d4f1df0c6544397e3.tar.bz2 |
Lighten grain and make live preview gpu friendly.
Preview now does yuv->rgb using the intrinsic
script. Grain uses a smaller wrapped rand buffer
so it is not just rand test.
bug 7216044
Change-Id: If74eedc7d3cf264895133671edc546af9b1527f2
Diffstat (limited to 'tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs')
-rw-r--r-- | tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs | 14 |
1 files changed, 7 insertions, 7 deletions
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 ea42524..c8531f3 100644 --- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs +++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.rs @@ -38,15 +38,15 @@ void genRand(uchar *out) { * 1 2 1 */ -int32_t gWidth; -int32_t gHeight; +int32_t gWMask; +int32_t gHMask; rs_allocation gBlendSource; void blend9(uchar *out, uint32_t x, uint32_t y) { - uint32_t x1 = min((int32_t)x+1, (int32_t)(gWidth -1)); - uint32_t x2 = max((int32_t)x-1, (int32_t)0); - uint32_t y1 = min((int32_t)y+1, (int32_t)(gHeight -1)); - uint32_t y2 = max((int32_t)y-1, (int32_t)0); + uint32_t x1 = (x-1) & gWMask; + uint32_t x2 = (x+1) & gWMask; + uint32_t y1 = (y-1) & gHMask; + uint32_t y2 = (y+1) & gHMask; uint p00 = 56 * rsGetElementAt_uchar(gBlendSource, x1, y1); uint p01 = 114 * rsGetElementAt_uchar(gBlendSource, x, y1); @@ -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) rsGetElementAt_uchar(gNoise, x, y); + float pnoise = (float) rsGetElementAt_uchar(gNoise, x & gWMask, y & gHMask); float energy_level = ip.r + ip.g + ip.b; float energy_mask = (28.f - sqrt(energy_level)) * 0.03571f; |