| 63 | |
| 64 | template<typename T> |
| 65 | unsigned nonMaximal(cl::Buffer* x_out, cl::Buffer* y_out, cl::Buffer* resp_out, |
| 66 | const unsigned idim0, const unsigned idim1, |
| 67 | const cl::Buffer* resp_in, const unsigned edge, |
| 68 | const unsigned max_corners) { |
| 69 | std::vector<TemplateArg> targs = { |
| 70 | TemplateTypename<T>(), |
| 71 | }; |
| 72 | std::vector<std::string> compileOpts = { |
| 73 | DefineKeyValue(T, dtype_traits<T>::getName()), |
| 74 | DefineKey(NONMAX), |
| 75 | }; |
| 76 | compileOpts.emplace_back(getTypeBuildDefinition<T>()); |
| 77 | |
| 78 | auto nonMax = |
| 79 | common::getKernel("non_maximal", {{susan_cl_src}}, targs, compileOpts); |
| 80 | |
| 81 | unsigned corners_found = 0; |
| 82 | auto d_corners_found = memAlloc<unsigned>(1); |
| 83 | getQueue().enqueueFillBuffer(*d_corners_found, corners_found, 0, |
| 84 | sizeof(unsigned)); |
| 85 | |
| 86 | cl::NDRange local(SUSAN_THREADS_X, SUSAN_THREADS_Y); |
| 87 | cl::NDRange global(divup(idim0 - 2 * edge, local[0]) * local[0], |
| 88 | divup(idim1 - 2 * edge, local[1]) * local[1]); |
| 89 | |
| 90 | nonMax(cl::EnqueueArgs(getQueue(), global, local), *x_out, *y_out, |
| 91 | *resp_out, *d_corners_found, idim0, idim1, *resp_in, edge, |
| 92 | max_corners); |
| 93 | getQueue().enqueueReadBuffer(*d_corners_found, CL_TRUE, 0, sizeof(unsigned), |
| 94 | &corners_found); |
| 95 | return corners_found; |
| 96 | } |
| 97 | } // namespace kernel |
| 98 | } // namespace opencl |
| 99 | } // namespace arrayfire |
nothing calls this directly
no test coverage detected