Dar*_*max 15 c android arm intrinsics neon
我当时正在处理四个像素的图像,这armv7适用于Android应用程序.
我想float32x4_t用另一个向量来划分一个向量,但是它中的数字从大约0.7到有不同,在3.85我看来,除法的唯一方法是使用右移,但这是一个数字2^n.
此外,我是新手,所以欢迎任何建设性的帮助或评论.
例:
如何使用NEON内在函数执行这些操作?
float32x4_t a = {25.3,34.1,11.0,25.1};
float32x4_t b = {1.2,3.5,2.5,2.0};
// somthing like this
float32x4 resultado = a/b; // {21.08,9.74,4.4,12.55}
Run Code Online (Sandbox Code Playgroud)
Ste*_*non 23
NEON指令集没有浮点除法.
如果您事先知道您的值没有很差地缩放,并且您不需要正确的舍入(如果您正在进行图像处理,这几乎肯定是这种情况),那么您可以使用倒数估计,细化步骤,然后相乘划分:
// get an initial estimate of 1/b.
float32x4_t reciprocal = vrecpeq_f32(b);
// use a couple Newton-Raphson steps to refine the estimate. Depending on your
// application's accuracy requirements, you may be able to get away with only
// one refinement (instead of the two used here). Be sure to test!
reciprocal = vmulq_f32(vrecpsq_f32(b, reciprocal), reciprocal);
reciprocal = vmulq_f32(vrecpsq_f32(b, reciprocal), reciprocal);
// and finally, compute a/b = a*(1/b)
float32x4_t result = vmulq_f32(a,reciprocal);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5156 次 |
| 最近记录: |