Add clipping for intrinsics.
Change-Id: Ic7e1da3c69aa3d5f990816178739120b6059e7a5
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user