mirror of
https://github.com/opencv/opencv.git
synced 2025-06-23 04:01:31 +08:00
Merge pull request #22278 from hanliutong:fix
This commit is contained in:
commit
47f30a04d2
@ -695,236 +695,14 @@ namespace CV__SIMD_NAMESPACE {
|
|||||||
/** @brief SIMD processing state cleanup call */
|
/** @brief SIMD processing state cleanup call */
|
||||||
inline void vx_cleanup() { VXPREFIX(_cleanup)(); }
|
inline void vx_cleanup() { VXPREFIX(_cleanup)(); }
|
||||||
|
|
||||||
#if CV_SIMD
|
#if !CV_SIMD_SCALABLE
|
||||||
// Compatibility layer
|
// Compatibility layer
|
||||||
#define CV_SIMD_SCALABLE 0
|
|
||||||
#define CV_SIMD_SCALABLE_64F 0
|
|
||||||
|
|
||||||
template <class T>
|
template<typename T> struct VTraits {
|
||||||
struct VTraits;
|
static inline int vlanes() { return T::nlanes; }
|
||||||
#if CV_SIMD512 && (!defined(CV__SIMD_FORCE_WIDTH) || CV__SIMD_FORCE_WIDTH == 512)
|
enum { nlanes = T::nlanes, max_nlanes = T::nlanes };
|
||||||
template <>
|
using lane_type = typename T::lane_type;
|
||||||
struct VTraits<v_uint8>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_uint8::nlanes; }
|
|
||||||
enum { nlanes = 64, max_nlanes = nlanes };
|
|
||||||
using lane_type = uchar;
|
|
||||||
};
|
};
|
||||||
template <>
|
|
||||||
struct VTraits<v_int8>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_int8::nlanes; }
|
|
||||||
enum { nlanes = 64, max_nlanes = nlanes };
|
|
||||||
using lane_type = schar;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_uint16>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_uint16::nlanes; }
|
|
||||||
enum { nlanes = 32, max_nlanes = nlanes };
|
|
||||||
using lane_type = ushort;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_int16>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_int16::nlanes; }
|
|
||||||
enum { nlanes = 32, max_nlanes = nlanes };
|
|
||||||
using lane_type = short;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_uint32>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_uint32::nlanes; }
|
|
||||||
enum { nlanes = 16, max_nlanes = nlanes };
|
|
||||||
using lane_type = uint;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_int32>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_int32::nlanes; }
|
|
||||||
enum { nlanes = 16, max_nlanes = nlanes };
|
|
||||||
using lane_type = int;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_float32>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_float32::nlanes; }
|
|
||||||
enum { nlanes = 16, max_nlanes = nlanes };
|
|
||||||
using lane_type = float;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_uint64>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_uint64::nlanes; }
|
|
||||||
enum { nlanes = 8, max_nlanes = nlanes };
|
|
||||||
using lane_type = uint64;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_int64>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_int64::nlanes; }
|
|
||||||
enum { nlanes = 8, max_nlanes = nlanes };
|
|
||||||
using lane_type = int64;
|
|
||||||
};
|
|
||||||
#if CV_SIMD_64F
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_float64>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_float64::nlanes; }
|
|
||||||
enum { nlanes = 8, max_nlanes = nlanes };
|
|
||||||
using lane_type = double;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
#elif CV_SIMD256 && (!defined(CV__SIMD_FORCE_WIDTH) || CV__SIMD_FORCE_WIDTH == 256)
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_uint8>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_uint8::nlanes; }
|
|
||||||
enum { nlanes = 32, max_nlanes = nlanes };
|
|
||||||
using lane_type = uchar;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_int8>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_int8::nlanes; }
|
|
||||||
enum { nlanes = 32, max_nlanes = nlanes };
|
|
||||||
using lane_type = schar;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_uint16>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_uint16::nlanes; }
|
|
||||||
enum { nlanes = 16, max_nlanes = nlanes };
|
|
||||||
using lane_type = ushort;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_int16>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_int16::nlanes; }
|
|
||||||
enum { nlanes = 16, max_nlanes = nlanes };
|
|
||||||
using lane_type = short;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_uint32>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_uint32::nlanes; }
|
|
||||||
enum { nlanes = 8, max_nlanes = nlanes };
|
|
||||||
using lane_type = uint;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_int32>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_int32::nlanes; }
|
|
||||||
enum { nlanes = 8, max_nlanes = nlanes };
|
|
||||||
using lane_type = int;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_float32>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_float32::nlanes; }
|
|
||||||
enum { nlanes = 8, max_nlanes = nlanes };
|
|
||||||
using lane_type = float;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_uint64>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_uint64::nlanes; }
|
|
||||||
enum { nlanes = 4, max_nlanes = nlanes };
|
|
||||||
using lane_type = uint64;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_int64>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_int64::nlanes; }
|
|
||||||
enum { nlanes = 4, max_nlanes = nlanes };
|
|
||||||
using lane_type = int64;
|
|
||||||
};
|
|
||||||
#if CV_SIMD_64F
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_float64>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_float64::nlanes; }
|
|
||||||
enum { nlanes = 4, max_nlanes = nlanes };
|
|
||||||
using lane_type = double;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
#elif CV_SIMD128 && (!defined(CV__SIMD_FORCE_WIDTH) || CV__SIMD_FORCE_WIDTH == 128)
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_uint8>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_uint8::nlanes; }
|
|
||||||
enum { nlanes = 16, max_nlanes = nlanes };
|
|
||||||
using lane_type = uchar;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_int8>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_int8::nlanes; }
|
|
||||||
enum { nlanes = 16, max_nlanes = nlanes };
|
|
||||||
using lane_type = schar;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_uint16>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_uint16::nlanes; }
|
|
||||||
enum { nlanes = 8, max_nlanes = nlanes };
|
|
||||||
using lane_type = ushort;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_int16>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_int16::nlanes; }
|
|
||||||
enum { nlanes = 8, max_nlanes = nlanes };
|
|
||||||
using lane_type = short;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_uint32>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_uint32::nlanes; }
|
|
||||||
enum { nlanes = 4, max_nlanes = nlanes };
|
|
||||||
using lane_type = uint;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_int32>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_int32::nlanes; }
|
|
||||||
enum { nlanes = 4, max_nlanes = nlanes };
|
|
||||||
using lane_type = int;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_float32>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_float32::nlanes; }
|
|
||||||
enum { nlanes = 4, max_nlanes = nlanes };
|
|
||||||
using lane_type = float;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_uint64>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_uint64::nlanes; }
|
|
||||||
enum { nlanes = 2, max_nlanes = nlanes };
|
|
||||||
using lane_type = uint64;
|
|
||||||
};
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_int64>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_int64::nlanes; }
|
|
||||||
enum { nlanes = 2, max_nlanes = nlanes };
|
|
||||||
using lane_type = int64;
|
|
||||||
};
|
|
||||||
#if CV_SIMD_64F
|
|
||||||
template <>
|
|
||||||
struct VTraits<v_float64>
|
|
||||||
{
|
|
||||||
static inline int vlanes() { return v_float64::nlanes; }
|
|
||||||
enum { nlanes = 2, max_nlanes = nlanes };
|
|
||||||
using lane_type = double;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define OPENCV_HAL_WRAP_BIN_OP_ADDSUB(_Tpvec) \
|
#define OPENCV_HAL_WRAP_BIN_OP_ADDSUB(_Tpvec) \
|
||||||
inline _Tpvec v_add(const _Tpvec& a, const _Tpvec& b) \
|
inline _Tpvec v_add(const _Tpvec& a, const _Tpvec& b) \
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include "opencv2/core/utility.hpp"
|
||||||
#include "opencv2/core/saturate.hpp"
|
#include "opencv2/core/saturate.hpp"
|
||||||
|
|
||||||
//! @cond IGNORED
|
//! @cond IGNORED
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#define OPENCV_CORE_SATURATE_HPP
|
#define OPENCV_CORE_SATURATE_HPP
|
||||||
|
|
||||||
#include "opencv2/core/cvdef.h"
|
#include "opencv2/core/cvdef.h"
|
||||||
|
#include <climits>
|
||||||
#include "opencv2/core/fast_math.hpp"
|
#include "opencv2/core/fast_math.hpp"
|
||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
|
@ -25,61 +25,7 @@ void test_hal_intrin_float16();
|
|||||||
template <typename R> struct Data;
|
template <typename R> struct Data;
|
||||||
template <int N> struct initializer;
|
template <int N> struct initializer;
|
||||||
|
|
||||||
#if CV_SIMD
|
#if CV_SIMD_SCALABLE
|
||||||
template <> struct initializer<64>
|
|
||||||
{
|
|
||||||
template <typename R> static R init(const Data<R> & d)
|
|
||||||
{
|
|
||||||
return R(d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15],
|
|
||||||
d[16], d[17], d[18], d[19], d[20], d[21], d[22], d[23], d[24], d[25], d[26], d[27], d[28], d[29], d[30], d[31],
|
|
||||||
d[32], d[33], d[34], d[35], d[36], d[37], d[38], d[39], d[40], d[41], d[42], d[43], d[44], d[45], d[46], d[47],
|
|
||||||
d[48], d[49], d[50], d[51], d[52], d[53], d[54], d[55], d[56], d[57], d[58], d[59], d[60], d[61], d[62], d[63]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct initializer<32>
|
|
||||||
{
|
|
||||||
template <typename R> static R init(const Data<R> & d)
|
|
||||||
{
|
|
||||||
return R(d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15],
|
|
||||||
d[16], d[17], d[18], d[19], d[20], d[21], d[22], d[23], d[24], d[25], d[26], d[27], d[28], d[29], d[30], d[31]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct initializer<16>
|
|
||||||
{
|
|
||||||
template <typename R> static R init(const Data<R> & d)
|
|
||||||
{
|
|
||||||
return R(d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct initializer<8>
|
|
||||||
{
|
|
||||||
template <typename R> static R init(const Data<R> & d)
|
|
||||||
{
|
|
||||||
return R(d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct initializer<4>
|
|
||||||
{
|
|
||||||
template <typename R> static R init(const Data<R> & d)
|
|
||||||
{
|
|
||||||
return R(d[0], d[1], d[2], d[3]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct initializer<2>
|
|
||||||
{
|
|
||||||
template <typename R> static R init(const Data<R> & d)
|
|
||||||
{
|
|
||||||
return R(d[0], d[1]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
template <> struct initializer<128>
|
template <> struct initializer<128>
|
||||||
{
|
{
|
||||||
template <typename R> static R init(const Data<R> & d)
|
template <typename R> static R init(const Data<R> & d)
|
||||||
@ -146,6 +92,59 @@ template <> struct initializer<2>
|
|||||||
return v_load({d[0], d[1]});
|
return v_load({d[0], d[1]});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
template <> struct initializer<64>
|
||||||
|
{
|
||||||
|
template <typename R> static R init(const Data<R> & d)
|
||||||
|
{
|
||||||
|
return R(d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15],
|
||||||
|
d[16], d[17], d[18], d[19], d[20], d[21], d[22], d[23], d[24], d[25], d[26], d[27], d[28], d[29], d[30], d[31],
|
||||||
|
d[32], d[33], d[34], d[35], d[36], d[37], d[38], d[39], d[40], d[41], d[42], d[43], d[44], d[45], d[46], d[47],
|
||||||
|
d[48], d[49], d[50], d[51], d[52], d[53], d[54], d[55], d[56], d[57], d[58], d[59], d[60], d[61], d[62], d[63]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct initializer<32>
|
||||||
|
{
|
||||||
|
template <typename R> static R init(const Data<R> & d)
|
||||||
|
{
|
||||||
|
return R(d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15],
|
||||||
|
d[16], d[17], d[18], d[19], d[20], d[21], d[22], d[23], d[24], d[25], d[26], d[27], d[28], d[29], d[30], d[31]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct initializer<16>
|
||||||
|
{
|
||||||
|
template <typename R> static R init(const Data<R> & d)
|
||||||
|
{
|
||||||
|
return R(d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct initializer<8>
|
||||||
|
{
|
||||||
|
template <typename R> static R init(const Data<R> & d)
|
||||||
|
{
|
||||||
|
return R(d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct initializer<4>
|
||||||
|
{
|
||||||
|
template <typename R> static R init(const Data<R> & d)
|
||||||
|
{
|
||||||
|
return R(d[0], d[1], d[2], d[3]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> struct initializer<2>
|
||||||
|
{
|
||||||
|
template <typename R> static R init(const Data<R> & d)
|
||||||
|
{
|
||||||
|
return R(d[0], d[1]);
|
||||||
|
}
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
|
||||||
@ -1726,8 +1725,122 @@ template<typename R> struct TheTest
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if CV_SIMD_SCALABLE //Temporary
|
||||||
|
#define DUMP_ENTRY(type) printf("SIMD: %s\n", CV__TRACE_FUNCTION);
|
||||||
|
|
||||||
|
|
||||||
|
//============= 8-bit integer =====================================================================
|
||||||
|
|
||||||
|
void test_hal_intrin_uint8()
|
||||||
|
{
|
||||||
|
DUMP_ENTRY(v_uint8);
|
||||||
|
// typedef v_uint8 R;
|
||||||
|
TheTest<v_uint8>()
|
||||||
|
.test_loadstore()
|
||||||
|
.test_min_max()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_hal_intrin_int8()
|
||||||
|
{
|
||||||
|
DUMP_ENTRY(v_int8);
|
||||||
|
// typedef v_int8 R;
|
||||||
|
TheTest<v_int8>()
|
||||||
|
.test_loadstore()
|
||||||
|
.test_min_max()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
//============= 16-bit integer =====================================================================
|
||||||
|
|
||||||
|
void test_hal_intrin_uint16()
|
||||||
|
{
|
||||||
|
DUMP_ENTRY(v_uint16);
|
||||||
|
// typedef v_uint16 R;
|
||||||
|
TheTest<v_uint16>()
|
||||||
|
.test_loadstore()
|
||||||
|
.test_min_max()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_hal_intrin_int16()
|
||||||
|
{
|
||||||
|
DUMP_ENTRY(v_int16);
|
||||||
|
// typedef v_int16 R;
|
||||||
|
TheTest<v_int16>()
|
||||||
|
.test_loadstore()
|
||||||
|
.test_min_max()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
//============= 32-bit integer =====================================================================
|
||||||
|
|
||||||
|
void test_hal_intrin_uint32()
|
||||||
|
{
|
||||||
|
DUMP_ENTRY(v_uint32);
|
||||||
|
// typedef v_uint32 R;
|
||||||
|
TheTest<v_uint32>()
|
||||||
|
.test_loadstore()
|
||||||
|
.test_min_max()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_hal_intrin_int32()
|
||||||
|
{
|
||||||
|
DUMP_ENTRY(v_int32);
|
||||||
|
// typedef v_int32 R;
|
||||||
|
TheTest<v_int32>()
|
||||||
|
.test_loadstore()
|
||||||
|
.test_min_max()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
//============= 64-bit integer =====================================================================
|
||||||
|
|
||||||
|
void test_hal_intrin_uint64()
|
||||||
|
{
|
||||||
|
DUMP_ENTRY(v_uint64);
|
||||||
|
// typedef v_uint64 R;
|
||||||
|
TheTest<v_uint64>()
|
||||||
|
.test_loadstore()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_hal_intrin_int64()
|
||||||
|
{
|
||||||
|
DUMP_ENTRY(v_int64);
|
||||||
|
// typedef v_int64 R;
|
||||||
|
TheTest<v_int64>()
|
||||||
|
.test_loadstore()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
//============= Floating point =====================================================================
|
||||||
|
void test_hal_intrin_float32()
|
||||||
|
{
|
||||||
|
DUMP_ENTRY(v_float32);
|
||||||
|
// typedef v_float32 R;
|
||||||
|
TheTest<v_float32>()
|
||||||
|
.test_loadstore()
|
||||||
|
.test_min_max()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_hal_intrin_float64()
|
||||||
|
{
|
||||||
|
DUMP_ENTRY(v_float64);
|
||||||
|
#if CV_SIMD_64F
|
||||||
|
// typedef v_float64 R;
|
||||||
|
TheTest<v_float64>()
|
||||||
|
.test_loadstore()
|
||||||
|
.test_min_max()
|
||||||
|
;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#if CV_SIMD
|
|
||||||
#define DUMP_ENTRY(type) printf("SIMD%d: %s\n", 8*(int)sizeof(v_uint8), CV__TRACE_FUNCTION);
|
#define DUMP_ENTRY(type) printf("SIMD%d: %s\n", 8*(int)sizeof(v_uint8), CV__TRACE_FUNCTION);
|
||||||
//============= 8-bit integer =====================================================================
|
//============= 8-bit integer =====================================================================
|
||||||
|
|
||||||
@ -2075,119 +2188,6 @@ void test_hal_intrin_float16()
|
|||||||
std::cout << "SKIP: CV_FP16 is not available" << std::endl;
|
std::cout << "SKIP: CV_FP16 is not available" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#elif CV_SIMD_SCALABLE //Temporary
|
|
||||||
#define DUMP_ENTRY(type) printf("SIMD: %s\n", CV__TRACE_FUNCTION);
|
|
||||||
|
|
||||||
|
|
||||||
//============= 8-bit integer =====================================================================
|
|
||||||
|
|
||||||
void test_hal_intrin_uint8()
|
|
||||||
{
|
|
||||||
DUMP_ENTRY(v_uint8);
|
|
||||||
// typedef v_uint8 R;
|
|
||||||
TheTest<v_uint8>()
|
|
||||||
.test_loadstore()
|
|
||||||
.test_min_max()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_hal_intrin_int8()
|
|
||||||
{
|
|
||||||
DUMP_ENTRY(v_int8);
|
|
||||||
// typedef v_int8 R;
|
|
||||||
TheTest<v_int8>()
|
|
||||||
.test_loadstore()
|
|
||||||
.test_min_max()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
//============= 16-bit integer =====================================================================
|
|
||||||
|
|
||||||
void test_hal_intrin_uint16()
|
|
||||||
{
|
|
||||||
DUMP_ENTRY(v_uint16);
|
|
||||||
// typedef v_uint16 R;
|
|
||||||
TheTest<v_uint16>()
|
|
||||||
.test_loadstore()
|
|
||||||
.test_min_max()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_hal_intrin_int16()
|
|
||||||
{
|
|
||||||
DUMP_ENTRY(v_int16);
|
|
||||||
// typedef v_int16 R;
|
|
||||||
TheTest<v_int16>()
|
|
||||||
.test_loadstore()
|
|
||||||
.test_min_max()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
//============= 32-bit integer =====================================================================
|
|
||||||
|
|
||||||
void test_hal_intrin_uint32()
|
|
||||||
{
|
|
||||||
DUMP_ENTRY(v_uint32);
|
|
||||||
// typedef v_uint32 R;
|
|
||||||
TheTest<v_uint32>()
|
|
||||||
.test_loadstore()
|
|
||||||
.test_min_max()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_hal_intrin_int32()
|
|
||||||
{
|
|
||||||
DUMP_ENTRY(v_int32);
|
|
||||||
// typedef v_int32 R;
|
|
||||||
TheTest<v_int32>()
|
|
||||||
.test_loadstore()
|
|
||||||
.test_min_max()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
//============= 64-bit integer =====================================================================
|
|
||||||
|
|
||||||
void test_hal_intrin_uint64()
|
|
||||||
{
|
|
||||||
DUMP_ENTRY(v_uint64);
|
|
||||||
// typedef v_uint64 R;
|
|
||||||
TheTest<v_uint64>()
|
|
||||||
.test_loadstore()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_hal_intrin_int64()
|
|
||||||
{
|
|
||||||
DUMP_ENTRY(v_int64);
|
|
||||||
// typedef v_int64 R;
|
|
||||||
TheTest<v_int64>()
|
|
||||||
.test_loadstore()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
//============= Floating point =====================================================================
|
|
||||||
void test_hal_intrin_float32()
|
|
||||||
{
|
|
||||||
DUMP_ENTRY(v_float32);
|
|
||||||
// typedef v_float32 R;
|
|
||||||
TheTest<v_float32>()
|
|
||||||
.test_loadstore()
|
|
||||||
.test_min_max()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_hal_intrin_float64()
|
|
||||||
{
|
|
||||||
DUMP_ENTRY(v_float64);
|
|
||||||
#if CV_SIMD_64F
|
|
||||||
// typedef v_float64 R;
|
|
||||||
TheTest<v_float64>()
|
|
||||||
.test_loadstore()
|
|
||||||
.test_min_max()
|
|
||||||
;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ static void depthWiseBlock(const float *inptr, float *outptr, const float *weigh
|
|||||||
int dilation_y, int stride_x, int stride_y, int inner_xleft, int inner_xright, int inner_ytop,
|
int dilation_y, int stride_x, int stride_y, int inner_xleft, int inner_xright, int inner_ytop,
|
||||||
int inner_ybottom, bool ifMinMaxAct, bool useSIMD, bool is3x3)
|
int inner_ybottom, bool ifMinMaxAct, bool useSIMD, bool is3x3)
|
||||||
{
|
{
|
||||||
#ifdef CV_SIMD128
|
#if CV_SIMD128
|
||||||
v_float32x4 vminval = v_setall_f32(minval), vmaxval = v_setall_f32(maxval);
|
v_float32x4 vminval = v_setall_f32(minval), vmaxval = v_setall_f32(maxval);
|
||||||
|
|
||||||
v_float32x4 w0 = v_setall_f32(
|
v_float32x4 w0 = v_setall_f32(
|
||||||
@ -44,7 +44,7 @@ static void depthWiseBlock(const float *inptr, float *outptr, const float *weigh
|
|||||||
int dy0 = 1;
|
int dy0 = 1;
|
||||||
for (int y0 = 0; y0 < H0; y0 += dy0, outptr += W0 * dy0)
|
for (int y0 = 0; y0 < H0; y0 += dy0, outptr += W0 * dy0)
|
||||||
{
|
{
|
||||||
#ifdef CV_SIMD128
|
#if CV_SIMD128
|
||||||
dy0 = inner_ytop <= y0 && y0 + 3 < inner_ybottom && is3x3 && stride_y == 1 && dilation_y == 1
|
dy0 = inner_ytop <= y0 && y0 + 3 < inner_ybottom && is3x3 && stride_y == 1 && dilation_y == 1
|
||||||
? 3 : 1;
|
? 3 : 1;
|
||||||
#endif
|
#endif
|
||||||
@ -103,7 +103,7 @@ static void depthWiseBlock(const float *inptr, float *outptr, const float *weigh
|
|||||||
if (x0 == W0)
|
if (x0 == W0)
|
||||||
break;
|
break;
|
||||||
x1 = inner_xright;
|
x1 = inner_xright;
|
||||||
#ifdef CV_SIMD128
|
#if CV_SIMD128
|
||||||
if (useSIMD)
|
if (useSIMD)
|
||||||
{
|
{
|
||||||
if (is3x3)
|
if (is3x3)
|
||||||
|
Loading…
Reference in New Issue
Block a user