diff options
author | Jason Sams <jsams@google.com> | 2013-10-08 18:03:50 -0700 |
---|---|---|
committer | Jason Sams <jsams@google.com> | 2013-11-25 16:35:36 -0800 |
commit | 7a3e3aa4948ff4b2c19a62f0b5003b902db0ce24 (patch) | |
tree | 1ed736f25188434b55e7afbc79958c5a45aeb6cd /java/tests/ImageProcessing_jb | |
parent | bde1a28e6652f25e4f74f018cb7d1dcba65a51e4 (diff) | |
download | rs-7a3e3aa4948ff4b2c19a62f0b5003b902db0ce24.tar.gz |
Enable toggle for USAGE_IO
Change-Id: Id2a42dec1e8449b178b92844d478ed51c2afee07
Diffstat (limited to 'java/tests/ImageProcessing_jb')
3 files changed, 64 insertions, 40 deletions
diff --git a/java/tests/ImageProcessing_jb/src/com/android/rs/image/IPControlsJB.java b/java/tests/ImageProcessing_jb/src/com/android/rs/image/IPControlsJB.java index c62294ce..1ce975c7 100644 --- a/java/tests/ImageProcessing_jb/src/com/android/rs/image/IPControlsJB.java +++ b/java/tests/ImageProcessing_jb/src/com/android/rs/image/IPControlsJB.java @@ -81,12 +81,13 @@ public class IPControlsJB extends Activity { return name; } } + private Resolutions mRes; private AdapterView.OnItemSelectedListener mResSpinnerListener = new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { - //changeTest(IPTestListJB.TestName.values()[pos]); + mRes = Resolutions.values()[pos]; } public void onNothingSelected(AdapterView parent) { @@ -206,6 +207,8 @@ public class IPControlsJB extends Activity { intent.putExtra("enable dvfs", mToggleDVFS); intent.putExtra("enable long", mToggleLong); intent.putExtra("enable pause", mTogglePause); + intent.putExtra("resolution X", mRes.width); + intent.putExtra("resolution Y", mRes.height); startActivityForResult(intent, 0); } diff --git a/java/tests/ImageProcessing_jb/src/com/android/rs/image/IPTestListJB.java b/java/tests/ImageProcessing_jb/src/com/android/rs/image/IPTestListJB.java index afb02bb3..88470c32 100644 --- a/java/tests/ImageProcessing_jb/src/com/android/rs/image/IPTestListJB.java +++ b/java/tests/ImageProcessing_jb/src/com/android/rs/image/IPTestListJB.java @@ -24,46 +24,50 @@ public class IPTestListJB { private final String TAG = "Img"; public final String RESULT_FILE = "image_processing_result.csv"; + public static final int FULL_FP = 0; + public static final int RELAXED_FP = 1; + public static final int INTRINSIC = 2; + /** * Define enum type for test names */ public enum TestName { // totally there are 38 test cases - LEVELS_VEC3_RELAXED ("Levels Vec3 Relaxed", 1), - LEVELS_VEC4_RELAXED ("Levels Vec4 Relaxed", 1), - LEVELS_VEC3_FULL ("Levels Vec3 Full", 0), - LEVELS_VEC4_FULL ("Levels Vec4 Full", 0), - BLUR_RADIUS_25 ("Blur radius 25", 1), - INTRINSIC_BLUE_RADIUS_25 ("Intrinsic Blur radius 25", 2), - GREYSCALE ("Greyscale", 1), - GRAIN ("Grain", 1), - FISHEYE_FULL ("Fisheye Full", 0), - FISHEYE_RELAXED ("Fisheye Relaxed", 1), - FISHEYE_APPROXIMATE_FULL ("Fisheye Approximate Full", 0), - FISHEYE_APPROXIMATE_RELAXED ("Fisheye Approximate Relaxed", 1), - VIGNETTE_FULL ("Vignette Full", 0), - VIGNETTE_RELAXED ("Vignette Relaxed", 1), - VIGNETTE_APPROXIMATE_FULL ("Vignette Approximate Full", 0), - VIGNETTE_APPROXIMATE_RELAXED ("Vignette Approximate Relaxed", 1), - GROUP_TEST_EMULATED ("Group Test (emulated)", 2), - GROUP_TEST_NATIVE ("Group Test (native)", 2), - CONVOLVE_3X3 ("Convolve 3x3", 1), - INTRINSICS_CONVOLVE_3X3 ("Intrinsics Convolve 3x3", 2), - COLOR_MATRIX ("ColorMatrix", 1), - INTRINSICS_COLOR_MATRIX ("Intrinsics ColorMatrix", 2), - INTRINSICS_COLOR_MATRIX_GREY ("Intrinsics ColorMatrix Grey", 2), - COPY ("Copy", 1), - CROSS_PROCESS_USING_LUT ("CrossProcess (using LUT)", 2), - CONVOLVE_5X5 ("Convolve 5x5", 1), - INTRINSICS_CONVOLVE_5X5 ("Intrinsics Convolve 5x5", 2), - MANDELBROT ("Mandelbrot", 0), - INTRINSICS_BLEND ("Intrinsics Blend", 2), - VIBRANCE ("Vibrance", 1), - BW_FILTER ("BW Filter", 1), - SHADOWS ("Shadows", 1), - CONTRAST ("Contrast", 1), - EXPOSURE ("Exposure", 1), - WHITE_BALANCE ("White Balance", 1); + LEVELS_VEC3_RELAXED ("Levels Vec3 Relaxed", RELAXED_FP), + LEVELS_VEC4_RELAXED ("Levels Vec4 Relaxed", RELAXED_FP), + LEVELS_VEC3_FULL ("Levels Vec3 Full", FULL_FP), + LEVELS_VEC4_FULL ("Levels Vec4 Full", FULL_FP), + BLUR_RADIUS_25 ("Blur radius 25", RELAXED_FP), + INTRINSIC_BLUE_RADIUS_25 ("Intrinsic Blur radius 25", INTRINSIC), + GREYSCALE ("Greyscale", RELAXED_FP), + GRAIN ("Grain", RELAXED_FP), + FISHEYE_FULL ("Fisheye Full", FULL_FP), + FISHEYE_RELAXED ("Fisheye Relaxed", RELAXED_FP), + FISHEYE_APPROXIMATE_FULL ("Fisheye Approximate Full", FULL_FP), + FISHEYE_APPROXIMATE_RELAXED ("Fisheye Approximate Relaxed", RELAXED_FP), + VIGNETTE_FULL ("Vignette Full", FULL_FP), + VIGNETTE_RELAXED ("Vignette Relaxed", RELAXED_FP), + VIGNETTE_APPROXIMATE_FULL ("Vignette Approximate Full", FULL_FP), + VIGNETTE_APPROXIMATE_RELAXED ("Vignette Approximate Relaxed", RELAXED_FP), + GROUP_TEST_EMULATED ("Group Test (emulated)", INTRINSIC), + GROUP_TEST_NATIVE ("Group Test (native)", INTRINSIC), + CONVOLVE_3X3 ("Convolve 3x3", RELAXED_FP), + INTRINSICS_CONVOLVE_3X3 ("Intrinsics Convolve 3x3", INTRINSIC), + COLOR_MATRIX ("ColorMatrix", RELAXED_FP), + INTRINSICS_COLOR_MATRIX ("Intrinsics ColorMatrix", INTRINSIC), + INTRINSICS_COLOR_MATRIX_GREY ("Intrinsics ColorMatrix Grey", INTRINSIC), + COPY ("Copy", RELAXED_FP), + CROSS_PROCESS_USING_LUT ("CrossProcess (using LUT)", INTRINSIC), + CONVOLVE_5X5 ("Convolve 5x5", RELAXED_FP), + INTRINSICS_CONVOLVE_5X5 ("Intrinsics Convolve 5x5", INTRINSIC), + MANDELBROT ("Mandelbrot", FULL_FP), + INTRINSICS_BLEND ("Intrinsics Blend", INTRINSIC), + VIBRANCE ("Vibrance", RELAXED_FP), + BW_FILTER ("BW Filter", RELAXED_FP), + SHADOWS ("Shadows", RELAXED_FP), + CONTRAST ("Contrast", RELAXED_FP), + EXPOSURE ("Exposure", RELAXED_FP), + WHITE_BALANCE ("White Balance", RELAXED_FP); private final String name; diff --git a/java/tests/ImageProcessing_jb/src/com/android/rs/image/ImageProcessingActivityJB.java b/java/tests/ImageProcessing_jb/src/com/android/rs/image/ImageProcessingActivityJB.java index a86bf318..3b52c473 100644 --- a/java/tests/ImageProcessing_jb/src/com/android/rs/image/ImageProcessingActivityJB.java +++ b/java/tests/ImageProcessing_jb/src/com/android/rs/image/ImageProcessingActivityJB.java @@ -86,6 +86,7 @@ public class ImageProcessingActivityJB extends Activity RenderScript mRS; Allocation mInPixelsAllocation; Allocation mInPixelsAllocation2; + Allocation mOutDisplayAllocation; Allocation mOutPixelsAllocation; private Surface mOutSurface; @@ -104,10 +105,19 @@ public class ImageProcessingActivityJB extends Activity mDisplayView = v; mInPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapIn); mInPixelsAllocation2 = Allocation.createFromBitmap(mRS, mBitmapIn2); - mOutPixelsAllocation = Allocation.createTyped(mRS, mInPixelsAllocation.getType(), + mOutDisplayAllocation = Allocation.createTyped(mRS, mInPixelsAllocation.getType(), Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT | Allocation.USAGE_IO_OUTPUT); + mOutPixelsAllocation = mOutDisplayAllocation; + + if (!mToggleIO) { + // Not using USAGE_IO for the script so create a non-io kernel to copy from + mOutPixelsAllocation = Allocation.createTyped(mRS, mInPixelsAllocation.getType(), + Allocation.MipmapControl.MIPMAP_NONE, + Allocation.USAGE_SCRIPT); + } + mBenchmarkMode = benchmarkMode; start(); } @@ -164,7 +174,10 @@ public class ImageProcessingActivityJB extends Activity if (mRS == null || mOutPixelsAllocation == null) { return; } - mOutPixelsAllocation.ioSend(); + if (mOutDisplayAllocation != mOutPixelsAllocation) { + mOutDisplayAllocation.copyFrom(mOutPixelsAllocation); + } + mOutDisplayAllocation.ioSend(); mDisplayView.invalidate(); //mTest.runTestSendMessage(); } @@ -186,7 +199,7 @@ public class ImageProcessingActivityJB extends Activity } if (lastSurface != mOutSurface) { - mOutPixelsAllocation.setSurface(mOutSurface); + mOutDisplayAllocation.setSurface(mOutSurface); lastSurface = mOutSurface; } } @@ -252,12 +265,16 @@ public class ImageProcessingActivityJB extends Activity mInPixelsAllocation.destroy(); mInPixelsAllocation2.destroy(); - mOutPixelsAllocation.destroy(); + if (mOutPixelsAllocation != mOutDisplayAllocation) { + mOutPixelsAllocation.destroy(); + } + mOutDisplayAllocation.destroy(); mRS.destroy(); mInPixelsAllocation = null; mInPixelsAllocation2 = null; mOutPixelsAllocation = null; + mOutDisplayAllocation = null; mRS = null; } } |