Skip to content

Commit 635342a

Browse files
committed
ocl_calcHist1: Use proper local size for merge_histogram kernel
merge_histogram kernel only need "BINS" theads to accumulate the histgrams, it is not efficient to directly use maxGroupSize as local size if maxGroupSize is far greater then BINS.
1 parent f670a99 commit 635342a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

modules/imgproc/src/histogram.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,6 +1723,7 @@ static bool ocl_calcHist1(InputArray _src, OutputArray _hist, int ddepth = CV_32
17231723
if (!k1.run(1, &globalsize, &wgs, false))
17241724
return false;
17251725

1726+
wgs = std::min<size_t>(ocl::Device::getDefault().maxWorkGroupSize(), BINS);
17261727
char cvt[40];
17271728
ocl::Kernel k2("merge_histogram", ocl::imgproc::histogram_oclsrc,
17281729
format("-D BINS=%d -D HISTS_COUNT=%d -D WGS=%d -D convertToHT=%s -D HT=%s",

0 commit comments

Comments
 (0)