summaryrefslogtreecommitdiff
path: root/graphics/java/android/renderscript/ScriptIntrinsicLUT.java
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/java/android/renderscript/ScriptIntrinsicLUT.java')
-rw-r--r--graphics/java/android/renderscript/ScriptIntrinsicLUT.java52
1 files changed, 40 insertions, 12 deletions
diff --git a/graphics/java/android/renderscript/ScriptIntrinsicLUT.java b/graphics/java/android/renderscript/ScriptIntrinsicLUT.java
index e7d8d34c17e6..e45c0fd735b0 100644
--- a/graphics/java/android/renderscript/ScriptIntrinsicLUT.java
+++ b/graphics/java/android/renderscript/ScriptIntrinsicLUT.java
@@ -20,17 +20,19 @@ import android.content.Context;
import android.content.res.Resources;
import android.util.Log;
-
/**
- * @hide
+ * Intrinsic for applying a per-channel lookup table. Each
+ * channel of the input has an independant lookup table. The
+ * tables are 256 entries in size and can cover the full value
+ * range of {@link Element#U8_4}.
**/
-public class ScriptIntrinsicLUT extends ScriptIntrinsic {
- private Matrix4f mMatrix = new Matrix4f();
+public final class ScriptIntrinsicLUT extends ScriptIntrinsic {
+ private final Matrix4f mMatrix = new Matrix4f();
private Allocation mTables;
- private byte mCache[] = new byte[1024];
+ private final byte mCache[] = new byte[1024];
private boolean mDirty = true;
- ScriptIntrinsicLUT(int id, RenderScript rs) {
+ private ScriptIntrinsicLUT(int id, RenderScript rs) {
super(id, rs);
mTables = Allocation.createSized(rs, Element.U8(rs), 1024);
for (int ct=0; ct < 256; ct++) {
@@ -43,12 +45,14 @@ public class ScriptIntrinsicLUT extends ScriptIntrinsic {
}
/**
- * Supported elements types are uchar4
+ * Supported elements types are {@link Element#U8_4}
+ *
+ * The defaults tables are identity.
*
- * @param rs
- * @param e
+ * @param rs The Renderscript context
+ * @param e Element type for intputs and outputs
*
- * @return ScriptIntrinsicColorMatrix
+ * @return ScriptIntrinsicLUT
*/
public static ScriptIntrinsicLUT create(RenderScript rs, Element e) {
int id = rs.nScriptIntrinsicCreate(3, e.getID(rs));
@@ -66,24 +70,48 @@ public class ScriptIntrinsicLUT extends ScriptIntrinsic {
}
}
+ /**
+ * Set an entry in the red channel lookup table
+ *
+ * @param index Must be 0-255
+ * @param value Must be 0-255
+ */
public void setRed(int index, int value) {
validate(index, value);
mCache[index] = (byte)value;
mDirty = true;
}
+ /**
+ * Set an entry in the green channel lookup table
+ *
+ * @param index Must be 0-255
+ * @param value Must be 0-255
+ */
public void setGreen(int index, int value) {
validate(index, value);
mCache[index+256] = (byte)value;
mDirty = true;
}
+ /**
+ * Set an entry in the blue channel lookup table
+ *
+ * @param index Must be 0-255
+ * @param value Must be 0-255
+ */
public void setBlue(int index, int value) {
validate(index, value);
mCache[index+512] = (byte)value;
mDirty = true;
}
+ /**
+ * Set an entry in the alpha channel lookup table
+ *
+ * @param index Must be 0-255
+ * @param value Must be 0-255
+ */
public void setAlpha(int index, int value) {
validate(index, value);
mCache[index+768] = (byte)value;
@@ -92,8 +120,8 @@ public class ScriptIntrinsicLUT extends ScriptIntrinsic {
/**
- * Invoke the kernel and apply the matrix to each cell of ain and copy to
- * aout.
+ * Invoke the kernel and apply the lookup to each cell of ain
+ * and copy to aout.
*
* @param ain Input allocation
* @param aout Output allocation