From c9c759f7005fdcf985216bcdf633e43d03b900a9 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Thu, 2 Nov 2017 13:35:28 +0300 Subject: [PATCH] ocl: fix moments global_size (should be >= local_size) --- modules/imgproc/src/moments.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/imgproc/src/moments.cpp b/modules/imgproc/src/moments.cpp index 00e74f7..7e52f1f 100644 --- a/modules/imgproc/src/moments.cpp +++ b/modules/imgproc/src/moments.cpp @@ -510,7 +510,8 @@ static bool ocl_moments( InputArray _src, Moments& m, bool binary) int ntiles = xtiles*ytiles; UMat umbuf(1, ntiles*K, CV_32S); - size_t globalsize[] = {(size_t)xtiles, (size_t)sz.height}, localsize[] = {1, TILE_SIZE}; + size_t globalsize[] = {(size_t)xtiles, std::max((size_t)TILE_SIZE, (size_t)sz.height)}; + size_t localsize[] = {1, TILE_SIZE}; bool ok = k.args(ocl::KernelArg::ReadOnly(src), ocl::KernelArg::PtrWriteOnly(umbuf), xtiles).run(2, globalsize, localsize, true); -- 2.7.4