FileDocCategorySizeDatePackage
ImageProcessingTest.javaAPI DocAndroid 5.1 API13449Thu Mar 12 22:22:54 GMT 2015com.android.rs.imagejb

ImageProcessingTest

public class ImageProcessingTest extends android.test.ActivityInstrumentationTestCase2
ImageProcessing benchmark test. To run the test, please use command adb shell am instrument -e iteration -w com.android.rs.image/.ImageProcessingTestRunner

Fields Summary
private final String
TAG
private final String
TEST_NAME
private final String
ITERATIONS
private final String
BENCHMARK
private static int
INSTRUMENTATION_IN_PROGRESS
private int
mIteration
private ImageProcessingActivityJB
mActivity
Constructors Summary
public ImageProcessingTest()


      
        super(ImageProcessingActivityJB.class);
    
Methods Summary
protected voidprepareTest(int test)

        /*
        mActivity.mTestList = new int[1];
        mActivity.mTestList[0] = test;

        mActivity.mBitmapWidth = 1920;
        mActivity.mBitmapHeight = 1080;

        mActivity.mTestResults = new float[1];

        mActivity.startProcessor();*/
    
public voidrunOnUiThread(java.lang.Runnable action)

        synchronized(action) {
            mActivity.runOnUiThread(action);
            try {
                action.wait();
            } catch (InterruptedException e) {
                Log.v(TAG, "waiting for action running on UI thread is interrupted: " +
                        e.toString());
            }
        }
    
public voidrunTest(com.android.rs.imagejb.ImageProcessingTest$TestAction ta, java.lang.String testName)

        float sum = 0;
        for (int i = 0; i < mIteration; i++) {
            runOnUiThread(ta);
            float bmValue = ta.getBenchmark();
            Log.v(TAG, "results for iteration " + i + " is " + bmValue);
            sum += bmValue;
        }
        float avgResult = sum/mIteration;

        // post result to INSTRUMENTATION_STATUS
        Bundle results = new Bundle();
        results.putString(TEST_NAME, testName);
        results.putInt(ITERATIONS, mIteration);
        results.putFloat(BENCHMARK, avgResult);
        getInstrumentation().sendStatus(INSTRUMENTATION_IN_PROGRESS, results);
    
public voidsetUp()

        super.setUp();
        setActivityInitialTouchMode(false);
        mActivity = getActivity();
        ImageProcessingTestRunner mRunner = (ImageProcessingTestRunner) getInstrumentation();
        mIteration = mRunner.mIteration;
        assertTrue("please enter a valid iteration value", mIteration > 0);
   
public voidtearDown()

        super.tearDown();
    
public voidtestBWFilter()

        TestAction ta = new TestAction(TestName.BW_FILTER);
        runTest(ta, TestName.BW_FILTER.name());
    
public voidtestBlurRadius25()

        TestAction ta = new TestAction(TestName.BLUR_RADIUS_25);
        runTest(ta, TestName.BLUR_RADIUS_25.name());
    
public voidtestColorCube()

        TestAction ta = new TestAction(TestName.COLOR_CUBE);
        runTest(ta, TestName.COLOR_CUBE.name());
    
public voidtestColorCube3DIntrinsic()

        TestAction ta = new TestAction(TestName.COLOR_CUBE_3D_INTRINSIC);
        runTest(ta, TestName.COLOR_CUBE_3D_INTRINSIC.name());
    
public voidtestColorMatrix()

        TestAction ta = new TestAction(TestName.COLOR_MATRIX);
        runTest(ta, TestName.COLOR_MATRIX.name());
    
public voidtestContrast()

        TestAction ta = new TestAction(TestName.CONTRAST);
        runTest(ta, TestName.CONTRAST.name());
    
public voidtestConvolve3x3()

        TestAction ta = new TestAction(TestName.CONVOLVE_3X3);
        runTest(ta, TestName.CONVOLVE_3X3.name());
    
public voidtestConvolve5x5()

        TestAction ta = new TestAction(TestName.CONVOLVE_5X5);
        runTest(ta, TestName.CONVOLVE_5X5.name());
    
public voidtestCopy()

        TestAction ta = new TestAction(TestName.COPY);
        runTest(ta, TestName.COPY.name());
    
public voidtestCrossProcessUsingLUT()

        TestAction ta = new TestAction(TestName.CROSS_PROCESS_USING_LUT);
        runTest(ta, TestName.CROSS_PROCESS_USING_LUT.name());
    
public voidtestExposure()

        TestAction ta = new TestAction(TestName.EXPOSURE);
        runTest(ta, TestName.EXPOSURE.name());
    
public voidtestFishEyeRelaxed()

        TestAction ta = new TestAction(TestName.FISHEYE_RELAXED);
        runTest(ta, TestName.FISHEYE_RELAXED.name());
    
public voidtestFisheyeApproximateFull()

        TestAction ta = new TestAction(TestName.FISHEYE_APPROXIMATE_FULL);
        runTest(ta, TestName.FISHEYE_APPROXIMATE_FULL.name());
    
