renderscript

Render script rendering is much slower than OpenGL rendering on Android

微笑、不失礼 提交于 2019-12-04 06:15:45
BACKGROUND: I want to add live filter based on the code of Android camera app. But the architecture of Android camera app is based on OpenGL ES 1.x. I need to use shader to custom our filter implementation. However, it is too difficult to update the camera app to OpenGL ES 2.0. Then I have to find some other methods to implement live filter instead of OpenGL. I decided to use render script after some research. PROBLEM: I have wrote a demo of a simple filter by render script. It shows that the fps is much lower than implementing it by OpenGL. About 5 fps vs 15 fps. QUESTIONS: The Android

Android Renderscript - Rotate YUV data in Renderscript

走远了吗. 提交于 2019-12-04 05:33:44
问题 Based on the discussion I had at Camera2 api Imageformat.yuv_420_888 results on rotated image, I wanted to know how to adjust the lookup done via rsGetElementAt_uchar methods so that the YUV data is rotated by 90 degree. I also have a project like the HdrViewfinder provided by Google. The problem is that the output is in landscape because the output surface used as target surface is connected to the yuv allocation which does not care if the device is in landscape or portrait mode. But I want

How to make a cylinder in renderscript

荒凉一梦 提交于 2019-12-04 05:20:14
问题 I have been trying to make a cylinder in renderscript. This is the code I've tried: public Mesh cylinder(){ float radius=1.25f, halfLength=5; int slices=16; Mesh.TriangleMeshBuilder mbo= new TriangleMeshBuilder(mRSGL,3, Mesh.TriangleMeshBuilder.TEXTURE_0); for(int i=0; i<slices; i++) { float theta = (float) (((float)i)*2.0*Math.PI); float nextTheta = (float) (((float)i+1)*2.0*Math.PI); /*vertex at middle of end*/ mbo.addVertex(0.0f, halfLength, 0.0f); /*vertices at edges of circle*/ mbo

Can one use RenderScript's rsForEach on a non-root kernel?

痴心易碎 提交于 2019-12-04 03:42:42
问题 Can one invoke a non-root RenderScript kernel using rsForEach ? There are many examples of using rsForEach to call the root kernel from within an invokable RenderScript function: Documentation for Androids Renderscript advanced rsForEach call How to write a convolution multiplication in Android Renderscript? Passing Array to rsForEach in Renderscript Compute These bind the script itself to a variable in the RenderScript context, then invoke the root kernel from within RenderScript. For

How to do correct timing of Android RenderScript code on Nvidia Shield

匆匆过客 提交于 2019-12-04 03:26:48
问题 I have implemented a small CNN in RenderScript and want to profile the performance on different hardware. On my Nexus 7 the times make sense, but on the NVIDIA Shield they do not. The CNN (LeNet) is implemented in 9 layers residing in a queue, computation is performed in sequence. Each layer is timed individually. Here is an example: conv1 pool1 conv2 pool2 resh1 ip1 relu1 ip2 softmax nexus7 11.177 7.813 13.357 8.367 8.097 2.1 0.326 1.557 2.667 shield 13.219 1.024 1.567 1.081 0.988 14.588 13

Renderscript fails on GPU enabled driver if USAGE_SHARED

对着背影说爱祢 提交于 2019-12-04 03:21:41
问题 We are using renderscript for audio dsp processing. It is simple and improves performance significantly for our use-case. But we run into an annoying issue with USAGE_SHARED on devices that have custom driver with GPU execution enabled. As you may know, USAGE_SHARED flag makes the renderscript allocation to reuse the given memory without having to create a copy of it. As a consequence, it not only saves memory, in our case, improves performance to desired level. The following code with USAGE

How can one verify whether a Android Mobile Device supports GPU renderscript or not?

女生的网名这么多〃 提交于 2019-12-04 01:34:17
问题 Is there a good way to verify whether algorithms written in renderscript are CPU or GPU bound? I understand that this decision is made runtime on the device, however, I see inconsistent trace information on Nexus 5 and Nexus 10 devices. Nexus 10 logcat spits out info saying that the algorithm is moved back to CPU (if GPU cant handle the kernels), while there is no such trace (as far as I have seen) on Nexus 5. One obvious, but less precise way, is to use execution time of rs based algorithms

Using SurfaceTexture in combination with RenderScript

不想你离开。 提交于 2019-12-04 00:03:20
I want to do camera image processing on the GPU on android. In my current set-up I use a SurfaceTexture to capture frames from the camera image stream as an OpenGL ES texture. This is an efficient way to get the camera stream accesible in my shaders. ( http://developer.android.com/reference/android/graphics/SurfaceTexture.html ) Now i would like to start using the new RenderScript API instead of direct OenGL ES usage. ( http://developer.android.com/guide/topics/renderscript/index.html ) But to create a SurfaceTexture, i need to pass the openGl Texture ID to the constructor. Unfortunately the

RenderScript speedup 10x when forcing default CPU implementation

旧时模样 提交于 2019-12-03 20:49:26
I have implemented a CNN in RenderScript, described in a previous question which spawned this one. Basically, when running adb shell setprop debug.rs.default-CPU-driver 1 there is a 10x speedup on both Nvidia Shield and Nexus 7. The average computation time goes from around 50ms to 5ms, the test app goes from around 50fps to 130 or more. There are two convolution algorithms: (1) moving kernel (2) im2col and GEMM from RenderScriptIntrinsicsBLAS. Both experience similar speedup. The question is: why is this happening and can this effect be instantiated from the code in a predictable way? And is

Android RenderScript FinalizerWatchdogDaemon Fatal Exception

江枫思渺然 提交于 2019-12-03 18:54:40
I use RenderScript in my app to do several image processing tasks. Sometimes, I randomly get the following exception: 10-10 15:27:04.479: E/AndroidRuntime(2113): FATAL EXCEPTION: FinalizerWatchdogDaemon 10-10 15:27:04.479: E/AndroidRuntime(2113): java.util.concurrent.TimeoutException: android.renderscript.Type.finalize() timed out after 10 seconds 10-10 15:27:04.479: E/AndroidRuntime(2113): at android.renderscript.RenderScript.nObjDestroy(RenderScript.java:216) 10-10 15:27:04.479: E/AndroidRuntime(2113): at android.renderscript.BaseObj.finalize(BaseObj.java:116) 10-10 15:27:04.479: E