我想找出一个 32x4 向量中四个值中的最大值。
我有一个类型的向量float32x4_t:
float32x4_t maxR = {10.21,10.25,23.5,24.86} //FOR EXAMPLE
Run Code Online (Sandbox Code Playgroud)
我想在这四个中找出最大值(10.21,10.25,23.5,24.86),有没有这样做的说明?
我正在考虑使用vpmax_f32内在函数,但得出的结论是这是错误的,因为返回类型float32x2_t再次是向量类型。那么,谁能告诉我这个操作的方法吗?
如何将数据类型的变量转换uint8_t为int32_t使用Neon?这样做我找不到任何内在的东西.
我想isnan()在NEON内在函数中使用功能.Below是我的代码:input1,input2和输出类型为float.这些值从输入图像/帧的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;
}
}
Run Code Online (Sandbox Code Playgroud)
}
通过使用牛顿Raphson方法,我试图通过使用氖内在进行除法.但是我无法获得任何内在函数.isnan我得到了 __builtin_isnan()这不是一个内在函数.我怎么能isnan用于float32x4_t a和float32x4_t b
我试图通过编写同样的霓虹内在函数来击败"memcpy"函数.以下是我的逻辑:
uint8_t* m_input; //Size as 400 x300
uint8_t* m_output; //Size as 400 x300
//not mentioning the complete code base for memory creat
memcpy(m_output, m_input, sizeof(m_output[0]) * 300* 400);
Run Code Online (Sandbox Code Playgroud)
氖:
int32_t ht_index,wd_index;
uint8x16_t vector8x16_image;
for(int32_t htI =0;htI < m_roiHeight;htI++){
ht_index = htI * m_roiWidth ;
for(int32_t wdI = 0;wdI < m_roiWidth;wdI+=16){
wd_index = ht_index + wdI;
vector8x16_image = vld1q_u8(m_input);
vst1q_u8(&m_output[wd_index],vector8x16_image);
}
}
Run Code Online (Sandbox Code Playgroud)
我在imx6硬件上多次验证了这些结果.
结果:
Memcpy :0.039 milisec
neon memcpy: 0.02841 milisec
Run Code Online (Sandbox Code Playgroud)
我读了一些没有预先说明的说明,我们不能打败MEMCPY.
如果是,那么我的代码如何给出这些结果.是对还是错