Skip to content

Commit

Permalink
visp: revision bump and patch (opencv-4.9.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
timsutton committed Jan 17, 2024
1 parent 8ba5808 commit dfbdd86
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion Formula/v/visp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Visp < Formula
url "https://visp-doc.inria.fr/download/releases/visp-3.6.0.tar.gz"
sha256 "eec93f56b89fd7c0d472b019e01c3fe03a09eda47f3903c38dc53a27cbfae532"
license "GPL-2.0-or-later"
revision 2
revision 3

livecheck do
url "https://visp.inria.fr/download/"
Expand Down Expand Up @@ -41,6 +41,12 @@ class Visp < Formula

fails_with gcc: "5"

# One usage of OpenCV Universal Intrinsics API altered starting from 4.9.0
# Remove this patch if it's merged into a future version
# https://github.com/lagadic/visp/issues/1309
# Patch source: https://github.com/lagadic/visp/pull/1310
patch :DATA

def install
ENV.cxx11

Expand Down Expand Up @@ -125,3 +131,37 @@ def install
assert_equal version.to_s, shell_output("./test").chomp
end
end
__END__
diff --git a/modules/tracker/mbt/src/depth/vpMbtFaceDepthDense.cpp b/modules/tracker/mbt/src/depth/vpMbtFaceDepthDense.cpp
index 8a47b5d437..c6d636bc9e 100644
--- a/modules/tracker/mbt/src/depth/vpMbtFaceDepthDense.cpp
+++ b/modules/tracker/mbt/src/depth/vpMbtFaceDepthDense.cpp
@@ -606,9 +606,15 @@ void vpMbtFaceDepthDense::computeInteractionMatrixAndResidu(const vpHomogeneousM
cv::v_float64x2 vx, vy, vz;
cv::v_load_deinterleave(ptr_point_cloud, vx, vy, vz);

+#if (VISP_HAVE_OPENCV_VERSION >= 0x040900)
+ cv::v_float64x2 va1 = cv::v_sub(cv::v_mul(vnz, vy), cv::v_mul(vny, vz)); // vnz*vy - vny*vz
+ cv::v_float64x2 va2 = cv::v_sub(cv::v_mul(vnx, vz), cv::v_mul(vnz, vx)); // vnx*vz - vnz*vx
+ cv::v_float64x2 va3 = cv::v_sub(cv::v_mul(vny, vx), cv::v_mul(vnx, vy)); // vny*vx - vnx*vy
+#else
cv::v_float64x2 va1 = vnz*vy - vny*vz;
cv::v_float64x2 va2 = vnx*vz - vnz*vx;
cv::v_float64x2 va3 = vny*vx - vnx*vy;
+#endif

cv::v_float64x2 vnxy = cv::v_combine_low(vnx, vny);
cv::v_store(ptr_L, vnxy);
@@ -630,7 +636,12 @@ void vpMbtFaceDepthDense::computeInteractionMatrixAndResidu(const vpHomogeneousM
cv::v_store(ptr_L, vnxy);
ptr_L += 2;

+#if (VISP_HAVE_OPENCV_VERSION >= 0x040900)
+ cv::v_float64x2 verr = cv::v_add(vd, cv::v_muladd(vnx, vx, cv::v_muladd(vny, vy, cv::v_mul(vnz, vz))));
+#else
cv::v_float64x2 verr = vd + cv::v_muladd(vnx, vx, cv::v_muladd(vny, vy, vnz*vz));
+#endif
+
cv::v_store(ptr_error, verr);
ptr_error += 2;
#elif USE_SSE

0 comments on commit dfbdd86

Please sign in to comment.