[opencv] 233/251: core: divUp function
Nobuhiro Iwamatsu
iwamatsu at moszumanska.debian.org
Sun Aug 27 23:27:46 UTC 2017
This is an automated email from the git hooks/post-receive script.
iwamatsu pushed a commit to annotated tag 3.3.0
in repository opencv.
commit 9ca39821c8f63eef35edd8e362d4f795e52da584
Author: Alexander Alekhin <alexander.alekhin at intel.com>
Date: Thu Aug 3 11:57:45 2017 +0300
core: divUp function
---
modules/core/include/opencv2/core/utility.hpp | 17 +++++++++++++++++
modules/core/src/matrix.cpp | 5 -----
modules/photo/src/fast_nlmeans_denoising_opencl.hpp | 5 -----
3 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/modules/core/include/opencv2/core/utility.hpp b/modules/core/include/opencv2/core/utility.hpp
index c844c17..41ccb4b 100644
--- a/modules/core/include/opencv2/core/utility.hpp
+++ b/modules/core/include/opencv2/core/utility.hpp
@@ -444,6 +444,23 @@ static inline size_t alignSize(size_t sz, int n)
return (sz + n-1) & -n;
}
+/** @brief Integer division with result round up.
+
+Use this function instead of `ceil((float)a / b)` expressions.
+
+ at sa alignSize
+*/
+static inline int divUp(int a, unsigned int b)
+{
+ CV_DbgAssert(a >= 0);
+ return (a + b - 1) / b;
+}
+/** @overload */
+static inline size_t divUp(size_t a, unsigned int b)
+{
+ return (a + b - 1) / b;
+}
+
/** @brief Enables or disables the optimized code.
The function can be used to dynamically turn on and off optimized code (code that uses SSE2, AVX,
diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp
index bc85170..ec09e21 100644
--- a/modules/core/src/matrix.cpp
+++ b/modules/core/src/matrix.cpp
@@ -3406,11 +3406,6 @@ static TransposeInplaceFunc transposeInplaceTab[] =
#ifdef HAVE_OPENCL
-static inline int divUp(int a, int b)
-{
- return (a + b - 1) / b;
-}
-
static bool ocl_transpose( InputArray _src, OutputArray _dst )
{
const ocl::Device & dev = ocl::Device::getDefault();
diff --git a/modules/photo/src/fast_nlmeans_denoising_opencl.hpp b/modules/photo/src/fast_nlmeans_denoising_opencl.hpp
index 216ba6d..b19adbd 100644
--- a/modules/photo/src/fast_nlmeans_denoising_opencl.hpp
+++ b/modules/photo/src/fast_nlmeans_denoising_opencl.hpp
@@ -23,11 +23,6 @@ enum
CTA_SIZE_DEFAULT = 256
};
-static int divUp(int a, int b)
-{
- return (a + b - 1) / b;
-}
-
template <typename FT, typename ST, typename WT>
static bool ocl_calcAlmostDist2Weight(UMat & almostDist2Weight,
int searchWindowSize, int templateWindowSize,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git
More information about the debian-science-commits
mailing list