Skip to content

Commit a8309cb

Browse files
Jason SamsAndroid (Google) Code Review
authored andcommitted
Merge "Move the kernel launch to specific intrinsic class." into jb-mr1-dev
2 parents 43c7aae + 19e1086 commit a8309cb

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

graphics/java/android/renderscript/ScriptIntrinsic.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,4 @@ public class ScriptIntrinsic extends Script {
2828
ScriptIntrinsic(int id, RenderScript rs) {
2929
super(id, rs);
3030
}
31-
32-
public void forEach(Allocation ain, Allocation aout) {
33-
forEach(0, ain, aout, null);
34-
}
3531
}

graphics/java/android/renderscript/ScriptIntrinsicConvolve3x3.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
**/
3333
public class ScriptIntrinsicConvolve3x3 extends ScriptIntrinsic {
3434
private float[] mValues = new float[9];
35+
private Allocation mInput;
3536

3637
ScriptIntrinsicConvolve3x3(int id, RenderScript rs) {
3738
super(id, rs);
@@ -52,14 +53,23 @@ public static ScriptIntrinsicConvolve3x3 create(RenderScript rs, Element e) {
5253

5354
}
5455

56+
public void setInput(Allocation ain) {
57+
mInput = ain;
58+
bindAllocation(ain, 1);
59+
}
5560

56-
public void setValues(float v[]) {
61+
public void setColorMatrix(float v[]) {
5762
FieldPacker fp = new FieldPacker(9*4);
5863
for (int ct=0; ct < mValues.length; ct++) {
5964
mValues[ct] = v[ct];
6065
fp.addF32(mValues[ct]);
6166
}
6267
setVar(0, fp);
6368
}
69+
70+
public void forEach(Allocation aout) {
71+
forEach(0, null, aout, null);
72+
}
73+
6474
}
6575

tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Intrinsics.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void onBar1Changed(int progress) {
4646
v[0] = 0.f; v[1] = -s; v[2] = 0.f;
4747
v[3] = -s; v[4] = s*4+1; v[5] = -s;
4848
v[6] = 0.f; v[7] = -s; v[8] = 0.f;
49-
mScript.setValues(v);
49+
mScript.setColorMatrix(v);
5050
}
5151

5252

@@ -55,7 +55,8 @@ public void createTest(android.content.res.Resources res) {
5555
}
5656

5757
public void runTest() {
58-
mScript.forEach(mInPixelsAllocation, mOutPixelsAllocation);
58+
mScript.setInput(mInPixelsAllocation);
59+
mScript.forEach(mOutPixelsAllocation);
5960
}
6061

6162
}

0 commit comments

Comments
 (0)