我想在NEON中使用isnan()功能,.Below是我的代码: input 1,input2和输出类型为input2,.These值从输入图像/帧的ROI中得到更新。(图像处理示例)
for(x = 0;x<ht;x++){
for(y = 0;y<width;y++){
float a = (input1[x + (y * width)]);
float b = (input2[x + (y * width)]);
// check for division by zero
output = 0.0f;
if (!(isnan(a) | isnan(b) | (b == 0)))
{
output[x + (y * width)] = a / b;
}
}}
通过牛顿拉夫森方法,我试图用霓虹灯内禀进行除法。但是我不能为isnan .I get __builtin_isnan()获取任何本质信息,这不是一个本质-- .How,我可以用isnan来表示float32x4_t a和float32x4_t b
发布于 2015-03-30 16:37:31
IEEE-754浮点值的一个有用性质是,比较两个NaN值总是返回false。您可以使用此属性测试NaN,如下所示:
bool isNaN(float x)
{
return !(x == x);
}同样的测试也适用于SIMD操作,其中浮动向量可以与其自身进行比较,对于任何NaN元素,结果都是假的。
float32x4_t vx = { ... };
uint32x4_t vcmp = vceqq_f32(vx, vx);vcmp的元素为true (UINT_MAX),用于x中的非NaN值,false (0)用于任何NaN值。
https://stackoverflow.com/questions/29349621
复制相似问题