Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.rs.image; |
| 18 | |
| 19 | import android.app.Activity; |
| 20 | import android.os.Bundle; |
| 21 | import android.graphics.BitmapFactory; |
| 22 | import android.graphics.Bitmap; |
| 23 | import android.graphics.Canvas; |
| 24 | import android.renderscript.ScriptC; |
| 25 | import android.renderscript.RenderScript; |
| 26 | import android.renderscript.Type; |
| 27 | import android.renderscript.Allocation; |
| 28 | import android.renderscript.Element; |
| 29 | import android.renderscript.Script; |
| 30 | import android.view.SurfaceView; |
| 31 | import android.view.SurfaceHolder; |
| 32 | import android.widget.ImageView; |
| 33 | import android.widget.SeekBar; |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 34 | import android.widget.TextView; |
| 35 | import android.view.View; |
Jason Sams | 586f3b5 | 2010-02-10 18:07:37 -0800 | [diff] [blame] | 36 | import java.lang.Math; |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 37 | |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 38 | public class ImageProcessingActivity extends Activity |
| 39 | implements SurfaceHolder.Callback, |
| 40 | SeekBar.OnSeekBarChangeListener { |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 41 | private Bitmap mBitmapIn; |
| 42 | private Bitmap mBitmapOut; |
Stephen Hines | 93a958f | 2010-09-16 17:18:55 -0700 | [diff] [blame] | 43 | private ScriptC_threshold mScript; |
| 44 | private ScriptC_vertical_blur mScriptVBlur; |
| 45 | private ScriptC_horizontal_blur mScriptHBlur; |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 46 | private int mRadius = 0; |
| 47 | private SeekBar mRadiusSeekBar; |
| 48 | |
| 49 | private float mInBlack = 0.0f; |
| 50 | private SeekBar mInBlackSeekBar; |
| 51 | private float mOutBlack = 0.0f; |
| 52 | private SeekBar mOutBlackSeekBar; |
| 53 | private float mInWhite = 255.0f; |
| 54 | private SeekBar mInWhiteSeekBar; |
| 55 | private float mOutWhite = 255.0f; |
| 56 | private SeekBar mOutWhiteSeekBar; |
| 57 | private float mGamma = 1.0f; |
| 58 | private SeekBar mGammaSeekBar; |
| 59 | |
| 60 | private float mSaturation = 1.0f; |
| 61 | private SeekBar mSaturationSeekBar; |
| 62 | |
| 63 | private TextView mBenchmarkResult; |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 64 | |
| 65 | @SuppressWarnings({"FieldCanBeLocal"}) |
| 66 | private RenderScript mRS; |
| 67 | @SuppressWarnings({"FieldCanBeLocal"}) |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 68 | private Type mPixelType; |
| 69 | @SuppressWarnings({"FieldCanBeLocal"}) |
| 70 | private Allocation mInPixelsAllocation; |
| 71 | @SuppressWarnings({"FieldCanBeLocal"}) |
| 72 | private Allocation mOutPixelsAllocation; |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 73 | @SuppressWarnings({"FieldCanBeLocal"}) |
Jason Sams | 43c3142 | 2010-08-16 12:29:23 -0700 | [diff] [blame] | 74 | private Allocation mScratchPixelsAllocation1; |
| 75 | private Allocation mScratchPixelsAllocation2; |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 76 | |
| 77 | private SurfaceView mSurfaceView; |
| 78 | private ImageView mDisplayView; |
| 79 | |
Alex Sakhartchouk | abf2b93 | 2011-04-22 12:42:47 -0700 | [diff] [blame] | 80 | private boolean mIsProcessing; |
| 81 | |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 82 | class FilterCallback extends RenderScript.RSMessageHandler { |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 83 | private Runnable mAction = new Runnable() { |
| 84 | public void run() { |
Alex Sakhartchouk | abf2b93 | 2011-04-22 12:42:47 -0700 | [diff] [blame] | 85 | |
| 86 | synchronized (mDisplayView) { |
| 87 | mIsProcessing = false; |
| 88 | } |
| 89 | |
| 90 | // This is a hack to work around an invalidation bug |
Alex Sakhartchouk | 9dc8b36 | 2011-04-26 17:19:41 -0700 | [diff] [blame] | 91 | mBitmapOut.setPixel(0, 0, 0); |
Alex Sakhartchouk | abf2b93 | 2011-04-22 12:42:47 -0700 | [diff] [blame] | 92 | mOutPixelsAllocation.copyTo(mBitmapOut); |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 93 | mDisplayView.invalidate(); |
| 94 | } |
Jason Sams | 718cd1f | 2009-12-23 14:35:29 -0800 | [diff] [blame] | 95 | }; |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 96 | |
| 97 | @Override |
| 98 | public void run() { |
| 99 | mSurfaceView.removeCallbacks(mAction); |
| 100 | mSurfaceView.post(mAction); |
| 101 | } |
| 102 | } |
| 103 | |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 104 | int in[]; |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 105 | int interm[]; |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 106 | int out[]; |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 107 | int MAX_RADIUS = 25; |
| 108 | // Store our coefficients here |
| 109 | float gaussian[]; |
| 110 | |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 111 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { |
| 112 | if (fromUser) { |
| 113 | |
Alex Sakhartchouk | ed9f210 | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 114 | if (seekBar == mRadiusSeekBar) { |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 115 | float fRadius = progress / 100.0f; |
| 116 | fRadius *= (float)(MAX_RADIUS); |
| 117 | mRadius = (int)fRadius; |
| 118 | |
| 119 | mScript.set_radius(mRadius); |
Alex Sakhartchouk | ed9f210 | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 120 | } else if (seekBar == mInBlackSeekBar) { |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 121 | mInBlack = (float)progress; |
Jason Sams | 43c3142 | 2010-08-16 12:29:23 -0700 | [diff] [blame] | 122 | mScriptVBlur.invoke_setLevels(mInBlack, mOutBlack, mInWhite, mOutWhite); |
Alex Sakhartchouk | ed9f210 | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 123 | } else if (seekBar == mOutBlackSeekBar) { |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 124 | mOutBlack = (float)progress; |
Jason Sams | 43c3142 | 2010-08-16 12:29:23 -0700 | [diff] [blame] | 125 | mScriptVBlur.invoke_setLevels(mInBlack, mOutBlack, mInWhite, mOutWhite); |
Alex Sakhartchouk | ed9f210 | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 126 | } else if (seekBar == mInWhiteSeekBar) { |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 127 | mInWhite = (float)progress + 127.0f; |
Jason Sams | 43c3142 | 2010-08-16 12:29:23 -0700 | [diff] [blame] | 128 | mScriptVBlur.invoke_setLevels(mInBlack, mOutBlack, mInWhite, mOutWhite); |
Alex Sakhartchouk | ed9f210 | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 129 | } else if (seekBar == mOutWhiteSeekBar) { |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 130 | mOutWhite = (float)progress + 127.0f; |
Jason Sams | 43c3142 | 2010-08-16 12:29:23 -0700 | [diff] [blame] | 131 | mScriptVBlur.invoke_setLevels(mInBlack, mOutBlack, mInWhite, mOutWhite); |
Alex Sakhartchouk | ed9f210 | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 132 | } else if (seekBar == mGammaSeekBar) { |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 133 | mGamma = (float)progress/100.0f; |
| 134 | mGamma = Math.max(mGamma, 0.1f); |
| 135 | mGamma = 1.0f / mGamma; |
Jason Sams | 43c3142 | 2010-08-16 12:29:23 -0700 | [diff] [blame] | 136 | mScriptVBlur.invoke_setGamma(mGamma); |
Alex Sakhartchouk | ed9f210 | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 137 | } else if (seekBar == mSaturationSeekBar) { |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 138 | mSaturation = (float)progress / 50.0f; |
Jason Sams | 43c3142 | 2010-08-16 12:29:23 -0700 | [diff] [blame] | 139 | mScriptVBlur.invoke_setSaturation(mSaturation); |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 140 | } |
| 141 | |
Alex Sakhartchouk | abf2b93 | 2011-04-22 12:42:47 -0700 | [diff] [blame] | 142 | synchronized (mDisplayView) { |
| 143 | if (mIsProcessing) { |
| 144 | return; |
| 145 | } |
| 146 | mIsProcessing = true; |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 147 | } |
| 148 | |
Alex Sakhartchouk | abf2b93 | 2011-04-22 12:42:47 -0700 | [diff] [blame] | 149 | mScript.invoke_filter(); |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 150 | } |
| 151 | } |
| 152 | |
| 153 | public void onStartTrackingTouch(SeekBar seekBar) { |
| 154 | } |
| 155 | |
| 156 | public void onStopTrackingTouch(SeekBar seekBar) { |
Jason Sams | 586f3b5 | 2010-02-10 18:07:37 -0800 | [diff] [blame] | 157 | } |
| 158 | |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 159 | @Override |
| 160 | protected void onCreate(Bundle savedInstanceState) { |
| 161 | super.onCreate(savedInstanceState); |
| 162 | setContentView(R.layout.main); |
| 163 | |
Alex Sakhartchouk | abf2b93 | 2011-04-22 12:42:47 -0700 | [diff] [blame] | 164 | mBitmapIn = loadBitmap(R.drawable.city); |
| 165 | mBitmapOut = loadBitmap(R.drawable.city); |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 166 | |
| 167 | mSurfaceView = (SurfaceView) findViewById(R.id.surface); |
| 168 | mSurfaceView.getHolder().addCallback(this); |
| 169 | |
| 170 | mDisplayView = (ImageView) findViewById(R.id.display); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 171 | mDisplayView.setImageBitmap(mBitmapOut); |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 172 | |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 173 | mRadiusSeekBar = (SeekBar) findViewById(R.id.radius); |
| 174 | mRadiusSeekBar.setOnSeekBarChangeListener(this); |
Jason Sams | 586f3b5 | 2010-02-10 18:07:37 -0800 | [diff] [blame] | 175 | |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 176 | mInBlackSeekBar = (SeekBar)findViewById(R.id.inBlack); |
| 177 | mInBlackSeekBar.setOnSeekBarChangeListener(this); |
| 178 | mInBlackSeekBar.setMax(128); |
| 179 | mInBlackSeekBar.setProgress(0); |
| 180 | mOutBlackSeekBar = (SeekBar)findViewById(R.id.outBlack); |
| 181 | mOutBlackSeekBar.setOnSeekBarChangeListener(this); |
| 182 | mOutBlackSeekBar.setMax(128); |
| 183 | mOutBlackSeekBar.setProgress(0); |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 184 | |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 185 | mInWhiteSeekBar = (SeekBar)findViewById(R.id.inWhite); |
| 186 | mInWhiteSeekBar.setOnSeekBarChangeListener(this); |
| 187 | mInWhiteSeekBar.setMax(128); |
| 188 | mInWhiteSeekBar.setProgress(128); |
| 189 | mOutWhiteSeekBar = (SeekBar)findViewById(R.id.outWhite); |
| 190 | mOutWhiteSeekBar.setOnSeekBarChangeListener(this); |
| 191 | mOutWhiteSeekBar.setMax(128); |
| 192 | mOutWhiteSeekBar.setProgress(128); |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 193 | |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 194 | mGammaSeekBar = (SeekBar)findViewById(R.id.inGamma); |
| 195 | mGammaSeekBar.setOnSeekBarChangeListener(this); |
| 196 | mGammaSeekBar.setMax(150); |
| 197 | mGammaSeekBar.setProgress(100); |
| 198 | |
| 199 | mSaturationSeekBar = (SeekBar)findViewById(R.id.inSaturation); |
| 200 | mSaturationSeekBar.setOnSeekBarChangeListener(this); |
| 201 | mSaturationSeekBar.setProgress(50); |
| 202 | |
| 203 | mBenchmarkResult = (TextView) findViewById(R.id.benchmarkText); |
Alex Sakhartchouk | db217e0 | 2011-02-17 14:43:27 -0800 | [diff] [blame] | 204 | mBenchmarkResult.setText("Result: not run"); |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 205 | } |
| 206 | |
| 207 | public void surfaceCreated(SurfaceHolder holder) { |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 208 | createScript(); |
Jason Sams | f110d4b | 2010-06-21 17:42:41 -0700 | [diff] [blame] | 209 | mScript.invoke_filter(); |
Jason Sams | 4ef6650 | 2010-12-10 16:03:15 -0800 | [diff] [blame] | 210 | mOutPixelsAllocation.copyTo(mBitmapOut); |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 211 | } |
| 212 | |
| 213 | public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { |
| 214 | } |
| 215 | |
| 216 | public void surfaceDestroyed(SurfaceHolder holder) { |
| 217 | } |
Jason Sams | 718cd1f | 2009-12-23 14:35:29 -0800 | [diff] [blame] | 218 | |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 219 | private void createScript() { |
Shih-wei Liao | 6b32fab | 2010-12-10 01:03:59 -0800 | [diff] [blame] | 220 | mRS = RenderScript.create(this); |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 221 | mRS.setMessageHandler(new FilterCallback()); |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 222 | |
Jason Sams | 4ef6650 | 2010-12-10 16:03:15 -0800 | [diff] [blame] | 223 | mInPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapIn, |
| 224 | Allocation.MipmapControl.MIPMAP_NONE, |
| 225 | Allocation.USAGE_SCRIPT); |
| 226 | mOutPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapOut, |
| 227 | Allocation.MipmapControl.MIPMAP_NONE, |
| 228 | Allocation.USAGE_SCRIPT); |
Jason Sams | 43c3142 | 2010-08-16 12:29:23 -0700 | [diff] [blame] | 229 | |
| 230 | Type.Builder tb = new Type.Builder(mRS, Element.F32_4(mRS)); |
Jason Sams | bf6ef8d | 2010-12-06 15:59:59 -0800 | [diff] [blame] | 231 | tb.setX(mBitmapIn.getWidth()); |
| 232 | tb.setY(mBitmapIn.getHeight()); |
Jason Sams | 43c3142 | 2010-08-16 12:29:23 -0700 | [diff] [blame] | 233 | mScratchPixelsAllocation1 = Allocation.createTyped(mRS, tb.create()); |
| 234 | mScratchPixelsAllocation2 = Allocation.createTyped(mRS, tb.create()); |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 235 | |
Jason Sams | 3ba02b3 | 2010-11-03 23:01:38 -0700 | [diff] [blame] | 236 | mScriptVBlur = new ScriptC_vertical_blur(mRS, getResources(), R.raw.vertical_blur); |
| 237 | mScriptHBlur = new ScriptC_horizontal_blur(mRS, getResources(), R.raw.horizontal_blur); |
Jason Sams | 8f8a572 | 2010-07-15 17:11:13 -0700 | [diff] [blame] | 238 | |
Jason Sams | 3ba02b3 | 2010-11-03 23:01:38 -0700 | [diff] [blame] | 239 | mScript = new ScriptC_threshold(mRS, getResources(), R.raw.threshold); |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 240 | mScript.set_width(mBitmapIn.getWidth()); |
| 241 | mScript.set_height(mBitmapIn.getHeight()); |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 242 | mScript.set_radius(mRadius); |
| 243 | |
Jason Sams | 43c3142 | 2010-08-16 12:29:23 -0700 | [diff] [blame] | 244 | mScriptVBlur.invoke_setLevels(mInBlack, mOutBlack, mInWhite, mOutWhite); |
| 245 | mScriptVBlur.invoke_setGamma(mGamma); |
| 246 | mScriptVBlur.invoke_setSaturation(mSaturation); |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 247 | |
Jason Sams | 4d33993 | 2010-05-11 14:03:58 -0700 | [diff] [blame] | 248 | mScript.bind_InPixel(mInPixelsAllocation); |
| 249 | mScript.bind_OutPixel(mOutPixelsAllocation); |
Jason Sams | 43c3142 | 2010-08-16 12:29:23 -0700 | [diff] [blame] | 250 | mScript.bind_ScratchPixel1(mScratchPixelsAllocation1); |
| 251 | mScript.bind_ScratchPixel2(mScratchPixelsAllocation2); |
Jason Sams | 8f8a572 | 2010-07-15 17:11:13 -0700 | [diff] [blame] | 252 | |
| 253 | mScript.set_vBlurScript(mScriptVBlur); |
| 254 | mScript.set_hBlurScript(mScriptHBlur); |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 255 | } |
| 256 | |
| 257 | private Bitmap loadBitmap(int resource) { |
| 258 | final BitmapFactory.Options options = new BitmapFactory.Options(); |
| 259 | options.inPreferredConfig = Bitmap.Config.ARGB_8888; |
| 260 | return copyBitmap(BitmapFactory.decodeResource(getResources(), resource, options)); |
| 261 | } |
| 262 | |
| 263 | private static Bitmap copyBitmap(Bitmap source) { |
| 264 | Bitmap b = Bitmap.createBitmap(source.getWidth(), source.getHeight(), source.getConfig()); |
| 265 | Canvas c = new Canvas(b); |
| 266 | c.drawBitmap(source, 0, 0, null); |
| 267 | source.recycle(); |
| 268 | return b; |
| 269 | } |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 270 | |
| 271 | // button hook |
| 272 | public void benchmark(View v) { |
| 273 | android.util.Log.v("Img", "Benchmarking"); |
| 274 | int oldRadius = mRadius; |
| 275 | mRadius = MAX_RADIUS; |
| 276 | mScript.set_radius(mRadius); |
| 277 | |
| 278 | long t = java.lang.System.currentTimeMillis(); |
| 279 | |
Jason Sams | 43c3142 | 2010-08-16 12:29:23 -0700 | [diff] [blame] | 280 | mScript.invoke_filter(); |
Jason Sams | 4ef6650 | 2010-12-10 16:03:15 -0800 | [diff] [blame] | 281 | mOutPixelsAllocation.copyTo(mBitmapOut); |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 282 | |
| 283 | t = java.lang.System.currentTimeMillis() - t; |
| 284 | android.util.Log.v("Img", "Renderscript frame time core ms " + t); |
| 285 | |
Jason Sams | 43c3142 | 2010-08-16 12:29:23 -0700 | [diff] [blame] | 286 | //long javaTime = javaFilter(); |
| 287 | //mBenchmarkResult.setText("RS: " + t + " ms Java: " + javaTime + " ms"); |
Alex Sakhartchouk | db217e0 | 2011-02-17 14:43:27 -0800 | [diff] [blame] | 288 | mBenchmarkResult.setText("Result: " + t + " ms"); |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 289 | |
| 290 | mRadius = oldRadius; |
| 291 | mScript.set_radius(mRadius); |
| 292 | |
Jason Sams | f110d4b | 2010-06-21 17:42:41 -0700 | [diff] [blame] | 293 | mScript.invoke_filter(); |
Jason Sams | 4ef6650 | 2010-12-10 16:03:15 -0800 | [diff] [blame] | 294 | mOutPixelsAllocation.copyTo(mBitmapOut); |
Alex Sakhartchouk | 814326b | 2010-05-19 16:28:27 -0700 | [diff] [blame] | 295 | } |
Romain Guy | d7fa122 | 2009-10-09 16:05:25 -0700 | [diff] [blame] | 296 | } |