Loading tests/RenderScriptTests/ImageProcessing/res/layout/main.xml +15 −39 Original line number Diff line number Diff line Loading @@ -50,8 +50,12 @@ android:textSize="8pt" android:text="@string/saturation"/> </LinearLayout> <Spinner android:id="@+id/filterselection" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/inSaturationText" android:id="@+id/slider1Text" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="8pt" Loading @@ -59,13 +63,13 @@ android:layout_marginTop="15sp" android:text="@string/saturation"/> <SeekBar android:id="@+id/inSaturation" android:id="@+id/slider1" android:layout_marginLeft="10sp" android:layout_marginRight="10sp" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/inGammaText" android:id="@+id/slider2Text" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="8pt" Loading @@ -73,13 +77,13 @@ android:layout_marginTop="15sp" android:text="@string/gamma"/> <SeekBar android:id="@+id/inGamma" android:id="@+id/slider2" android:layout_marginLeft="10sp" android:layout_marginRight="10sp" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/outWhiteText" android:id="@+id/slider3Text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10sp" Loading @@ -87,13 +91,13 @@ android:textSize="8pt" android:text="@string/out_white"/> <SeekBar android:id="@+id/outWhite" android:id="@+id/slider3" android:layout_marginLeft="10sp" android:layout_marginRight="10sp" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/inWhiteText" android:id="@+id/slider4Text" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="8pt" Loading @@ -101,49 +105,21 @@ android:layout_marginTop="15sp" android:text="@string/in_white"/> <SeekBar android:id="@+id/inWhite" android:layout_marginLeft="10sp" android:layout_marginRight="10sp" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/outBlackText" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="8pt" android:layout_marginLeft="10sp" android:layout_marginTop="15sp" android:text="@string/out_black"/> <SeekBar android:id="@+id/outBlack" android:id="@+id/slider4" android:layout_marginLeft="10sp" android:layout_marginRight="10sp" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/inBlackText" android:id="@+id/slider5Text" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="8pt" android:layout_marginLeft="10sp" android:layout_marginTop="15sp" android:text="@string/in_black"/> <SeekBar android:id="@+id/inBlack" android:layout_marginLeft="10sp" android:layout_marginRight="10sp" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/blurText" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="8pt" android:layout_marginLeft="10sp" android:layout_marginTop="15sp" android:text="@string/blur_description"/> android:text="@string/in_white"/> <SeekBar android:id="@+id/radius" android:id="@+id/slider5" android:layout_marginLeft="10sp" android:layout_marginRight="10sp" android:layout_width="match_parent" Loading tests/RenderScriptTests/ImageProcessing/res/layout/spinner_layout.xml 0 → 100644 +23 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2012 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp" android:textSize="16sp" /> tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blur25.java 0 → 100644 +106 −0 Original line number Diff line number Diff line /* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.rs.image; import java.lang.Math; import android.renderscript.Allocation; import android.renderscript.Element; import android.renderscript.RenderScript; import android.renderscript.Script; import android.renderscript.ScriptC; import android.renderscript.Type; import android.util.Log; import android.widget.SeekBar; import android.widget.TextView; public class Blur25 extends TestBase { private int MAX_RADIUS = 25; private ScriptC_threshold mScript; private ScriptC_vertical_blur mScriptVBlur; private ScriptC_horizontal_blur mScriptHBlur; private int mRadius = MAX_RADIUS; private float mSaturation = 1.0f; private Allocation mScratchPixelsAllocation1; private Allocation mScratchPixelsAllocation2; public boolean onBar1Setup(SeekBar b, TextView t) { t.setText("Radius"); b.setProgress(100); return true; } public boolean onBar2Setup(SeekBar b, TextView t) { b.setProgress(50); t.setText("Saturation"); return true; } public void onBar1Changed(int progress) { float fRadius = progress / 100.0f; fRadius *= (float)(MAX_RADIUS); mRadius = (int)fRadius; mScript.set_radius(mRadius); } public void onBar2Changed(int progress) { mSaturation = (float)progress / 50.0f; mScriptVBlur.invoke_setSaturation(mSaturation); } public void createTest(android.content.res.Resources res) { int width = mInPixelsAllocation.getType().getX(); int height = mInPixelsAllocation.getType().getY(); Type.Builder tb = new Type.Builder(mRS, Element.F32_4(mRS)); tb.setX(width); tb.setY(height); mScratchPixelsAllocation1 = Allocation.createTyped(mRS, tb.create()); mScratchPixelsAllocation2 = Allocation.createTyped(mRS, tb.create()); mScriptVBlur = new ScriptC_vertical_blur(mRS, res, R.raw.vertical_blur); mScriptHBlur = new ScriptC_horizontal_blur(mRS, res, R.raw.horizontal_blur); mScript = new ScriptC_threshold(mRS, res, R.raw.threshold); mScript.set_width(width); mScript.set_height(height); mScript.set_radius(mRadius); mScriptVBlur.invoke_setSaturation(mSaturation); mScript.bind_InPixel(mInPixelsAllocation); mScript.bind_OutPixel(mOutPixelsAllocation); mScript.bind_ScratchPixel1(mScratchPixelsAllocation1); mScript.bind_ScratchPixel2(mScratchPixelsAllocation2); mScript.set_vBlurScript(mScriptVBlur); mScript.set_hBlurScript(mScriptHBlur); } public void runTest() { mScript.invoke_filter(); } public void setupBenchmark() { mScript.set_radius(MAX_RADIUS); } public void exitBenchmark() { mScript.set_radius(mRadius); } } tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Greyscale.java 0 → 100644 +40 −0 Original line number Diff line number Diff line /* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.rs.image; import java.lang.Math; import android.renderscript.Allocation; import android.renderscript.Element; import android.renderscript.RenderScript; import android.renderscript.Script; import android.renderscript.ScriptC; import android.renderscript.Type; import android.util.Log; public class Greyscale extends TestBase { private ScriptC_greyscale mScript; public void createTest(android.content.res.Resources res) { mScript = new ScriptC_greyscale(mRS, res, R.raw.greyscale); } public void runTest() { mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation); } } tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java +149 −184 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
tests/RenderScriptTests/ImageProcessing/res/layout/main.xml +15 −39 Original line number Diff line number Diff line Loading @@ -50,8 +50,12 @@ android:textSize="8pt" android:text="@string/saturation"/> </LinearLayout> <Spinner android:id="@+id/filterselection" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/inSaturationText" android:id="@+id/slider1Text" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="8pt" Loading @@ -59,13 +63,13 @@ android:layout_marginTop="15sp" android:text="@string/saturation"/> <SeekBar android:id="@+id/inSaturation" android:id="@+id/slider1" android:layout_marginLeft="10sp" android:layout_marginRight="10sp" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/inGammaText" android:id="@+id/slider2Text" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="8pt" Loading @@ -73,13 +77,13 @@ android:layout_marginTop="15sp" android:text="@string/gamma"/> <SeekBar android:id="@+id/inGamma" android:id="@+id/slider2" android:layout_marginLeft="10sp" android:layout_marginRight="10sp" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/outWhiteText" android:id="@+id/slider3Text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10sp" Loading @@ -87,13 +91,13 @@ android:textSize="8pt" android:text="@string/out_white"/> <SeekBar android:id="@+id/outWhite" android:id="@+id/slider3" android:layout_marginLeft="10sp" android:layout_marginRight="10sp" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/inWhiteText" android:id="@+id/slider4Text" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="8pt" Loading @@ -101,49 +105,21 @@ android:layout_marginTop="15sp" android:text="@string/in_white"/> <SeekBar android:id="@+id/inWhite" android:layout_marginLeft="10sp" android:layout_marginRight="10sp" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/outBlackText" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="8pt" android:layout_marginLeft="10sp" android:layout_marginTop="15sp" android:text="@string/out_black"/> <SeekBar android:id="@+id/outBlack" android:id="@+id/slider4" android:layout_marginLeft="10sp" android:layout_marginRight="10sp" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/inBlackText" android:id="@+id/slider5Text" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="8pt" android:layout_marginLeft="10sp" android:layout_marginTop="15sp" android:text="@string/in_black"/> <SeekBar android:id="@+id/inBlack" android:layout_marginLeft="10sp" android:layout_marginRight="10sp" android:layout_width="match_parent" android:layout_height="wrap_content"/> <TextView android:id="@+id/blurText" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="8pt" android:layout_marginLeft="10sp" android:layout_marginTop="15sp" android:text="@string/blur_description"/> android:text="@string/in_white"/> <SeekBar android:id="@+id/radius" android:id="@+id/slider5" android:layout_marginLeft="10sp" android:layout_marginRight="10sp" android:layout_width="match_parent" Loading
tests/RenderScriptTests/ImageProcessing/res/layout/spinner_layout.xml 0 → 100644 +23 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2012 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp" android:textSize="16sp" />
tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blur25.java 0 → 100644 +106 −0 Original line number Diff line number Diff line /* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.rs.image; import java.lang.Math; import android.renderscript.Allocation; import android.renderscript.Element; import android.renderscript.RenderScript; import android.renderscript.Script; import android.renderscript.ScriptC; import android.renderscript.Type; import android.util.Log; import android.widget.SeekBar; import android.widget.TextView; public class Blur25 extends TestBase { private int MAX_RADIUS = 25; private ScriptC_threshold mScript; private ScriptC_vertical_blur mScriptVBlur; private ScriptC_horizontal_blur mScriptHBlur; private int mRadius = MAX_RADIUS; private float mSaturation = 1.0f; private Allocation mScratchPixelsAllocation1; private Allocation mScratchPixelsAllocation2; public boolean onBar1Setup(SeekBar b, TextView t) { t.setText("Radius"); b.setProgress(100); return true; } public boolean onBar2Setup(SeekBar b, TextView t) { b.setProgress(50); t.setText("Saturation"); return true; } public void onBar1Changed(int progress) { float fRadius = progress / 100.0f; fRadius *= (float)(MAX_RADIUS); mRadius = (int)fRadius; mScript.set_radius(mRadius); } public void onBar2Changed(int progress) { mSaturation = (float)progress / 50.0f; mScriptVBlur.invoke_setSaturation(mSaturation); } public void createTest(android.content.res.Resources res) { int width = mInPixelsAllocation.getType().getX(); int height = mInPixelsAllocation.getType().getY(); Type.Builder tb = new Type.Builder(mRS, Element.F32_4(mRS)); tb.setX(width); tb.setY(height); mScratchPixelsAllocation1 = Allocation.createTyped(mRS, tb.create()); mScratchPixelsAllocation2 = Allocation.createTyped(mRS, tb.create()); mScriptVBlur = new ScriptC_vertical_blur(mRS, res, R.raw.vertical_blur); mScriptHBlur = new ScriptC_horizontal_blur(mRS, res, R.raw.horizontal_blur); mScript = new ScriptC_threshold(mRS, res, R.raw.threshold); mScript.set_width(width); mScript.set_height(height); mScript.set_radius(mRadius); mScriptVBlur.invoke_setSaturation(mSaturation); mScript.bind_InPixel(mInPixelsAllocation); mScript.bind_OutPixel(mOutPixelsAllocation); mScript.bind_ScratchPixel1(mScratchPixelsAllocation1); mScript.bind_ScratchPixel2(mScratchPixelsAllocation2); mScript.set_vBlurScript(mScriptVBlur); mScript.set_hBlurScript(mScriptHBlur); } public void runTest() { mScript.invoke_filter(); } public void setupBenchmark() { mScript.set_radius(MAX_RADIUS); } public void exitBenchmark() { mScript.set_radius(mRadius); } }
tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Greyscale.java 0 → 100644 +40 −0 Original line number Diff line number Diff line /* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.rs.image; import java.lang.Math; import android.renderscript.Allocation; import android.renderscript.Element; import android.renderscript.RenderScript; import android.renderscript.Script; import android.renderscript.ScriptC; import android.renderscript.Type; import android.util.Log; public class Greyscale extends TestBase { private ScriptC_greyscale mScript; public void createTest(android.content.res.Resources res) { mScript = new ScriptC_greyscale(mRS, res, R.raw.greyscale); } public void runTest() { mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation); } }
tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java +149 −184 File changed.Preview size limit exceeded, changes collapsed. Show changes