renderscript

Forcing Renderscript to run on CPU or GPU (Atleast for performance tuning purposes)

馋奶兔 提交于 2019-12-03 17:15:33
问题 I have a few basic algorithms (DCT/IDCT and a few others) ported and working (as expected atleast functionally) on Nexus 10. Since these algorithms are first implementations, their execution time is currently running into secs, which is understandable. However, given the architecture of Renderscript, I see that these algorithms run either on CPU or GPU depending on other parallel application activities. For instance, in my application, there is a scrollview for images and any activity on this

About RenderScript

ぃ、小莉子 提交于 2019-12-03 07:28:23
问题 Recently,i search for articles about renderscript,but it seems that there's none. can any one give me some articles talking about renderscript? 回答1: Resources, documentation, and tutorials for Renderscript are still pretty scarce. Here are the places I've found. Introduction to Renderscript: parts 1 & 2 (Android Blogs) http://android-developers.blogspot.com/2011/02/introducing-renderscript.html http://android-developers.blogspot.com/2011/03/renderscript.html Main Overview (Android Docs) http:

Forcing Renderscript to run on CPU or GPU (Atleast for performance tuning purposes)

China☆狼群 提交于 2019-12-03 06:13:18
I have a few basic algorithms (DCT/IDCT and a few others) ported and working (as expected atleast functionally) on Nexus 10. Since these algorithms are first implementations, their execution time is currently running into secs, which is understandable. However, given the architecture of Renderscript, I see that these algorithms run either on CPU or GPU depending on other parallel application activities. For instance, in my application, there is a scrollview for images and any activity on this view, essentially pushes the renderscript execution to CPU. If there is no activity the algorithm runs

How to share a Renderscript allocation with OpenGL in Android

拟墨画扇 提交于 2019-12-03 01:38:08
I have a Renderscript which processes an image that is given in output to an Allocation. I want to use this Allocation as a texture in my OpenGL program but I don't know how to get a texture ID from the Allocation. On the other hand, I know I could use a graphic Renderscript, but since it has been deprecated, I guess there must be some other way to achieve the same result. Specify USAGE_IO_OUTPUT when you create the Allocation. Assuming you are generating the texture data in a script you would also add USAGE_SCRIPT. You can then call Allocation.setSurface(theGLSurface) to link the allocation

Google Plus tile animation

主宰稳场 提交于 2019-12-02 16:25:40
I'm trying to figure out how I could make a similar layout as in Google plus timeline view. There's an animation while scrolling in timeline and I really like it. Any idea how to do that? You need to set a TranslateAnimation to the view and that would do the trick for you. TranslateAnimation translateAnim = new TranslateAnimation(200, 0, 0, 0 ); //Use (0, 0, 200, 0 ) if you would like to animate this in a mobile device rather than a tab listView.clearAnimation(); translateAnim.setDuration(500); translateAnim.setFillBefore(true); listView.startAnimation(translateAnim); Hope this helps :) I

Can I set input and output allocations on Renderscript to be of different sizes/dimensions?

假装没事ソ 提交于 2019-12-02 08:51:18
问题 Background I'm trying to learn Renderscript, so I wish to try to do some simple operations that I think about. The problem I thought of rotating a bitmap, which is something that's simple enough to manage. on C/C++, it's a simple thing to do (search for "jniRotateBitmapCw90") : https://github.com/AndroidDeveloperLB/AndroidJniBitmapOperations/blob/master/JniBitmapOperationsLibrary/jni/JniBitmapOperationsLibrary.cpp Thing is, when I try this on Renderscript, I get this error: android.support.v8

Android Renderscript - Rotate YUV data in Renderscript

故事扮演 提交于 2019-12-02 08:08:15
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 to adjust the code so that it is in portrait mode. Therefore, I took a custom YUVToRGBA renderscript

Renderscript c style pointer usage performance issue

末鹿安然 提交于 2019-12-02 07:48:27
In render script, I am using bound pointers to iterate over a large image. The problem is in the array access performance. ... for(int i=0; i < channels; i++) { sum += (input[i*input_size]) * mulValue; } ... For example, when the input_size is 12288 it takes 1.5 seconds to complete script, but when the input_size is 12280 it takes ~0.5 seconds. What can cause such a mystery behavior? Understanding the performance implications of what you write in RenderScript (or openCL) is complex. Just writing it in RendersScript does not guarantee performance. Many times you encounter cache coherence issues

How to make a cylinder in renderscript

末鹿安然 提交于 2019-12-02 04:18:35
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.addVertex((float)(radius*Math.cos(theta)), halfLength, (float)(radius*Math.sin(theta))); mbo.addVertex(

Can I set input and output allocations on Renderscript to be of different sizes/dimensions?

[亡魂溺海] 提交于 2019-12-02 03:09:02
Background I'm trying to learn Renderscript, so I wish to try to do some simple operations that I think about. The problem I thought of rotating a bitmap, which is something that's simple enough to manage. on C/C++, it's a simple thing to do (search for "jniRotateBitmapCw90") : https://github.com/AndroidDeveloperLB/AndroidJniBitmapOperations/blob/master/JniBitmapOperationsLibrary/jni/JniBitmapOperationsLibrary.cpp Thing is, when I try this on Renderscript, I get this error: android.support.v8.renderscript.RSRuntimeException: Dimension mismatch between parameters ain and aout! Here's what I do: