1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Alekhin
2023-01-09 11:08:02 +00:00
880 changed files with 83958 additions and 9368 deletions
+10 -3
View File
@@ -1102,6 +1102,13 @@ around both axes.
*/
CV_EXPORTS_W void flip(InputArray src, OutputArray dst, int flipCode);
/** @brief Flips a n-dimensional at given axis
* @param src input array
* @param dst output array that has the same shape of src
* @param axis axis that performs a flip on. 0 <= axis < src.dims.
*/
CV_EXPORTS_W void flipND(InputArray src, OutputArray dst, int axis);
enum RotateFlags {
ROTATE_90_CLOCKWISE = 0, //!<Rotate 90 degrees clockwise
ROTATE_180 = 1, //!<Rotate 180 degrees clockwise
@@ -3142,12 +3149,12 @@ public:
/** @brief Stores algorithm parameters in a file storage
*/
virtual void write(FileStorage& fs) const { CV_UNUSED(fs); }
CV_WRAP virtual void write(FileStorage& fs) const { CV_UNUSED(fs); }
/** @brief simplified API for language bindings
/**
* @overload
*/
CV_WRAP void write(const Ptr<FileStorage>& fs, const String& name = String()) const;
CV_WRAP void write(FileStorage& fs, const String& name) const;
/** @brief Reads algorithm parameters from a file storage
*/
@@ -35,6 +35,14 @@ String dumpInt(int argument)
return cv::format("Int: %d", argument);
}
CV_WRAP static inline
String dumpInt64(int64 argument)
{
std::ostringstream oss("Int64: ", std::ios::ate);
oss << argument;
return oss.str();
}
CV_WRAP static inline
String dumpSizeT(size_t argument)
{
@@ -219,6 +227,22 @@ AsyncArray testAsyncException()
return p.getArrayResult();
}
CV_WRAP static inline
String dumpVec2i(const cv::Vec2i value = cv::Vec2i(42, 24)) {
return format("Vec2i(%d, %d)", value[0], value[1]);
}
struct CV_EXPORTS_W_SIMPLE ClassWithKeywordProperties {
CV_PROP_RW int lambda;
CV_PROP int except;
CV_WRAP explicit ClassWithKeywordProperties(int lambda_arg = 24, int except_arg = 42)
{
lambda = lambda_arg;
except = except_arg;
}
};
namespace nested {
CV_WRAP static inline bool testEchoBooleanFunction(bool flag) {
return flag;
@@ -65,6 +65,7 @@ struct CheckContext {
static const cv::detail::CheckContext CV__CHECK_LOCATION_VARNAME(id) = \
{ CV__CHECK_FUNCTION, CV__CHECK_FILENAME, __LINE__, testOp, "" message, "" p1_str, "" p2_str }
CV_EXPORTS void CV_NORETURN check_failed_auto(const bool v1, const bool v2, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_auto(const int v1, const int v2, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_auto(const size_t v1, const size_t v2, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_auto(const float v1, const float v2, const CheckContext& ctx);
@@ -74,6 +75,9 @@ CV_EXPORTS void CV_NORETURN check_failed_MatDepth(const int v1, const int v2, co
CV_EXPORTS void CV_NORETURN check_failed_MatType(const int v1, const int v2, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_MatChannels(const int v1, const int v2, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_true(const bool v, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_false(const bool v, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_auto(const int v, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_auto(const size_t v, const CheckContext& ctx);
CV_EXPORTS void CV_NORETURN check_failed_auto(const float v, const CheckContext& ctx);
@@ -134,6 +138,12 @@ CV_EXPORTS void CV_NORETURN check_failed_MatChannels(const int v, const CheckCon
/// Example: v == A || v == B
#define CV_Check(v, test_expr, msg) CV__CHECK_CUSTOM_TEST(_, auto, v, (test_expr), #v, #test_expr, msg)
/// Example: v == true
#define CV_CheckTrue(v, msg) CV__CHECK_CUSTOM_TEST(_, true, v, v, #v, "", msg)
/// Example: v == false
#define CV_CheckFalse(v, msg) CV__CHECK_CUSTOM_TEST(_, false, v, (!(v)), #v, "", msg)
/// Some complex conditions: CV_Check(src2, src2.empty() || (src2.type() == src1.type() && src2.size() == src1.size()), "src2 should have same size/type as src1")
// TODO define pretty-printers
@@ -65,8 +65,10 @@
namespace cv { namespace cuda {
static inline void checkCudaError(cudaError_t err, const char* file, const int line, const char* func)
{
if (cudaSuccess != err)
if (cudaSuccess != err) {
cudaGetLastError(); // reset the last stored error to cudaSuccess
cv::error(cv::Error::GpuApiCallError, cudaGetErrorString(err), func, file, line);
}
}
}}
@@ -95,26 +97,6 @@ namespace cv { namespace cuda
{
return (total + grain - 1) / grain;
}
template<class T> inline void bindTexture(const textureReference* tex, const PtrStepSz<T>& img)
{
cudaChannelFormatDesc desc = cudaCreateChannelDesc<T>();
cudaSafeCall( cudaBindTexture2D(0, tex, img.ptr(), &desc, img.cols, img.rows, img.step) );
}
template<class T> inline void createTextureObjectPitch2D(cudaTextureObject_t* tex, PtrStepSz<T>& img, const cudaTextureDesc& texDesc)
{
cudaResourceDesc resDesc;
memset(&resDesc, 0, sizeof(resDesc));
resDesc.resType = cudaResourceTypePitch2D;
resDesc.res.pitch2D.devPtr = static_cast<void*>(img.ptr());
resDesc.res.pitch2D.height = img.rows;
resDesc.res.pitch2D.width = img.cols;
resDesc.res.pitch2D.pitchInBytes = img.step;
resDesc.res.pitch2D.desc = cudaCreateChannelDesc<T>();
cudaSafeCall( cudaCreateTextureObject(tex, &resDesc, &texDesc, NULL) );
}
}
}}
@@ -172,6 +172,11 @@
# define CV_MSA 1
#endif
#ifdef CV_CPU_COMPILE_LASX
# include <lasxintrin.h>
# define CV_LASX 1
#endif
#ifdef __EMSCRIPTEN__
# define CV_WASM_SIMD 1
# include <wasm_simd128.h>
@@ -370,3 +375,7 @@ struct VZeroUpperGuard {
#ifndef CV_RVV
# define CV_RVV 0
#endif
#ifndef CV_LASX
# define CV_LASX 0
#endif
@@ -525,5 +525,26 @@
#endif
#define __CV_CPU_DISPATCH_CHAIN_RVV(fn, args, mode, ...) CV_CPU_CALL_RVV(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#if !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_COMPILE_LASX
# define CV_TRY_LASX 1
# define CV_CPU_FORCE_LASX 1
# define CV_CPU_HAS_SUPPORT_LASX 1
# define CV_CPU_CALL_LASX(fn, args) return (cpu_baseline::fn args)
# define CV_CPU_CALL_LASX_(fn, args) return (opt_LASX::fn args)
#elif !defined CV_DISABLE_OPTIMIZATION && defined CV_ENABLE_INTRINSICS && defined CV_CPU_DISPATCH_COMPILE_LASX
# define CV_TRY_LASX 1
# define CV_CPU_FORCE_LASX 0
# define CV_CPU_HAS_SUPPORT_LASX (cv::checkHardwareSupport(CV_CPU_LASX))
# define CV_CPU_CALL_LASX(fn, args) if (CV_CPU_HAS_SUPPORT_LASX) return (opt_LASX::fn args)
# define CV_CPU_CALL_LASX_(fn, args) if (CV_CPU_HAS_SUPPORT_LASX) return (opt_LASX::fn args)
#else
# define CV_TRY_LASX 0
# define CV_CPU_FORCE_LASX 0
# define CV_CPU_HAS_SUPPORT_LASX 0
# define CV_CPU_CALL_LASX(fn, args)
# define CV_CPU_CALL_LASX_(fn, args)
#endif
#define __CV_CPU_DISPATCH_CHAIN_LASX(fn, args, mode, ...) CV_CPU_CALL_LASX(fn, args); __CV_EXPAND(__CV_CPU_DISPATCH_CHAIN_ ## mode(fn, args, __VA_ARGS__))
#define CV_CPU_CALL_BASELINE(fn, args) return (cpu_baseline::fn args)
#define __CV_CPU_DISPATCH_CHAIN_BASELINE(fn, args, mode, ...) CV_CPU_CALL_BASELINE(fn, args) /* last in sequence */
+5 -1
View File
@@ -279,6 +279,8 @@ namespace cv {
#define CV_CPU_RVV 210
#define CV_CPU_LASX 230
// CPU features groups
#define CV_CPU_AVX512_SKX 256
#define CV_CPU_AVX512_COMMON 257
@@ -336,6 +338,8 @@ enum CpuFeatures {
CPU_RVV = 210,
CPU_LASX = 230,
CPU_AVX512_SKX = 256, //!< Skylake-X with AVX-512F/CD/BW/DQ/VL
CPU_AVX512_COMMON = 257, //!< Common instructions AVX-512F/CD for all CPUs that support AVX-512
CPU_AVX512_KNL = 258, //!< Knights Landing with AVX-512F/CD/ER/PF
@@ -808,7 +812,7 @@ __CV_ENUM_FLAGS_BITWISE_XOR_EQ (EnumType, EnumType)
# define CV_CONSTEXPR
#endif
// Integer types portatibility
// Integer types portability
#ifdef OPENCV_STDINT_HEADER
#include OPENCV_STDINT_HEADER
#elif defined(__cplusplus)
@@ -128,8 +128,12 @@
#define CV_INLINE_ISNAN_FLT(value) CV_INLINE_ISNAN_DBL(value)
#endif
#if !defined(OPENCV_USE_FASTMATH_BUILTINS) && \
(defined __GNUC__ || defined __clang__ || defined _MSC_VER)
#if !defined(OPENCV_USE_FASTMATH_BUILTINS) \
&& ( \
defined(__x86_64__) || defined(__i686__) \
|| defined(__arm__) \
|| defined(__PPC64__) \
)
/* Let builtin C math functions when available. Dedicated hardware is available to
round and convert FP values. */
#define OPENCV_USE_FASTMATH_BUILTINS 1
@@ -229,6 +233,15 @@ CV_INLINE int cvFloor( double value )
#if defined CV__FASTMATH_ENABLE_GCC_MATH_BUILTINS || \
defined CV__FASTMATH_ENABLE_CLANG_MATH_BUILTINS
return (int)__builtin_floor(value);
#elif defined __loongarch64
int i;
double tmp;
__asm__ ("ftintrm.l.d %[tmp], %[in] \n\t"
"movfr2gr.d %[i], %[tmp] \n\t"
: [i] "=r" (i), [tmp] "=f" (tmp)
: [in] "f" (value)
:);
return i;
#else
int i = (int)value;
return i - (i > value);
@@ -247,6 +260,15 @@ CV_INLINE int cvCeil( double value )
#if defined CV__FASTMATH_ENABLE_GCC_MATH_BUILTINS || \
defined CV__FASTMATH_ENABLE_CLANG_MATH_BUILTINS
return (int)__builtin_ceil(value);
#elif defined __loongarch64
int i;
double tmp;
__asm__ ("ftintrp.l.d %[tmp], %[in] \n\t"
"movfr2gr.d %[i], %[tmp] \n\t"
: [i] "=r" (i), [tmp] "=f" (tmp)
: [in] "f" (value)
:);
return i;
#else
int i = (int)value;
return i + (i < value);
@@ -281,7 +303,7 @@ CV_INLINE int cvIsInf( double value )
{
#if defined CV_INLINE_ISINF_DBL
CV_INLINE_ISINF_DBL(value);
#elif defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(_M_ARM64) || defined(__PPC64__)
#elif defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(_M_ARM64) || defined(__PPC64__) || defined(__loongarch64)
Cv64suf ieee754;
ieee754.f = value;
return (ieee754.u & 0x7fffffff00000000) ==
@@ -332,6 +354,15 @@ CV_INLINE int cvFloor( float value )
#if defined CV__FASTMATH_ENABLE_GCC_MATH_BUILTINS || \
defined CV__FASTMATH_ENABLE_CLANG_MATH_BUILTINS
return (int)__builtin_floorf(value);
#elif defined __loongarch
int i;
float tmp;
__asm__ ("ftintrm.w.s %[tmp], %[in] \n\t"
"movfr2gr.s %[i], %[tmp] \n\t"
: [i] "=r" (i), [tmp] "=f" (tmp)
: [in] "f" (value)
:);
return i;
#else
int i = (int)value;
return i - (i > value);
@@ -350,6 +381,15 @@ CV_INLINE int cvCeil( float value )
#if defined CV__FASTMATH_ENABLE_GCC_MATH_BUILTINS || \
defined CV__FASTMATH_ENABLE_CLANG_MATH_BUILTINS
return (int)__builtin_ceilf(value);
#elif defined __loongarch
int i;
float tmp;
__asm__ ("ftintrp.w.s %[tmp], %[in] \n\t"
"movfr2gr.s %[i], %[tmp] \n\t"
: [i] "=r" (i), [tmp] "=f" (tmp)
: [in] "f" (value)
:);
return i;
#else
int i = (int)value;
return i + (i < value);
@@ -50,6 +50,12 @@
#include <stdlib.h>
#include "opencv2/core/cvdef.h"
#if defined(__GNUC__) && __GNUC__ == 12
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuninitialized"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
#define OPENCV_HAL_ADD(a, b) ((a) + (b))
#define OPENCV_HAL_AND(a, b) ((a) & (b))
#define OPENCV_HAL_NOP(a) (a)
@@ -229,10 +235,19 @@ using namespace CV_CPU_OPTIMIZATION_HAL_NAMESPACE;
#elif CV_WASM_SIMD && !defined(CV_FORCE_SIMD128_CPP)
#include "opencv2/core/hal/intrin_wasm.hpp"
#elif CV_RVV && !defined(CV_FORCE_SIMD128_CPP) && !defined(CV_RVV_SCALABLE)
#include "opencv2/core/hal/intrin_rvv.hpp"
#elif CV_RVV && !defined(CV_FORCE_SIMD128_CPP) && CV_RVV_SCALABLE
#elif CV_RVV && !defined(CV_FORCE_SIMD128_CPP)
#if defined(CV_RVV_SCALABLE)
#include "opencv2/core/hal/intrin_rvv_scalable.hpp"
#else
#include "opencv2/core/hal/intrin_rvv.hpp"
#endif
#elif CV_LASX
#if !defined(CV_FORCE_SIMD128_CPP)
#define CV_FORCE_SIMD128_CPP 1
#endif
#include "opencv2/core/hal/intrin_cpp.hpp"
#else
#include "opencv2/core/hal/intrin_cpp.hpp"
@@ -267,6 +282,14 @@ using namespace CV_CPU_OPTIMIZATION_HAL_NAMESPACE;
#endif
#if CV_LASX
#define CV__SIMD_FORWARD 256
#include "opencv2/core/hal/intrin_forward.hpp"
#include "opencv2/core/hal/intrin_lasx.hpp"
#endif
//! @cond IGNORED
namespace cv {
@@ -522,6 +545,11 @@ using namespace CV__SIMD_NAMESPACE;
#endif
//! @cond IGNORED
#ifndef CV_SIMD_64F
#define CV_SIMD_64F 0
#endif
namespace CV__SIMD_NAMESPACE {
//! @addtogroup core_hal_intrin
//! @{
@@ -537,7 +565,7 @@ namespace CV__SIMD_NAMESPACE {
inline v_float32 vx_setall_f32(float v) { return VXPREFIX(_setall_f32)(v); }
inline v_int64 vx_setall_s64(int64 v) { return VXPREFIX(_setall_s64)(v); }
inline v_uint64 vx_setall_u64(uint64 v) { return VXPREFIX(_setall_u64)(v); }
#if CV_SIMD_64F
#if CV_SIMD_64F || CV_SIMD_SCALABLE_64F
inline v_float64 vx_setall_f64(double v) { return VXPREFIX(_setall_f64)(v); }
#endif
//! @}
@@ -554,7 +582,7 @@ namespace CV__SIMD_NAMESPACE {
inline v_float32 vx_setzero_f32() { return VXPREFIX(_setzero_f32)(); }
inline v_int64 vx_setzero_s64() { return VXPREFIX(_setzero_s64)(); }
inline v_uint64 vx_setzero_u64() { return VXPREFIX(_setzero_u64)(); }
#if CV_SIMD_64F
#if CV_SIMD_64F || CV_SIMD_SCALABLE_64F
inline v_float64 vx_setzero_f64() { return VXPREFIX(_setzero_f64)(); }
#endif
//! @}
@@ -571,7 +599,7 @@ namespace CV__SIMD_NAMESPACE {
inline v_float32 vx_load(const float * ptr) { return VXPREFIX(_load)(ptr); }
inline v_int64 vx_load(const int64 * ptr) { return VXPREFIX(_load)(ptr); }
inline v_uint64 vx_load(const uint64 * ptr) { return VXPREFIX(_load)(ptr); }
#if CV_SIMD_64F
#if CV_SIMD_64F || CV_SIMD_SCALABLE_64F
inline v_float64 vx_load(const double * ptr) { return VXPREFIX(_load)(ptr); }
#endif
//! @}
@@ -588,7 +616,7 @@ namespace CV__SIMD_NAMESPACE {
inline v_float32 vx_load_aligned(const float * ptr) { return VXPREFIX(_load_aligned)(ptr); }
inline v_int64 vx_load_aligned(const int64 * ptr) { return VXPREFIX(_load_aligned)(ptr); }
inline v_uint64 vx_load_aligned(const uint64 * ptr) { return VXPREFIX(_load_aligned)(ptr); }
#if CV_SIMD_64F
#if CV_SIMD_64F || CV_SIMD_SCALABLE_64F
inline v_float64 vx_load_aligned(const double * ptr) { return VXPREFIX(_load_aligned)(ptr); }
#endif
//! @}
@@ -605,7 +633,7 @@ namespace CV__SIMD_NAMESPACE {
inline v_float32 vx_load_low(const float * ptr) { return VXPREFIX(_load_low)(ptr); }
inline v_int64 vx_load_low(const int64 * ptr) { return VXPREFIX(_load_low)(ptr); }
inline v_uint64 vx_load_low(const uint64 * ptr) { return VXPREFIX(_load_low)(ptr); }
#if CV_SIMD_64F
#if CV_SIMD_64F || CV_SIMD_SCALABLE_64F
inline v_float64 vx_load_low(const double * ptr) { return VXPREFIX(_load_low)(ptr); }
#endif
//! @}
@@ -622,7 +650,7 @@ namespace CV__SIMD_NAMESPACE {
inline v_float32 vx_load_halves(const float * ptr0, const float * ptr1) { return VXPREFIX(_load_halves)(ptr0, ptr1); }
inline v_int64 vx_load_halves(const int64 * ptr0, const int64 * ptr1) { return VXPREFIX(_load_halves)(ptr0, ptr1); }
inline v_uint64 vx_load_halves(const uint64 * ptr0, const uint64 * ptr1) { return VXPREFIX(_load_halves)(ptr0, ptr1); }
#if CV_SIMD_64F
#if CV_SIMD_64F || CV_SIMD_SCALABLE_64F
inline v_float64 vx_load_halves(const double * ptr0, const double * ptr1) { return VXPREFIX(_load_halves)(ptr0, ptr1); }
#endif
//! @}
@@ -639,7 +667,7 @@ namespace CV__SIMD_NAMESPACE {
inline v_float32 vx_lut(const float* ptr, const int* idx) { return VXPREFIX(_lut)(ptr, idx); }
inline v_int64 vx_lut(const int64 * ptr, const int* idx) { return VXPREFIX(_lut)(ptr, idx); }
inline v_uint64 vx_lut(const uint64 * ptr, const int* idx) { return VXPREFIX(_lut)(ptr, idx); }
#if CV_SIMD_64F
#if CV_SIMD_64F || CV_SIMD_SCALABLE_64F
inline v_float64 vx_lut(const double* ptr, const int* idx) { return VXPREFIX(_lut)(ptr, idx); }
#endif
//! @}
@@ -656,7 +684,7 @@ namespace CV__SIMD_NAMESPACE {
inline v_float32 vx_lut_pairs(const float* ptr, const int* idx) { return VXPREFIX(_lut_pairs)(ptr, idx); }
inline v_int64 vx_lut_pairs(const int64 * ptr, const int* idx) { return VXPREFIX(_lut_pairs)(ptr, idx); }
inline v_uint64 vx_lut_pairs(const uint64 * ptr, const int* idx) { return VXPREFIX(_lut_pairs)(ptr, idx); }
#if CV_SIMD_64F
#if CV_SIMD_64F || CV_SIMD_SCALABLE_64F
inline v_float64 vx_lut_pairs(const double* ptr, const int* idx) { return VXPREFIX(_lut_pairs)(ptr, idx); }
#endif
//! @}
@@ -758,7 +786,6 @@ namespace CV__SIMD_NAMESPACE {
OPENCV_HAL_WRAP_BIN_OP_LOGIC(v_int32)
OPENCV_HAL_WRAP_BIN_OP_LOGIC(v_int64)
#define OPENCV_HAL_WRAP_BIN_OP_MUL(_Tpvec) \
inline _Tpvec v_mul(const _Tpvec& a, const _Tpvec& b) \
{ \
@@ -886,10 +913,6 @@ namespace CV__SIMD_NAMESPACE {
#undef VXPREFIX
} // namespace
//! @cond IGNORED
#ifndef CV_SIMD_64F
#define CV_SIMD_64F 0
#endif
#ifndef CV_SIMD_FP16
#define CV_SIMD_FP16 0 //!< Defined to 1 on native support of operations with float16x8_t / float16x16_t (SIMD256) types
@@ -909,4 +932,8 @@ CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END
//! @endcond
#if defined(__GNUC__) && __GNUC__ == 12
#pragma GCC diagnostic pop
#endif
#endif
File diff suppressed because it is too large Load Diff
@@ -2646,14 +2646,14 @@ inline v_##_Tpvec v_interleave_quads(const v_##_Tpvec& vec) \
v_store(ptrvec, vec); \
for (int i = 0; i < v_##_Tpvec::nlanes/8; i++) \
{ \
ptr[8*i ] = ptrvec[4*i ]; \
ptr[8*i+1] = ptrvec[4*i+4]; \
ptr[8*i+2] = ptrvec[4*i+1]; \
ptr[8*i+3] = ptrvec[4*i+5]; \
ptr[8*i+4] = ptrvec[4*i+2]; \
ptr[8*i+5] = ptrvec[4*i+6]; \
ptr[8*i+6] = ptrvec[4*i+3]; \
ptr[8*i+7] = ptrvec[4*i+7]; \
ptr[8*i ] = ptrvec[8*i ]; \
ptr[8*i+1] = ptrvec[8*i+4]; \
ptr[8*i+2] = ptrvec[8*i+1]; \
ptr[8*i+3] = ptrvec[8*i+5]; \
ptr[8*i+4] = ptrvec[8*i+2]; \
ptr[8*i+5] = ptrvec[8*i+6]; \
ptr[8*i+6] = ptrvec[8*i+3]; \
ptr[8*i+7] = ptrvec[8*i+7]; \
} \
return v_load(ptr); \
}
@@ -2753,7 +2753,7 @@ inline int v_signmask(const _Tpvec& a) \
{ \
uint8_t ans[16] = {0};\
vsm(ans, vmslt(a, 0, vl), vl);\
return reinterpret_cast<int*>(ans)[0];\
return reinterpret_cast<int*>(ans)[0] & ((1 << (vl)) - 1);\
}
OPENCV_HAL_IMPL_RVV_SIGNMASK_OP(v_int8x16, 8, 16)
@@ -2810,7 +2810,7 @@ OPENCV_HAL_IMPL_RVV_SCAN_FORWOARD_OP(v_float64x2, double, f64)
#ifndef __clang__
inline v_int8x16 v_pack_triplets(const v_int8x16& vec)
{
uint64 ptr[2] = {0x0908060504020100, 0xFFFFFFFF0E0D0C0A};
uint64 ptr[2] = {0x0908060504020100, 0xFFFFFF0F0E0D0C0A};
return v_int8x16((vint8m1_t)vrgather_vv_u8m1((vuint8m1_t)vint8m1_t(vec), (vuint8m1_t)vle64_v_u64m1(ptr, 2), 16));
}
inline v_uint8x16 v_pack_triplets(const v_uint8x16& vec)
@@ -2820,7 +2820,7 @@ inline v_uint8x16 v_pack_triplets(const v_uint8x16& vec)
inline v_int16x8 v_pack_triplets(const v_int16x8& vec)
{
uint64 ptr[2] = {0x0908060504020100, 0xFFFFFFFF0E0D0C0A};
uint64 ptr[2] = {0x0908050403020100, 0xFFFF0F0E0D0C0B0A};
return v_int16x8((vint16m1_t)vrgather_vv_u8m1((vuint8m1_t)vint16m1_t(vec), (vuint8m1_t)vle64_v_u64m1(ptr, 2), 16));
}
inline v_uint16x8 v_pack_triplets(const v_uint16x8& vec)
@@ -2836,7 +2836,7 @@ inline v_float32x4 v_pack_triplets(const v_float32x4& vec) { return vec; }
inline v_int8x16 v_pack_triplets(const v_int8x16& vec)
{
uint64 ptr[2] = {0x0908060504020100, 0xFFFFFFFF0E0D0C0A};
uint64 ptr[2] = {0x0908060504020100, 0xFFFFFF0F0E0D0C0A};
return v_int8x16(vreinterpret_i8m1(vrgather_vv_u8m1(v_reinterpret_as_u8(vec), vreinterpret_u8m1(vle64_v_u64m1(ptr, 2)), 16)));
}
inline v_uint8x16 v_pack_triplets(const v_uint8x16& vec)
@@ -2846,7 +2846,7 @@ inline v_uint8x16 v_pack_triplets(const v_uint8x16& vec)
inline v_int16x8 v_pack_triplets(const v_int16x8& vec)
{
uint64 ptr[2] = {0x0908060504020100, 0xFFFFFFFF0E0D0C0A};
uint64 ptr[2] = {0x0908050403020100, 0xFFFF0F0E0D0C0B0A};
return v_int16x8(v_reinterpret_as_s16(v_uint8x16(vrgather_vv_u8m1(v_reinterpret_as_u8(vec), vreinterpret_u8m1(vle64_v_u64m1(ptr, 2)), 16))));
}
inline v_uint16x8 v_pack_triplets(const v_uint16x8& vec)
File diff suppressed because it is too large Load Diff
@@ -57,6 +57,11 @@
#include "opencv2/core/cvstd.hpp"
#include "opencv2/core/matx.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4459) // declaration of '...' hides global declaration
#endif
namespace cv
{
@@ -2014,6 +2019,15 @@ double jaccardDistance(const Rect_<_Tp>& a, const Rect_<_Tp>& b) {
return 1.0 - Aab / (Aa + Ab - Aab);
}
/** @brief Finds out if there is any intersection between two rectangles
*
* mainly useful for language bindings
* @param rect1 First rectangle
* @param rect2 Second rectangle
* @return the area of the intersection
*/
CV_EXPORTS_W inline double rectangleIntersectionArea(const Rect2d& a, const Rect2d& b) { return (a & b).area(); }
////////////////////////////// RotatedRect //////////////////////////////
inline
@@ -2453,4 +2467,8 @@ inline TermCriteria::TermCriteria(int _maxCount, double _epsilon)
} // cv
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif //OPENCV_CORE_TYPES_HPP
@@ -62,7 +62,7 @@ CV_EXPORTS void glob_relative(const cv::String& directory, const cv::String& pat
CV_EXPORTS bool createDirectory(const cv::String& path);
CV_EXPORTS bool createDirectories(const cv::String& path);
#ifdef __OPENCV_BUILD
#if defined(__OPENCV_BUILD) || defined(BUILD_PLUGIN)
// TODO
//CV_EXPORTS cv::String getTempDirectory();
@@ -63,7 +63,7 @@ class TraceMessage;
class TraceStorage {
public:
TraceStorage() {}
virtual ~TraceStorage() {};
virtual ~TraceStorage() {}
virtual bool put(const TraceMessage& msg) const = 0;
};