Skip to content

Commit df36c85

Browse files
committed
opencl: Remove more unused code
Signed-off-by: Stefan Weil <[email protected]>
1 parent f581497 commit df36c85

File tree

2 files changed

+0
-149
lines changed

2 files changed

+0
-149
lines changed

opencl/oclkernels.h

-111
Original file line numberDiff line numberDiff line change
@@ -75,38 +75,6 @@ KERNEL(
7575
}\n
7676
)
7777

78-
KERNEL(
79-
\n__kernel void pixAND(__global int *dword, __global int *sword, __global int *outword,
80-
const int wpl, const int h)
81-
{
82-
const unsigned int row = get_global_id(1);
83-
const unsigned int col = get_global_id(0);
84-
const unsigned int pos = row * wpl + col;
85-
86-
//Ignore the execss
87-
if (row >= h || col >= wpl)
88-
return;
89-
90-
*(outword + pos) = *(dword + pos) & (*(sword + pos));
91-
}\n
92-
)
93-
94-
KERNEL(
95-
\n__kernel void pixOR(__global int *dword, __global int *sword, __global int *outword,
96-
const int wpl, const int h)
97-
{
98-
const unsigned int row = get_global_id(1);
99-
const unsigned int col = get_global_id(0);
100-
const unsigned int pos = row * wpl + col;
101-
102-
//Ignore the execss
103-
if (row >= h || col >= wpl)
104-
return;
105-
106-
*(outword + pos) = *(dword + pos) | (*(sword + pos));
107-
}\n
108-
)
109-
11078
KERNEL(
11179
\n__kernel void morphoDilateHor_5x5(__global int *sword,__global int *dword,
11280
const int wpl, const int h)
@@ -885,36 +853,6 @@ void kernel_HistogramRectOneChannel(
885853
}
886854
)
887855

888-
889-
KERNEL(
890-
// unused
891-
\n __attribute__((reqd_work_group_size(256, 1, 1)))
892-
\n __kernel
893-
\n void kernel_HistogramRectAllChannels_Grey(
894-
\n __global const uchar* data,
895-
\n uint numPixels,
896-
\n __global uint *histBuffer) { // each wg will write HIST_SIZE*NUM_CHANNELS into this result; cpu will accumulate across wg's
897-
\n
898-
\n /* declare variables */
899-
\n
900-
\n // work indices
901-
\n size_t groupId = get_group_id(0);
902-
\n size_t localId = get_local_id(0); // 0 -> 256-1
903-
\n size_t globalId = get_global_id(0); // 0 -> 8*10*256-1=20480-1
904-
\n uint numThreads = get_global_size(0);
905-
\n
906-
\n /* accumulate in global memory */
907-
\n for ( uint pc = get_global_id(0); pc < numPixels; pc += get_global_size(0) ) {
908-
\n uchar value = data[ pc ];
909-
\n int idx = value * get_global_size(0) + get_global_id(0);
910-
\n histBuffer[ idx ]++;
911-
\n
912-
\n }
913-
\n
914-
\n } // kernel_HistogramRectAllChannels_Grey
915-
916-
)
917-
918856
// HistogramRect Kernel: Reduction
919857
// only supports 4 channels
920858
// each work group handles a single channel of a single histogram bin
@@ -1000,55 +938,6 @@ void kernel_HistogramRectOneChannelReduction(
1000938
} // kernel_HistogramRectOneChannelReduction
1001939
)
1002940

