From d574e6dc0965d8879c4057ec0025c7802df2a7e9 Mon Sep 17 00:00:00 2001 From: yao Date: Thu, 24 Jan 2013 14:58:41 +0800 Subject: [PATCH] fix canny crash in bug #2279 --- modules/ocl/src/kernels/imgproc_canny.cl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ocl/src/kernels/imgproc_canny.cl b/modules/ocl/src/kernels/imgproc_canny.cl index 1022c36..5ec4465 100644 --- a/modules/ocl/src/kernels/imgproc_canny.cl +++ b/modules/ocl/src/kernels/imgproc_canny.cl @@ -691,7 +691,7 @@ __kernel } barrier(CLK_LOCAL_MEM_FENCE); - int ind = grp_idy * get_num_groups(0) + grp_idx; + int ind = mad24(grp_idy, (int)get_local_size(0), grp_idx); if(ind < count) { @@ -714,10 +714,10 @@ __kernel } barrier(CLK_LOCAL_MEM_FENCE); - while (s_counter > 0 && s_counter <= stack_size - get_num_groups(0)) + while (s_counter > 0 && s_counter <= stack_size - get_local_size(0)) { const int subTaskIdx = lidx >> 3; - const int portion = min(s_counter, get_num_groups(0) >> 3); + const int portion = min(s_counter, get_local_size(0)>> 3); pos.x = pos.y = 0; @@ -757,7 +757,7 @@ __kernel ind = s_ind; - for (int i = lidx; i < s_counter; i += get_num_groups(0)) + for (int i = lidx; i < s_counter; i += get_local_size(0)) { st2[ind + i] = s_st[i]; } -- 2.7.4