summaryrefslogtreecommitdiffstats
path: root/libs/rs/java/ImageProcessing
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2010-08-12 16:59:18 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-08-12 16:59:18 -0700
commit2a115d84228ee8e289b0eceae4af3a935ffcd1f2 (patch)
tree83e13e816ee97bf1cf86b0e3d16735668abccf5c /libs/rs/java/ImageProcessing
parentbf19bce30113f5824ffceb7a339501366bba2332 (diff)
parent2cbd298f390a8a944892198efdb25d81f07de3ae (diff)
downloadframeworks_base-2a115d84228ee8e289b0eceae4af3a935ffcd1f2.zip
frameworks_base-2a115d84228ee8e289b0eceae4af3a935ffcd1f2.tar.gz
frameworks_base-2a115d84228ee8e289b0eceae4af3a935ffcd1f2.tar.bz2
Merge "Thread launch strategies."
Diffstat (limited to 'libs/rs/java/ImageProcessing')
-rw-r--r--libs/rs/java/ImageProcessing/src/com/android/rs/image/horizontal_blur.rs28
1 files changed, 4 insertions, 24 deletions
diff --git a/libs/rs/java/ImageProcessing/src/com/android/rs/image/horizontal_blur.rs b/libs/rs/java/ImageProcessing/src/com/android/rs/image/horizontal_blur.rs
index 4ed5aba..58c9acf 100644
--- a/libs/rs/java/ImageProcessing/src/com/android/rs/image/horizontal_blur.rs
+++ b/libs/rs/java/ImageProcessing/src/com/android/rs/image/horizontal_blur.rs
@@ -8,43 +8,23 @@ void root(const void *v_in, void *v_out, const void *usrData, uint32_t x, uint32
const uchar4 *input = (const uchar4 *)rsGetElementAt(fs->ain, 0, y);
float3 blurredPixel = 0;
- float3 currentPixel = 0;
-
const float *gPtr = fs->gaussian;
if ((x > fs->radius) && (x < (fs->width - fs->radius))) {
const uchar4 *i = input + (x - fs->radius);
for(int r = -fs->radius; r <= fs->radius; r ++) {
- currentPixel.x = (float)(i->x);
- currentPixel.y = (float)(i->y);
- currentPixel.z = (float)(i->z);
- blurredPixel += currentPixel * gPtr[0];
+ blurredPixel += convert_float3(i->xyz) * gPtr[0];
gPtr++;
i++;
}
} else {
for(int r = -fs->radius; r <= fs->radius; r ++) {
// Stepping left and right away from the pixel
- int validW = x + r;
- // Clamp to zero and width max() isn't exposed for ints yet
- if(validW < 0) {
- validW = 0;
- }
- if(validW > fs->width - 1) {
- validW = fs->width - 1;
- }
- //int validW = rsClamp(w + r, 0, width - 1);
-
- currentPixel.x = (float)(input[validW].x);
- currentPixel.y = (float)(input[validW].y);
- currentPixel.z = (float)(input[validW].z);
-
- blurredPixel += currentPixel * gPtr[0];
+ int validW = rsClamp(x + r, (uint)0, (uint)(fs->width - 1));
+ blurredPixel += convert_float3(input[validW].xyz) * gPtr[0];
gPtr++;
}
}
- output->x = (uint8_t)blurredPixel.x;
- output->y = (uint8_t)blurredPixel.y;
- output->z = (uint8_t)blurredPixel.z;
+ output->xyz = convert_uchar3(blurredPixel);
}