1003-
1004-
KERNEL(
1005-
// unused
1006-
// each work group (x256) handles a histogram bin
1007-
\n __attribute__((reqd_work_group_size(256, 1, 1)))
1008-
\n __kernel
1009-
\n void kernel_HistogramRectAllChannelsReduction_Grey(
1010-
\n int n, // pixel redundancy that needs to be accumulated
1011-
\n __global uint *histBuffer,
1012-
\n __global uint* histResult) { // each wg accumulates 1 bin
1013-
\n
1014-
\n /* declare variables */
1015-
\n
1016-
\n // work indices
1017-
\n size_t groupId = get_group_id(0);
1018-
\n size_t localId = get_local_id(0); // 0 -> 256-1
1019-
\n size_t globalId = get_global_id(0); // 0 -> 8*10*256-1=20480-1
1020-
\n uint numThreads = get_global_size(0);
1021-
\n unsigned int hist = 0;
1022-
\n
1023-
\n /* accumulate in global memory */
1024-
\n for ( uint p = 0; p < n; p+=GROUP_SIZE) {
1025-
\n hist += histBuffer[ (get_group_id(0)*n + p)];
1026-
\n }
1027-
\n
1028-
\n /* reduction in local memory */
1029-
\n // populate local memory
1030-
\n __local unsigned int localHist[GROUP_SIZE];
1031-
1032-
\n localHist[localId] = hist;
1033-
\n barrier(CLK_LOCAL_MEM_FENCE);
1034-
\n
1035-
\n for (int stride = GROUP_SIZE/2; stride >= 1; stride /= 2) {
1036-
\n if (localId < stride) {
1037-
\n hist = localHist[ (localId+stride)];
1038-
\n }
1039-
\n barrier(CLK_LOCAL_MEM_FENCE);
1040-
\n if (localId < stride) {
1041-
\n localHist[ localId] += hist;
1042-
\n }
1043-
\n barrier(CLK_LOCAL_MEM_FENCE);
1044-
\n }
1045-
\n
1046-
\n if (localId == 0)
1047-
\n histResult[get_group_id(0)] = localHist[0];
1048-
\n
1049-
\n } // kernel_HistogramRectAllChannelsReduction_Grey
1050-
)
1051-
1052941
// ThresholdRectToPix Kernel
1053942
// only supports 4 channels
1054943
// imageData is input image (24-bits/pixel)

opencl/openclwrapper.cpp

-38
Original file line numberDiff line numberDiff line change
@@ -1691,44 +1691,6 @@ static cl_int pixCloseCL(l_int32 hsize, l_int32 vsize, l_int32 wpl, l_int32 h)
16911691
return status;
16921692
}
16931693

1694-
//pix OR operation: outbuffer = buffer1 | buffer2
1695-
static cl_int
1696-
pixORCL_work(l_uint32 wpl, l_uint32 h, cl_mem buffer1, cl_mem buffer2, cl_mem outbuffer)
1697-
{
1698-
cl_int status;
1699-
size_t globalThreads[2];
1700-
int gsize;
1701-
size_t localThreads[] = {GROUPSIZE_X, GROUPSIZE_Y};
1702-
1703-
gsize = (wpl + GROUPSIZE_X - 1)/ GROUPSIZE_X * GROUPSIZE_X;
1704-
globalThreads[0] = gsize;
1705-
gsize = (h + GROUPSIZE_Y - 1)/ GROUPSIZE_Y * GROUPSIZE_Y;
1706-
globalThreads[1] = gsize;
1707-
1708-
rEnv.mpkKernel = clCreateKernel( rEnv.mpkProgram, "pixOR", &status );
1709-
CHECK_OPENCL(status, "clCreateKernel pixOR");
1710-
1711-
status = clSetKernelArg(rEnv.mpkKernel,
1712-
0,
1713-
sizeof(cl_mem),
1714-
&buffer1);
1715-
status = clSetKernelArg(rEnv.mpkKernel,
1716-
1,
1717-
sizeof(cl_mem),
1718-
&buffer2);
1719-
status = clSetKernelArg(rEnv.mpkKernel,
1720-
2,
1721-
sizeof(cl_mem),
1722-
&outbuffer);
1723-
status = clSetKernelArg(rEnv.mpkKernel, 3, sizeof(wpl), &wpl);
1724-
status = clSetKernelArg(rEnv.mpkKernel, 4, sizeof(h), &h);
1725-
status = clEnqueueNDRangeKernel(rEnv.mpkCmdQueue, rEnv.mpkKernel, 2,
1726-
nullptr, globalThreads, localThreads, 0,
1727-
nullptr, nullptr);
1728-
1729-
return status;
1730-
}
1731-
17321694
//output = buffer1 & ~(buffer2)
17331695
static
17341696
cl_int pixSubtractCL_work(l_uint32 wpl, l_uint32 h, cl_mem buffer1,

0 commit comments

Comments
 (0)