ScriptIntrinsic(int id, RenderScript rs) {
super(id, rs);
}
-
- public void forEach(Allocation ain, Allocation aout) {
- forEach(0, ain, aout, null);
- }
}
**/
public class ScriptIntrinsicConvolve3x3 extends ScriptIntrinsic {
private float[] mValues = new float[9];
+ private Allocation mInput;
ScriptIntrinsicConvolve3x3(int id, RenderScript rs) {
super(id, rs);
}
+ public void setInput(Allocation ain) {
+ mInput = ain;
+ bindAllocation(ain, 1);
+ }
- public void setValues(float v[]) {
+ public void setColorMatrix(float v[]) {
FieldPacker fp = new FieldPacker(9*4);
for (int ct=0; ct < mValues.length; ct++) {
mValues[ct] = v[ct];
}
setVar(0, fp);
}
+
+ public void forEach(Allocation aout) {
+ forEach(0, null, aout, null);
+ }
+
}
v[0] = 0.f; v[1] = -s; v[2] = 0.f;
v[3] = -s; v[4] = s*4+1; v[5] = -s;
v[6] = 0.f; v[7] = -s; v[8] = 0.f;
- mScript.setValues(v);
+ mScript.setColorMatrix(v);
}
}
public void runTest() {
- mScript.forEach(mInPixelsAllocation, mOutPixelsAllocation);
+ mScript.setInput(mInPixelsAllocation);
+ mScript.forEach(mOutPixelsAllocation);
}
}