From 702fb2c502ee6bab5cced1835005e0e225533751 Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Tue, 10 Jul 2012 14:18:45 -0700 Subject: Cleanup filter preview test. Change-Id: I626a1261affb86499ec398678523b0fe9e5fe679 --- tests/RenderScriptTests/LivePreview/Android.mk | 2 +- .../rs/livepreview/CameraPreviewActivity.java | 56 ++++++++++++++-------- .../src/com/android/rs/livepreview/yuv.rs | 29 +++-------- 3 files changed, 44 insertions(+), 43 deletions(-) (limited to 'tests/RenderScriptTests') diff --git a/tests/RenderScriptTests/LivePreview/Android.mk b/tests/RenderScriptTests/LivePreview/Android.mk index be7ab6ec812c..1b45573e9619 100644 --- a/tests/RenderScriptTests/LivePreview/Android.mk +++ b/tests/RenderScriptTests/LivePreview/Android.mk @@ -17,7 +17,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_TAGS := tests LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src) diff --git a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/CameraPreviewActivity.java b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/CameraPreviewActivity.java index bba3b5bbcae9..f21331f76be1 100644 --- a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/CameraPreviewActivity.java +++ b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/CameraPreviewActivity.java @@ -299,6 +299,38 @@ public class CameraPreviewActivity extends Activity } + private class ProcessPreviewDataTask extends AsyncTask { + protected Boolean doInBackground(byte[]... datas) { + byte[] data = datas[0]; + + long t1 = java.lang.System.currentTimeMillis(); + + mFilterYuv.execute(data); + mFilterYuv.copyOut(mCallbackBitmap); + + long t2 = java.lang.System.currentTimeMillis(); + mTiming[mTimingSlot++] = t2 - t1; + if (mTimingSlot >= mTiming.length) { + float total = 0; + for (int i=0; i= mTiming.length) { - float total = 0; - for (int i=0; i> 1; - y -= gHeight >> 1; - - uint32_t dist = (x * x + y * y); - //float d = sqrt((float)dist) * vignette_dist_mod; - float d = vignette_dist_mod * dist; - - //RS_DEBUG(d); + int2 xy = {x, y}; + xy -= vignette_half_dims; + xy *= xy; + float d = vignette_dist_mod * (xy.x + xy.y); ushort4 c = convert_ushort4(color); c *= vignette_table[(int)d]; c >>= (ushort4)8; return convert_uchar4(c); } - - void root(uchar4 *out, uint32_t x, uint32_t y) { uchar Y = gYuvIn[(y * gWidth) + x]; uchar *uv = &gYuvIn[gWidth * gHeight]; uv += (((x>>1)<<1) + (y>>1) * gWidth); -#if 0 - float4 p = toRGB_F(Y, uv[1], uv[0]); - p = crossProcess(p); - p = colortemp(p); - out->rgba = rsPackColorTo8888(p); - -#else uchar4 p = rsYuvToRGBA_uchar4(Y, uv[1], uv[0]); p = crossProcess_i(p); p = vignette(p, x, y); out->rgba = p; -#endif - out->a = 0xff; } @@ -131,7 +115,6 @@ static void precompute() { lumen = clamp(lumen, 0.f, 1.f); vignette_table[i] = (uchar)(lumen * 255.f + 0.5f); - RS_DEBUG(lumen); } } @@ -142,7 +125,7 @@ void init() { void setSize(int w, int h) { gWidth = w; gHeight = h; - + vignette_half_dims = (int2){w / 2, h / 2}; vignette_dist_mod = 512.f; vignette_dist_mod /= (float)(w*w + h*h) / 4.f; -- cgit v1.2.3-59-g8ed1b