Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8309cb7 authored by Jason Sams's avatar Jason Sams Committed by Android (Google) Code Review
Browse files

Merge "Move the kernel launch to specific intrinsic class." into jb-mr1-dev

parents 43c7aae4 19e1086d
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -28,8 +28,4 @@ public class ScriptIntrinsic extends Script {
    ScriptIntrinsic(int id, RenderScript rs) {
        super(id, rs);
    }

    public void forEach(Allocation ain, Allocation aout) {
        forEach(0, ain, aout, null);
    }
}
+11 −1
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import java.util.HashMap;
 **/
public class ScriptIntrinsicConvolve3x3 extends ScriptIntrinsic {
    private float[] mValues = new float[9];
    private Allocation mInput;

    ScriptIntrinsicConvolve3x3(int id, RenderScript rs) {
        super(id, rs);
@@ -52,8 +53,12 @@ public class ScriptIntrinsicConvolve3x3 extends ScriptIntrinsic {

    }

    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];
@@ -61,5 +66,10 @@ public class ScriptIntrinsicConvolve3x3 extends ScriptIntrinsic {
        }
        setVar(0, fp);
    }

    public void forEach(Allocation aout) {
        forEach(0, null, aout, null);
    }

}
+3 −2
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ public class Intrinsics extends TestBase {
        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);
    }


@@ -55,7 +55,8 @@ public class Intrinsics extends TestBase {
    }

    public void runTest() {
        mScript.forEach(mInPixelsAllocation, mOutPixelsAllocation);
        mScript.setInput(mInPixelsAllocation);
        mScript.forEach(mOutPixelsAllocation);
    }

}