File tree Expand file tree Collapse file tree 3 files changed +12
-8
lines changed
tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -296,14 +296,14 @@ private static Bitmap copyBitmap(Bitmap source) {
296296
297297 // button hook
298298 public void benchmark (View v ) {
299- long t = getBenchmark ();
299+ float t = getBenchmark ();
300300 //long javaTime = javaFilter();
301301 //mBenchmarkResult.setText("RS: " + t + " ms Java: " + javaTime + " ms");
302302 mBenchmarkResult .setText ("Result: " + t + " ms" );
303303 }
304304
305305 // For benchmark test
306- public long getBenchmark () {
306+ public float getBenchmark () {
307307 mDoingBenchmark = true ;
308308
309309 mTest .setupBenchmark ();
@@ -319,14 +319,18 @@ public long getBenchmark() {
319319
320320 Log .v (TAG , "Benchmarking" );
321321 t = java .lang .System .currentTimeMillis ();
322- mTest .runTest ();
322+ for (int i =0 ; i <10 ; i ++) {
323+ mTest .runTest ();
324+ }
323325 mTest .finish ();
324326 t = java .lang .System .currentTimeMillis () - t ;
327+ float ft = (float )t ;
328+ ft /= 10 ;
325329
326- Log .v (TAG , "getBenchmark: Renderscript frame time core ms " + t );
330+ Log .v (TAG , "getBenchmark: Renderscript frame time core ms " + ft );
327331 mTest .exitBenchmark ();
328332 mDoingBenchmark = false ;
329333
330- return t ;
334+ return ft ;
331335 }
332336}
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ public void testImageProcessingBench() {
7878 BufferedWriter rsWriter = new BufferedWriter (new FileWriter (resultFile ));
7979 Log .v (TAG , "Saved results in: " + resultFile .getAbsolutePath ());
8080 for (int i = 0 ; i < ITERATION ; i ++ ) {
81- t = mAct .getBenchmark ();
81+ t = ( long ) mAct .getBenchmark ();
8282 sum += t ;
8383 rsWriter .write ("Renderscript frame time core: " + t + " ms\n " );
8484 Log .v (TAG , "RenderScript framew time core: " + t + " ms" );
Original file line number Diff line number Diff line change @@ -25,9 +25,9 @@ rs_allocation gIn;
2525float gCoeffs[9];
2626
2727void root(uchar4 *out, uint32_t x, uint32_t y) {
28- uint32_t x1 = min((int32_t)x+1, gWidth);
28+ uint32_t x1 = min((int32_t)x+1, gWidth-1 );
2929 uint32_t x2 = max((int32_t)x-1, 0);
30- uint32_t y1 = min((int32_t)y+1, gHeight);
30+ uint32_t y1 = min((int32_t)y+1, gHeight-1 );
3131 uint32_t y2 = max((int32_t)y-1, 0);
3232
3333 float4 p00 = convert_float4(((uchar4 *)rsGetElementAt(gIn, x1, y1))[0]);
You can’t perform that action at this time.
0 commit comments