Skip to content

Commit 5ebf066

Browse files
committed
Updated OpenVX detector and wrappers to handle Reference attribute names change
1 parent 3e2b05b commit 5ebf066

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

3rdparty/openvx/hal/openvx_hal.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <cfloat>
1212
#include <climits>
1313
#include <cmath>
14+
#include <cstring>
1415

1516
//==================================================================================================
1617
// utility
@@ -1076,7 +1077,7 @@ int ovx_hal_integral(int depth, int sdepth, int, const uchar * a, size_t astep,
10761077
ib = ivx::Image::createFromHandle(ctx, VX_DF_IMAGE_U32,
10771078
ivx::Image::createAddressing(w, h, 4, (vx_int32)bstep), (unsigned int *)(b + bstep + sizeof(unsigned int)));
10781079
ivx::IVX_CHECK_STATUS(vxuIntegralImage(ctx, ia, ib));
1079-
memset(b, 0, (w + 1) * sizeof(unsigned int));
1080+
std::memset(b, 0, (w + 1) * sizeof(unsigned int));
10801081
b += bstep;
10811082
for (int i = 0; i < h; i++, b += bstep)
10821083
{

3rdparty/openvx/include/ivx.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ static const vx_enum VX_INTERPOLATION_NEAREST_NEIGHBOR = VX_INTERPOLATION_TYPE_N
3232
static const vx_enum VX_BORDER_CONSTANT = VX_BORDER_MODE_CONSTANT;
3333
static const vx_enum VX_BORDER_REPLICATE = VX_BORDER_MODE_REPLICATE;
3434

35+
#else
36+
37+
#ifdef IVX_RENAMED_REFS
38+
static const vx_enum VX_REF_ATTRIBUTE_TYPE = VX_REFERENCE_TYPE;
39+
#endif
40+
3541
#endif
3642

3743
#ifndef IVX_USE_CXX98

cmake/FindOpenVX.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ endif()
2525

2626
if(OPENVX_INCLUDE_DIR AND OPENVX_LIBRARIES)
2727
set(HAVE_OPENVX TRUE)
28+
29+
try_compile(OPENVX_RENAMED_REF
30+
"${OpenCV_BINARY_DIR}"
31+
"${OpenCV_SOURCE_DIR}/cmake/checks/openvx_refenum_test.cpp"
32+
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${OPENVX_INCLUDE_DIR}"
33+
LINK_LIBRARIES ${OPENVX_LIBRARIES}
34+
OUTPUT_VARIABLE OUTPUT
35+
)
36+
if(OPENVX_RENAMED_REF)
37+
add_definitions(-DIVX_RENAMED_REFS=1)
38+
message(STATUS "OpenVX: Checking reference attribute name convention... New")
39+
else()
40+
message(STATUS "OpenVX: Checking reference attribute name convention... Old")
41+
endif()
2842
endif()
2943

3044
if(NOT HAVE_OPENVX)

cmake/checks/openvx_refenum_test.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include <VX/vx.h>
2+
int main()
3+
{
4+
return VX_REFERENCE_COUNT == VX_REFERENCE_TYPE ? VX_REFERENCE_NAME : 0;
5+
}

0 commit comments

Comments
 (0)