From 5ebf066dd529aa496c1954f66e8cd89378eb3448 Mon Sep 17 00:00:00 2001 From: Vitaly Tuzov Date: Tue, 14 Mar 2017 15:24:21 +0300 Subject: [PATCH] Updated OpenVX detector and wrappers to handle Reference attribute names change --- 3rdparty/openvx/hal/openvx_hal.cpp | 3 ++- 3rdparty/openvx/include/ivx.hpp | 6 ++++++ cmake/FindOpenVX.cmake | 14 ++++++++++++++ cmake/checks/openvx_refenum_test.cpp | 5 +++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 cmake/checks/openvx_refenum_test.cpp diff --git a/3rdparty/openvx/hal/openvx_hal.cpp b/3rdparty/openvx/hal/openvx_hal.cpp index 2999f929c5..cc3e034b3a 100644 --- a/3rdparty/openvx/hal/openvx_hal.cpp +++ b/3rdparty/openvx/hal/openvx_hal.cpp @@ -11,6 +11,7 @@ #include #include #include +#include //================================================================================================== // utility @@ -1076,7 +1077,7 @@ int ovx_hal_integral(int depth, int sdepth, int, const uchar * a, size_t astep, ib = ivx::Image::createFromHandle(ctx, VX_DF_IMAGE_U32, ivx::Image::createAddressing(w, h, 4, (vx_int32)bstep), (unsigned int *)(b + bstep + sizeof(unsigned int))); ivx::IVX_CHECK_STATUS(vxuIntegralImage(ctx, ia, ib)); - memset(b, 0, (w + 1) * sizeof(unsigned int)); + std::memset(b, 0, (w + 1) * sizeof(unsigned int)); b += bstep; for (int i = 0; i < h; i++, b += bstep) { diff --git a/3rdparty/openvx/include/ivx.hpp b/3rdparty/openvx/include/ivx.hpp index 47213e6d5c..5c3029d617 100644 --- a/3rdparty/openvx/include/ivx.hpp +++ b/3rdparty/openvx/include/ivx.hpp @@ -32,6 +32,12 @@ static const vx_enum VX_INTERPOLATION_NEAREST_NEIGHBOR = VX_INTERPOLATION_TYPE_N static const vx_enum VX_BORDER_CONSTANT = VX_BORDER_MODE_CONSTANT; static const vx_enum VX_BORDER_REPLICATE = VX_BORDER_MODE_REPLICATE; +#else + + #ifdef IVX_RENAMED_REFS + static const vx_enum VX_REF_ATTRIBUTE_TYPE = VX_REFERENCE_TYPE; + #endif + #endif #ifndef IVX_USE_CXX98 diff --git a/cmake/FindOpenVX.cmake b/cmake/FindOpenVX.cmake index 0a55e951d8..6cba52717c 100644 --- a/cmake/FindOpenVX.cmake +++ b/cmake/FindOpenVX.cmake @@ -25,6 +25,20 @@ endif() if(OPENVX_INCLUDE_DIR AND OPENVX_LIBRARIES) set(HAVE_OPENVX TRUE) + + try_compile(OPENVX_RENAMED_REF + "${OpenCV_BINARY_DIR}" + "${OpenCV_SOURCE_DIR}/cmake/checks/openvx_refenum_test.cpp" + CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${OPENVX_INCLUDE_DIR}" + LINK_LIBRARIES ${OPENVX_LIBRARIES} + OUTPUT_VARIABLE OUTPUT + ) + if(OPENVX_RENAMED_REF) + add_definitions(-DIVX_RENAMED_REFS=1) + message(STATUS "OpenVX: Checking reference attribute name convention... New") + else() + message(STATUS "OpenVX: Checking reference attribute name convention... Old") + endif() endif() if(NOT HAVE_OPENVX) diff --git a/cmake/checks/openvx_refenum_test.cpp b/cmake/checks/openvx_refenum_test.cpp new file mode 100644 index 0000000000..f28db050cb --- /dev/null +++ b/cmake/checks/openvx_refenum_test.cpp @@ -0,0 +1,5 @@ +#include +int main() +{ + return VX_REFERENCE_COUNT == VX_REFERENCE_TYPE ? VX_REFERENCE_NAME : 0; +}