From 2d71bc7b4c46a32cead32a35e6e137d13e8315ea Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Fri, 26 Mar 2010 16:06:43 -0700 Subject: Update Script java classes and llvm samples. Change-Id: I05c8d63fcca095d4fea6abb1ff5736ab9d78a3e6 --- libs/rs/java/ImageProcessing/res/raw/threshold2.rs | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 libs/rs/java/ImageProcessing/res/raw/threshold2.rs (limited to 'libs/rs/java/ImageProcessing') diff --git a/libs/rs/java/ImageProcessing/res/raw/threshold2.rs b/libs/rs/java/ImageProcessing/res/raw/threshold2.rs new file mode 100644 index 0000000..9f687b5 --- /dev/null +++ b/libs/rs/java/ImageProcessing/res/raw/threshold2.rs @@ -0,0 +1,49 @@ +#pragma version(1) + +#include "../../../../scriptc/rs_types.rsh" +#include "../../../../scriptc/rs_math.rsh" +#include "../../../../scriptc/rs_graphics.rsh" + +typedef struct Params_s{ + int inHeight; + int inWidth; + int outHeight; + int outWidth; + float threshold; +} Params_t; + +Params_t * Params; +rs_color4u * InPixel; +rs_color4u * OutPixel; + + +int main() { + int t = uptimeMillis(); + + rs_color4u *in = InPixel; + rs_color4u *out = OutPixel; + + int count = Params->inWidth * Params->inHeight; + int i; + float threshold = Params->threshold * 255.f; + + for (i = 0; i < count; i++) { + float luminance = 0.2125f * in->x + + 0.7154f * in->y + + 0.0721f * in->z; + if (luminance > threshold) { + *out = *in; + } else { + *((int *)out) = *((int *)in) & 0xff000000; + } + + in++; + out++; + } + + t= uptimeMillis() - t; + debugI32("Filter time", t); + + sendToClient(&count, 1, 4, 0); + return 0; +} -- cgit v1.1