After watching Jeff Sharkey great Google I/O presentation and kicking to write some renderscript to speed up my existing audio processing project. The first problem comes in is that in the example code given, the conversion function in the very first line of code isn't documented anywhere. As least not in http://developer.android.com/guide/topics/renderscript/reference.html
float4 inColor = convert_float4(*inPixel);
Well the function convert_float4() in the example is obvious enough to understand what it does. But in my case I would like to know if it exists other built-in conversions like from a char to a float which I guess could be convert_float(char*) ?
The generic answer is RS support conversion from all basic vector numeric types to other types of the same vector size. The casts are done as if they were a normal C cast for rounding.
The form is:
convert_[dest type](source type)
(2,3,4) vectors of char,uchar,int,uint,short,ushort, and float
are supported.
Avoid:
float4 f = (float4)myInt4;
It doesn't do what you expect it to do.