mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Merge pull request #22292 from hanliutong:fix
[GSoC] Fix compilation errors and warnings when using MSVC on Windows. * Pass reference of the argument. * Add some cast to suppress warnings.
This commit is contained in:
parent
47f30a04d2
commit
2bd72af2ef
@ -714,7 +714,7 @@ namespace CV__SIMD_NAMESPACE {
|
||||
return a - b; \
|
||||
} \
|
||||
template<typename... Args> \
|
||||
inline _Tpvec v_add(_Tpvec f1, _Tpvec f2, Args... vf) { \
|
||||
inline _Tpvec v_add(const _Tpvec& f1, const _Tpvec& f2, const Args&... vf) { \
|
||||
return v_add(f1 + f2, vf...); \
|
||||
}
|
||||
|
||||
@ -765,7 +765,7 @@ namespace CV__SIMD_NAMESPACE {
|
||||
return a * b; \
|
||||
} \
|
||||
template<typename... Args> \
|
||||
inline _Tpvec v_mul(_Tpvec f1, _Tpvec f2, Args... vf) { \
|
||||
inline _Tpvec v_mul(const _Tpvec& f1, const _Tpvec& f2, const Args&... vf) { \
|
||||
return v_mul(f1 * f2, vf...); \
|
||||
}
|
||||
OPENCV_HAL_WRAP_BIN_OP_MUL(v_uint8)
|
||||
@ -820,7 +820,7 @@ namespace CV__SIMD_NAMESPACE {
|
||||
|
||||
//////////// get0 ////////////
|
||||
#define OPENCV_HAL_WRAP_GRT0_INT(_Tpvec, _Tp) \
|
||||
inline _Tp v_get0(v_##_Tpvec v) \
|
||||
inline _Tp v_get0(const v_##_Tpvec& v) \
|
||||
{ \
|
||||
return v.get0(); \
|
||||
}
|
||||
@ -839,7 +839,7 @@ namespace CV__SIMD_NAMESPACE {
|
||||
#endif
|
||||
|
||||
#define OPENCV_HAL_WRAP_EXTRACT(_Tpvec, _Tp, vl) \
|
||||
inline _Tp v_extract_highest(_Tpvec v) \
|
||||
inline _Tp v_extract_highest(const _Tpvec& v) \
|
||||
{ \
|
||||
return v_extract_n<vl-1>(v); \
|
||||
}
|
||||
@ -858,7 +858,7 @@ namespace CV__SIMD_NAMESPACE {
|
||||
#endif
|
||||
|
||||
#define OPENCV_HAL_WRAP_BROADCAST(_Tpvec) \
|
||||
inline _Tpvec v_broadcast_highest(_Tpvec v) \
|
||||
inline _Tpvec v_broadcast_highest(const _Tpvec& v) \
|
||||
{ \
|
||||
return v_broadcast_element<VTraits<_Tpvec>::nlanes-1>(v); \
|
||||
}
|
||||
@ -868,7 +868,7 @@ namespace CV__SIMD_NAMESPACE {
|
||||
OPENCV_HAL_WRAP_BROADCAST(v_float32)
|
||||
|
||||
|
||||
#endif //CV_SIMD
|
||||
#endif //!CV_SIMD_SCALABLE
|
||||
|
||||
//! @cond IGNORED
|
||||
|
||||
|
@ -123,7 +123,7 @@ struct VTraits<v_float64>
|
||||
|
||||
//////////// get0 ////////////
|
||||
#define OPENCV_HAL_IMPL_RVV_GRT0_INT(_Tpvec, _Tp) \
|
||||
inline _Tp v_get0(v_##_Tpvec v) \
|
||||
inline _Tp v_get0(const v_##_Tpvec& v) \
|
||||
{ \
|
||||
return vmv_x(v); \
|
||||
}
|
||||
@ -137,12 +137,12 @@ OPENCV_HAL_IMPL_RVV_GRT0_INT(int32, int)
|
||||
OPENCV_HAL_IMPL_RVV_GRT0_INT(uint64, uint64)
|
||||
OPENCV_HAL_IMPL_RVV_GRT0_INT(int64, int64)
|
||||
|
||||
inline float v_get0(v_float32 v) \
|
||||
inline float v_get0(const v_float32& v) \
|
||||
{ \
|
||||
return vfmv_f(v); \
|
||||
}
|
||||
#if CV_SIMD_SCALABLE_64F
|
||||
inline double v_get0(v_float64 v) \
|
||||
inline double v_get0(const v_float64& v) \
|
||||
{ \
|
||||
return vfmv_f(v); \
|
||||
}
|
||||
|
@ -1004,7 +1004,7 @@ template<typename R> struct TheTest
|
||||
TheTest & test_reduce()
|
||||
{
|
||||
Data<R> dataA;
|
||||
LaneType min = VTraits<R>::vlanes(), max = 0;
|
||||
LaneType min = (LaneType)VTraits<R>::vlanes(), max = 0;
|
||||
int sum = 0;
|
||||
for (int i = 0; i < VTraits<R>::vlanes(); ++i)
|
||||
{
|
||||
@ -1016,9 +1016,9 @@ template<typename R> struct TheTest
|
||||
EXPECT_EQ((LaneType)min, (LaneType)v_reduce_min(a));
|
||||
EXPECT_EQ((LaneType)max, (LaneType)v_reduce_max(a));
|
||||
EXPECT_EQ((int)(sum), (int)v_reduce_sum(a));
|
||||
dataA[0] += VTraits<R>::vlanes();
|
||||
dataA[0] += (LaneType)VTraits<R>::vlanes();
|
||||
R an = dataA;
|
||||
min = VTraits<R>::vlanes();
|
||||
min = (LaneType)VTraits<R>::vlanes();
|
||||
for (int i = 0; i < VTraits<R>::vlanes(); ++i)
|
||||
{
|
||||
min = std::min<LaneType>(min, dataA[i]);
|
||||
@ -1029,7 +1029,7 @@ template<typename R> struct TheTest
|
||||
|
||||
TheTest & test_reduce_sad()
|
||||
{
|
||||
Data<R> dataA, dataB(VTraits<R>::vlanes()/2);
|
||||
Data<R> dataA, dataB((LaneType)VTraits<R>::vlanes() /2);
|
||||
R a = dataA;
|
||||
R b = dataB;
|
||||
uint sum = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user