Skip to content

Commit

Permalink
Updated OpenVX detector and wrappers to handle Reference attribute na…
Browse files Browse the repository at this point in the history
…mes change
  • Loading branch information
terfendail committed Mar 22, 2017
1 parent 3e2b05b commit 5ebf066
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion 3rdparty/openvx/hal/openvx_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstring>

//==================================================================================================
// utility
Expand Down Expand Up @@ -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)
{
Expand Down
6 changes: 6 additions & 0 deletions 3rdparty/openvx/include/ivx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions cmake/FindOpenVX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions cmake/checks/openvx_refenum_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include <VX/vx.h>
int main()
{
return VX_REFERENCE_COUNT == VX_REFERENCE_TYPE ? VX_REFERENCE_NAME : 0;
}

0 comments on commit 5ebf066

Please sign in to comment.