renderscript

vertical carousel renderscript

心已入冬 提交于 2020-01-23 09:51:29
问题 I need some help with the CarouselExample that can be checked out using this link. I want to make it spin vertically. I found a method in the .rs file called getMatrixForCard where the transformations on the matrix of the cards is done. Here is the method: static bool getMatrixForCard(rs_matrix4x4* matrix, int i, bool enableSway, bool enableCardMatrix) { float theta = cardPosition(i); float swayAngle = getSwayAngleForVelocity(velocity, enableSway); rsMatrixRotate(matrix, degrees(theta), 0, 1,

vertical carousel renderscript

◇◆丶佛笑我妖孽 提交于 2020-01-23 09:50:46
问题 I need some help with the CarouselExample that can be checked out using this link. I want to make it spin vertically. I found a method in the .rs file called getMatrixForCard where the transformations on the matrix of the cards is done. Here is the method: static bool getMatrixForCard(rs_matrix4x4* matrix, int i, bool enableSway, bool enableCardMatrix) { float theta = cardPosition(i); float swayAngle = getSwayAngleForVelocity(velocity, enableSway); rsMatrixRotate(matrix, degrees(theta), 0, 1,

RenderScript Support Library crashes on x86 devices

非 Y 不嫁゛ 提交于 2020-01-13 10:36:08
问题 I'm getting FATAL EXCEPTION running android.support.v8.renderscript.* on Razor i, a x86 device. The problem goes away if I use android.renderscript.* Also there is not problem with ARM devices. Here is the exception: 03-03 18:35:26.009 25011-25011/com.example.app E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.MainActivity}: android.support.v8.renderscript.RSRuntimeException: Error loading RS jni

Renderscript and the GPU

試著忘記壹切 提交于 2020-01-11 08:47:06
问题 I know that Renderscript's design is to obscure the fact about what processor I'm running on, but is there any way to write the code such that on GPU-compute-capable devices (at the moment, Nexus 10), it will run on the GPU? Is there any way to tell that a script's function is running on the GPU? www.leapconf.com/downloads/LihuaZhang-MulticoreWare.pdf suggests that if I don't use globals, I don't use recursion, and don't call rsDebug anywhere in a kernel, it will be run on the GPU; is that

Why very simple Renderscript runs 3 times slower in GPU than in CPU

谁说胖子不能爱 提交于 2020-01-07 04:07:26
问题 My test platform: Development OS: Windows 7 32-bit Phone: Nexus 5 Phone OS version: Android 4.4 SDK bundle: adt-bundle-windows-x86-20131030 Build-tool version: 19 SDK tool version: 22.3 Platform tool version: 19 I wrote a very simple Renderscript as follows: #pragma rs_fp_relaxed uchar4 __attribute__((kernel)) someKernel(uchar4 in, uint32_t x, uint32_t y){ return in; } I also used adb shell setprop debug.rs.default-CPU-driver 1 to force the script to run on CPU for performance comparison. I

How to use renderscript support mode correctly

送分小仙女□ 提交于 2020-01-06 08:16:33
问题 I recently tested my renderscript code on a Huawei P10 with api28 and I noticed that the runtime of the renderscipt code is around 100ms. For older devices I tested (eg. S6 or Nexus4) the runtime is in the range of 20-30ms. For the P10 I found two solutions to this problem: Forcing only cpu usage via adb got to renderscriptTargetApi 28 (any api < 28 is slow) Since solution 1 cant be done programmatically, solution 2 seems the only valid way to overcome the issue. My app is supposed to support

Increment a count variable in RenderScript

馋奶兔 提交于 2020-01-05 05:46:06
问题 I want to count the pixels of a bitmap using the following RenderScript code RenderScript Filename: counter.rs #pragma version(1) #pragma rs java_package_name(com.mypackage) #pragma rs_fp_relaxed uint count; // initialized in Java void countPixels(uchar4* unused, uint x, uint y) { rsAtomicInc(&count); } Java Application context = ...; // The application context RenderScript rs = RenderScript.create(applicationContext); Bitmap bitmap = ...; // A random bitmap Allocation allocation = Allocation

How do I correctly convert YUV colours to RGB in Android?

此生再无相见时 提交于 2020-01-05 04:51:46
问题 I am using MediaCodec to retrieve frames from a video on the SD card. I am using ScriptIntrinsicYuvToRGB to convert the outputted frames of the MediaCodec to RGB. Then I am displaying them in a TextureView. The problem is, the RGB colours are wrong (e.g. The grass is meant to be green. NOT purplish-grey) Anybody know how to fix this please? Thanks 来源: https://stackoverflow.com/questions/29953508/how-do-i-correctly-convert-yuv-colours-to-rgb-in-android

How do I correctly convert YUV colours to RGB in Android?

╄→гoц情女王★ 提交于 2020-01-05 04:51:05
问题 I am using MediaCodec to retrieve frames from a video on the SD card. I am using ScriptIntrinsicYuvToRGB to convert the outputted frames of the MediaCodec to RGB. Then I am displaying them in a TextureView. The problem is, the RGB colours are wrong (e.g. The grass is meant to be green. NOT purplish-grey) Anybody know how to fix this please? Thanks 来源: https://stackoverflow.com/questions/29953508/how-do-i-correctly-convert-yuv-colours-to-rgb-in-android

Histogram Matching in Renderscript

筅森魡賤 提交于 2020-01-05 03:09:14
问题 In order to align the intensity values of two grayscale Images (as a first step for further processing) I wrote a Java method that: converts the bitmaps of the two images into two int[] arrays containing the bitmap's intensities (I just take the red component here, since it's grayscale, i.e. r=g=b ). public static int[] bmpToData(Bitmap bmp){ int width = bmp.getWidth(); int height = bmp.getHeight(); int anzpixel = width*height; int [] pixels = new int[anzpixel]; int [] data = new int[anzpixel