0

I am working with some renderscripts, I created a samplescript.rs and I built the project but the .bc file is not being created. I can access the ScriptC_samplescript class, but I can't see the .bc file. What am I doing wrong?

Please help me I have been struggling with this issue for a week! I can't find any solutions on google.

I want to do some realtime image processing, but I can't get the scripts to work.

Here's what my script looks like:

#pragma version(1)
#pragma rs java_package_name(com.example.cameratesting)

float intensityValue;
rs_matrix4x4 colorMatrix;

void root(const uchar4 *v_in, uchar4 *v_out,const void *userData, uint32_t x, uint32_t y) {
    float4 pixel = rsUnpackColor8888(*v_in);
    float4 color = rsMatrixMultiply(&colorMatrix,pixel);
    color = (intensityValue * color) + ((1.0f - intensityValue) * pixel);
    color = clamp(color,0.0f,1.0f);
    *v_out = rsPackColorTo8888(color);
}

void filter(rs_script script,rs_allocation inAllocation,rs_allocation outAllocation){
    rsForEach(script, inAllocation, outAllocation, 0, 0);
}
buczek
  • 2,011
  • 7
  • 29
  • 40
Blerim Blerii
  • 223
  • 3
  • 16
  • 1
    Given than Eclipse for Android has been deprecated for a while: http://android-developers.blogspot.com/2015/06/an-update-on-eclipse-android-developer.html You might want to list out which version of Eclipse/Plugins you are using, whats in your project.properties file: http://stackoverflow.com/questions/24547710/eclipse-cant-read-code-format-of-renderscript-rs-file or switch over to Android Studio – Morrison Chang Apr 28 '16 at 21:11
  • @MorrisonChang Eclipse reads my renderscript code, also it works when i create a custom .txt file in the res/raw folder , but the problem is that some scripts that i want to use requires to be accessed from .bc files and those .bc files are not generated , i can't create them manually, i am using eclipse luna , build tools and other plugins updated to the last version – Blerim Blerii Apr 28 '16 at 21:15
  • 1
    I don't know what you mean by `scripts that i want to use requires to be accessed from .bc files and those .bc files are not generated` Are you trying to do something like: http://stackoverflow.com/questions/18924176/can-one-use-renderscripts-rsforeach-on-a-non-root-kernel – Morrison Chang Apr 28 '16 at 21:21
  • @MorrisonChang i took one script from Github it's about color curves like in photoshop, and to load this script into my project i need to call it from R.raw.filter_curve.bc, this is the way i call other scripts' .txt files and they work, more info, i am using GLES to render camera preview – Blerim Blerii Apr 28 '16 at 21:26
  • 1
    .bc files are binary files of your RenderScript kernels/functions (like a class file). Its in the .rs file or Java file that you invoke the methods. You should update your OP/question with what you are trying to do in more detail as they way it is written you just appear to have a RenderScript compile problem, but it sounds like an integration problem with a third-party library. – Morrison Chang Apr 28 '16 at 21:48
  • @MorrisonChang It is a RenderScript compile problem, i don't use third-party libraries, i tried the same project on Android Studio, but it won't work, so i decided to give up , thanks for your time and your answers! – Blerim Blerii Apr 28 '16 at 22:12
  • 1
    What API level are you targeting? If you are choosing >= 21, then there are no .bc files produced because they get put directly into the Java sources. It also looks like the RS sample code you are compiling is pretty ancient. Can you try omitting everything in your "new ScriptC_FOO()" call except for the first parameter? That is the only supported form after API 21. – Stephen Hines Apr 29 '16 at 00:45
  • @StephenHines, yes i am targeting api level >= 21, from what you said , it looks like i should learn the new way of Renderscript, there are no good tutorials about renderscript on the internet these days, i really don't know where you guys learned it, however thanks for your help, i will try to change the code based on what you said and try to see if it's going to work ! – Blerim Blerii Apr 29 '16 at 00:59
  • As far as learning RS goes, I actually work on it at Google! https://android.googlesource.com/platform/frameworks/rs/+/master/java/tests/ImageProcessing/src/com/android/rs/image is a better example of modern RS (and you can probably get a lot of interesting code from it too). We do have plans to put up some tutorials soon, especially since there have been so many convenience features added to make working with it easier than the old days. – Stephen Hines Apr 29 '16 at 01:11
  • @StephenHines maybe it's off topic but, i got the exposure.rs code to test and learn better renderscript, i can apply it into a bitmap but how can i change the values for example higher or lower exposure ? do i need to extend the ScriptC_exposure class ? can i get your email or how can i contact you i have few other questions (simple) if you'd liked to help me ? – Blerim Blerii Apr 30 '16 at 22:53

0 Answers0