【发布时间】:2012-07-20 22:07:35
【问题描述】:
我正在为 iOS 开发一些图像处理应用程序,阈值处理确实是一个巨大的瓶颈。所以我正在尝试使用 NEON 对其进行优化。这是函数的C版本。有没有办法使用 NEON 重写它(不幸的是我完全没有这方面的经验)?
static void thresh_8u( const Image& _src, Image& _dst, uchar thresh, uchar maxval, int type ) {
int i, j;
uchar tab[256];
Size roi = _src.size();
roi.width *= _src.channels();
memset(&tab[0], 0, thresh);
memset(&tab[thresh], maxval, 256-thresh);
for( i = 0; i < roi.height; i++ ) {
const uchar* src = (const uchar*)(_src.data + _src.step*i);
uchar* dst = (uchar*)(_dst.data + _dst.step*i);
j = 0;
for(; j <= roi.width; ++j) {
dst[j] = tab[src[j]];
}
}
}
【问题讨论】:
-
当然,只需使用阈值执行
VCGT,然后使用maxval 执行VAND。不幸的是,我对 ARM 和 NEON 的了解还不够,无法将其变成完整的东西。 -
This guide to NEON on iOS 和a few things iOS developers ought to know about ARM 可能会有所帮助。它们不能解决您的确切问题,但可能会为您提供开始调查的地方。
-
嵌套循环中的条件不应该是“j
标签: iphone ios c assembly neon