小编惊奇漫*_*奇漫画的帖子

谷歌关于RenderScript的代码不起作用?

我发现谷歌关于RenderScript的文档有更新(https://developer.android.com/guide/topics/renderscript/compute.html).所以我用它的代码来测试,但是有一个错误

Error:(31, 23) error: implicit declaration of function 'rsCreateAllocation_uchar4' is invalid in C99
Error:(31, 17) error: initializing 'rs_allocation' (aka 'struct rs_allocation') with an expression of incompatible type 'int'
Run Code Online (Sandbox Code Playgroud)

那是代码:

rs_allocation tmp = rsCreateAllocation_uchar4(imageWidth, imageHeight);
rsForEach(invert, inputImage, tmp);
rsForEach(greyscale, tmp, outputImage);
Run Code Online (Sandbox Code Playgroud)

所以我想知道:1:为什么会发生这种情况(我认为sdk api是原因,但我已将AS,SDK和sdk工具更新到最新版本)?2:有什么区别

uchar4 RS_KERNEL root(uchr4 in, unit32_t x, uint32_t y)
Run Code Online (Sandbox Code Playgroud)

void RS_KERNEL root(uchr4* in, uchar4* out, unit32_t x, uint32_t y)
Run Code Online (Sandbox Code Playgroud)

我认为第二种方法更快?!但我不能确定.并且使用指针作为params的方法用于未命名为root()的函数(我测试它).如果带有指针参数的方法更快,我如何在RS文件中使用2个或更多内核函数?

android renderscript

1
推荐指数
1
解决办法
416
查看次数

标签 统计

android ×1

renderscript ×1