在ARM NEON中的阵列边界上加载矢量
Loading of a vector on the border of the array in ARM NEON
我尝试使用NEON内部函数优化ARM的一些图像处理算法。对于某些过滤器,它需要加载点附近的元素。例如,为了对像素p[x]
中的图像进行滤波,我需要加载p[x - 1]
、p[x]
和p[x + 1]
。如果是x=0
,则我加载p[0]
、p[0]
和p[1]
。如果是x=width-1
,则我加载p[width-2]
、p[width-1]
和p[width-1]
。
所以如果我有一个矢量:
uint8x16_t a = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
我如何从中获得以下矢量:
uint8x16_t b = {0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
uint8x16_t c = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15};
我认为以下函数将对您的情况有用:
template <size_t count> inline uint8x16_t LoadBeforeFirst(uint8x16_t first)
{
return vextq_u8(vextq_u8(first, first, count), first, 16 - count);
}
template <size_t count> inline uint8x16_t LoadAfterLast(uint8x16_t last)
{
return vextq_u8(last, vextq_u8(last, last, 16 - count), count);
}
相关文章:
- std::原子加载和存储都需要吗
- 如何加载(或映射)文件部分的最大大小,但适合在Windows上的RAM
- C++ 雷神库 - 使用资源加载器类时出现问题(不命名类型)
- 为什么加载SDF会导致Mobilizer创建闭环错误
- C++atioglxx.pdb未加载错误glBufferData OpenGL
- 如何使用tinyxml2从XML加载父实体和子实体
- 如何在C++中使用pybind11加载一个pickle python列表
- 系统.将数组移交给c#中动态加载的c++DLL时发生AccessViolationException
- 当我尝试加载内核模块时,如何修复C++中的这个 malloc() 错误?
- 树莓上的 Libtorch 无法加载 pt 文件,但在 ubuntu 上工作
- Python ctypes:不会按预期加载 dll
- 为什么会出现 gettnig 运行时错误:加载类型为"_Bit_type"(stl_bvector.h) 的空指针?
- 我的程序有一个保存配置文件的GUI,如何双击此配置文件以直接加载带有配置数据的GUI?
- 保存/加载大量短数组到二进制文件
- 使用 SDL2 和SDL_image C++加载图像
- 无法使用加载库卸载注入的 dll (C++)
- 是否有原子加载非原子值的函数?
- 将 bmp 文件加载到 TSpeedButton 中
- 如何使用Qt 3D库加载和显示搅拌机.obj源文件场景
- 在ARM NEON中的阵列边界上加载矢量