OpenCV 4.13.0
开源计算机视觉库 (Open Source Computer Vision)
正在加载...
正在搜索...
未找到匹配项

主题

 私有实现辅助工具
 

详细说明

“通用内联函数 (Universal intrinsics)”是一组旨在简化不同平台上代码向量化工作的类型和函数。目前支持不同架构上的多种 SIMD 扩展。

OpenCV 通用内联函数支持以下指令集

如果在编译期间没有可用的 SIMD 扩展,则会选择内联函数的 C++ 备用实现,代码将按预期运行,但速度可能会较慢。

类型

有几种类型代表打包值的向量寄存器,每种类型都实现为基于单个 SIMD 寄存器的结构体。

所列类型的确切位长度(以及值数量)在编译时推导,并取决于编译库时选择的可用架构 SIMD 能力。所有类型都包含 nlanes 枚举,用于检查该类型的确切值数量。

如果类型的确切位长度很重要,可以使用特定的定长寄存器类型。

有几种代表 128 位寄存器的类型。

有几种代表 256 位寄存器的类型。

注意
256 位寄存器目前仅针对 AVX2 SIMD 扩展实现,如果您想直接使用此类型,请不要忘记检查 CV_SIMD256 预处理器定义
#if CV_SIMD256
//...
#endif

有几种代表 512 位寄存器的类型。

加载和存储操作

这些操作允许显式设置寄存器内容,或通过从某些内存块加载来设置,以及将寄存器内容保存到内存块。

有可变大小的寄存器加载操作,根据所选平台的能力提供最大可用大小的结果。

此外还有固定大小的寄存器加载/存储操作。

对于 128 位寄存器

对于 256 位寄存器 (请检查 CV_SIMD256 预处理器定义)

对于 512 位寄存器 (请检查 CV_SIMD512 预处理器定义)

存储到内存的操作在不同平台能力下是类似的: v_store, v_store_aligned, v_store_high, v_store_low

数值重排序 (Value reordering)

这些操作允许对一个或多个向量中的元素进行重排序或重新组合。

算术、位运算和比较操作

逐元素的二元和一元操作。

归约和掩码 (Reduce and mask)

这些操作中的大多数仅返回一个值。

其他数学运算

转换 (Conversions)

不同类型的转换和强制转换

矩阵操作

在这些操作中,向量代表矩阵的行/列: v_dotprod, v_dotprod_fast, v_dotprod_expand, v_dotprod_expand_fast, v_matmul, v_transpose4x4

可用性

大多数操作仅针对可用类型的某些子集实现,以下矩阵显示了不同操作对各类型的适用性。

普通整数

操作\类型无符号 8位有符号 8位无符号 16位有符号 16位无符号 32位有符号 32位
加载, 存储xxxxxx
交错 (interleave)xxxxxx
扩展 (expand)xxxxxx
低位扩展 (expand_low)xxxxxx
高位扩展 (expand_high)xxxxxx
四倍扩展 (expand_q)xx
加, 减xxxxxx
非饱和加, 非饱和减xxxx
非饱和乘xxxx
xxxxxx
乘并扩展xxxxx
comparexxxxxx
移位xxxx
点积xx
快速点积xx
点积并扩展xxxxx
快速点积并扩展xxxxx
逻辑运算xxxxxx
最小值, 最大值xxxxxx
absdiffxxxxxx
饱和绝对差xx
reducexxxxxx
maskxxxxxx
打包xxxxxx
打包为无符号xx
打包为布尔x
拆包xxxxxx
提取xxxxxx
旋转 (通道)xxxxxx
转换为 32位浮点x
转换为 64位浮点x
4x4 矩阵转置xx
反转xxxxxx
提取第 n 个元素xxxxxx
广播元素xx

大整数

操作\类型无符号 64位有符号 64位
加载, 存储xx
加, 减xx
移位xx
逻辑运算xx
反转xx
提取xx
旋转 (通道)xx
转换为 64位浮点x
提取第 n 个元素xx

浮点数

操作\类型32位浮点数64位浮点数
加载, 存储xx
交错 (interleave)x
加, 减xx
xx
除法xx
comparexx
最小值, 最大值xx
absdiffxx
reducex
maskxx
拆包xx
转换为 32位浮点x
转换为 64位浮点x
平方根, 绝对值xx
浮点数学运算xx
4x4 矩阵转置x
提取xx
旋转 (通道)xx
反转xx
提取第 n 个元素xx
广播元素x
expxx
logxx
正弦, 余弦xx

结构体  cv::v_reg< _Tp, n >
 

#define OPENCV_HAL_MATH_HAVE_EXP   1
 

类型定义 (Typedefs)

typedef v_float32x16 simd512::v_float32
 最大可用向量寄存器容量的 32位浮点值 (单精度)
 
typedef v_reg< float, 16 > cv::v_float32x16
 16个 32位浮点值 (单精度)
 
typedef v_reg< float, 4 > cv::v_float32x4
 4个 32位浮点值 (单精度)
 
typedef v_reg< float, 8 > cv::v_float32x8
 8个 32位浮点值 (单精度)
 
typedef v_float64x8 simd512::v_float64
 最大可用向量寄存器容量的 64位浮点值 (双精度)
 
typedef v_reg< double, 2 > cv::v_float64x2
 2个 64位浮点值 (双精度)
 
typedef v_reg< double, 4 > cv::v_float64x4
 4个 64位浮点值 (双精度)
 
typedef v_reg< double, 8 > cv::v_float64x8
 8个 64位浮点值 (双精度)
 
typedef v_int16x32 simd512::v_int16
 最大可用向量寄存器容量的 16位有符号整数值。
 
typedef v_reg< short, 16 > cv::v_int16x16
 16个 16位有符号整数值。
 
typedef v_reg< short, 32 > cv::v_int16x32
 32个 16位有符号整数值。
 
typedef v_reg< short, 8 > cv::v_int16x8
 8个 16位有符号整数值。
 
typedef v_int32x16 simd512::v_int32
 最大可用向量寄存器容量的 32位有符号整数值。
 
typedef v_reg< int, 16 > cv::v_int32x16
 16个 32位有符号整数值。
 
typedef v_reg< int, 4 > cv::v_int32x4
 4个 32位有符号整数值。
 
typedef v_reg< int, 8 > cv::v_int32x8
 8个 32位有符号整数值。
 
typedef v_int64x8 simd512::v_int64
 最大可用向量寄存器容量的 64位有符号整数值。
 
typedef v_reg< int64, 2 > cv::v_int64x2
 2个 64位有符号整数值。
 
typedef v_reg< int64, 4 > cv::v_int64x4
 4个 64位有符号整数值。
 
typedef v_reg< int64, 8 > cv::v_int64x8
 8个 64位有符号整数值。
 
typedef v_int8x64 simd512::v_int8
 最大可用向量寄存器容量的 8位有符号整数值。
 
typedef v_reg< schar, 16 > cv::v_int8x16
 16个 8位有符号整数值。
 
typedef v_reg< schar, 32 > cv::v_int8x32
 32个 8位有符号整数值。
 
typedef v_reg< schar, 64 > cv::v_int8x64
 64个 8位有符号整数值。
 
typedef v_uint16x32 simd512::v_uint16
 最大可用向量寄存器容量的 16位无符号整数值。
 
typedef v_reg< ushort, 16 > cv::v_uint16x16
 16个 16位无符号整数值。
 
typedef v_reg< ushort, 32 > cv::v_uint16x32
 32个 16位无符号整数值。
 
typedef v_reg< ushort, 8 > cv::v_uint16x8
 8个 16位无符号整数值。
 
typedef v_uint32x16 simd512::v_uint32
 最大可用向量寄存器容量的 32位无符号整数值。
 
typedef v_reg< unsigned, 16 > cv::v_uint32x16
 16个 32位无符号整数值。
 
typedef v_reg< unsigned, 4 > cv::v_uint32x4
 4个 32位无符号整数值。
 
typedef v_reg< unsigned, 8 > cv::v_uint32x8
 8个 32位无符号整数值。
 
typedef v_uint64x8 simd512::v_uint64
 最大可用向量寄存器容量的 64位无符号整数值。
 
typedef v_reg< uint64, 2 > cv::v_uint64x2
 2个 64位无符号整数值。
 
typedef v_reg< uint64, 4 > cv::v_uint64x4
 4个 64位无符号整数值。
 
typedef v_reg< uint64, 8 > cv::v_uint64x8
 8个 64位无符号整数值。
 
typedef v_uint8x64 simd512::v_uint8
 最大可用向量寄存器容量的 8位无符号整数值。
 
typedef v_reg< uchar, 16 > cv::v_uint8x16
 16个 8位无符号整数值。
 
typedef v_reg< uchar, 32 > cv::v_uint8x32
 32个 8位无符号整数值。
 
typedef v_reg< uchar, 64 > cv::v_uint8x64
 64个 8位无符号整数值。
 

枚举

enum  {
  cv::simd128_width = 16 ,
  cv::simd256_width = 32 ,
  cv::simd512_width = 64 ,
  cv::simdmax_width = simd512_width
}
 

函数

void cv::v256_cleanup ()
 
template<typename _Tp >
v_reg< _Tp, simd256_width/sizeof(_Tp)> cv::v256_load (const _Tp *ptr)
 从内存加载 256 位长度的寄存器内容。
 
template<typename _Tp >
v_reg< _Tp, simd256_width/sizeof(_Tp)> cv::v256_load_aligned (const _Tp *ptr)
 从内存加载寄存器内容 (对齐加载)
 
template<typename _Tp >
v_reg< typename V_TypeTraits< _Tp >::w_type, simd256_width/sizeof(typename V_TypeTraits< _Tp >::w_type)> cv::v256_load_expand (const _Tp *ptr)
 从内存加载寄存器内容并进行双倍扩展 (double expand)。
 
v_reg< float, simd256_width/sizeof(float)> cv::v256_load_expand (const hfloat *ptr)
 
template<typename _Tp >
v_reg< typename V_TypeTraits< _Tp >::q_type, simd256_width/sizeof(typename V_TypeTraits< _Tp >::q_type)> cv::v256_load_expand_q (const _Tp *ptr)
 从内存加载寄存器内容并进行四倍扩展 (quad expand)。
 
template<typename _Tp >
v_reg< _Tp, simd256_width/sizeof(_Tp)> cv::v256_load_halves (const _Tp *loptr, const _Tp *hiptr)
 从两个内存块加载寄存器内容。
 
template<typename _Tp >
v_reg< _Tp, simd256_width/sizeof(_Tp)> cv::v256_load_low (const _Tp *ptr)
 加载 128 位数据到低位部分 (高位部分未定义)。
 
void cv::v512_cleanup ()
 
template<typename _Tp >
v_reg< _Tp, simd512_width/sizeof(_Tp)> cv::v512_load (const _Tp *ptr)
 从内存加载 512 位长度的寄存器内容。
 
template<typename _Tp >
v_reg< _Tp, simd512_width/sizeof(_Tp)> cv::v512_load_aligned (const _Tp *ptr)
 从内存加载寄存器内容 (对齐加载)
 
template<typename _Tp >
v_reg< typename V_TypeTraits< _Tp >::w_type, simd512_width/sizeof(typename V_TypeTraits< _Tp >::w_type)> cv::v512_load_expand (const _Tp *ptr)
 从内存加载寄存器内容并进行双倍扩展 (double expand)。
 
v_reg< float, simd512_width/sizeof(float)> cv::v512_load_expand (const hfloat *ptr)
 
template<typename _Tp >
v_reg< typename V_TypeTraits< _Tp >::q_type, simd512_width/sizeof(typename V_TypeTraits< _Tp >::q_type)> cv::v512_load_expand_q (const _Tp *ptr)
 从内存加载寄存器内容并进行四倍扩展 (quad expand)。
 
template<typename _Tp >
v_reg< _Tp, simd512_width/sizeof(_Tp)> cv::v512_load_halves (const _Tp *loptr, const _Tp *hiptr)
 从两个内存块加载寄存器内容。
 
template<typename _Tp >
v_reg< _Tp, simd512_width/sizeof(_Tp)> cv::v512_load_low (const _Tp *ptr)
 加载 256 位数据到低位部分 (高位部分未定义)。
 
template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::abs_type, n > cv::v_abs (const v_reg< _Tp, n > &a)
 元素的绝对值。
 
