Loading tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java +18 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,12 @@ import android.widget.Spinner; import android.widget.TextView; import android.view.View; import android.util.Log; import android.renderscript.ScriptC; import android.renderscript.RenderScript; import android.renderscript.Type; import android.renderscript.Allocation; import android.renderscript.Element; import android.renderscript.Script; import android.os.Environment; import java.io.BufferedWriter; Loading @@ -44,6 +50,11 @@ public class ImageProcessingActivity extends Activity private final String TAG = "Img"; public final String RESULT_FILE = "image_processing_result.csv"; RenderScript mRS; Allocation mInPixelsAllocation; Allocation mInPixelsAllocation2; Allocation mOutPixelsAllocation; /** * Define enum type for test names */ Loading Loading @@ -408,6 +419,13 @@ public class ImageProcessingActivity extends Activity mBenchmarkResult = (TextView) findViewById(R.id.benchmarkText); mBenchmarkResult.setText("Result: not run"); mRS = RenderScript.create(this); mInPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapIn); mInPixelsAllocation2 = Allocation.createFromBitmap(mRS, mBitmapIn2); mOutPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapOut); setupTests(); changeTest(TestName.LEVELS_VEC3_RELAXED); } Loading tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/TestBase.java +5 −7 Original line number Diff line number Diff line Loading @@ -45,7 +45,6 @@ public class TestBase { protected Allocation mInPixelsAllocation; protected Allocation mInPixelsAllocation2; protected Allocation mOutPixelsAllocation; protected ImageProcessingActivity act; private class MessageProcessor extends RenderScript.RSMessageHandler { Loading Loading @@ -107,12 +106,12 @@ public class TestBase { public final void createBaseTest(ImageProcessingActivity ipact, Bitmap b, Bitmap b2, Bitmap outb) { act = ipact; mRS = RenderScript.create(act); mRS = ipact.mRS; mRS.setMessageHandler(new MessageProcessor(act)); mInPixelsAllocation = Allocation.createFromBitmap(mRS, b); mInPixelsAllocation2 = Allocation.createFromBitmap(mRS, b2); mOutPixelsAllocation = Allocation.createFromBitmap(mRS, outb); mInPixelsAllocation = ipact.mInPixelsAllocation; mInPixelsAllocation2 = ipact.mInPixelsAllocation2; mOutPixelsAllocation = ipact.mOutPixelsAllocation; createTest(act.getResources()); } Loading @@ -135,8 +134,7 @@ public class TestBase { } public void destroy() { mRS.destroy(); mRS = null; mRS.setMessageHandler(null); } public void updateBitmap(Bitmap b) { Loading Loading
tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java +18 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,12 @@ import android.widget.Spinner; import android.widget.TextView; import android.view.View; import android.util.Log; import android.renderscript.ScriptC; import android.renderscript.RenderScript; import android.renderscript.Type; import android.renderscript.Allocation; import android.renderscript.Element; import android.renderscript.Script; import android.os.Environment; import java.io.BufferedWriter; Loading @@ -44,6 +50,11 @@ public class ImageProcessingActivity extends Activity private final String TAG = "Img"; public final String RESULT_FILE = "image_processing_result.csv"; RenderScript mRS; Allocation mInPixelsAllocation; Allocation mInPixelsAllocation2; Allocation mOutPixelsAllocation; /** * Define enum type for test names */ Loading Loading @@ -408,6 +419,13 @@ public class ImageProcessingActivity extends Activity mBenchmarkResult = (TextView) findViewById(R.id.benchmarkText); mBenchmarkResult.setText("Result: not run"); mRS = RenderScript.create(this); mInPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapIn); mInPixelsAllocation2 = Allocation.createFromBitmap(mRS, mBitmapIn2); mOutPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapOut); setupTests(); changeTest(TestName.LEVELS_VEC3_RELAXED); } Loading
tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/TestBase.java +5 −7 Original line number Diff line number Diff line Loading @@ -45,7 +45,6 @@ public class TestBase { protected Allocation mInPixelsAllocation; protected Allocation mInPixelsAllocation2; protected Allocation mOutPixelsAllocation; protected ImageProcessingActivity act; private class MessageProcessor extends RenderScript.RSMessageHandler { Loading Loading @@ -107,12 +106,12 @@ public class TestBase { public final void createBaseTest(ImageProcessingActivity ipact, Bitmap b, Bitmap b2, Bitmap outb) { act = ipact; mRS = RenderScript.create(act); mRS = ipact.mRS; mRS.setMessageHandler(new MessageProcessor(act)); mInPixelsAllocation = Allocation.createFromBitmap(mRS, b); mInPixelsAllocation2 = Allocation.createFromBitmap(mRS, b2); mOutPixelsAllocation = Allocation.createFromBitmap(mRS, outb); mInPixelsAllocation = ipact.mInPixelsAllocation; mInPixelsAllocation2 = ipact.mInPixelsAllocation2; mOutPixelsAllocation = ipact.mOutPixelsAllocation; createTest(act.getResources()); } Loading @@ -135,8 +134,7 @@ public class TestBase { } public void destroy() { mRS.destroy(); mRS = null; mRS.setMessageHandler(null); } public void updateBitmap(Bitmap b) { Loading