FileDocCategorySizeDatePackage
Convolve3x3.javaAPI DocAndroid 5.1 API2104Thu Mar 12 22:22:54 GMT 2015com.android.rs.image2

Convolve3x3

public class Convolve3x3 extends TestBase

Fields Summary
private ScriptC_ip2_convolve3x3
mScript
private ScriptIntrinsicConvolve3x3
mIntrinsic
private int
mWidth
private int
mHeight
private boolean
mUseIntrinsic
Constructors Summary
public Convolve3x3(boolean useIntrinsic)

        mUseIntrinsic = useIntrinsic;
    
Methods Summary
public voidcreateTest(android.content.res.Resources res)

        mWidth = mInPixelsAllocation.getType().getX();
        mHeight = mInPixelsAllocation.getType().getY();

        float f[] = new float[9];
        f[0] =  0.f;    f[1] = -1.f;    f[2] =  0.f;
        f[3] = -1.f;    f[4] =  5.f;    f[5] = -1.f;
        f[6] =  0.f;    f[7] = -1.f;    f[8] =  0.f;

        if (mUseIntrinsic) {
            mIntrinsic = ScriptIntrinsicConvolve3x3.create(mRS, Element.U8_4(mRS));
            mIntrinsic.setCoefficients(f);
            mIntrinsic.setInput(mInPixelsAllocation);
        } else {
            mScript = new ScriptC_ip2_convolve3x3(mRS);
            mScript.set_gCoeffs(f);
            mScript.set_gIn(mInPixelsAllocation);
            mScript.set_gWidth(mWidth);
            mScript.set_gHeight(mHeight);
        }
    
public voidrunTest()

        if (mUseIntrinsic) {
            mIntrinsic.forEach(mOutPixelsAllocation);
        } else {
            mScript.forEach_root(mOutPixelsAllocation);
        }