diff options
-rw-r--r-- | api/current.txt | 25 | ||||
-rw-r--r-- | rs/java/android/renderscript/ScriptIntrinsic3DLUT.java | 15 | ||||
-rw-r--r-- | rs/java/android/renderscript/ScriptIntrinsicBlend.java | 201 | ||||
-rw-r--r-- | rs/java/android/renderscript/ScriptIntrinsicBlur.java | 15 | ||||
-rw-r--r-- | rs/java/android/renderscript/ScriptIntrinsicColorMatrix.java | 23 | ||||
-rw-r--r-- | rs/java/android/renderscript/ScriptIntrinsicConvolve3x3.java | 14 | ||||
-rw-r--r-- | rs/java/android/renderscript/ScriptIntrinsicConvolve5x5.java | 15 | ||||
-rw-r--r-- | rs/java/android/renderscript/ScriptIntrinsicHistogram.java | 40 | ||||
-rw-r--r-- | rs/java/android/renderscript/ScriptIntrinsicLUT.java | 15 |
9 files changed, 336 insertions, 27 deletions
diff --git a/api/current.txt b/api/current.txt index 2b04927..241c540 100644 --- a/api/current.txt +++ b/api/current.txt @@ -22585,7 +22585,7 @@ package android.renderscript { } public class BaseObj { - method public synchronized void destroy(); + method public void destroy(); method public java.lang.String getName(); method public void setName(java.lang.String); } @@ -23177,6 +23177,7 @@ package android.renderscript { public final class ScriptIntrinsic3DLUT extends android.renderscript.ScriptIntrinsic { method public static android.renderscript.ScriptIntrinsic3DLUT create(android.renderscript.RenderScript, android.renderscript.Element); method public void forEach(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEach(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public android.renderscript.Script.KernelID getKernelID(); method public void setLUT(android.renderscript.Allocation); } @@ -23184,20 +23185,35 @@ package android.renderscript { public class ScriptIntrinsicBlend extends android.renderscript.ScriptIntrinsic { method public static android.renderscript.ScriptIntrinsicBlend create(android.renderscript.RenderScript, android.renderscript.Element); method public void forEachAdd(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachAdd(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public void forEachClear(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachClear(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public void forEachDst(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachDst(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public void forEachDstAtop(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachDstAtop(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public void forEachDstIn(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachDstIn(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public void forEachDstOut(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachDstOut(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public void forEachDstOver(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachDstOver(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public void forEachMultiply(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachMultiply(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public void forEachSrc(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSrc(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public void forEachSrcAtop(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSrcAtop(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public void forEachSrcIn(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSrcIn(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public void forEachSrcOut(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSrcOut(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public void forEachSrcOver(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSrcOver(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public void forEachSubtract(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachSubtract(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public void forEachXor(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEachXor(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public android.renderscript.Script.KernelID getKernelIDAdd(); method public android.renderscript.Script.KernelID getKernelIDClear(); method public android.renderscript.Script.KernelID getKernelIDDst(); @@ -23218,6 +23234,7 @@ package android.renderscript { public final class ScriptIntrinsicBlur extends android.renderscript.ScriptIntrinsic { method public static android.renderscript.ScriptIntrinsicBlur create(android.renderscript.RenderScript, android.renderscript.Element); method public void forEach(android.renderscript.Allocation); + method public void forEach(android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public android.renderscript.Script.FieldID getFieldID_Input(); method public android.renderscript.Script.KernelID getKernelID(); method public void setInput(android.renderscript.Allocation); @@ -23228,6 +23245,7 @@ package android.renderscript { method public static deprecated android.renderscript.ScriptIntrinsicColorMatrix create(android.renderscript.RenderScript, android.renderscript.Element); method public static android.renderscript.ScriptIntrinsicColorMatrix create(android.renderscript.RenderScript); method public void forEach(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEach(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public android.renderscript.Script.KernelID getKernelID(); method public void setAdd(android.renderscript.Float4); method public void setAdd(float, float, float, float); @@ -23241,6 +23259,7 @@ package android.renderscript { public final class ScriptIntrinsicConvolve3x3 extends android.renderscript.ScriptIntrinsic { method public static android.renderscript.ScriptIntrinsicConvolve3x3 create(android.renderscript.RenderScript, android.renderscript.Element); method public void forEach(android.renderscript.Allocation); + method public void forEach(android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public android.renderscript.Script.FieldID getFieldID_Input(); method public android.renderscript.Script.KernelID getKernelID(); method public void setCoefficients(float[]); @@ -23250,6 +23269,7 @@ package android.renderscript { public final class ScriptIntrinsicConvolve5x5 extends android.renderscript.ScriptIntrinsic { method public static android.renderscript.ScriptIntrinsicConvolve5x5 create(android.renderscript.RenderScript, android.renderscript.Element); method public void forEach(android.renderscript.Allocation); + method public void forEach(android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public android.renderscript.Script.FieldID getFieldID_Input(); method public android.renderscript.Script.KernelID getKernelID(); method public void setCoefficients(float[]); @@ -23259,7 +23279,9 @@ package android.renderscript { public final class ScriptIntrinsicHistogram extends android.renderscript.ScriptIntrinsic { method public static android.renderscript.ScriptIntrinsicHistogram create(android.renderscript.RenderScript, android.renderscript.Element); method public void forEach(android.renderscript.Allocation); + method public void forEach(android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public void forEach_Dot(android.renderscript.Allocation); + method public void forEach_Dot(android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public android.renderscript.Script.FieldID getFieldID_Input(); method public android.renderscript.Script.KernelID getKernelID_Separate(); method public void setDotCoefficients(float, float, float, float); @@ -23269,6 +23291,7 @@ package android.renderscript { public final class ScriptIntrinsicLUT extends android.renderscript.ScriptIntrinsic { method public static android.renderscript.ScriptIntrinsicLUT create(android.renderscript.RenderScript, android.renderscript.Element); method public void forEach(android.renderscript.Allocation, android.renderscript.Allocation); + method public void forEach(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions); method public android.renderscript.Script.KernelID getKernelID(); method public void setAlpha(int, int); method public void setBlue(int, int); diff --git a/rs/java/android/renderscript/ScriptIntrinsic3DLUT.java b/rs/java/android/renderscript/ScriptIntrinsic3DLUT.java index 33e64bd..ce149d9 100644 --- a/rs/java/android/renderscript/ScriptIntrinsic3DLUT.java +++ b/rs/java/android/renderscript/ScriptIntrinsic3DLUT.java @@ -84,10 +84,23 @@ public final class ScriptIntrinsic3DLUT extends ScriptIntrinsic { * @param aout Output allocation */ public void forEach(Allocation ain, Allocation aout) { - forEach(0, ain, aout, null); + forEach(ain, aout, null); } /** + * Invoke the kernel and apply the lookup to each cell of ain + * and copy to aout. + * + * @param ain Input allocation + * @param aout Output allocation + * @param opt Launch options for kernel + */ + public void forEach(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + forEach(0, ain, aout, null, opt); + } + + + /** * Get a KernelID for this intrinsic kernel. * * @return Script.KernelID The KernelID object. diff --git a/rs/java/android/renderscript/ScriptIntrinsicBlend.java b/rs/java/android/renderscript/ScriptIntrinsicBlend.java index 40f1a3e..d4038c2 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicBlend.java +++ b/rs/java/android/renderscript/ScriptIntrinsicBlend.java @@ -40,14 +40,14 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { } - private void blend(int id, Allocation ain, Allocation aout) { + private void blend(int id, Allocation ain, Allocation aout, Script.LaunchOptions opt) { if (!ain.getElement().isCompatible(Element.U8_4(mRS))) { throw new RSIllegalArgumentException("Input is not of expected format."); } if (!aout.getElement().isCompatible(Element.U8_4(mRS))) { throw new RSIllegalArgumentException("Output is not of expected format."); } - forEach(id, ain, aout, null); + forEach(id, ain, aout, null, opt); } /** @@ -57,7 +57,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachClear(Allocation ain, Allocation aout) { - blend(0, ain, aout); + forEachClear(ain, aout, null); + } + + /** + * Sets dst = {0, 0, 0, 0} + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachClear(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(0, ain, aout, opt); } /** @@ -77,7 +88,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachSrc(Allocation ain, Allocation aout) { - blend(1, ain, aout); + forEachSrc(ain, aout, null); + } + + /** + * Sets dst = src + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachSrc(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + forEachDst(ain, aout, null); } /** @@ -102,6 +124,19 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { } /** + * Sets dst = dst + * + * This is a NOP. + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachDst(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + // N, optOP + } + + /** * Get a KernelID for the Dst kernel. * * @return Script.KernelID The KernelID object. @@ -117,7 +152,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachSrcOver(Allocation ain, Allocation aout) { - blend(3, ain, aout); + forEachSrcOver(ain, aout, null); + } + + /** + * Sets dst = src + dst * (1.0 - src.a) + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachSrcOver(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(3, ain, aout, opt); } /** @@ -136,7 +182,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachDstOver(Allocation ain, Allocation aout) { - blend(4, ain, aout); + forEachDstOver(ain, aout, null); + } + + /** + * Sets dst = dst + src * (1.0 - dst.a) + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachDstOver(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(4, ain, aout, opt); } /** @@ -155,7 +212,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachSrcIn(Allocation ain, Allocation aout) { - blend(5, ain, aout); + forEachSrcIn(ain, aout, null); + } + + /** + * Sets dst = src * dst.a + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachSrcIn(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(5, ain, aout, opt); } /** @@ -174,7 +242,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachDstIn(Allocation ain, Allocation aout) { - blend(6, ain, aout); + forEachDstIn(ain, aout, null); + } + + /** + * Sets dst = dst * src.a + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachDstIn(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(6, ain, aout, opt); } /** @@ -193,7 +272,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachSrcOut(Allocation ain, Allocation aout) { - blend(7, ain, aout); + forEachSrcOut(ain, aout, null); + } + + /** + * Sets dst = src * (1.0 - dst.a) + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachSrcOut(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(7, ain, aout, opt); } /** @@ -212,7 +302,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachDstOut(Allocation ain, Allocation aout) { - blend(8, ain, aout); + forEachDstOut(ain, aout, null); + } + + /** + * Sets dst = dst * (1.0 - src.a) + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachDstOut(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(8, ain, aout, opt); } /** @@ -232,7 +333,19 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachSrcAtop(Allocation ain, Allocation aout) { - blend(9, ain, aout); + forEachSrcAtop(ain, aout, null); + } + + /** + * dst.rgb = src.rgb * dst.a + (1.0 - src.a) * dst.rgb + * dst.a = dst.a + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachSrcAtop(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(9, ain, aout, opt); } /** @@ -252,7 +365,19 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachDstAtop(Allocation ain, Allocation aout) { - blend(10, ain, aout); + forEachDstAtop(ain, aout, null); + } + + /** + * dst = dst.rgb * src.a + (1.0 - dst.a) * src.rgb + * dst.a = src.a + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachDstAtop(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(10, ain, aout, opt); } /** @@ -271,7 +396,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachXor(Allocation ain, Allocation aout) { - blend(11, ain, aout); + forEachXor(ain, aout, null); + } + + /** + * Sets dst = {src.r ^ dst.r, src.g ^ dst.g, src.b ^ dst.b, src.a ^ dst.a} + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachXor(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(11, ain, aout, opt); } /** @@ -300,7 +436,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachMultiply(Allocation ain, Allocation aout) { - blend(14, ain, aout); + forEachMultiply(ain, aout, null); + } + + /** + * Sets dst = src * dst + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachMultiply(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(14, ain, aout, opt); } /** @@ -396,7 +543,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachAdd(Allocation ain, Allocation aout) { - blend(34, ain, aout); + forEachAdd(ain, aout, null); + } + + /** + * Sets dst = min(src + dst, 1.0) + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachAdd(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(34, ain, aout, opt); } /** @@ -415,7 +573,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachSubtract(Allocation ain, Allocation aout) { - blend(35, ain, aout); + forEachSubtract(ain, aout, null); + } + + /** + * Sets dst = max(dst - src, 0.0) + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachSubtract(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(35, ain, aout, opt); } /** diff --git a/rs/java/android/renderscript/ScriptIntrinsicBlur.java b/rs/java/android/renderscript/ScriptIntrinsicBlur.java index 2b36d27..e7e33b8 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicBlur.java +++ b/rs/java/android/renderscript/ScriptIntrinsicBlur.java @@ -84,10 +84,23 @@ public final class ScriptIntrinsicBlur extends ScriptIntrinsic { * type. */ public void forEach(Allocation aout) { - forEach(0, null, aout, null); + forEach(aout, null); } /** + * Apply the filter to the input and save to the specified + * allocation. + * + * @param aout Output allocation. Must match creation element + * type. + * @param opt LaunchOptions for clipping + */ + public void forEach(Allocation aout, Script.LaunchOptions opt) { + forEach(0, null, aout, null, opt); + } + + + /** * Get a KernelID for this intrinsic kernel. * * @return Script.KernelID The KernelID object. diff --git a/rs/java/android/renderscript/ScriptIntrinsicColorMatrix.java b/rs/java/android/renderscript/ScriptIntrinsicColorMatrix.java index 4b0d507..57d917c 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicColorMatrix.java +++ b/rs/java/android/renderscript/ScriptIntrinsicColorMatrix.java @@ -206,7 +206,6 @@ public final class ScriptIntrinsicColorMatrix extends ScriptIntrinsic { setMatrix(); } - /** * Invoke the kernel and apply the matrix to each cell of input * {@link Allocation} and copy to the output {@link Allocation}. @@ -223,6 +222,26 @@ public final class ScriptIntrinsicColorMatrix extends ScriptIntrinsic { * @param aout Output allocation */ public void forEach(Allocation ain, Allocation aout) { + forEach(ain, aout, null); + } + + /** + * Invoke the kernel and apply the matrix to each cell of input + * {@link Allocation} and copy to the output {@link Allocation}. + * + * If the vector size of the input is less than four, the + * remaining components are treated as zero for the matrix + * multiply. + * + * If the output vector size is less than four, the unused + * vector components are discarded. + * + * + * @param ain Input allocation + * @param aout Output allocation + * @param opt LaunchOptions for clipping + */ + public void forEach(Allocation ain, Allocation aout, Script.LaunchOptions opt) { if (!ain.getElement().isCompatible(Element.U8(mRS)) && !ain.getElement().isCompatible(Element.U8_2(mRS)) && !ain.getElement().isCompatible(Element.U8_3(mRS)) && @@ -247,7 +266,7 @@ public final class ScriptIntrinsicColorMatrix extends ScriptIntrinsic { throw new RSIllegalArgumentException("Unsuported element type."); } - forEach(0, ain, aout, null); + forEach(0, ain, aout, null, opt); } /** diff --git a/rs/java/android/renderscript/ScriptIntrinsicConvolve3x3.java b/rs/java/android/renderscript/ScriptIntrinsicConvolve3x3.java index a1a1b7e..fb91fdc 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicConvolve3x3.java +++ b/rs/java/android/renderscript/ScriptIntrinsicConvolve3x3.java @@ -106,7 +106,19 @@ public final class ScriptIntrinsicConvolve3x3 extends ScriptIntrinsic { * type. */ public void forEach(Allocation aout) { - forEach(0, null, aout, null); + forEach(aout, null); + } + + /** + * Apply the filter to the input and save to the specified + * allocation. + * + * @param aout Output allocation. Must match creation element + * type. + * @param opt LaunchOptions for clipping + */ + public void forEach(Allocation aout, Script.LaunchOptions opt) { + forEach(0, null, aout, null, opt); } /** diff --git a/rs/java/android/renderscript/ScriptIntrinsicConvolve5x5.java b/rs/java/android/renderscript/ScriptIntrinsicConvolve5x5.java index 8b66896..0357560 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicConvolve5x5.java +++ b/rs/java/android/renderscript/ScriptIntrinsicConvolve5x5.java @@ -107,10 +107,23 @@ public final class ScriptIntrinsicConvolve5x5 extends ScriptIntrinsic { * type. */ public void forEach(Allocation aout) { - forEach(0, null, aout, null); + forEach(aout, null); } /** + * Apply the filter to the input and save to the specified + * allocation. + * + * @param aout Output allocation. Must match creation element + * type. + * @param opt LaunchOptions for clipping + */ + public void forEach(Allocation aout, Script.LaunchOptions opt) { + forEach(0, null, aout, null, opt); + } + + + /** * Get a KernelID for this intrinsic kernel. * * @return Script.KernelID The KernelID object. diff --git a/rs/java/android/renderscript/ScriptIntrinsicHistogram.java b/rs/java/android/renderscript/ScriptIntrinsicHistogram.java index 536663d..95b610a 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicHistogram.java +++ b/rs/java/android/renderscript/ScriptIntrinsicHistogram.java @@ -67,6 +67,24 @@ public final class ScriptIntrinsicHistogram extends ScriptIntrinsic { * @param ain The input image */ public void forEach(Allocation ain) { + forEach(ain, null); + } + + /** + * Process an input buffer and place the histogram into the + * output allocation. The output allocation may be a narrower + * vector size than the input. In this case the vector size of + * the output is used to determine how many of the input + * channels are used in the computation. This is useful if you + * have an RGBA input buffer but only want the histogram for + * RGB. + * + * 1D and 2D input allocations are supported. + * + * @param ain The input image + * @param opt LaunchOptions for clipping + */ + public void forEach(Allocation ain, Script.LaunchOptions opt) { if (ain.getType().getElement().getVectorSize() < mOut.getType().getElement().getVectorSize()) { @@ -78,9 +96,11 @@ public final class ScriptIntrinsicHistogram extends ScriptIntrinsic { throw new RSIllegalArgumentException("Output type must be U32 or I32."); } - forEach(0, ain, null, null); + forEach(0, ain, null, null, opt); } + + /** * Set the coefficients used for the RGBA to Luminocity * calculation. The default is {0.299f, 0.587f, 0.114f, 0.f}. @@ -137,6 +157,7 @@ public final class ScriptIntrinsicHistogram extends ScriptIntrinsic { setVar(1, aout); } + /** * Process an input buffer and place the histogram into the * output allocation. The dot product of the input channel and @@ -148,6 +169,21 @@ public final class ScriptIntrinsicHistogram extends ScriptIntrinsic { * @param ain The input image */ public void forEach_Dot(Allocation ain) { + forEach_Dot(ain, null); + } + + /** + * Process an input buffer and place the histogram into the + * output allocation. The dot product of the input channel and + * the coefficients from 'setDotCoefficients' are used to + * calculate the output values. + * + * 1D and 2D input allocations are supported. + * + * @param ain The input image + * @param opt LaunchOptions for clipping + */ + public void forEach_Dot(Allocation ain, Script.LaunchOptions opt) { if (mOut.getType().getElement().getVectorSize() != 1) { throw new RSIllegalArgumentException("Output vector size must be one."); } @@ -156,7 +192,7 @@ public final class ScriptIntrinsicHistogram extends ScriptIntrinsic { throw new RSIllegalArgumentException("Output type must be U32 or I32."); } - forEach(1, ain, null, null); + forEach(1, ain, null, null, opt); } diff --git a/rs/java/android/renderscript/ScriptIntrinsicLUT.java b/rs/java/android/renderscript/ScriptIntrinsicLUT.java index 001095c..69ff64a 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicLUT.java +++ b/rs/java/android/renderscript/ScriptIntrinsicLUT.java @@ -114,7 +114,6 @@ public final class ScriptIntrinsicLUT extends ScriptIntrinsic { mDirty = true; } - /** * Invoke the kernel and apply the lookup to each cell of ain * and copy to aout. @@ -123,11 +122,23 @@ public final class ScriptIntrinsicLUT extends ScriptIntrinsic { * @param aout Output allocation */ public void forEach(Allocation ain, Allocation aout) { + forEach(ain, aout, null); + } + + /** + * Invoke the kernel and apply the lookup to each cell of ain + * and copy to aout. + * + * @param ain Input allocation + * @param aout Output allocation + * @param opt Options for clipping + */ + public void forEach(Allocation ain, Allocation aout, Script.LaunchOptions opt) { if (mDirty) { mDirty = false; mTables.copyFromUnchecked(mCache); } - forEach(0, ain, aout, null); + forEach(0, ain, aout, null, opt); } /** |