public voidtestFisheyeApproximateRelaxed()

        TestAction ta = new TestAction(TestName.FISHEYE_APPROXIMATE_RELAXED);
        runTest(ta, TestName.FISHEYE_APPROXIMATE_RELAXED.name());
    
public voidtestFisheyeFull()

        TestAction ta = new TestAction(TestName.FISHEYE_FULL);
        runTest(ta, TestName.FISHEYE_FULL.name());
    
public voidtestGrain()

        TestAction ta = new TestAction(TestName.GRAIN);
        runTest(ta, TestName.GRAIN.name());
    
public voidtestGreyscale()

        TestAction ta = new TestAction(TestName.GREYSCALE);
        runTest(ta, TestName.GREYSCALE.name());
    
public voidtestGroupTestEmulated()

        TestAction ta = new TestAction(TestName.GROUP_TEST_EMULATED);
        runTest(ta, TestName.GROUP_TEST_EMULATED.name());
    
public voidtestGroupTestNative()

        TestAction ta = new TestAction(TestName.GROUP_TEST_NATIVE);
        runTest(ta, TestName.GROUP_TEST_NATIVE.name());
    
public voidtestIntrinsicBlurRadius25()

        TestAction ta = new TestAction(TestName.INTRINSIC_BLUR_RADIUS_25);
        runTest(ta, TestName.INTRINSIC_BLUR_RADIUS_25.name());
    
public voidtestIntrinsicsBlend()

        TestAction ta = new TestAction(TestName.INTRINSICS_BLEND);
        runTest(ta, TestName.INTRINSICS_BLEND.name());
    
public voidtestIntrinsicsBlur25G()

        TestAction ta = new TestAction(TestName.INTRINSICS_BLUR_25G);
        runTest(ta, TestName.INTRINSICS_BLUR_25G.name());
    
public voidtestIntrinsicsColorMatrix()

        TestAction ta = new TestAction(TestName.INTRINSICS_COLOR_MATRIX);
        runTest(ta, TestName.INTRINSICS_COLOR_MATRIX.name());
    
public voidtestIntrinsicsColorMatrixGrey()

        TestAction ta = new TestAction(TestName.INTRINSICS_COLOR_MATRIX_GREY);
        runTest(ta, TestName.INTRINSICS_COLOR_MATRIX_GREY.name());
    
public voidtestIntrinsicsConvolve3x3()

        TestAction ta = new TestAction(TestName.INTRINSICS_CONVOLVE_3X3);
        runTest(ta, TestName.INTRINSICS_CONVOLVE_3X3.name());
    
public voidtestIntrinsicsConvolve5x5()

        TestAction ta = new TestAction(TestName.INTRINSICS_CONVOLVE_5X5);
        runTest(ta, TestName.INTRINSICS_CONVOLVE_5X5.name());
    
public voidtestLevelsVec3Full()

        TestAction ta = new TestAction(TestName.LEVELS_VEC3_FULL);
        runTest(ta, TestName.LEVELS_VEC3_FULL.name());
    
public voidtestLevelsVec3Relaxed()

        TestAction ta = new TestAction(TestName.LEVELS_VEC3_RELAXED);
        runTest(ta, TestName.LEVELS_VEC3_RELAXED.name());
    
public voidtestLevelsVec4Full()

        TestAction ta = new TestAction(TestName.LEVELS_VEC4_FULL);
        runTest(ta, TestName.LEVELS_VEC4_FULL.name());
    
public voidtestLevelsVec4Relaxed()

        TestAction ta = new TestAction(TestName.LEVELS_VEC4_RELAXED);
        runTest(ta, TestName.LEVELS_VEC4_RELAXED.name());
    
public voidtestMandelbrot()

        TestAction ta = new TestAction(TestName.MANDELBROT_FLOAT);
        runTest(ta, TestName.MANDELBROT_FLOAT.name());
    
public voidtestShadows()

        TestAction ta = new TestAction(TestName.SHADOWS);
        runTest(ta, TestName.SHADOWS.name());
    
public voidtestVibrance()

        TestAction ta = new TestAction(TestName.VIBRANCE);
        runTest(ta, TestName.VIBRANCE.name());
    
public voidtestVignetteApproximateFull()

        TestAction ta = new TestAction(TestName.VIGNETTE_APPROXIMATE_FULL);
        runTest(ta, TestName.VIGNETTE_APPROXIMATE_FULL.name());
    
public voidtestVignetteApproximateRelaxed()

        TestAction ta = new TestAction(TestName.VIGNETTE_APPROXIMATE_RELAXED);
        runTest(ta, TestName.VIGNETTE_APPROXIMATE_RELAXED.name());
    
public voidtestVignetteFull()

        TestAction ta = new TestAction(TestName.VIGNETTE_FULL);
        runTest(ta, TestName.VIGNETTE_FULL.name());
    
public voidtestVignetteRelaxed()

        TestAction ta = new TestAction(TestName.VIGNETTE_RELAXED);
        runTest(ta, TestName.VIGNETTE_RELAXED.name());
    
public voidtestWhiteBalance()

        TestAction ta = new TestAction(TestName.WHITE_BALANCE);
        runTest(ta, TestName.WHITE_BALANCE.name());