[arrayfire] 320/408: Changing build flags to build non free algorithms
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:12:22 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.
commit b9fac73ab62bfd029f2da7e492a901e1305354a9
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date: Mon Aug 24 03:55:24 2015 -0400
Changing build flags to build non free algorithms
---
CMakeLists.txt | 22 +++++++++++++++++++++-
src/api/c/sift.cpp | 2 +-
src/backend/cpu/sift.cpp | 6 +++---
src/backend/cpu/sift_nonfree.hpp | 2 +-
src/backend/cuda/sift.cu | 4 ++--
src/backend/opencl/sift.cpp | 4 ++--
test/sift_nonfree.cpp | 4 ++--
7 files changed, 32 insertions(+), 12 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e88a176..0582890 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,6 +31,9 @@ OPTION(BUILD_DOCS "Create ArrayFire Documentation" OFF)
OPTION(WITH_COVERAGE "Added code coverage flags" OFF)
OPTION(BUILD_NONFREE "Build ArrayFire nonfree algorithms" OFF)
+OPTION(BUILD_SIFT "Build ArrayFire nonfree algorithms" OFF)
+
+MARK_AS_ADVANCED(BUIL_SIFT)
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
@@ -84,9 +87,26 @@ IF(BUILD_GRAPHICS)
ENDIF(BUILD_GRAPHICS)
IF(BUILD_NONFREE)
- ADD_DEFINITIONS(-DAF_NONFREE)
+ MESSAGE(WARNING "Building With NONFREE ON requires the following patents")
+ SET(BUILD_SIFT ON)
ENDIF(BUILD_NONFREE)
+IF(BUILD_SIFT)
+ ADD_DEFINITIONS(-DAF_BUILD_SIFT)
+
+ IF (NOT BUILD_NONFREE)
+ MESSAGE(WARNING "Building with SIFT requires the following patents")
+ ENDIF()
+
+ MESSAGE("Method and apparatus for identifying scale invariant features"
+ "in an image and use of same for locating an object in an image,\" David"
+ "G. Lowe, US Patent 6,711,293 (March 23, 2004). Provisional application"
+ "filed March 8, 1999. Asignee: The University of British Columbia. For"
+ "further details, contact David Lowe (lowe at cs.ubc.ca) or the"
+ "University-Industry Liaison Office of the University of British"
+ "Columbia.")
+ENDIF(BUILD_SIFT)
+
INCLUDE_DIRECTORIES(
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/src/backend"
diff --git a/src/api/c/sift.cpp b/src/api/c/sift.cpp
index 352baf1..ef68c30 100644
--- a/src/api/c/sift.cpp
+++ b/src/api/c/sift.cpp
@@ -53,7 +53,7 @@ af_err af_sift(af_features* feat, af_array* desc, const af_array in, const unsig
const bool double_input, const float img_scale, const float feature_ratio)
{
try {
-#ifdef AF_NONFREE
+#ifdef AF_BUILD_SIFT
ArrayInfo info = getInfo(in);
af::dim4 dims = info.dims();
diff --git a/src/backend/cpu/sift.cpp b/src/backend/cpu/sift.cpp
index 421549a..1f38fff 100644
--- a/src/backend/cpu/sift.cpp
+++ b/src/backend/cpu/sift.cpp
@@ -21,7 +21,7 @@
#include <cfloat>
#include <vector>
-#ifdef AF_NONFREE
+#ifdef AF_BUILD_SIFT
#include <sift_nonfree.hpp>
#endif
@@ -38,8 +38,8 @@ unsigned sift(Array<float>& x, Array<float>& y, Array<float>& score,
const float init_sigma, const bool double_input,
const float img_scale, const float feature_ratio)
{
-#ifdef AF_NONFREE
- return sift_impl<T, convAcct>(x, y, score, ori, size, desc, in, n_layers,
+#ifdef AF_BUILD_SIFT
+ return sift_impl<T, convAccT>(x, y, score, ori, size, desc, in, n_layers,
contrast_thr, edge_thr, init_sigma, double_input,
img_scale, feature_ratio);
#else
diff --git a/src/backend/cpu/sift_nonfree.hpp b/src/backend/cpu/sift_nonfree.hpp
index 9652f0a..b331e4c 100644
--- a/src/backend/cpu/sift_nonfree.hpp
+++ b/src/backend/cpu/sift_nonfree.hpp
@@ -305,7 +305,7 @@ namespace cpu
const float sigma,
const float img_scale)
{
- for (int f = 0; f < extrema_feat; f++) {
+ for (int f = 0; f < (int)extrema_feat; f++) {
const float first_deriv_scale = img_scale*0.5f;
const float second_deriv_scale = img_scale;
const float cross_deriv_scale = img_scale*0.25f;
diff --git a/src/backend/cuda/sift.cu b/src/backend/cuda/sift.cu
index 1fb6800..3f1e99b 100644
--- a/src/backend/cuda/sift.cu
+++ b/src/backend/cuda/sift.cu
@@ -15,7 +15,7 @@
#include <err_cuda.hpp>
#include <handle.hpp>
-#ifdef AF_NONFREE
+#ifdef AF_BUILD_SIFT
#include <kernel/sift_nonfree.hpp>
#endif
@@ -33,7 +33,7 @@ unsigned sift(Array<float>& x, Array<float>& y, Array<float>& score,
const float init_sigma, const bool double_input,
const float img_scale, const float feature_ratio)
{
-#ifdef AF_NONFREE
+#ifdef AF_BUILD_SIFT
const dim4 dims = in.dims();
unsigned nfeat_out;
diff --git a/src/backend/opencl/sift.cpp b/src/backend/opencl/sift.cpp
index 898f361..7e5aa6d 100644
--- a/src/backend/opencl/sift.cpp
+++ b/src/backend/opencl/sift.cpp
@@ -15,7 +15,7 @@
#include <err_opencl.hpp>
#include <handle.hpp>
-#ifdef AF_NONFREE
+#ifdef AF_BUILD_SIFT
#include <kernel/sift_nonfree.hpp>
#endif
@@ -33,7 +33,7 @@ unsigned sift(Array<float>& x_out, Array<float>& y_out, Array<float>& score_out,
const float init_sigma, const bool double_input,
const float img_scale, const float feature_ratio)
{
-#ifdef AF_NONFREE
+#ifdef AF_BUILD_SIFT
unsigned nfeat_out;
unsigned desc_len;
diff --git a/test/sift_nonfree.cpp b/test/sift_nonfree.cpp
index bc84307..f5bd8a4 100644
--- a/test/sift_nonfree.cpp
+++ b/test/sift_nonfree.cpp
@@ -157,7 +157,7 @@ TYPED_TEST_CASE(SIFT, TestTypes);
template<typename T>
void siftTest(string pTestFile)
{
-#ifdef AF_NONFREE
+#ifdef AF_BUILD_SIFT
if (noDoubleTests<T>()) return;
vector<dim4> inDims;
@@ -268,7 +268,7 @@ void siftTest(string pTestFile)
//
TEST(SIFT, CPP)
{
-#ifdef AF_NONFREE
+#ifdef AF_BUILD_SIFT
if (noDoubleTests<float>()) return;
vector<dim4> inDims;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git
More information about the debian-science-commits
mailing list