fixed bug in buildPointList

This commit is contained in:
Vladislav Vinogradov 2012-08-30 09:48:16 +04:00
parent 3ae2244bd9
commit 29cdddd845

View File

@ -64,23 +64,22 @@ namespace cv { namespace gpu { namespace device
const int x = blockIdx.x * blockDim.x * PIXELS_PER_THREAD + threadIdx.x; const int x = blockIdx.x * blockDim.x * PIXELS_PER_THREAD + threadIdx.x;
const int y = blockIdx.y * blockDim.y + threadIdx.y; const int y = blockIdx.y * blockDim.y + threadIdx.y;
if (y >= src.rows)
return;
if (threadIdx.x == 0) if (threadIdx.x == 0)
s_qsize[threadIdx.y] = 0; s_qsize[threadIdx.y] = 0;
__syncthreads(); __syncthreads();
// fill the queue if (y < src.rows)
const uchar* srcRow = src.ptr(y);
for (int i = 0, xx = x; i < PIXELS_PER_THREAD && xx < src.cols; ++i, xx += blockDim.x)
{ {
if (srcRow[xx]) // fill the queue
const uchar* srcRow = src.ptr(y);
for (int i = 0, xx = x; i < PIXELS_PER_THREAD && xx < src.cols; ++i, xx += blockDim.x)
{ {
const unsigned int val = (y << 16) | xx; if (srcRow[xx])
const int qidx = Emulation::smem::atomicAdd(&s_qsize[threadIdx.y], 1); {
s_queues[threadIdx.y][qidx] = val; const unsigned int val = (y << 16) | xx;
const int qidx = Emulation::smem::atomicAdd(&s_qsize[threadIdx.y], 1);
s_queues[threadIdx.y][qidx] = val;
}
} }
} }