2012-11-12 29 views
0

看完Jeff Sharkey great Google I/O presentation后踢脚踢写一些renderscript加快我现有的音频处理项目。第一个问题是,在给出的示例代码中,第一行代码中的转换函数没有记录在任何地方。由于至少不是http://developer.android.com/guide/topics/renderscript/reference.html数据类型转换函数中是否有任何renderscript文档?

float4 inColor = convert_float4(*inPixel); 

嘛功能convert_float4()在本例中是明显不够了解它做什么。但在我的情况下,我想知道它是否存在其他内置转换,如从char到float,我猜可能是convert_float(char *)?

回答

1

通用答案是RS支持从所有基本向量数字类型转换为其他类型的相同向量大小。这些演员表演就好像他们是正常的C演员一样。

形式为:的char,uchar,int,uint,short,ushort, and float

convert_[dest type](source type) 

(2,3,4)载体支持。

避免:

float4 f = (float4)myInt4; 

它不会做你希望它做什么。

0

看起来像没有这样的内建。 convert_float4()是在rc_core.c中声明的唯一转换函数。