template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::abs_type, n > cv::v_absdiff (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 绝对差值。
 
template<int n>
v_reg< double, n > cv::v_absdiff (const v_reg< double, n > &a, const v_reg< double, n > &b)
 
template<int n>
v_reg< float, n > cv::v_absdiff (const v_reg< float, n > &a, const v_reg< float, n > &b)
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_absdiffs (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 饱和绝对差值。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_add (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 数值相加。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_add_wrap (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 数值相加 (不进行饱和处理)。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_and (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 按位与 (Bitwise AND)。
 
template<int i, typename _Tp , int n>
v_reg< _Tp, n > cv::v_broadcast_element (const v_reg< _Tp, n > &a)
 广播向量的第 i 个元素。
 
template<int n>
v_reg< int, n *2 > cv::v_ceil (const v_reg< double, n > &a)
 
template<int n>
v_reg< int, n > cv::v_ceil (const v_reg< float, n > &a)
 向上取整。
 
template<typename _Tp , int n>
bool cv::v_check_all (const v_reg< _Tp, n > &a)
 检查是否所有打包值都小于零。
 
template<typename _Tp , int n>
bool cv::v_check_any (const v_reg< _Tp, n > &a)
 检查是否有任何打包值小于零。
 
void cv::v_cleanup ()
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_combine_high (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 从两个向量的后半部分元素组合成新向量。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_combine_low (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 从两个向量的前半部分元素组合成新向量。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_cos (const v_reg< _Tp, n > &a)
 元素的余弦值 \( cos(x) \)。
 
template<int n>
v_reg< float, n *2 > cv::v_cvt_f32 (const v_reg< double, n > &a)
 将低半部分转换为 float。
 
template<int n>
v_reg< float, n *2 > cv::v_cvt_f32 (const v_reg< double, n > &a, const v_reg< double, n > &b)
 转换为 float。
 
template<int n>
v_reg< float, n > cv::v_cvt_f32 (const v_reg< int, n > &a)
 转换为 float。
 
template<int n>
v_reg< double,(n/2)> cv::v_cvt_f64 (const v_reg< float, n > &a)
 将低半部分转换为 double。
 
template<int n>
v_reg< double, n/2 > cv::v_cvt_f64 (const v_reg< int, n > &a)
 将低半部分转换为 double。
 
template<int n>
v_reg< double, n > cv::v_cvt_f64 (const v_reg< int64, n > &a)
 转换为 double。
 
template<int n>
v_reg< double,(n/2)> cv::v_cvt_f64_high (const v_reg< float, n > &a)
 将向量的高半部分转换为 double。
 
template<int n>
v_reg< double,(n/2)> cv::v_cvt_f64_high (const v_reg< int, n > &a)
 将向量的高半部分转换为 double。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_div (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 数值相除。
 
template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > cv::v_dotprod (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 元素的点积。
 
template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > cv::v_dotprod (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b, const v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > &c)
 元素的点积。
 
template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::q_type, n/4 > cv::v_dotprod_expand (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 点积并扩展。
 
template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::q_type, n/4 > cv::v_dotprod_expand (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b, const v_reg< typename V_TypeTraits< _Tp >::q_type, n/4 > &c)
 元素的点积。
 
template<int n>
v_reg< double, n/2 > cv::v_dotprod_expand (const v_reg< int, n > &a, const v_reg< int, n > &b)
 
template<int n>
v_reg< double, n/2 > cv::v_dotprod_expand (const v_reg< int, n > &a, const v_reg< int, n > &b, const v_reg< double, n/2 > &c)
 
template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::q_type, n/4 > cv::v_dotprod_expand_fast (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 快速点积并扩展。
 
template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::q_type, n/4 > cv::v_dotprod_expand_fast (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b, const v_reg< typename V_TypeTraits< _Tp >::q_type, n/4 > &c)
 快速点积。
 
template<int n>
v_reg< double, n/2 > cv::v_dotprod_expand_fast (const v_reg< int, n > &a, const v_reg< int, n > &b)
 
template<int n>
v_reg< double, n/2 > cv::v_dotprod_expand_fast (const v_reg< int, n > &a, const v_reg< int, n > &b, const v_reg< double, n/2 > &c)
 
template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > cv::v_dotprod_fast (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 快速点积。
 
template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > cv::v_dotprod_fast (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b, const v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > &c)
 快速点积。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_eq (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 等于比较。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_erf (const v_reg< _Tp, n > &a)
 误差 (Error) 函数。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_exp (const v_reg< _Tp, n > &a)
 元素的指数值 \( e^x \)。
 
template<typename _Tp , int n>
void cv::v_expand (const v_reg< _Tp, n > &a, v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > &b0, v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > &b1)
 将数值扩展到更宽的打包类型。
 
template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > cv::v_expand_high (const v_reg< _Tp, n > &a)
 将高位数值扩展到更宽的打包类型。
 
template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > cv::v_expand_low (const v_reg< _Tp, n > &a)
 将低位数值扩展到更宽的打包类型。
 
template<int s, typename _Tp , int n>
v_reg< _Tp, n > cv::v_extract (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 向量提取。
 
template<int s, typename _Tp , int n>
_Tp cv::v_extract_n (const v_reg< _Tp, n > &v)
 向量提取。
 
template<int n>
v_reg< int, n *2 > cv::v_floor (const v_reg< double, n > &a)
 
template<int n>
v_reg< int, n > cv::v_floor (const v_reg< float, n > &a)
 向下取整。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_fma (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b, const v_reg< _Tp, n > &c)
 乘加运算 (FMA)。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_ge (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 大于或等于比较。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_gt (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 大于比较。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_interleave_pairs (const v_reg< _Tp, n > &vec)
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_interleave_quads (const v_reg< _Tp, n > &vec)
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_invsqrt (const v_reg< _Tp, n > &a)
 平方根倒数。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_le (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 小于或等于比较。
 
template<typename _Tp >
v_reg< _Tp, simd128_width/sizeof(_Tp)> cv::v_load (const _Tp *ptr)
 从内存加载寄存器内容。
 
template<typename _Tp >
v_reg< _Tp, simd128_width/sizeof(_Tp)> cv::v_load_aligned (const _Tp *ptr)
 从内存加载寄存器内容 (对齐加载)
 
template<typename _Tp , int n>
void cv::v_load_deinterleave (const _Tp *ptr, v_reg< _Tp, n > &a, v_reg< _Tp, n > &b)
 加载并去交错 (2 通道)
 
template<typename _Tp , int n>
void cv::v_load_deinterleave (const _Tp *ptr, v_reg< _Tp, n > &a, v_reg< _Tp, n > &b, v_reg< _Tp, n > &c)
 加载并去交错 (3 通道)
 
template<typename _Tp , int n>
void cv::v_load_deinterleave (const _Tp *ptr, v_reg< _Tp, n > &a, v_reg< _Tp, n > &b, v_reg< _Tp, n > &c, v_reg< _Tp, n > &d)
 加载并去交错 (4 通道)
 
template<typename _Tp >
v_reg< typename V_TypeTraits< _Tp >::w_type, simd128_width/sizeof(typename V_TypeTraits< _Tp >::w_type)> cv::v_load_expand (const _Tp *ptr)
 从内存加载寄存器内容并进行双倍扩展 (double expand)。
 
v_reg< float, simd128_width/sizeof(float)> cv::v_load_expand (const hfloat *ptr)
 
template<typename _Tp >
v_reg< typename V_TypeTraits< _Tp >::q_type, simd128_width/sizeof(typename V_TypeTraits< _Tp >::q_type)> cv::v_load_expand_q (const _Tp *ptr)
 从内存加载寄存器内容并进行四倍扩展 (quad expand)。
 
template<typename _Tp >
v_reg< _Tp, simd128_width/sizeof(_Tp)> cv::v_load_halves (const _Tp *loptr, const _Tp *hiptr)
 从两个内存块加载寄存器内容。
 
template<typename _Tp >
v_reg< _Tp, simd128_width/sizeof(_Tp)> cv::v_load_low (const _Tp *ptr)
 加载 64 位数据到低位部分 (高位部分未定义)。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_log (const v_reg< _Tp, n > &a)
 元素的自然对数 \( \log(x) \)。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_lt (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 小于比较。
 
template<typename _Tp >
v_reg< _Tp, simd128_width/sizeof(_Tp)> cv::v_lut (const _Tp *tab, const int *idx)
 
template<int n>
v_reg< double, n/2 > cv::v_lut (const double *tab, const v_reg< int, n > &idx)
 
template<int n>
v_reg< float, n > cv::v_lut (const float *tab, const v_reg< int, n > &idx)
 
template<int n>
v_reg< int, n > cv::v_lut (const int *tab, const v_reg< int, n > &idx)
 
template<int n>
v_reg< unsigned, n > cv::v_lut (const unsigned *tab, const v_reg< int, n > &idx)
 
template<int n>
void cv::v_lut_deinterleave (const double *tab, const v_reg< int, n *2 > &idx, v_reg< double, n > &x, v_reg< double, n > &y)
 
template<int n>
void cv::v_lut_deinterleave (const float *tab, const v_reg< int, n > &idx, v_reg< float, n > &x, v_reg< float, n > &y)
 
template<typename _Tp >
v_reg< _Tp, simd128_width/sizeof(_Tp)> cv::v_lut_pairs (const _Tp *tab, const int *idx)
 
template<typename _Tp >
v_reg< _Tp, simd128_width/sizeof(_Tp)> cv::v_lut_quads (const _Tp *tab, const int *idx)
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_magnitude (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 模长 (Magnitude)。
 
template<int n>
v_reg< float, n > cv::v_matmul (const v_reg< float, n > &v, const v_reg< float, n > &a, const v_reg< float, n > &b, const v_reg< float, n > &c, const v_reg< float, n > &d)
 矩阵乘法。
 
template<int n>
v_reg< float, n > cv::v_matmuladd (const v_reg< float, n > &v, const v_reg< float, n > &a, const v_reg< float, n > &b, const v_reg< float, n > &c, const v_reg< float, n > &d)
 矩阵乘加运算。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_max (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 为每对元素选择最大值。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_min (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 为每对元素选择最小值。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_mul (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 数值相乘。
 
template<typename _Tp , int n>
void cv::v_mul_expand (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b, v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > &c, v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > &d)
 相乘并扩展。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_mul_hi (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 相乘并提取高位部分。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_mul_wrap (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 数值相乘 (不进行饱和处理)。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_muladd (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b, const v_reg< _Tp, n > &c)
 v_fma 的同义词。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_ne (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 不等于比较。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_not (const v_reg< _Tp, n > &a)
 按位非 (Bitwise NOT)。
 
template<int n>
v_reg< double, n > cv::v_not_nan (const v_reg< double, n > &a)
 
template<int n>
v_reg< float, n > cv::v_not_nan (const v_reg< float, n > &a)
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_or (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 按位或 (Bitwise OR)。
 
template<int n>
void cv::v_pack_store (hfloat *ptr, const v_reg< float, n > &v)
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_pack_triplets (const v_reg< _Tp, n > &vec)
 
template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::abs_type, n > cv::v_popcount (const v_reg< _Tp, n > &a)
 统计向量通道中 1 位的数量,并以相应的无符号类型返回结果。
 
template<typename _Tp , int n>
void cv::v_recombine (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b, v_reg< _Tp, n > &low, v_reg< _Tp, n > &high)
 从另外两个向量的低位和高位部分组合出两个新向量。
 
template<typename _Tp , int n>
_Tp cv::v_reduce_max (const v_reg< _Tp, n > &a)
 寻找一个最大值。
 
template<typename _Tp , int n>
_Tp cv::v_reduce_min (const v_reg< _Tp, n > &a)
 寻找一个最小值。
 
template<typename _Tp , int n>
V_TypeTraits< typenameV_TypeTraits< _Tp >::abs_type >::sum_type cv::v_reduce_sad (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 计算数值的绝对差之和 (SAD)。
 
template<typename _Tp , int n>
V_TypeTraits< _Tp >::sum_type cv::v_reduce_sum (const v_reg< _Tp, n > &a)
 对打包值求和。
 
template<int n>
v_reg< float, n > cv::v_reduce_sum4 (const v_reg< float, n > &a, const v_reg< float, n > &b, const v_reg< float, n > &c, const v_reg< float, n > &d)
 对每个输入向量的所有元素求和,并返回由这些和组成的向量。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_reverse (const v_reg< _Tp, n > &a)
 向量元素次序反转。
 
template<int imm, typename _Tp , int n>
v_reg< _Tp, n > cv::v_rotate_left (const v_reg< _Tp, n > &a)
 向量内元素向左平移。
 
template<int imm, typename _Tp , int n>
v_reg< _Tp, n > cv::v_rotate_left (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 
template<int imm, typename _Tp , int n>
v_reg< _Tp, n > cv::v_rotate_right (const v_reg< _Tp, n > &a)
 向量内元素向右平移。
 
template<int imm, typename _Tp , int n>
v_reg< _Tp, n > cv::v_rotate_right (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 
template<int n>
v_reg< int, n *2 > cv::v_round (const v_reg< double, n > &a)
 
template<int n>
v_reg< int, n *2 > cv::v_round (const v_reg< double, n > &a, const v_reg< double, n > &b)
 
template<int n>
v_reg< int, n > cv::v_round (const v_reg< float, n > &a)
 元素舍入。
 
template<typename _Tp , int n>
int cv::v_scan_forward (const v_reg< _Tp, n > &a)
 获取第一个负值通道的索引。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_select (const v_reg< _Tp, n > &mask, const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 逐元素选择 (混合操作/blend operation)
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_shl (const v_reg< _Tp, n > &a, int imm)
 按位左移。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_shr (const v_reg< _Tp, n > &a, int imm)
 按位右移。
 
template<typename _Tp , int n>
int cv::v_signmask (const v_reg< _Tp, n > &a)
 获取负值掩码。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_sin (const v_reg< _Tp, n > &a)
 元素的正弦值 \( sin(x) \)。
 
template<typename _Tp , int n>
void cv::v_sincos (const v_reg< _Tp, n > &x, v_reg< _Tp, n > &s, v_reg< _Tp, n > &c)
 同时计算元素的正弦 \( sin(x) \) 和余弦 \( cos(x) \)。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_sqr_magnitude (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 模长的平方。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_sqrt (const v_reg< _Tp, n > &a)
 元素的平方根。
 
template<typename _Tp , int n>
void cv::v_store (_Tp *ptr, const v_reg< _Tp, n > &a)
 将数据存储到内存。
 
template<typename _Tp , int n>
void cv::v_store (_Tp *ptr, const v_reg< _Tp, n > &a, hal::StoreMode)
 
template<typename _Tp , int n>
void cv::v_store_aligned (_Tp *ptr, const v_reg< _Tp, n > &a)
 将数据存储到内存 (对齐存储)
 
template<typename _Tp , int n>
void cv::v_store_aligned (_Tp *ptr, const v_reg< _Tp, n > &a, hal::StoreMode)
 
template<typename _Tp , int n>
void cv::v_store_aligned_nocache (_Tp *ptr, const v_reg< _Tp, n > &a)
 
template<typename _Tp , int n>
void cv::v_store_high (_Tp *ptr, const v_reg< _Tp, n > &a)
 将数据存储到内存 (高半部分)
 
template<typename _Tp , int n>
void cv::v_store_interleave (_Tp *ptr, const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b, const v_reg< _Tp, n > &c, const v_reg< _Tp, n > &d, hal::StoreMode=hal::STORE_UNALIGNED)
 交错并存储 (4 通道)
 
template<typename _Tp , int n>
void cv::v_store_interleave (_Tp *ptr, const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b, const v_reg< _Tp, n > &c, hal::StoreMode=hal::STORE_UNALIGNED)
 交错并存储 (3 通道)
 
template<typename _Tp , int n>
void cv::v_store_interleave (_Tp *ptr, const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b, hal::StoreMode=hal::STORE_UNALIGNED)
 交错并存储 (2 通道)
 
template<typename _Tp , int n>
void cv::v_store_low (_Tp *ptr, const v_reg< _Tp, n > &a)
 将数据存储到内存 (低半部分)
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_sub (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 数值相减。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_sub_wrap (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 数值相减 (不进行饱和处理)。
 
template<typename _Tp , int n>
void cv::v_transpose4x4 (v_reg< _Tp, n > &a0, const v_reg< _Tp, n > &a1, const v_reg< _Tp, n > &a2, const v_reg< _Tp, n > &a3, v_reg< _Tp, n > &b0, v_reg< _Tp, n > &b1, v_reg< _Tp, n > &b2, v_reg< _Tp, n > &b3)
 4x4 矩阵转置。
 
template<int n>
v_reg< int, n *2 > cv::v_trunc (const v_reg< double, n > &a)
 
template<int n>
v_reg< int, n > cv::v_trunc (const v_reg< float, n > &a)
 元素截断 (取整)。
 
template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_xor (const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
 按位异或 (Bitwise XOR)。
 
template<typename _Tp , int n>
void cv::v_zip (const v_reg< _Tp, n > &a0, const v_reg< _Tp, n > &a1, v_reg< _Tp, n > &b0, v_reg< _Tp, n > &b1)
 交织两个向量。
 

变量

static const unsigned char cv::popCountTable []
 

以零初始化

创建元素全为零的新向量

v_uint8x16 cv::v_setzero_u8 ()
 
template<>
v_uint8x16 cv::v_setzero_ ()
 
v_int8x16 cv::v_setzero_s8 ()
 
v_uint16x8 cv::v_setzero_u16 ()
 
v_int16x8 cv::v_setzero_s16 ()
 
v_uint32x4 cv::v_setzero_u32 ()
 
v_int32x4 cv::v_setzero_s32 ()
 
v_float32x4 cv::v_setzero_f32 ()
 
v_float64x2 cv::v_setzero_f64 ()
 
v_uint64x2 cv::v_setzero_u64 ()
 
v_int64x2 cv::v_setzero_s64 ()
 
v_uint8x32 cv::v256_setzero_u8 ()
 
v_int8x32 cv::v256_setzero_s8 ()
 
v_uint16x16 cv::v256_setzero_u16 ()
 
v_int16x16 cv::v256_setzero_s16 ()
 
v_uint32x8 cv::v256_setzero_u32 ()
 
v_int32x8 cv::v256_setzero_s32 ()
 
v_float32x8 cv::v256_setzero_f32 ()
 
v_float64x4 cv::v256_setzero_f64 ()
 
v_uint64x4 cv::v256_setzero_u64 ()
 
v_int64x4 cv::v256_setzero_s64 ()
 
v_uint8x64 cv::v512_setzero_u8 ()
 
v_int8x64 cv::v512_setzero_s8 ()
 
v_uint16x32 cv::v512_setzero_u16 ()
 
v_int16x32 cv::v512_setzero_s16 ()
 
v_uint32x16 cv::v512_setzero_u32 ()
 
v_int32x16 cv::v512_setzero_s32 ()
 
v_float32x16 cv::v512_setzero_f32 ()
 
v_float64x8 cv::v512_setzero_f64 ()
 
v_uint64x8 cv::v512_setzero_u64 ()
 
v_int64x8 cv::v512_setzero_s64 ()
 

以特定值初始化

创建元素被设为特定值的新向量

v_uint8x16 cv::v_setall_u8 (uchar val)
 
template<>
v_uint8x16 cv::v_setall_ (uchar val)
 
v_int8x16 cv::v_setall_s8 (schar val)
 
template<>
v_int8x16 cv::v_setall_ (schar val)
 
v_uint16x8 cv::v_setall_u16 (ushort val)
 
template<>
v_uint16x8 cv::v_setall_ (ushort val)
 
v_int16x8 cv::v_setall_s16 (short val)
 
template<>
v_int16x8 cv::v_setall_ (short val)
 
v_uint32x4 cv::v_setall_u32 (unsigned val)
 
template<>
v_uint32x4 cv::v_setall_ (unsigned val)
 
v_int32x4 cv::v_setall_s32 (int val)
 
template<>
v_int32x4 cv::v_setall_ (int val)
 
v_float32x4 cv::v_setall_f32 (float val)
 
template<>
v_float32x4 cv::v_setall_ (float val)
 
v_float64x2 cv::v_setall_f64 (double val)
 
template<>
v_float64x2 cv::v_setall_ (double val)
 
v_uint64x2 cv::v_setall_u64 (uint64 val)
 
template<>
v_uint64x2 cv::v_setall_ (uint64 val)
 
v_int64x2 cv::v_setall_s64 (int64 val)
 
template<>
v_int64x2 cv::v_setall_ (int64 val)
 
v_uint8x32 cv::v256_setall_u8 (uchar val)
 
v_int8x32 cv::v256_setall_s8 (schar val)
 
v_uint16x16 cv::v256_setall_u16 (ushort val)
 
v_int16x16 cv::v256_setall_s16 (short val)
 
v_uint32x8 cv::v256_setall_u32 (unsigned val)
 
v_int32x8 cv::v256_setall_s32 (int val)
 
v_float32x8 cv::v256_setall_f32 (float val)
 
v_float64x4 cv::v256_setall_f64 (double val)
 
v_uint64x4 cv::v256_setall_u64 (uint64 val)
 
v_int64x4 cv::v256_setall_s64 (int64 val)
 
v_uint8x64 cv::v512_setall_u8 (uchar val)
 
v_int8x64 cv::v512_setall_s8 (schar val)
 
v_uint16x32 cv::v512_setall_u16 (ushort val)
 
v_int16x32 cv::v512_setall_s16 (short val)
 
v_uint32x16 cv::v512_setall_u32 (unsigned val)
 
v_int32x16 cv::v512_setall_s32 (int val)
 
v_float32x16 cv::v512_setall_f32 (float val)
 
v_float64x8 cv::v512_setall_f64 (double val)
 
v_uint64x8 cv::v512_setall_u64 (uint64 val)
 
v_int64x8 cv::v512_setall_s64 (int64 val)
 

类型重解释

在不修改底层数据的情况下,将向量转换为不同的类型。

template<typename _Tp0 , int n0>
v_reg< uchar, n0 *sizeof(_Tp0)/sizeof(uchar)> cv::v_reinterpret_as_u8 (const v_reg< _Tp0, n0 > &a)
 
template<typename _Tp0 , int n0>
v_reg< schar, n0 *sizeof(_Tp0)/sizeof(schar)> cv::v_reinterpret_as_s8 (const v_reg< _Tp0, n0 > &a)
 
template<typename _Tp0 , int n0>
v_reg< ushort, n0 *sizeof(_Tp0)/sizeof(ushort)> cv::v_reinterpret_as_u16 (const v_reg< _Tp0, n0 > &a)
 
template<typename _Tp0 , int n0>
v_reg< short, n0 *sizeof(_Tp0)/sizeof(short)> cv::v_reinterpret_as_s16 (const v_reg< _Tp0, n0 > &a)
 
template<typename _Tp0 , int n0>
v_reg< unsigned, n0 *sizeof(_Tp0)/sizeof(unsigned)> cv::v_reinterpret_as_u32 (const v_reg< _Tp0, n0 > &a)
 
template<typename _Tp0 , int n0>
v_reg< int, n0 *sizeof(_Tp0)/sizeof(int)> cv::v_reinterpret_as_s32 (const v_reg< _Tp0, n0 > &a)
 
template<typename _Tp0 , int n0>
v_reg< float, n0 *sizeof(_Tp0)/sizeof(float)> cv::v_reinterpret_as_f32 (const v_reg< _Tp0, n0 > &a)
 
template<typename _Tp0 , int n0>
v_reg< double, n0 *sizeof(_Tp0)/sizeof(double)> cv::v_reinterpret_as_f64 (const v_reg< _Tp0, n0 > &a)
 
template<typename _Tp0 , int n0>
v_reg< uint64, n0 *sizeof(_Tp0)/sizeof(uint64)> cv::v_reinterpret_as_u64 (const v_reg< _Tp0, n0 > &a)
 
template<typename _Tp0 , int n0>
v_reg< int64, n0 *sizeof(_Tp0)/sizeof(int64)> cv::v_reinterpret_as_s64 (const v_reg< _Tp0, n0 > &a)
 

左移

左移位

template<int shift, int n>
v_reg< ushort, n > cv::v_shl (const v_reg< ushort, n > &a)
 
template<int shift, int n>
v_reg< short, n > cv::v_shl (const v_reg< short, n > &a)
 
template<int shift, int n>
v_reg< unsigned, n > cv::v_shl (const v_reg< unsigned, n > &a)
 
template<int shift, int n>
v_reg< int, n > cv::v_shl (const v_reg< int, n > &a)
 
template<int shift, int n>
v_reg< uint64, n > cv::v_shl (const v_reg< uint64, n > &a)
 
template<int shift, int n>
v_reg< int64, n > cv::v_shl (const v_reg< int64, n > &a)
 

右移

右移位

template<int shift, int n>
v_reg< ushort, n > cv::v_shr (const v_reg< ushort, n > &a)
 
template<int shift, int n>
v_reg< short, n > cv::v_shr (const v_reg< short, n > &a)
 
template<int shift, int n>
v_reg< unsigned, n > cv::v_shr (const v_reg< unsigned, n > &a)
 
template<int shift, int n>
v_reg< int, n > cv::v_shr (const v_reg< int, n > &a)
 
template<int shift, int n>
v_reg< uint64, n > cv::v_shr (const v_reg< uint64, n > &a)
 
template<int shift, int n>
v_reg< int64, n > cv::v_shr (const v_reg< int64, n > &a)
 

舍入移位

舍入右移位

template<int shift, int n>
v_reg< ushort, n > cv::v_rshr (const v_reg< ushort, n > &a)
 
template<int shift, int n>
v_reg< short, n > cv::v_rshr (const v_reg< short, n > &a)
 
template<int shift, int n>
v_reg< unsigned, n > cv::v_rshr (const v_reg< unsigned, n > &a)
 
template<int shift, int n>
v_reg< int, n > cv::v_rshr (const v_reg< int, n > &a)
 
template<int shift, int n>
v_reg< uint64, n > cv::v_rshr (const v_reg< uint64, n > &a)
 
template<int shift, int n>
v_reg< int64, n > cv::v_rshr (const v_reg< int64, n > &a)
 

压缩

将两个向量的值压缩为一个

返回的向量类型拥有的元素数量是输入向量类型的两倍。带有 u 后缀的变体还会转换为对应的无符号类型。

  • pack:用于 16 位、32 位和 64 位整数输入类型
  • pack_u:用于 16 位和 32 位有符号整数输入类型
注意
除 64 位外的所有变体都使用饱和处理。
template<int n>
v_reg< uchar, 2 *n > cv::v_pack (const v_reg< ushort, n > &a, const v_reg< ushort, n > &b)
 
template<int n>
v_reg< schar, 2 *n > cv::v_pack (const v_reg< short, n > &a, const v_reg< short, n > &b)
 
template<int n>
v_reg< ushort, 2 *n > cv::v_pack (const v_reg< unsigned, n > &a, const v_reg< unsigned, n > &b)
 
template<int n>
v_reg< short, 2 *n > cv::v_pack (const v_reg< int, n > &a, const v_reg< int, n > &b)
 
template<int n>
v_reg< unsigned, 2 *n > cv::v_pack (const v_reg< uint64, n > &a, const v_reg< uint64, n > &b)
 
template<int n>
v_reg< int, 2 *n > cv::v_pack (const v_reg< int64, n > &a, const v_reg< int64, n > &b)
 
template<int n>
v_reg< uchar, 2 *n > cv::v_pack_u (const v_reg< short, n > &a, const v_reg< short, n > &b)
 
template<int n>
v_reg< ushort, 2 *n > cv::v_pack_u (const v_reg< int, n > &a, const v_reg< int, n > &b)
 

带舍入移位的压缩

将两个向量的值通过舍入移位压缩为一个

输入向量的值将向右舍入移位 n 位,转换为更窄的类型并返回到结果向量中。带有 u 后缀的变体转换为无符号类型。

  • pack:用于 16 位、32 位和 64 位整数输入类型
  • pack_u:用于 16 位和 32 位有符号整数输入类型
注意
除 64 位外的所有变体都使用饱和处理。
template<int shift, int n>
v_reg< uchar, 2 *n > cv::v_rshr_pack (const v_reg< ushort, n > &a, const v_reg< ushort, n > &b)
 
template<int shift, int n>
v_reg< schar, 2 *n > cv::v_rshr_pack (const v_reg< short, n > &a, const v_reg< short, n > &b)
 
template<int shift, int n>
v_reg< ushort, 2 *n > cv::v_rshr_pack (const v_reg< unsigned, n > &a, const v_reg< unsigned, n > &b)
 
template<int shift, int n>
v_reg< short, 2 *n > cv::v_rshr_pack (const v_reg< int, n > &a, const v_reg< int, n > &b)
 
template<int shift, int n>
v_reg< unsigned, 2 *n > cv::v_rshr_pack (const v_reg< uint64, n > &a, const v_reg< uint64, n > &b)
 
template<int shift, int n>
v_reg< int, 2 *n > cv::v_rshr_pack (const v_reg< int64, n > &a, const v_reg< int64, n > &b)
 
template<int shift, int n>
v_reg< uchar, 2 *n > cv::v_rshr_pack_u (const v_reg< short, n > &a, const v_reg< short, n > &b)
 
template<int shift, int n>
v_reg< ushort, 2 *n > cv::v_rshr_pack_u (const v_reg< int, n > &a, const v_reg< int, n > &b)
 

压缩并存储

通过压缩将输入向量的值存储到内存中

值将被转换为更窄的类型并存储到内存中。带有 u 后缀的变体转换为对应的无符号类型。

  • pack:用于 16 位、32 位和 64 位整数输入类型
  • pack_u:用于 16 位和 32 位有符号整数输入类型
注意
除 64 位外的所有变体都使用饱和处理。
template<int n>
void cv::v_pack_store (uchar *ptr, const v_reg< ushort, n > &a)
 
template<int n>
void cv::v_pack_store (schar *ptr, const v_reg< short, n > &a)
 
template<int n>
void cv::v_pack_store (ushort *ptr, const v_reg< unsigned, n > &a)
 
template<int n>
void cv::v_pack_store (short *ptr, const v_reg< int, n > &a)
 
template<int n>
void cv::v_pack_store (unsigned *ptr, const v_reg< uint64, n > &a)
 
template<int n>
void cv::v_pack_store (int *ptr, const v_reg< int64, n > &a)
 
template<int n>
void cv::v_pack_u_store (uchar *ptr, const v_reg< short, n > &a)
 
template<int n>
void cv::v_pack_u_store (ushort *ptr, const v_reg< int, n > &a)
 

带舍入移位的压缩并存储

通过压缩将输入向量的值存储到内存中

值将通过舍入向右移位 n 位,转换为更窄的类型并存储到内存中。带有 u 后缀的变体转换为无符号类型。

  • pack:用于 16 位、32 位和 64 位整数输入类型
  • pack_u:用于 16 位和 32 位有符号整数输入类型
注意
除 64 位外的所有变体都使用饱和处理。
template<int shift, int n>
void cv::v_rshr_pack_store (uchar *ptr, const v_reg< ushort, n > &a)
 
template<int shift, int n>
void cv::v_rshr_pack_store (schar *ptr, const v_reg< short, n > &a)
 
template<int shift, int n>
void cv::v_rshr_pack_store (ushort *ptr, const v_reg< unsigned, n > &a)
 
template<int shift, int n>
void cv::v_rshr_pack_store (short *ptr, const v_reg< int, n > &a)
 
template<int shift, int n>
void cv::v_rshr_pack_store (unsigned *ptr, const v_reg< uint64, n > &a)
 
template<int shift, int n>
void cv::v_rshr_pack_store (int *ptr, const v_reg< int64, n > &a)
 
template<int shift, int n>
void cv::v_rshr_pack_u_store (uchar *ptr, const v_reg< short, n > &a)
 
template<int shift, int n>
void cv::v_rshr_pack_u_store (ushort *ptr, const v_reg< int, n > &a)
 

压缩布尔值

将多个向量的布尔值压缩为一个无符号 8 位整数向量

注意
必须提供有效的布尔值,以保证在所有架构上获得相同的结果。
template<int n>
v_reg< uchar, 2 *n > cv::v_pack_b (const v_reg< ushort, n > &a, const v_reg< ushort, n > &b)
 ! 用于 16 位布尔值
 
template<int n>
v_reg< uchar, 4 *n > cv::v_pack_b (const v_reg< unsigned, n > &a, const v_reg< unsigned, n > &b, const v_reg< unsigned, n > &c, const v_reg< unsigned, n > &d)
 
template<int n>
v_reg< uchar, 8 *n > cv::v_pack_b (const v_reg< uint64, n > &a, const v_reg< uint64, n > &b, const v_reg< uint64, n > &c, const v_reg< uint64, n > &d, const v_reg< uint64, n > &e, const v_reg< uint64, n > &f, const v_reg< uint64, n > &g, const v_reg< uint64, n > &h)
 

宏定义文档

◆ OPENCV_HAL_MATH_HAVE_EXP

#define OPENCV_HAL_MATH_HAVE_EXP   1

类型定义文档 (Typedef Documentation)

◆ v_float32

typedef v_float32x16 simd512::v_float32

#include <opencv2/core/hal/intrin.hpp>

最大可用向量寄存器容量的 32位浮点值 (单精度)

◆ v_float32x16

typedef v_reg<float, 16> cv::v_float32x16

#include <opencv2/core/hal/intrin_cpp.hpp>

16个 32位浮点值 (单精度)

◆ v_float32x4

typedef v_reg<float, 4> cv::v_float32x4

#include <opencv2/core/hal/intrin_cpp.hpp>

4个 32位浮点值 (单精度)

◆ v_float32x8

typedef v_reg<float, 8> cv::v_float32x8

#include <opencv2/core/hal/intrin_cpp.hpp>

8个 32位浮点值 (单精度)

◆ v_float64

typedef v_float64x8 simd512::v_float64

#include <opencv2/core/hal/intrin.hpp>

最大可用向量寄存器容量的 64位浮点值 (双精度)

◆ v_float64x2

typedef v_reg<double, 2> cv::v_float64x2

#include <opencv2/core/hal/intrin_cpp.hpp>

2个 64位浮点值 (双精度)

◆ v_float64x4

typedef v_reg<double, 4> cv::v_float64x4

#include <opencv2/core/hal/intrin_cpp.hpp>

4个 64位浮点值 (双精度)

◆ v_float64x8

typedef v_reg<double, 8> cv::v_float64x8

#include <opencv2/core/hal/intrin_cpp.hpp>

8个 64位浮点值 (双精度)

◆ v_int16

typedef v_int16x32 simd512::v_int16

#include <opencv2/core/hal/intrin.hpp>

最大可用向量寄存器容量的 16位有符号整数值。

◆ v_int16x16

typedef v_reg<short, 16> cv::v_int16x16

#include <opencv2/core/hal/intrin_cpp.hpp>

16个 16位有符号整数值。

◆ v_int16x32

typedef v_reg<short, 32> cv::v_int16x32

#include <opencv2/core/hal/intrin_cpp.hpp>

32个 16位有符号整数值。

◆ v_int16x8

typedef v_reg<short, 8> cv::v_int16x8

#include <opencv2/core/hal/intrin_cpp.hpp>

8个 16位有符号整数值。

◆ v_int32

typedef v_int32x16 simd512::v_int32

#include <opencv2/core/hal/intrin.hpp>

最大可用向量寄存器容量的 32位有符号整数值。

◆ v_int32x16

typedef v_reg<int, 16> cv::v_int32x16

#include <opencv2/core/hal/intrin_cpp.hpp>

16个 32位有符号整数值。

◆ v_int32x4

typedef v_reg<int, 4> cv::v_int32x4

#include <opencv2/core/hal/intrin_cpp.hpp>

4个 32位有符号整数值。

◆ v_int32x8

typedef v_reg<int, 8> cv::v_int32x8

#include <opencv2/core/hal/intrin_cpp.hpp>

8个 32位有符号整数值。

◆ v_int64

typedef v_int64x8 simd512::v_int64

#include <opencv2/core/hal/intrin.hpp>

最大可用向量寄存器容量的 64位有符号整数值。

◆ v_int64x2

typedef v_reg<int64, 2> cv::v_int64x2

#include <opencv2/core/hal/intrin_cpp.hpp>

2个 64位有符号整数值。

◆ v_int64x4

typedef v_reg<int64, 4> cv::v_int64x4

#include <opencv2/core/hal/intrin_cpp.hpp>

4个 64位有符号整数值。

◆ v_int64x8

typedef v_reg<int64, 8> cv::v_int64x8

#include <opencv2/core/hal/intrin_cpp.hpp>

8个 64位有符号整数值。

◆ v_int8

typedef v_int8x64 simd512::v_int8

#include <opencv2/core/hal/intrin.hpp>

最大可用向量寄存器容量的 8位有符号整数值。

◆ v_int8x16

typedef v_reg<schar, 16> cv::v_int8x16

#include <opencv2/core/hal/intrin_cpp.hpp>

16个 8位有符号整数值。

◆ v_int8x32

typedef v_reg<schar, 32> cv::v_int8x32

#include <opencv2/core/hal/intrin_cpp.hpp>

32个 8位有符号整数值。

◆ v_int8x64

typedef v_reg<schar, 64> cv::v_int8x64

#include <opencv2/core/hal/intrin_cpp.hpp>

64个 8位有符号整数值。

◆ v_uint16

typedef v_uint16x32 simd512::v_uint16

#include <opencv2/core/hal/intrin.hpp>

最大可用向量寄存器容量的 16位无符号整数值。

◆ v_uint16x16

#include <opencv2/core/hal/intrin_cpp.hpp>

16个 16位无符号整数值。

◆ v_uint16x32

#include <opencv2/core/hal/intrin_cpp.hpp>

32个 16位无符号整数值。

◆ v_uint16x8

#include <opencv2/core/hal/intrin_cpp.hpp>

8个 16位无符号整数值。

◆ v_uint32

typedef v_uint32x16 simd512::v_uint32

#include <opencv2/core/hal/intrin.hpp>

最大可用向量寄存器容量的 32位无符号整数值。

◆ v_uint32x16

typedef v_reg<unsigned, 16> cv::v_uint32x16

#include <opencv2/core/hal/intrin_cpp.hpp>

16个 32位无符号整数值。

◆ v_uint32x4

typedef v_reg<unsigned, 4> cv::v_uint32x4

#include <opencv2/core/hal/intrin_cpp.hpp>

4个 32位无符号整数值。

◆ v_uint32x8

typedef v_reg<unsigned, 8> cv::v_uint32x8

#include <opencv2/core/hal/intrin_cpp.hpp>

8个 32位无符号整数值。

◆ v_uint64

typedef v_uint64x8 simd512::v_uint64

#include <opencv2/core/hal/intrin.hpp>

最大可用向量寄存器容量的 64位无符号整数值。

◆ v_uint64x2

#include <opencv2/core/hal/intrin_cpp.hpp>

2个 64位无符号整数值。

◆ v_uint64x4

#include <opencv2/core/hal/intrin_cpp.hpp>

4个 64位无符号整数值。

◆ v_uint64x8

#include <opencv2/core/hal/intrin_cpp.hpp>

8个 64位无符号整数值。

◆ v_uint8

typedef v_uint8x64 simd512::v_uint8

#include <opencv2/core/hal/intrin.hpp>

最大可用向量寄存器容量的 8位无符号整数值。

◆ v_uint8x16

typedef v_reg<uchar, 16> cv::v_uint8x16

#include <opencv2/core/hal/intrin_cpp.hpp>

16个 8位无符号整数值。

◆ v_uint8x32

typedef v_reg<uchar, 32> cv::v_uint8x32

#include <opencv2/core/hal/intrin_cpp.hpp>

32个 8位无符号整数值。

◆ v_uint8x64

typedef v_reg<uchar, 64> cv::v_uint8x64

#include <opencv2/core/hal/intrin_cpp.hpp>

64个 8位无符号整数值。

枚举类型文档 (Enumeration Type Documentation)

◆ 匿名枚举

匿名枚举

#include <opencv2/core/hal/intrin_cpp.hpp>

枚举值 (Enumerator)
simd128_width 
simd256_width 
simd512_width 
simdmax_width 

函数文档 (Function Documentation)

◆ v256_cleanup()

void cv::v256_cleanup ( )
内联

◆ v256_load()

template<typename _Tp >
v_reg< _Tp, simd256_width/sizeof(_Tp)> cv::v256_load ( const _Tp * ptr)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从内存加载 256 位长度的寄存器内容。

参数
ptr指向带数据内存块的指针
返回
寄存器对象
注意
返回类型将从传递的指针类型中检测,例如 uchar ==> cv::v_uint8x32, int ==> cv::v_int32x8 等。
使用前请检查 CV_SIMD256 预处理器定义。使用 vx_load 版本可获得最大可用寄存器长度的结果
对齐要求:如果 CV_STRONG_ALIGNMENT=1,则传递的指针必须对齐(sizeof(lane type) 应该足够)。在未进行运行时指针对齐检查的情况下,请勿转换指针类型(如 uchar* => int*)。
此函数的调用图

◆ v256_load_aligned()

template<typename _Tp >
v_reg< _Tp, simd256_width/sizeof(_Tp)> cv::v256_load_aligned ( const _Tp * ptr)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从内存加载寄存器内容 (对齐加载)

类似于 cv::v256_load,但源内存块应当对齐(SIMD256 为 32 字节边界,SIMD512 为 64 字节等)

注意
使用前请检查 CV_SIMD256 预处理器定义。使用 vx_load_aligned 版本可获得最大可用寄存器长度的结果
此函数的调用图

◆ v256_load_expand() [1/2]

template<typename _Tp >
v_reg< typename V_TypeTraits< _Tp >::w_type, simd256_width/sizeof(typename V_TypeTraits< _Tp >::w_type)> cv::v256_load_expand ( const _Tp * ptr)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从内存加载寄存器内容并进行双倍扩展 (double expand)。

cv::v256_load 相同,但结果包类型将比内存类型宽 2 倍。

short buf[8] = {1, 2, 3, 4, 5, 6, 7, 8}; // 类型为 int16
v_int32x8 r = v256_load_expand(buf); // r = {1, 2, 3, 4, 5, 6, 7, 8} - 类型为 int32
v_reg< int, 8 > v_int32x8
8个 32位有符号整数值。
定义 intrin_cpp.hpp:540
v_reg< typename V_TypeTraits< _Tp >::w_type, simd256_width/sizeof(typename V_TypeTraits< _Tp >::w_type)> v256_load_expand(const _Tp *ptr)
从内存加载寄存器内容并进行双倍扩展 (double expand)。
定义 intrin_cpp.hpp:1971

适用于 8 位、16 位、32 位整数源类型。

注意
使用前请检查 CV_SIMD256 预处理器定义。使用 vx_load_expand 版本可获得最大可用寄存器长度的结果
此函数的调用图

◆ v256_load_expand() [2/2]

v_reg< float, simd256_width/sizeof(float)> cv::v256_load_expand ( const hfloat * ptr)
内联

◆ v256_load_expand_q()

template<typename _Tp >
v_reg< typename V_TypeTraits< _Tp >::q_type, simd256_width/sizeof(typename V_TypeTraits< _Tp >::q_type)> cv::v256_load_expand_q ( const _Tp * ptr)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从内存加载寄存器内容并进行四倍扩展 (quad expand)。

cv::v256_load_expand 相同,但结果类型比源类型宽 4 倍。

char buf[8] = {1, 2, 3, 4, 5, 6, 7, 8}; // 类型为 int8
v_int32x8 r = v256_load_expand_q(buf); // r = {1, 2, 3, 4, 5, 6, 7, 8} - 类型为 int32
v_reg< typename V_TypeTraits< _Tp >::q_type, simd256_width/sizeof(typename V_TypeTraits< _Tp >::q_type)> v256_load_expand_q(const _Tp *ptr)
从内存加载寄存器内容并进行四倍扩展 (quad expand)。
定义 intrin_cpp.hpp:2059

适用于 8 位整数源类型。

注意
使用前请检查 CV_SIMD256 预处理器定义。使用 vx_load_expand_q 版本可获得最大可用寄存器长度的结果
此函数的调用图

◆ v256_load_halves()

template<typename _Tp >
v_reg< _Tp, simd256_width/sizeof(_Tp)> cv::v256_load_halves ( const _Tp * loptr,
const _Tp * hiptr )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从两个内存块加载寄存器内容。

参数
loptr包含前半部分(0..n/2)数据的内存块
hiptr包含后半部分(n/2..n)数据的内存块
int lo[4] = { 1, 2, 3, 4 }, hi[4] = { 5, 6, 7, 8 };
v_reg< _Tp, simd256_width/sizeof(_Tp)> v256_load_halves(const _Tp *loptr, const _Tp *hiptr)
从两个内存块加载寄存器内容。
定义 intrin_cpp.hpp:1880
注意
使用前请检查 CV_SIMD256 预处理器定义。使用 vx_load_halves 版本可获得最大可用寄存器长度的结果
此函数的调用图

◆ v256_load_low()

template<typename _Tp >
v_reg< _Tp, simd256_width/sizeof(_Tp)> cv::v256_load_low ( const _Tp * ptr)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

加载 128 位数据到低位部分 (高位部分未定义)。

参数
ptr包含前半部分(0..n/2)数据的内存块
int lo[4] = { 1, 2, 3, 4 };
v_reg< _Tp, simd256_width/sizeof(_Tp)> v256_load_low(const _Tp *ptr)
加载 128 位数据到低位部分 (高位部分未定义)。
定义 intrin_cpp.hpp:1795
注意
使用前请检查 CV_SIMD256 预处理器定义。使用 vx_load_low 版本可获得最大可用寄存器长度的结果
此函数的调用图

◆ v256_setall_f32()

v_float32x8 cv::v256_setall_f32 ( float val)
内联

◆ v256_setall_f64()

v_float64x4 cv::v256_setall_f64 ( double val)
内联

◆ v256_setall_s16()

v_int16x16 cv::v256_setall_s16 ( short val)
内联

◆ v256_setall_s32()

v_int32x8 cv::v256_setall_s32 ( int val)
内联

◆ v256_setall_s64()

v_int64x4 cv::v256_setall_s64 ( int64 val)
内联

◆ v256_setall_s8()

v_int8x32 cv::v256_setall_s8 ( schar val)
内联

◆ v256_setall_u16()

v_uint16x16 cv::v256_setall_u16 ( ushort val)
内联

◆ v256_setall_u32()

v_uint32x8 cv::v256_setall_u32 ( unsigned val)
内联

◆ v256_setall_u64()

v_uint64x4 cv::v256_setall_u64 ( uint64 val)
内联

◆ v256_setall_u8()

v_uint8x32 cv::v256_setall_u8 ( uchar val)
内联

◆ v256_setzero_f32()

v_float32x8 cv::v256_setzero_f32 ( )
内联

◆ v256_setzero_f64()

v_float64x4 cv::v256_setzero_f64 ( )
内联

◆ v256_setzero_s16()

v_int16x16 cv::v256_setzero_s16 ( )
内联

◆ v256_setzero_s32()

v_int32x8 cv::v256_setzero_s32 ( )
内联

◆ v256_setzero_s64()

v_int64x4 cv::v256_setzero_s64 ( )
内联

◆ v256_setzero_s8()

v_int8x32 cv::v256_setzero_s8 ( )
内联

◆ v256_setzero_u16()

v_uint16x16 cv::v256_setzero_u16 ( )
内联

◆ v256_setzero_u32()

v_uint32x8 cv::v256_setzero_u32 ( )
内联

◆ v256_setzero_u64()

v_uint64x4 cv::v256_setzero_u64 ( )
内联

◆ v256_setzero_u8()

v_uint8x32 cv::v256_setzero_u8 ( )
内联

◆ v512_cleanup()

void cv::v512_cleanup ( )
内联

◆ v512_load()

template<typename _Tp >
v_reg< _Tp, simd512_width/sizeof(_Tp)> cv::v512_load ( const _Tp * ptr)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从内存加载 512 位长度的寄存器内容。

参数
ptr指向带数据内存块的指针
返回
寄存器对象
注意
返回类型将从传递的指针类型中检测,例如 uchar ==> cv::v_uint8x64, int ==> cv::v_int32x16 等。
使用前请检查 CV_SIMD512 预处理器定义。使用 vx_load 版本可获得最大可用寄存器长度的结果
对齐要求:如果 CV_STRONG_ALIGNMENT=1,则传递的指针必须对齐(sizeof(lane type) 应该足够)。在未进行运行时指针对齐检查的情况下,请勿转换指针类型(如 uchar* => int*)。
此函数的调用图

◆ v512_load_aligned()

template<typename _Tp >
v_reg< _Tp, simd512_width/sizeof(_Tp)> cv::v512_load_aligned ( const _Tp * ptr)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从内存加载寄存器内容 (对齐加载)

类似于 cv::v512_load,但源内存块应当对齐(SIMD512 为 64 字节边界等)

注意
使用前请检查 CV_SIMD512 预处理器定义。使用 vx_load_aligned 版本可获得最大可用寄存器长度的结果
此函数的调用图

◆ v512_load_expand() [1/2]

template<typename _Tp >
v_reg< typename V_TypeTraits< _Tp >::w_type, simd512_width/sizeof(typename V_TypeTraits< _Tp >::w_type)> cv::v512_load_expand ( const _Tp * ptr)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从内存加载寄存器内容并进行双倍扩展 (double expand)。

cv::v512_load 相同,但结果包类型将比内存类型宽 2 倍。

short buf[8] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; // 类型为 int16
v_int32x16 r = v512_load_expand(buf); // r = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} - 类型为 int32
v_reg< typename V_TypeTraits< _Tp >::w_type, simd512_width/sizeof(typename V_TypeTraits< _Tp >::w_type)> v512_load_expand(const _Tp *ptr)
从内存加载寄存器内容并进行双倍扩展 (double expand)。
定义 intrin_cpp.hpp:2002
v_reg< int, 16 > v_int32x16
16个 32位有符号整数值。
定义 intrin_cpp.hpp:563

适用于 8 位、16 位、32 位整数源类型。

注意
使用前请检查 CV_SIMD512 预处理器定义。使用 vx_load_expand 版本可获得最大可用寄存器长度的结果
此函数的调用图

◆ v512_load_expand() [2/2]

v_reg< float, simd512_width/sizeof(float)> cv::v512_load_expand ( const hfloat * ptr)
内联

◆ v512_load_expand_q()

template<typename _Tp >
v_reg< typename V_TypeTraits< _Tp >::q_type, simd512_width/sizeof(typename V_TypeTraits< _Tp >::q_type)> cv::v512_load_expand_q ( const _Tp * ptr)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从内存加载寄存器内容并进行四倍扩展 (quad expand)。

cv::v512_load_expand 相同,但结果类型比源类型宽 4 倍。

char buf[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; // 类型为 int8
v_int32x16 r = v512_load_expand_q(buf); // r = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} - 类型为 int32
v_reg< typename V_TypeTraits< _Tp >::q_type, simd512_width/sizeof(typename V_TypeTraits< _Tp >::q_type)> v512_load_expand_q(const _Tp *ptr)
从内存加载寄存器内容并进行四倍扩展 (quad expand)。
定义 intrin_cpp.hpp:2089

适用于 8 位整数源类型。

注意
使用前请检查 CV_SIMD512 预处理器定义。使用 vx_load_expand_q 版本可获得最大可用寄存器长度的结果
此函数的调用图

◆ v512_load_halves()

template<typename _Tp >
v_reg< _Tp, simd512_width/sizeof(_Tp)> cv::v512_load_halves ( const _Tp * loptr,
const _Tp * hiptr )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从两个内存块加载寄存器内容。

参数
loptr包含前半部分(0..n/2)数据的内存块
hiptr包含后半部分(n/2..n)数据的内存块
int lo[4] = { 1, 2, 3, 4, 5, 6, 7, 8 }, hi[4] = { 9, 10, 11, 12, 13, 14, 15, 16 };
v_reg< _Tp, simd512_width/sizeof(_Tp)> v512_load_halves(const _Tp *loptr, const _Tp *hiptr)
从两个内存块加载寄存器内容。
定义 intrin_cpp.hpp:1911
注意
使用前请检查 CV_SIMD512 预处理器定义。使用 vx_load_halves 版本可获得最大可用寄存器长度的结果
此函数的调用图

◆ v512_load_low()

template<typename _Tp >
v_reg< _Tp, simd512_width/sizeof(_Tp)> cv::v512_load_low ( const _Tp * ptr)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

加载 256 位数据到低位部分 (高位部分未定义)。

参数
ptr包含前半部分(0..n/2)数据的内存块
int lo[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
v_reg< _Tp, simd512_width/sizeof(_Tp)> v512_load_low(const _Tp *ptr)
加载 256 位数据到低位部分 (高位部分未定义)。
定义 intrin_cpp.hpp:1823
注意
使用前请检查 CV_SIMD512 预处理器定义。使用 vx_load_low 版本可获得最大可用寄存器长度的结果
此函数的调用图

◆ v512_setall_f32()

v_float32x16 cv::v512_setall_f32 ( float val)
内联

◆ v512_setall_f64()

v_float64x8 cv::v512_setall_f64 ( double val)
内联

◆ v512_setall_s16()

v_int16x32 cv::v512_setall_s16 ( short val)
内联

◆ v512_setall_s32()

v_int32x16 cv::v512_setall_s32 ( int val)
内联

◆ v512_setall_s64()

v_int64x8 cv::v512_setall_s64 ( int64 val)
内联

◆ v512_setall_s8()

v_int8x64 cv::v512_setall_s8 ( schar val)
内联

◆ v512_setall_u16()

v_uint16x32 cv::v512_setall_u16 ( ushort val)
内联

◆ v512_setall_u32()

v_uint32x16 cv::v512_setall_u32 ( unsigned val)
内联

◆ v512_setall_u64()

v_uint64x8 cv::v512_setall_u64 ( uint64 val)
内联

◆ v512_setall_u8()

v_uint8x64 cv::v512_setall_u8 ( uchar val)
内联

◆ v512_setzero_f32()

v_float32x16 cv::v512_setzero_f32 ( )
内联

◆ v512_setzero_f64()

v_float64x8 cv::v512_setzero_f64 ( )
内联

◆ v512_setzero_s16()

v_int16x32 cv::v512_setzero_s16 ( )
内联

◆ v512_setzero_s32()

v_int32x16 cv::v512_setzero_s32 ( )
内联

◆ v512_setzero_s64()

v_int64x8 cv::v512_setzero_s64 ( )
内联

◆ v512_setzero_s8()

v_int8x64 cv::v512_setzero_s8 ( )
内联

◆ v512_setzero_u16()

v_uint16x32 cv::v512_setzero_u16 ( )
内联

◆ v512_setzero_u32()

v_uint32x16 cv::v512_setzero_u32 ( )
内联

◆ v512_setzero_u64()

v_uint64x8 cv::v512_setzero_u64 ( )
内联

◆ v512_setzero_u8()

v_uint8x64 cv::v512_setzero_u8 ( )
内联

◆ v_abs()

template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::abs_type, n > cv::v_abs ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

元素的绝对值。

仅适用于浮点类型。

◆ v_absdiff() [1/3]

template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::abs_type, n > cv::v_absdiff ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

绝对差值。

返回 \( |a - b| \) 并转换为对应的无符号类型。例如:

v_int32x4 a, b; // {1, 2, 3, 4} 和 {4, 3, 2, 1}
v_uint32x4 c = v_absdiff(a, b); // 结果为 {3, 1, 1, 3}
v_reg< typename V_TypeTraits< _Tp >::abs_type, n > v_absdiff(const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
绝对差值。
定义 intrin_cpp.hpp:1022
定义 intrin_cpp.hpp:389

适用于 8 位、16 位、32 位整数源类型。

◆ v_absdiff() [2/3]

template<int n>
v_reg< double, n > cv::v_absdiff ( const v_reg< double, n > & a,
const v_reg< double, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

这是一个重载的成员函数,为方便起见而提供。它与上述函数的区别仅在于所接受的参数不同。

用于 64 位浮点值

◆ v_absdiff() [3/3]

template<int n>
v_reg< float, n > cv::v_absdiff ( const v_reg< float, n > & a,
const v_reg< float, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

这是一个重载的成员函数,为方便起见而提供。它与上述函数的区别仅在于所接受的参数不同。

用于 32 位浮点值

◆ v_absdiffs()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_absdiffs ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

饱和绝对差值。

返回 \( saturate(|a - b|) \)。适用于 8 位、16 位有符号整数源类型。

此函数的调用图

◆ v_add()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_add ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )

#include <opencv2/core/hal/intrin_cpp.hpp>

数值相加。

适用于所有类型。

◆ v_add_wrap()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_add_wrap ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

数值相加 (不进行饱和处理)。

适用于 8 位和 16 位整数值。

◆ v_and()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_and ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )

#include <opencv2/core/hal/intrin_cpp.hpp>

按位与 (Bitwise AND)。

仅适用于整数类型。

◆ v_broadcast_element()

template<int i, typename _Tp , int n>
v_reg< _Tp, n > cv::v_broadcast_element ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

广播向量的第 i 个元素。

方案

{ v[0] v[1] v[2] ... v[SZ] } => { v[i], v[i], v[i] ... v[i] }

限制:0 <= i < nlanes。支持的类型:32 位整数和浮点数 (s32/u32/f32)

◆ v_ceil() [1/2]

template<int n>
v_reg< int, n *2 > cv::v_ceil ( const v_reg< double, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

这是一个重载的成员函数,为方便起见而提供。它与上述函数的区别仅在于所接受的参数不同。

此函数的调用图

◆ v_ceil() [2/2]

template<int n>
v_reg< int, n > cv::v_ceil ( const v_reg< float, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

向上取整。

对每个值向上取整。输入类型为浮点向量 ==> 输出类型为整数向量。

注意
仅适用于浮点类型。
此函数的调用图

◆ v_check_all()

template<typename _Tp , int n>
bool cv::v_check_all ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

检查是否所有打包值都小于零。

无符号值将被转换为有符号:uchar 254 => char -2

◆ v_check_any()

template<typename _Tp , int n>
bool cv::v_check_any ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

检查是否有任何打包值小于零。

无符号值将被转换为有符号:uchar 254 => char -2

◆ v_cleanup()

void cv::v_cleanup ( )
内联

◆ v_combine_high()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_combine_high ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从两个向量的后半部分元素组合成新向量。

方案

{A1 A2 A3 A4}
{B1 B2 B3 B4}
---------------
{A3 A4 B3 B4}

除 64 位外的所有类型。

◆ v_combine_low()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_combine_low ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从两个向量的前半部分元素组合成新向量。

方案

{A1 A2 A3 A4}
{B1 B2 B3 B4}
---------------
{A1 A2 B1 B2}

除 64 位外的所有类型。

◆ v_cos()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_cos ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

元素的余弦值 \( cos(x) \)。

仅适用于浮点类型。核心实现与 v_sincos 相同。

◆ v_cvt_f32() [1/3]

template<int n>
v_reg< float, n *2 > cv::v_cvt_f32 ( const v_reg< double, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

将低半部分转换为 float。

支持的输入类型为 cv::v_float64。

◆ v_cvt_f32() [2/3]

template<int n>
v_reg< float, n *2 > cv::v_cvt_f32 ( const v_reg< double, n > & a,
const v_reg< double, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

转换为 float。

支持的输入类型为 cv::v_float64。

◆ v_cvt_f32() [3/3]

template<int n>
v_reg< float, n > cv::v_cvt_f32 ( const v_reg< int, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

转换为 float。

支持的输入类型为 cv::v_int32。

◆ v_cvt_f64() [1/3]

template<int n>
v_reg< double,(n/2)> cv::v_cvt_f64 ( const v_reg< float, n > & a)

#include <opencv2/core/hal/intrin_cpp.hpp>

将低半部分转换为 double。

支持的输入类型为 cv::v_float32。

◆ v_cvt_f64() [2/3]

template<int n>
v_reg< double, n/2 > cv::v_cvt_f64 ( const v_reg< int, n > & a)

#include <opencv2/core/hal/intrin_cpp.hpp>

将低半部分转换为 double。

支持的输入类型为 cv::v_int32。

◆ v_cvt_f64() [3/3]

template<int n>
v_reg< double, n > cv::v_cvt_f64 ( const v_reg< int64, n > & a)

#include <opencv2/core/hal/intrin_cpp.hpp>

转换为 double。

支持的输入类型为 cv::v_int64。

◆ v_cvt_f64_high() [1/2]

template<int n>
v_reg< double,(n/2)> cv::v_cvt_f64_high ( const v_reg< float, n > & a)

#include <opencv2/core/hal/intrin_cpp.hpp>

将向量的高半部分转换为 double。

支持的输入类型为 cv::v_float32。

◆ v_cvt_f64_high() [2/2]

template<int n>
v_reg< double,(n/2)> cv::v_cvt_f64_high ( const v_reg< int, n > & a)

#include <opencv2/core/hal/intrin_cpp.hpp>

将向量的高半部分转换为 double。

支持的输入类型为 cv::v_int32。

◆ v_div()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_div ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )

#include <opencv2/core/hal/intrin_cpp.hpp>

数值相除。

仅适用于浮点类型。

◆ v_dotprod() [1/2]

template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > cv::v_dotprod ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

元素的点积。

将两个寄存器中的值相乘,并对相邻的结果对求和。

方案

{A1 A2 ...} // 16位
x {B1 B2 ...} // 16位
-------------
{A1B1+A2B2 ...} // 32位

◆ v_dotprod() [2/2]

template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > cv::v_dotprod ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b,
const v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > & c )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

元素的点积。

cv::v_dotprod 相同,但在相邻对的和中加入第三个元素。方案如下:

{A1 A2 ...} // 16位
x {B1 B2 ...} // 16位
-------------
{A1B1+A2B2+C1 ...} // 32位

◆ v_dotprod_expand() [1/4]

template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::q_type, n/4 > cv::v_dotprod_expand ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

点积并扩展。

将两个寄存器中的值相乘,并扩展相邻结果对的和。

方案

{A1 A2 A3 A4 ...} // 8位
x {B1 B2 B3 B4 ...} // 8位
-------------
{A1B1+A2B2+A3B3+A4B4 ...} // 32位

◆ v_dotprod_expand() [2/4]

template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::q_type, n/4 > cv::v_dotprod_expand ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b,
const v_reg< typename V_TypeTraits< _Tp >::q_type, n/4 > & c )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

元素的点积。

cv::v_dotprod_expand 相同,但在相邻对的和中加入第三个元素。方案如下:

{A1 A2 A3 A4 ...} // 8位
x {B1 B2 B3 B4 ...} // 8位
-------------
{A1B1+A2B2+A3B3+A4B4+C1 ...} // 32位

◆ v_dotprod_expand() [3/4]

template<int n>
v_reg< double, n/2 > cv::v_dotprod_expand ( const v_reg< int, n > & a,
const v_reg< int, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

此函数的调用图

◆ v_dotprod_expand() [4/4]

template<int n>
v_reg< double, n/2 > cv::v_dotprod_expand ( const v_reg< int, n > & a,
const v_reg< int, n > & b,
const v_reg< double, n/2 > & c )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

此函数的调用图

◆ v_dotprod_expand_fast() [1/4]

template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::q_type, n/4 > cv::v_dotprod_expand_fast ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

快速点积并扩展。

将两个寄存器中的值相乘,并扩展相邻结果对的和。

cv::v_dotprod_expand 相同,但在某些平台上它可能会在结果对之间执行无序求和。如果只关心所有通道之间的总和,则可以使用此指令,并且在受影响的平台上它应该能产生更好的性能。

此函数的调用图

◆ v_dotprod_expand_fast() [2/4]

template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::q_type, n/4 > cv::v_dotprod_expand_fast ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b,
const v_reg< typename V_TypeTraits< _Tp >::q_type, n/4 > & c )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

快速点积。

cv::v_dotprod_expand_fast 相同,但在相邻对的和中加入第三个元素。

此函数的调用图

◆ v_dotprod_expand_fast() [3/4]

template<int n>
v_reg< double, n/2 > cv::v_dotprod_expand_fast ( const v_reg< int, n > & a,
const v_reg< int, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

此函数的调用图

◆ v_dotprod_expand_fast() [4/4]

template<int n>
v_reg< double, n/2 > cv::v_dotprod_expand_fast ( const v_reg< int, n > & a,
const v_reg< int, n > & b,
const v_reg< double, n/2 > & c )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

此函数的调用图

◆ v_dotprod_fast() [1/2]

template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > cv::v_dotprod_fast ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

快速点积。

cv::v_dotprod 相同,但在某些平台上它可能会在结果对之间执行无序求和。如果只关心所有通道之间的总和,则可以使用此指令,并且在受影响的平台上它应该能产生更好的性能。

此函数的调用图

◆ v_dotprod_fast() [2/2]

template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > cv::v_dotprod_fast ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b,
const v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > & c )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

快速点积。

cv::v_dotprod_fast 相同,但在相邻对的和中加入第三个元素。

此函数的调用图

◆ v_eq()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_eq ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

等于比较。

◆ v_erf()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_erf ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

误差 (Error) 函数。

注意
目前仅支持 FP32 精度。

◆ v_exp()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_exp ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

元素的指数值 \( e^x \)。

仅适用于浮点类型。核心实现步骤:

  1. 分解输入:将输入转换为 \( 2^{x \cdot \log_2e} \) 并将其指数部分拆分为整数部分和小数部分:\( x \cdot \log_2e = n + f \),其中 \( n \) 是整数部分,\( f \) 是小数部分。
  2. 计算 \( 2^n \):通过位移计算。
  3. 调整小数部分:计算 \( f \cdot \ln2 \) 以将小数部分转换为以 \( e \) 为底。\( C1 \) 和 \( C2 \) 用于调整小数部分。
  4. 对 \( e^{f \cdot \ln2} \) 的多项式逼近:小数部分越接近 0,结果越准确。
    • 对于 float16 和 float32,使用 6 项泰勒级数。
    • 对于 float64,使用 4 项 Pade 多项式逼近。
  5. 组合结果:将两个部分相乘得到最终结果:\( e^x = 2^n \cdot e^{f \cdot \ln2} \)。
注意
计算精度取决于实现和输入向量的数据类型。

◆ v_expand()

template<typename _Tp , int n>
void cv::v_expand ( const v_reg< _Tp, n > & a,
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > & b0,
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > & b1 )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

将数值扩展到更宽的打包类型。

将寄存器的内容复制到两个具有 2 倍宽封装类型的寄存器中。方案如下:

int32x4 int64x2 int64x2
{A B C D} ==> {A B} , {C D}

◆ v_expand_high()

template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > cv::v_expand_high ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

将高位数值扩展到更宽的打包类型。

cv::v_expand_low 相同,但改为扩展向量的高半部分。

方案

int32x4 int64x2
{A B C D} ==> {C D}

◆ v_expand_low()

template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > cv::v_expand_low ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

将低位数值扩展到更宽的打包类型。

cv::v_expand 相同,但返回向量的低半部分。

方案

int32x4 int64x2
{A B C D} ==> {A B}

◆ v_extract()

template<int s, typename _Tp , int n>
v_reg< _Tp, n > cv::v_extract ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

向量提取。

方案

{A1 A2 A3 A4}
{B1 B2 B3 B4}
========================
shift = 1 {A2 A3 A4 B1}
shift = 2 {A3 A4 B1 B2}
shift = 3 {A4 B1 B2 B3}

限制条件:0 <= shift < nlanes

用法

v_int32x4 a, b, c;
c = v_extract<2>(a, b);
v_reg< _Tp, n > v_extract(const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
向量提取。
定义位于 intrin_cpp.hpp:2440

适用于所有类型。

◆ v_extract_n()

template<int s, typename _Tp , int n>
_Tp cv::v_extract_n ( const v_reg< _Tp, n > & v)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

向量提取。

方案:返回 v 的第 s 个元素。限制条件:0 <= s < nlanes

用法

int r;
_Tp v_extract_n(const v_reg< _Tp, n > &v)
向量提取。
定义位于 intrin_cpp.hpp:2466

适用于所有类型。

◆ v_floor() [1/2]

template<int n>
v_reg< int, n *2 > cv::v_floor ( const v_reg< double, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

这是一个重载的成员函数,为方便起见而提供。它与上述函数的区别仅在于所接受的参数不同。

此函数的调用图

◆ v_floor() [2/2]

template<int n>
v_reg< int, n > cv::v_floor ( const v_reg< float, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

向下取整。

对每个值向下取整。输入类型为浮点向量 ==> 输出类型为整型向量。

注意
仅适用于浮点类型。
此函数的调用图

◆ v_fma()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_fma ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b,
const v_reg< _Tp, n > & c )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

乘加运算 (FMA)。

返回 \( a*b + c \)。仅适用于浮点类型和有符号 32 位整型。

◆ v_ge()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_ge ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

大于或等于比较。

适用于除 64 位整数值以外的所有类型。

◆ v_gt()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_gt ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

大于比较。

适用于除 64 位整数值以外的所有类型。

◆ v_interleave_pairs()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_interleave_pairs ( const v_reg< _Tp, n > & vec)
内联

◆ v_interleave_quads()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_interleave_quads ( const v_reg< _Tp, n > & vec)
内联

◆ v_invsqrt()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_invsqrt ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

平方根倒数。

返回 \( 1/sqrt(a) \)。仅适用于浮点类型。

◆ v_le()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_le ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

小于或等于比较。

适用于除 64 位整数值以外的所有类型。

◆ v_load()

template<typename _Tp >
v_reg< _Tp, simd128_width/sizeof(_Tp)> cv::v_load ( const _Tp * ptr)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从内存加载寄存器内容。

参数
ptr指向带数据内存块的指针
返回
寄存器对象
注意
返回的类型将从传递的指针类型中检测,例如 uchar ==> cv::v_uint8x16,int ==> cv::v_int32x4 等。
使用 vx_load 版本以获取最大可用寄存器长度的结果。
对齐要求:如果 CV_STRONG_ALIGNMENT=1,则传递的指针必须对齐(sizeof(lane type) 应该足够)。在未进行运行时指针对齐检查的情况下,请勿转换指针类型(如 uchar* => int*)。
此函数的调用图

◆ v_load_aligned()

template<typename _Tp >
v_reg< _Tp, simd128_width/sizeof(_Tp)> cv::v_load_aligned ( const _Tp * ptr)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从内存加载寄存器内容 (对齐加载)

类似于 cv::v_load,但源内存块应该是对齐的(在 SIMD128 的情况下对齐到 16 字节边界,SIMD256 为 32 字节,依此类推)。

注意
使用 vx_load_aligned 版本以获取最大可用寄存器长度的结果。
此函数的调用图

◆ v_load_deinterleave() [1/3]

template<typename _Tp , int n>
void cv::v_load_deinterleave ( const _Tp * ptr,
v_reg< _Tp, n > & a,
v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

加载并去交错 (2 通道)

从内存中解交织加载数据并存储到 2 个寄存器中。方案如下:

{A1 B1 A2 B2 ...} ==> {A1 A2 ...}, {B1 B2 ...}

除 64 位外的所有类型。

此函数的调用图

◆ v_load_deinterleave() [2/3]

template<typename _Tp , int n>
void cv::v_load_deinterleave ( const _Tp * ptr,
v_reg< _Tp, n > & a,
v_reg< _Tp, n > & b,
v_reg< _Tp, n > & c )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

加载并去交错 (3 通道)

从内存中解交织加载数据并存储到 3 个寄存器中。方案如下:

{A1 B1 C1 A2 B2 C2 ...} ==> {A1 A2 ...}, {B1 B2 ...}, {C1 C2 ...}

除 64 位外的所有类型。

此函数的调用图

◆ v_load_deinterleave() [3/3]

template<typename _Tp , int n>
void cv::v_load_deinterleave ( const _Tp * ptr,
v_reg< _Tp, n > & a,
v_reg< _Tp, n > & b,
v_reg< _Tp, n > & c,
v_reg< _Tp, n > & d )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

加载并去交错 (4 通道)

从内存中解交织加载数据并存储到 4 个寄存器中。方案如下:

{A1 B1 C1 D1 A2 B2 C2 D2 ...} ==> {A1 A2 ...}, {B1 B2 ...}, {C1 C2 ...}, {D1 D2 ...}

除 64 位外的所有类型。

此函数的调用图

◆ v_load_expand() [1/2]

template<typename _Tp >
v_reg< typename V_TypeTraits< _Tp >::w_type, simd128_width/sizeof(typename V_TypeTraits< _Tp >::w_type)> cv::v_load_expand ( const _Tp * ptr)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从内存加载寄存器内容并进行双倍扩展 (double expand)。

cv::v_load 相同,但结果封装类型将比内存类型宽 2 倍。

short buf[4] = {1, 2, 3, 4}; // 类型为 int16
v_int32x4 r = v_load_expand(buf); // r = {1, 2, 3, 4} - 类型为 int32
v_reg< typename V_TypeTraits< _Tp >::w_type, simd128_width/sizeof(typename V_TypeTraits< _Tp >::w_type)> v_load_expand(const _Tp *ptr)
从内存加载寄存器内容并进行双倍扩展 (double expand)。
定义位于 intrin_cpp.hpp:1941
v_reg< int, 4 > v_int32x4
4个 32位有符号整数值。
定义位于 intrin_cpp.hpp:518

适用于 8 位、16 位、32 位整数源类型。

注意
使用 vx_load_expand 版本以获取最大可用寄存器长度的结果。
此函数的调用图

◆ v_load_expand() [2/2]

v_reg< float, simd128_width/sizeof(float)> cv::v_load_expand ( const hfloat * ptr)
内联

◆ v_load_expand_q()

template<typename _Tp >
v_reg< typename V_TypeTraits< _Tp >::q_type, simd128_width/sizeof(typename V_TypeTraits< _Tp >::q_type)> cv::v_load_expand_q ( const _Tp * ptr)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从内存加载寄存器内容并进行四倍扩展 (quad expand)。

cv::v_load_expand 相同,但结果类型比源类型宽 4 倍。

char buf[4] = {1, 2, 3, 4}; // 类型为 int8
v_int32x4 r = v_load_expand_q(buf); // r = {1, 2, 3, 4} - 类型为 int32
v_reg< typename V_TypeTraits< _Tp >::q_type, simd128_width/sizeof(typename V_TypeTraits< _Tp >::q_type)> v_load_expand_q(const _Tp *ptr)
从内存加载寄存器内容并进行四倍扩展 (quad expand)。
定义位于 intrin_cpp.hpp:2030

适用于 8 位整数源类型。

注意
使用 vx_load_expand_q 版本以获取最大可用寄存器长度的结果。
此函数的调用图

◆ v_load_halves()

template<typename _Tp >
v_reg< _Tp, simd128_width/sizeof(_Tp)> cv::v_load_halves ( const _Tp * loptr,
const _Tp * hiptr )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从两个内存块加载寄存器内容。

参数
loptr包含前半部分(0..n/2)数据的内存块
hiptr包含后半部分(n/2..n)数据的内存块
int lo[2] = { 1, 2 }, hi[2] = { 3, 4 };
v_reg< _Tp, simd128_width/sizeof(_Tp)> v_load_halves(const _Tp *loptr, const _Tp *hiptr)
从两个内存块加载寄存器内容。
定义位于 intrin_cpp.hpp:1850
注意
使用 vx_load_halves 版本以获取最大可用寄存器长度的结果。
此函数的调用图

◆ v_load_low()

template<typename _Tp >
v_reg< _Tp, simd128_width/sizeof(_Tp)> cv::v_load_low ( const _Tp * ptr)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

加载 64 位数据到低位部分 (高位部分未定义)。

参数
ptr包含前半部分(0..n/2)数据的内存块
int lo[2] = { 1, 2 };
v_reg< _Tp, simd128_width/sizeof(_Tp)> v_load_low(const _Tp *ptr)
加载 64 位数据到低位部分 (高位部分未定义)。
定义位于 intrin_cpp.hpp:1768
注意
使用 vx_load_low 版本以获取最大可用寄存器长度的结果。
此函数的调用图

◆ v_log()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_log ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

元素的自然对数 \( \log(x) \)。

仅适用于浮点类型。核心实现步骤:

  1. 分解输入:利用二进制表示将输入分解为尾数部分 \( m \) 和指数部分 \( e \)。使得 \( \log(x) = \log(m \cdot 2^e) = \log(m) + e \cdot \ln(2) \)。
  2. 调整尾数和指数部分:如果尾数小于 \( \sqrt{0.5} \),则调整指数和尾数,以确保尾数处于 \( (\sqrt{0.5}, \sqrt{2}) \) 范围内,从而获得更好的逼近效果。
  3. 对 \( \log(m) \) 的多项式逼近:\( m \) 越接近 1,结果越准确。
    • 对于 float16 和 float32,使用 9 项泰勒级数。
    • 对于 float64,使用 6 项 Pade 多项式逼近。
  4. 组合结果:将两个部分相加得到最终结果。
注意
计算精度取决于实现和输入的数据类型。
类似于 std::log() 的行为,\( \ln(0) = -\infty \)。

◆ v_lt()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_lt ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

小于比较。

适用于除 64 位整数值以外的所有类型。

◆ v_lut() [1/5]

template<typename _Tp >
v_reg< _Tp, simd128_width/sizeof(_Tp)> cv::v_lut ( const _Tp * tab,
const int * idx (索引) )
内联

◆ v_lut() [2/5]

template<int n>
v_reg< double, n/2 > cv::v_lut ( const double * tab,
const v_reg< int, n > & idx (索引) )
内联

◆ v_lut() [3/5]

template<int n>
v_reg< float, n > cv::v_lut ( const float * tab,
const v_reg< int, n > & idx (索引) )
内联

◆ v_lut() [4/5]

template<int n>
v_reg< int, n > cv::v_lut ( const int * tab,
const v_reg< int, n > & idx (索引) )
内联

◆ v_lut() [5/5]

template<int n>
v_reg< unsigned, n > cv::v_lut ( const unsigned * tab,
const v_reg< int, n > & idx (索引) )
内联

◆ v_lut_deinterleave() [1/2]

template<int n>
void cv::v_lut_deinterleave ( const double * tab,
const v_reg< int, n *2 > & idx (索引),
v_reg< double, n > & x,
v_reg< double, n > & y )
内联

◆ v_lut_deinterleave() [2/2]

template<int n>
void cv::v_lut_deinterleave ( const float * tab,
const v_reg< int, n > & idx (索引),
v_reg< float, n > & x,
v_reg< float, n > & y )
内联

◆ v_lut_pairs()

template<typename _Tp >
v_reg< _Tp, simd128_width/sizeof(_Tp)> cv::v_lut_pairs ( const _Tp * tab,
const int * idx (索引) )
内联

◆ v_lut_quads()

template<typename _Tp >
v_reg< _Tp, simd128_width/sizeof(_Tp)> cv::v_lut_quads ( const _Tp * tab,
const int * idx (索引) )
内联

◆ v_magnitude()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_magnitude ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

模长 (Magnitude)。

返回 \( sqrt(a^2 + b^2) \)。仅适用于浮点类型。

◆ v_matmul()

template<int n>
v_reg< float, n > cv::v_matmul ( const v_reg< float, n > & v,
const v_reg< float, n > & a,
const v_reg< float, n > & b,
const v_reg< float, n > & c,
const v_reg< float, n > & d )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

矩阵乘法。

方案

{A0 A1 A2 A3} |V0|
{B0 B1 B2 B3} |V1|
{C0 C1 C2 C3} |V2|
{D0 D1 D2 D3} x |V3|
====================
{R0 R1 R2 R3},其中
R0 = A0V0 + B0V1 + C0V2 + D0V3,
R1 = A1V0 + B1V1 + C1V2 + D1V3
...

◆ v_matmuladd()

template<int n>
v_reg< float, n > cv::v_matmuladd ( const v_reg< float, n > & v,
const v_reg< float, n > & a,
const v_reg< float, n > & b,
const v_reg< float, n > & c,
const v_reg< float, n > & d )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

矩阵乘加运算。

方案

{A0 A1 A2 A3} |V0| |D0|
{B0 B1 B2 B3} |V1| |D1|
{C0 C1 C2 C3} x |V2| + |D2|
==================== |D3|
{R0 R1 R2 R3},其中
R0 = A0V0 + B0V1 + C0V2 + D0,
R1 = A1V0 + B1V1 + C1V2 + D1
...

◆ v_max()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_max ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

为每对元素选择最大值。

方案

{A1 A2 ...}
{B1 B2 ...}
--------------
{max(A1,B1) max(A2,B2) ...}
void max(InputArray src1, InputArray src2, OutputArray dst)
计算两个数组或数组与标量的逐元素最大值。

适用于除 64 位整数以外的所有类型。

◆ v_min()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_min ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

为每对元素选择最小值。

方案

{A1 A2 ...}
{B1 B2 ...}
--------------
{min(A1,B1) min(A2,B2) ...}
void min(InputArray src1, InputArray src2, OutputArray dst)
计算两个数组或数组与标量的逐元素最小值。

适用于除 64 位整数以外的所有类型。

◆ v_mul()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_mul ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )

#include <opencv2/core/hal/intrin_cpp.hpp>

数值相乘。

适用于 16 位和 32 位整型以及浮点类型。

◆ v_mul_expand()

template<typename _Tp , int n>
void cv::v_mul_expand ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b,
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > & c,
v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > & d )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

相乘并扩展。

将两个寄存器中的值相乘,并将结果存储在两个具有更宽封装类型的寄存器中。方案如下:

{A B C D} // 32位
x {E F G H} // 32位
---------------
{AE BF} // 64位
{CG DH} // 64位

示例:

v_uint32x4 a, b; // {1,2,3,4} 和 {2,2,2,2}
v_uint64x2 c, d; // 结果
v_mul_expand(a, b, c, d); // c, d = {2,4}, {6, 8}
void v_mul_expand(const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b, v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > &c, v_reg< typename V_TypeTraits< _Tp >::w_type, n/2 > &d)
相乘并扩展。
定义位于 intrin_cpp.hpp:1285

仅对 16 位和无符号 32 位源类型(v_int16x8, v_uint16x8, v_uint32x4)实现。

◆ v_mul_hi()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_mul_hi ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

相乘并提取高位部分。

将两个寄存器中的值相乘,并存储结果的高位部分。仅对 16 位源类型(v_int16x8, v_uint16x8)实现。返回 \( a*b >> 16 \)。

◆ v_mul_wrap()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_mul_wrap ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

数值相乘 (不进行饱和处理)。

适用于 8 位和 16 位整数值。

◆ v_muladd()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_muladd ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b,
const v_reg< _Tp, n > & c )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

v_fma 的同义词。

此函数的调用图

◆ v_ne()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_ne ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

不等于比较。

◆ v_not()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_not ( const v_reg< _Tp, n > & a)

#include <opencv2/core/hal/intrin_cpp.hpp>

按位非 (Bitwise NOT)。

仅适用于整数类型。

◆ v_not_nan() [1/2]

template<int n>
v_reg< double, n > cv::v_not_nan ( const v_reg< double, n > & a)
内联

◆ v_not_nan() [2/2]

template<int n>
v_reg< float, n > cv::v_not_nan ( const v_reg< float, n > & a)
内联

◆ v_or()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_or ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )

#include <opencv2/core/hal/intrin_cpp.hpp>

按位或 (Bitwise OR)。

仅适用于整数类型。

◆ v_pack() [1/6]

template<int n>
v_reg< short, 2 *n > cv::v_pack ( const v_reg< int, n > & a,
const v_reg< int, n > & b )
内联

◆ v_pack() [2/6]

template<int n>
v_reg< int, 2 *n > cv::v_pack ( const v_reg< int64, n > & a,
const v_reg< int64, n > & b )
内联

◆ v_pack() [3/6]

template<int n>
v_reg< schar, 2 *n > cv::v_pack ( const v_reg< short, n > & a,
const v_reg< short, n > & b )
内联

◆ v_pack() [4/6]

template<int n>
v_reg< unsigned, 2 *n > cv::v_pack ( const v_reg< uint64, n > & a,
const v_reg< uint64, n > & b )
内联

◆ v_pack() [5/6]

template<int n>
v_reg< ushort, 2 *n > cv::v_pack ( const v_reg< unsigned, n > & a,
const v_reg< unsigned, n > & b )
内联

◆ v_pack() [6/6]

template<int n>
v_reg< uchar, 2 *n > cv::v_pack ( const v_reg< ushort, n > & a,
const v_reg< ushort, n > & b )
内联

◆ v_pack_b() [1/3]

template<int n>
v_reg< uchar, 8 *n > cv::v_pack_b ( const v_reg< uint64, n > & a,
const v_reg< uint64, n > & b,
const v_reg< uint64, n > & c,
const v_reg< uint64, n > & d,
const v_reg< uint64, n > & e,
const v_reg< uint64, n > & f,
const v_reg< uint64, n > & g,
const v_reg< uint64, n > & h )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

这是一个重载的成员函数,为方便起见而提供。它与上述函数的不同之处仅在于它所接受的参数。适用于 64 位布尔值:

方案

a {0xFFFF.. 0}
b {0 0xFFFF..}
c {0xFFFF.. 0}
d {0 0xFFFF..}
e {0xFFFF.. 0}
f {0xFFFF.. 0}
g {0 0xFFFF..}
h {0 0xFFFF..}
===============
{
0xFF 0 0 0xFF 0xFF 0 0 0xFF
0xFF 0 0xFF 0 0 0xFF 0 0xFF
}

◆ v_pack_b() [2/3]

template<int n>
v_reg< uchar, 4 *n > cv::v_pack_b ( const v_reg< unsigned, n > & a,
const v_reg< unsigned, n > & b,
const v_reg< unsigned, n > & c,
const v_reg< unsigned, n > & d )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

这是一个重载的成员函数,为方便起见而提供。它与上述函数的不同之处仅在于它所接受的参数。适用于 32 位布尔值:

方案

a {0xFFFF.. 0 0 0xFFFF..}
b {0 0xFFFF.. 0xFFFF.. 0}
c {0xFFFF.. 0 0xFFFF.. 0}
d {0 0xFFFF.. 0 0xFFFF..}
===============
{
0xFF 0 0 0xFF 0 0xFF 0xFF 0
0xFF 0 0xFF 0 0 0xFF 0 0xFF
}

◆ v_pack_b() [3/3]

template<int n>
v_reg< uchar, 2 *n > cv::v_pack_b ( const v_reg< ushort, n > & a,
const v_reg< ushort, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

! 用于 16 位布尔值

方案

a {0xFFFF 0 0 0xFFFF 0 0xFFFF 0xFFFF 0}
b {0xFFFF 0 0xFFFF 0 0 0xFFFF 0 0xFFFF}
===============
{
0xFF 0 0 0xFF 0 0xFF 0xFF 0
0xFF 0 0xFF 0 0 0xFF 0 0xFF
}

◆ v_pack_store() [1/7]

template<int n>
void cv::v_pack_store ( hfloat * ptr,
const v_reg< float, n > & v )
内联

◆ v_pack_store() [2/7]

template<int n>
void cv::v_pack_store ( int * ptr,
const v_reg< int64, n > & a )
内联

◆ v_pack_store() [3/7]

template<int n>
void cv::v_pack_store ( schar * ptr,
const v_reg< short, n > & a )
内联

◆ v_pack_store() [4/7]

template<int n>
void cv::v_pack_store ( short * ptr,
const v_reg< int, n > & a )
内联

◆ v_pack_store() [5/7]

template<int n>
void cv::v_pack_store ( uchar * ptr,
const v_reg< ushort, n > & a )
内联

◆ v_pack_store() [6/7]

template<int n>
void cv::v_pack_store ( unsigned * ptr,
const v_reg< uint64, n > & a )
内联

◆ v_pack_store() [7/7]

template<int n>
void cv::v_pack_store ( ushort * ptr,
const v_reg< unsigned, n > & a )
内联

◆ v_pack_triplets()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_pack_triplets ( const v_reg< _Tp, n > & vec)
内联

◆ v_pack_u() [1/2]

template<int n>
v_reg< ushort, 2 *n > cv::v_pack_u ( const v_reg< int, n > & a,
const v_reg< int, n > & b )
内联

◆ v_pack_u() [2/2]

template<int n>
v_reg< uchar, 2 *n > cv::v_pack_u ( const v_reg< short, n > & a,
const v_reg< short, n > & b )
内联

◆ v_pack_u_store() [1/2]

template<int n>
void cv::v_pack_u_store ( uchar * ptr,
const v_reg< short, n > & a )
内联

◆ v_pack_u_store() [2/2]

template<int n>
void cv::v_pack_u_store ( ushort * ptr,
const v_reg< int, n > & a )
内联

◆ v_popcount()

template<typename _Tp , int n>
v_reg< typename V_TypeTraits< _Tp >::abs_type, n > cv::v_popcount ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

统计向量通道中 1 位的数量,并以相应的无符号类型返回结果。

方案

{A1 A2 A3 ...} => {popcount(A1), popcount(A2), popcount(A3), ...}

适用于所有整数类型。

此函数的调用图

◆ v_recombine()

template<typename _Tp , int n>
void cv::v_recombine ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b,
v_reg< _Tp, n > & low,
v_reg< _Tp, n > & high )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

从另外两个向量的低位和高位部分组合出两个新向量。

low = cv::v_combine_low(a, b);
high = cv::v_combine_high(a, b);
v_reg< _Tp, n > v_combine_high(const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
从两个向量的后半部分元素组合成新向量。
定义位于 intrin_cpp.hpp:2373
v_reg< _Tp, n > v_combine_low(const v_reg< _Tp, n > &a, const v_reg< _Tp, n > &b)
从两个向量的前半部分元素组合成新向量。
定义位于 intrin_cpp.hpp:2351

◆ v_reduce_max()

template<typename _Tp , int n>
_Tp cv::v_reduce_max ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

寻找一个最大值。

方案

{A1 A2 A3 ...} => max(A1,A2,A3,...)

适用于除 64 位整数和 64 位浮点类型以外的所有类型。

◆ v_reduce_min()

template<typename _Tp , int n>
_Tp cv::v_reduce_min ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

寻找一个最小值。

方案

{A1 A2 A3 ...} => min(A1,A2,A3,...)

适用于除 64 位整数和 64 位浮点类型以外的所有类型。

◆ v_reduce_sad()

template<typename _Tp , int n>
V_TypeTraits< typenameV_TypeTraits< _Tp >::abs_type >::sum_type cv::v_reduce_sad ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

计算数值的绝对差之和 (SAD)。

方案

{A1 A2 A3 ...} {B1 B2 B3 ...} => sum{ABS(A1-B1),abs(A2-B2),abs(A3-B3),...}
Scalar sum(InputArray src)
计算数组元素的总和。
static uchar abs(uchar a)
定义位于 cvstd.hpp:66

适用于除 64 位类型以外的所有类型。

◆ v_reduce_sum()

template<typename _Tp , int n>
V_TypeTraits< _Tp >::sum_type cv::v_reduce_sum ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

对打包值求和。

方案

{A1 A2 A3 ...} => sum{A1,A2,A3,...}

◆ v_reduce_sum4()

template<int n>
v_reg< float, n > cv::v_reduce_sum4 ( const v_reg< float, n > & a,
const v_reg< float, n > & b,
const v_reg< float, n > & c,
const v_reg< float, n > & d )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

对每个输入向量的所有元素求和,并返回由这些和组成的向量。

方案

result[0] = a[0] + a[1] + a[2] + a[3]
result[1] = b[0] + b[1] + b[2] + b[3]
result[2] = c[0] + c[1] + c[2] + c[3]
result[3] = d[0] + d[1] + d[2] + d[3]

◆ v_reinterpret_as_f32()

template<typename _Tp0 , int n0>
v_reg< float, n0 *sizeof(_Tp0)/sizeof(float)> cv::v_reinterpret_as_f32 ( const v_reg< _Tp0, n0 > & a)
内联

◆ v_reinterpret_as_f64()

template<typename _Tp0 , int n0>
v_reg< double, n0 *sizeof(_Tp0)/sizeof(double)> cv::v_reinterpret_as_f64 ( const v_reg< _Tp0, n0 > & a)
内联

◆ v_reinterpret_as_s16()

template<typename _Tp0 , int n0>
v_reg< short, n0 *sizeof(_Tp0)/sizeof(short)> cv::v_reinterpret_as_s16 ( const v_reg< _Tp0, n0 > & a)
内联

◆ v_reinterpret_as_s32()

template<typename _Tp0 , int n0>
v_reg< int, n0 *sizeof(_Tp0)/sizeof(int)> cv::v_reinterpret_as_s32 ( const v_reg< _Tp0, n0 > & a)
内联

◆ v_reinterpret_as_s64()

template<typename _Tp0 , int n0>
int64, n0 *sizeof(_Tp0)/sizeof(int64)> cv::v_reinterpret_as_s64 ( const v_reg< _Tp0, n0 > & a)
内联

◆ v_reinterpret_as_s8()

template<typename _Tp0 , int n0>
v_reg< schar, n0 *sizeof(_Tp0)/sizeof(schar)> cv::v_reinterpret_as_s8 ( const v_reg< _Tp0, n0 > & a)
内联

◆ v_reinterpret_as_u16()

template<typename _Tp0 , int n0>
v_reg< ushort, n0 *sizeof(_Tp0)/sizeof(ushort)> cv::v_reinterpret_as_u16 ( const v_reg< _Tp0, n0 > & a)
内联

◆ v_reinterpret_as_u32()

template<typename _Tp0 , int n0>
v_reg< unsigned, n0 *sizeof(_Tp0)/sizeof(unsigned)> cv::v_reinterpret_as_u32 ( const v_reg< _Tp0, n0 > & a)
内联

◆ v_reinterpret_as_u64()

template<typename _Tp0 , int n0>
v_reg< uint64, n0 *sizeof(_Tp0)/sizeof(uint64)> cv::v_reinterpret_as_u64 ( const v_reg< _Tp0, n0 > & a)
内联

◆ v_reinterpret_as_u8()

template<typename _Tp0 , int n0>
v_reg< uchar, n0 *sizeof(_Tp0)/sizeof(uchar)> cv::v_reinterpret_as_u8 ( const v_reg< _Tp0, n0 > & a)
内联

◆ v_reverse()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_reverse ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

向量元素次序反转。

反转向量的顺序。方案如下:

REG {A1 ... An} ==> REG {An ... A1}

适用于所有类型。

◆ v_rotate_left() [1/2]

template<int imm, typename _Tp , int n>
v_reg< _Tp, n > cv::v_rotate_left ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

向量内元素向左平移。

适用于所有类型

◆ v_rotate_left() [2/2]

template<int imm, typename _Tp , int n>
v_reg< _Tp, n > cv::v_rotate_left ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

◆ v_rotate_right() [1/2]

template<int imm, typename _Tp , int n>
v_reg< _Tp, n > cv::v_rotate_right ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

向量内元素向右平移。

适用于所有类型

◆ v_rotate_right() [2/2]

template<int imm, typename _Tp , int n>
v_reg< _Tp, n > cv::v_rotate_right ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

◆ v_round() [1/3]

template<int n>
v_reg< int, n *2 > cv::v_round ( const v_reg< double, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

这是一个重载的成员函数,为方便起见而提供。它与上述函数的区别仅在于所接受的参数不同。

此函数的调用图

◆ v_round() [2/3]

template<int n>
v_reg< int, n *2 > cv::v_round ( const v_reg< double, n > & a,
const v_reg< double, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

这是一个重载的成员函数,为方便起见而提供。它与上述函数的区别仅在于所接受的参数不同。

此函数的调用图

◆ v_round() [3/3]

template<int n>
v_reg< int, n > cv::v_round ( const v_reg< float, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

元素舍入。

四舍五入每个值。输入类型为浮点向量 ==> 输出类型为整型向量。

注意
仅适用于浮点类型。
此函数的调用图

◆ v_rshr() [1/6]

template<int shift, int n>
v_reg< int, n > cv::v_rshr ( const v_reg< int, n > & a)
内联

◆ v_rshr() [2/6]

template<int shift, int n>
v_reg< int64, n > cv::v_rshr ( const v_reg< int64, n > & a)
内联

◆ v_rshr() [3/6]

template<int shift, int n>
v_reg< short, n > cv::v_rshr ( const v_reg< short, n > & a)
内联

◆ v_rshr() [4/6]

template<int shift, int n>
v_reg< uint64, n > cv::v_rshr ( const v_reg< uint64, n > & a)
内联

◆ v_rshr() [5/6]

template<int shift, int n>
v_reg< unsigned, n > cv::v_rshr ( const v_reg< unsigned, n > & a)
内联

◆ v_rshr() [6/6]

template<int shift, int n>
v_reg< ushort, n > cv::v_rshr ( const v_reg< ushort, n > & a)
内联

◆ v_rshr_pack() [1/6]

template<int shift, int n>
v_reg< short, 2 *n > cv::v_rshr_pack ( const v_reg< int, n > & a,
const v_reg< int, n > & b )
内联

◆ v_rshr_pack() [2/6]

template<int shift, int n>
v_reg< int, 2 *n > cv::v_rshr_pack ( const v_reg< int64, n > & a,
const v_reg< int64, n > & b )
内联

◆ v_rshr_pack() [3/6]

template<int shift, int n>
v_reg< schar, 2 *n > cv::v_rshr_pack ( const v_reg< short, n > & a,
const v_reg< short, n > & b )
内联

◆ v_rshr_pack() [4/6]

template<int shift, int n>
v_reg< unsigned, 2 *n > cv::v_rshr_pack ( const v_reg< uint64, n > & a,
const v_reg< uint64, n > & b )
内联

◆ v_rshr_pack() [5/6]

template<int shift, int n>
v_reg< ushort, 2 *n > cv::v_rshr_pack ( const v_reg< unsigned, n > & a,
const v_reg< unsigned, n > & b )
内联

◆ v_rshr_pack() [6/6]

template<int shift, int n>
v_reg< uchar, 2 *n > cv::v_rshr_pack ( const v_reg< ushort, n > & a,
const v_reg< ushort, n > & b )
内联

◆ v_rshr_pack_store() [1/6]

template<int shift, int n>
void cv::v_rshr_pack_store ( int * ptr,
const v_reg< int64, n > & a )
内联

◆ v_rshr_pack_store() [2/6]

template<int shift, int n>
void cv::v_rshr_pack_store ( schar * ptr,
const v_reg< short, n > & a )
内联

◆ v_rshr_pack_store() [3/6]

template<int shift, int n>
void cv::v_rshr_pack_store ( short * ptr,
const v_reg< int, n > & a )
内联

◆ v_rshr_pack_store() [4/6]

template<int shift, int n>
void cv::v_rshr_pack_store ( uchar * ptr,
const v_reg< ushort, n > & a )
内联

◆ v_rshr_pack_store() [5/6]

template<int shift, int n>
void cv::v_rshr_pack_store ( unsigned * ptr,
const v_reg< uint64, n > & a )
内联

◆ v_rshr_pack_store() [6/6]

template<int shift, int n>
void cv::v_rshr_pack_store ( ushort * ptr,
const v_reg< unsigned, n > & a )
内联

◆ v_rshr_pack_u() [1/2]

template<int shift, int n>
v_reg< ushort, 2 *n > cv::v_rshr_pack_u ( const v_reg< int, n > & a,
const v_reg< int, n > & b )
内联

◆ v_rshr_pack_u() [2/2]

template<int shift, int n>
v_reg< uchar, 2 *n > cv::v_rshr_pack_u ( const v_reg< short, n > & a,
const v_reg< short, n > & b )
内联

◆ v_rshr_pack_u_store() [1/2]

template<int shift, int n>
void cv::v_rshr_pack_u_store ( uchar * ptr,
const v_reg< short, n > & a )
内联

◆ v_rshr_pack_u_store() [2/2]

template<int shift, int n>
void cv::v_rshr_pack_u_store ( ushort * ptr,
const v_reg< int, n > & a )
内联

◆ v_scan_forward()

template<typename _Tp , int n>
int cv::v_scan_forward ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

获取第一个负值通道的索引。

返回值为第一个负值通道的索引(如果输入全为正值,则结果未定义)。示例:

v_int32x4 r; // 设置为 {0, 0, -1, -1}
int idx = v_heading_zeros(r); // idx = 2

◆ v_select()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_select ( const v_reg< _Tp, n > & mask,
const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

逐元素选择 (混合操作/blend operation)

返回值将通过以下方案组合 ab 的值来构建:result[i] = mask[i] ? a[i] : b[i];

注意
mask 元素的值仅限于以下取值:
  • 0:选择 b 中的元素
  • 0xff/0xffff/等:选择 a 中的元素(与基于位运算的操作符完全兼容)

◆ v_setall_() [1/10]

template<>
v_float64x2 cv::v_setall_ ( double val)
内联

◆ v_setall_() [2/10]

template<>
v_float32x4 cv::v_setall_ ( float val)
内联

◆ v_setall_() [3/10]

template<>
v_int32x4 cv::v_setall_ ( int val)
内联

◆ v_setall_() [4/10]

template<>
v_int64x2 cv::v_setall_ ( int64 val)
内联

◆ v_setall_() [5/10]

template<>
v_int8x16 cv::v_setall_ ( schar val)
内联

◆ v_setall_() [6/10]

template<>
v_int16x8 cv::v_setall_ ( short val)
内联

◆ v_setall_() [7/10]

template<>
v_uint8x16 cv::v_setall_ ( uchar val)
内联

◆ v_setall_() [8/10]

template<>
v_uint64x2 cv::v_setall_ ( uint64 val)
内联

◆ v_setall_() [9/10]

template<>
v_uint32x4 cv::v_setall_ ( unsigned val)
内联

◆ v_setall_() [10/10]

template<>
v_uint16x8 cv::v_setall_ ( ushort val)
内联

◆ v_setall_f32()

v_float32x4 cv::v_setall_f32 ( float val)
内联

◆ v_setall_f64()

v_float64x2 cv::v_setall_f64 ( double val)
内联

◆ v_setall_s16()

v_int16x8 cv::v_setall_s16 ( short val)
内联

◆ v_setall_s32()

v_int32x4 cv::v_setall_s32 ( int val)
内联

◆ v_setall_s64()

v_int64x2 cv::v_setall_s64 ( int64 val)
内联

◆ v_setall_s8()

v_int8x16 cv::v_setall_s8 ( schar val)
内联

◆ v_setall_u16()

v_uint16x8 cv::v_uint16x8 ( ushort val)
内联

◆ v_setall_u32()

v_uint32x4 cv::v_setall_u32 ( unsigned val)
内联

◆ v_setall_u64()

v_uint64x2 cv::v_setall_u64 ( uint64 val)
内联

◆ v_setall_u8()

v_uint8x16 cv::v_setall_u8 ( uchar val)
内联

◆ v_setzero_()

template<>
v_uint8x16 cv::v_setzero_ ( )
内联

◆ v_setzero_f32()

v_float32x4 cv::v_setzero_f32 ( )
内联

◆ v_setzero_f64()

v_float64x2 cv::v_setzero_f64 ( )
内联

◆ v_setzero_s16()

v_int16x8 cv::v_setzero_s16 ( )
内联

◆ v_setzero_s32()

v_int32x4 cv::v_setzero_s32 ( )
内联

◆ v_setzero_s64()

v_int64x2 cv::v_setzero_s64 ( )
内联

◆ v_setzero_s8()

v_int8x16 cv::v_setzero_s8 ( )
内联

◆ v_setzero_u16()

v_uint16x8 cv::v_setzero_u16 ( )
内联

◆ v_setzero_u32()

v_uint32x4 cv::v_setzero_u32 ( )
内联

◆ v_setzero_u64()

v_uint64x2 cv::v_setzero_u64 ( )
内联

◆ v_setzero_u8()

v_uint8x16 cv::v_setzero_u8 ( )
内联

◆ v_shl() [1/7]

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_shl ( const v_reg< _Tp, n > & a,
int imm )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

按位左移。

适用于 16 位、32 位和 64 位整数值。

◆ v_shl() [2/7]

template<int shift, int n>
v_reg< int, n > cv::v_shl ( const v_reg< int, n > & a)
内联

◆ v_shl() [3/7]

template<int shift, int n>
v_reg< int64, n > cv::v_shl ( const v_reg< int64, n > & a)
内联

◆ v_shl() [4/7]

template<int shift, int n>
v_reg< short, n > cv::v_shl ( const v_reg< short, n > & a)
内联

◆ v_shl() [5/7]

template<int shift, int n>
v_reg< uint64, n > cv::v_shl ( const v_reg< uint64, n > & a)
内联

◆ v_shl() [6/7]

template<int shift, int n>
v_reg< unsigned, n > cv::v_shl ( const v_reg< unsigned, n > & a)
内联

◆ v_shl() [7/7]

template<int shift, int n>
v_reg< ushort, n > cv::v_shl ( const v_reg< ushort, n > & a)
内联

◆ v_shr() [1/7]

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_shr ( const v_reg< _Tp, n > & a,
int imm )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

按位右移。

适用于 16 位、32 位和 64 位整数值。

◆ v_shr() [2/7]

template<int shift, int n>
v_reg< int, n > cv::v_shr ( const v_reg< int, n > & a)
内联

◆ v_shr() [3/7]

template<int shift, int n>
v_reg< int64, n > cv::v_shr ( const v_reg< int64, n > & a)
内联

◆ v_shr() [4/7]

template<int shift, int n>
v_reg< short, n > cv::v_shr ( const v_reg< short, n > & a)
内联

◆ v_shr() [5/7]

template<int shift, int n>
v_reg< uint64, n > cv::v_shr ( const v_reg< uint64, n > & a)
内联

◆ v_shr() [6/7]

template<int shift, int n>
v_reg< unsigned, n > cv::v_shr ( const v_reg< unsigned, n > & a)
内联

◆ v_shr() [7/7]

template<int shift, int n>
v_reg< ushort, n > cv::v_shr ( const v_reg< ushort, n > & a)
内联

◆ v_signmask()

template<typename _Tp , int n>
int cv::v_signmask ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

获取负值掩码。

已弃用
v_signmask 严重依赖于通道数量,因此通用性不够。

返回值为一个位掩码,在对应于负封装值索引的位置设置位为 1。示例:

v_int32x4 r; // 设置为 {-1, -1, 1, 1}
int mask = v_signmask(r); // mask = 3 <== 00000000 00000000 00000000 00000011
int v_signmask(const v_reg< _Tp, n > &a)
获取负值掩码。
定义位于 intrin_cpp.hpp:1461

◆ v_sin()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_sin ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

元素的正弦值 \( sin(x) \)。

仅适用于浮点类型。核心实现与 v_sincos 相同。

◆ v_sincos()

template<typename _Tp , int n>
void cv::v_sincos ( const v_reg< _Tp, n > & x,
v_reg< _Tp, n > & s,
v_reg< _Tp, n > & c )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

同时计算元素的正弦 \( sin(x) \) 和余弦 \( cos(x) \)。

仅适用于浮点类型。核心实现步骤:

  1. 输入归一化:将周期从 2π 缩放为 4,并利用周期性和三角恒等式将角度减小到 \( [0, \frac{\pi}{4}] \) 范围内。
  2. 对 \( sin(x) \) 和 \( cos(x) \) 的多项式逼近:
    • 对于 float16 和 float32,正弦使用 4 项泰勒级数,余弦使用 5 项泰勒级数。
    • 对于 float64,正弦使用 7 项泰勒级数,余弦使用 8 项泰勒级数。
  3. 选择结果:针对原始输入角度选择并转换最终的正弦和余弦值。
注意
计算精度取决于实现和输入向量的数据类型。

◆ v_sqr_magnitude()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_sqr_magnitude ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

模长的平方。

返回 \( a^2 + b^2 \)。仅适用于浮点类型。

◆ v_sqrt()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_sqrt ( const v_reg< _Tp, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

元素的平方根。

仅适用于浮点类型。

◆ v_store() [1/2]

template<typename _Tp , int n>
void cv::v_store ( _Tp * ptr,
const v_reg< _Tp, n > & a )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

将数据存储到内存。

将寄存器内容存储到内存中。方案如下:

REG {A B C D} ==> MEM {A B C D}

指针可以是不对齐的。

此函数的调用图

◆ v_store() [2/2]

template<typename _Tp , int n>
void cv::v_store ( _Tp * ptr,
const v_reg< _Tp, n > & a,
hal::StoreMode  )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

此函数的调用图

◆ v_store_aligned() [1/2]

template<typename _Tp , int n>
void cv::v_store_aligned ( _Tp * ptr,
const v_reg< _Tp, n > & a )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

将数据存储到内存 (对齐存储)

将寄存器内容存储到内存中。方案如下:

REG {A B C D} ==> MEM {A B C D}

指针应当按 16 字节边界对齐。

此函数的调用图

◆ v_store_aligned() [2/2]

template<typename _Tp , int n>
void cv::v_store_aligned ( _Tp * ptr,
const v_reg< _Tp, n > & a,
hal::StoreMode  )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

此函数的调用图

◆ v_store_aligned_nocache()

template<typename _Tp , int n>
void cv::v_store_aligned_nocache ( _Tp * ptr,
const v_reg< _Tp, n > & a )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

此函数的调用图

◆ v_store_high()

template<typename _Tp , int n>
void cv::v_store_high ( _Tp * ptr,
const v_reg< _Tp, n > & a )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

将数据存储到内存 (高半部分)

将寄存器内容的高半部分存储到内存中。方案如下:

REG {A B C D} ==> MEM {C D}
此函数的调用图

◆ v_store_interleave() [1/3]

template<typename _Tp , int n>
void cv::v_store_interleave ( _Tp * ptr,
const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b,
const v_reg< _Tp, n > & c,
const v_reg< _Tp, n > & d,
hal::StoreMode = hal::STORE_UNALIGNED )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

交错并存储 (4 通道)

将 4 个寄存器中的数据交织存储到内存中。方案如下:

{A1 A2 ...}, {B1 B2 ...}, {C1 C2 ...}, {D1 D2 ...} ==> {A1 B1 C1 D1 A2 B2 C2 D2 ...}

除 64 位外的所有类型。

此函数的调用图

◆ v_store_interleave() [2/3]

template<typename _Tp , int n>
void cv::v_store_interleave ( _Tp * ptr,
const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b,
const v_reg< _Tp, n > & c,
hal::StoreMode = hal::STORE_UNALIGNED )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

交错并存储 (3 通道)

将 3 个寄存器中的数据交织存储到内存中。方案如下:

{A1 A2 ...}, {B1 B2 ...}, {C1 C2 ...} ==> {A1 B1 C1 A2 B2 C2 ...}

除 64 位外的所有类型。

此函数的调用图

◆ v_store_interleave() [3/3]

template<typename _Tp , int n>
void cv::v_store_interleave ( _Tp * ptr,
const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b,
hal::StoreMode = hal::STORE_UNALIGNED )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

交错并存储 (2 通道)

将 2 个寄存器中的数据交织存储到内存中。方案如下:

{A1 A2 ...}, {B1 B2 ...} ==> {A1 B1 A2 B2 ...}

除 64 位外的所有类型。

此函数的调用图

◆ v_store_low()

template<typename _Tp , int n>
void cv::v_store_low ( _Tp * ptr,
const v_reg< _Tp, n > & a )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

将数据存储到内存 (低半部分)

将寄存器内容的低半部分存储到内存中。方案如下:

REG {A B C D} ==> MEM {A B}
此函数的调用图

◆ v_sub()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_sub ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )

#include <opencv2/core/hal/intrin_cpp.hpp>

数值相减。

适用于所有类型。

◆ v_sub_wrap()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_sub_wrap ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

数值相减 (不进行饱和处理)。

适用于 8 位和 16 位整数值。

◆ v_transpose4x4()

template<typename _Tp , int n>
void cv::v_transpose4x4 ( v_reg< _Tp, n > & a0,
const v_reg< _Tp, n > & a1,
const v_reg< _Tp, n > & a2,
const v_reg< _Tp, n > & a3,
v_reg< _Tp, n > & b0,
v_reg< _Tp, n > & b1,
v_reg< _Tp, n > & b2,
v_reg< _Tp, n > & b3 )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

4x4 矩阵转置。

方案

a0 {A1 A2 A3 A4}
a1 {B1 B2 B3 B4}
a2 {C1 C2 C3 C4}
a3 {D1 D2 D3 D4}
===============
b0 {A1 B1 C1 D1}
b1 {A2 B2 C2 D2}
b2 {A3 B3 C3 D3}
b3 {A4 B4 C4 D4}

◆ v_trunc() [1/2]

template<int n>
v_reg< int, n *2 > cv::v_trunc ( const v_reg< double, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

这是一个重载的成员函数,为方便起见而提供。它与上述函数的区别仅在于所接受的参数不同。

◆ v_trunc() [2/2]

template<int n>
v_reg< int, n > cv::v_trunc ( const v_reg< float, n > & a)
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

元素截断 (取整)。

截断每个值。输入类型为浮点向量 ==> 输出类型为整型向量。

注意
仅适用于浮点类型。

◆ v_xor()

template<typename _Tp , int n>
v_reg< _Tp, n > cv::v_xor ( const v_reg< _Tp, n > & a,
const v_reg< _Tp, n > & b )

#include <opencv2/core/hal/intrin_cpp.hpp>

按位异或 (Bitwise XOR)。

仅适用于整数类型。

◆ v_zip()

template<typename _Tp , int n>
void cv::v_zip ( const v_reg< _Tp, n > & a0,
const v_reg< _Tp, n > & a1,
v_reg< _Tp, n > & b0,
v_reg< _Tp, n > & b1 )
内联

#include <opencv2/core/hal/intrin_cpp.hpp>

交织两个向量。

方案

{A1 A2 A3 A4}
{B1 B2 B3 B4}
---------------
{A1 B1 A2 B2} 和 {A3 B3 A4 B4}

除 64 位外的所有类型。

变量文档

◆ popCountTable

const unsigned char cv::popCountTable[]
static (静态)

#include <opencv2/core/hal/intrin_cpp.hpp>

初始值
=
{
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8,
}