From c8abf2ad14833f1aee5b2b6849b1ee7afa165ed0 Mon Sep 17 00:00:00 2001 From: Maksim Shabunin Date: Mon, 28 Jan 2019 14:48:00 +0300 Subject: [PATCH] backport: fixed warnings produced by clang-9.0.0 ea3dc789867564e3727cde46245e35577a0c5d80 https://github.com/opencv/opencv_contrib/commit/83fc27cb99db4435d07974090fbdc77d831931cd --- modules/core/include/opencv2/core/cvdef.h | 7 +++++++ modules/stitching/src/camera.cpp | 2 +- modules/videostab/src/global_motion.cpp | 16 ++++++++-------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h index d534a7fc1f4c..49390ec8d679 100644 --- a/modules/core/include/opencv2/core/cvdef.h +++ b/modules/core/include/opencv2/core/cvdef.h @@ -588,6 +588,13 @@ Cv64suf; # endif #endif +#ifdef CV_CXX_MOVE_SEMANTICS +#define CV_CXX_MOVE(x) std::move(x) +#else +#define CV_CXX_MOVE(x) (x) +#endif + + /****************************************************************************************\ * C++11 std::array * \****************************************************************************************/ diff --git a/modules/stitching/src/camera.cpp b/modules/stitching/src/camera.cpp index 0b1ae36a94dc..6605bc978c57 100644 --- a/modules/stitching/src/camera.cpp +++ b/modules/stitching/src/camera.cpp @@ -66,7 +66,7 @@ Mat CameraParams::K() const Mat_ k = Mat::eye(3, 3, CV_64F); k(0,0) = focal; k(0,2) = ppx; k(1,1) = focal * aspect; k(1,2) = ppy; - return k; + return CV_CXX_MOVE(k); } } // namespace detail diff --git a/modules/videostab/src/global_motion.cpp b/modules/videostab/src/global_motion.cpp index ac4ca4d2e18c..dceb16ef25a8 100644 --- a/modules/videostab/src/global_motion.cpp +++ b/modules/videostab/src/global_motion.cpp @@ -113,7 +113,7 @@ static Mat normalizePoints(int npoints, Point2f *points) T(0,0) = T(1,1) = s; T(0,2) = -cx*s; T(1,2) = -cy*s; - return T; + return CV_CXX_MOVE(T); } @@ -138,7 +138,7 @@ static Mat estimateGlobMotionLeastSquaresTranslation( *rmse = std::sqrt(*rmse / npoints); } - return M; + return CV_CXX_MOVE(M); } @@ -219,7 +219,7 @@ static Mat estimateGlobMotionLeastSquaresRotation( *rmse = std::sqrt(*rmse / npoints); } - return M; + return CV_CXX_MOVE(M); } static Mat estimateGlobMotionLeastSquaresRigid( @@ -273,7 +273,7 @@ static Mat estimateGlobMotionLeastSquaresRigid( *rmse = std::sqrt(*rmse / npoints); } - return M; + return CV_CXX_MOVE(M); } @@ -484,7 +484,7 @@ Mat estimateGlobalMotionRansac( if (ninliers) *ninliers = ninliersMax; - return bestM; + return CV_CXX_MOVE(bestM); } @@ -527,7 +527,7 @@ Mat MotionEstimatorRansacL2::estimate(InputArray points0, InputArray points1, bo if (ok) *ok = false; } - return M; + return CV_CXX_MOVE(M); } @@ -681,7 +681,7 @@ Mat FromFileMotionReader::estimate(const Mat &/*frame0*/, const Mat &/*frame1*/, >> M(1,0) >> M(1,1) >> M(1,2) >> M(2,0) >> M(2,1) >> M(2,2) >> ok_; if (ok) *ok = ok_; - return M; + return CV_CXX_MOVE(M); } @@ -701,7 +701,7 @@ Mat ToFileMotionWriter::estimate(const Mat &frame0, const Mat &frame1, bool *ok) << M(1,0) << " " << M(1,1) << " " << M(1,2) << " " << M(2,0) << " " << M(2,1) << " " << M(2,2) << " " << ok_ << std::endl; if (ok) *ok = ok_; - return M; + return CV_CXX_MOVE(M); }