I am trying to understand Renderscript. Could somebody have a look at this code, and let me know what the in
parameter is ? It is not an Allocation object, so it is an Element? Why is it an array then?
(I got the code from here, and modified it, http://www.jayway.com/2014/02/11/renderscript-on-android-basics/)
#pragma version(1)
#pragma rs java_package_name(foo.bar)
rs_allocation inPixels;
int height;
int width;
void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {
float3 pixel = convert_float4(in[0]).rgb;
pixel.r = (pixel.r + pixel.g + pixel.b)/3;
pixel.g = (pixel.r + pixel.g + pixel.b)/3;
pixel.b = (pixel.r + pixel.g + pixel.b)/3;
int topRight
//float4 f4 = rsUnpackColor8888(*(uchar*)rsGetElementAt(inPixels, x+1, y+1));
out->xyz = convert_uchar3(pixel);
}
What does this line convert_float4(in[0])
do?
The index 0 point to what ? The first pixel? So if I want to access the next pixel I should increase that by one?