| 25 | |
| 26 | template<typename inType, typename outType> |
| 27 | void matchTemplate(Param out, const Param srch, const Param tmplt, |
| 28 | const af_match_type mType, const bool needMean) { |
| 29 | constexpr int THREADS_X = 16; |
| 30 | constexpr int THREADS_Y = 16; |
| 31 | |
| 32 | std::array<TemplateArg, 4> targs = { |
| 33 | TemplateTypename<inType>(), |
| 34 | TemplateTypename<outType>(), |
| 35 | TemplateArg(mType), |
| 36 | TemplateArg(needMean), |
| 37 | }; |
| 38 | std::array<std::string, 14> options = { |
| 39 | DefineKeyValue(inType, dtype_traits<inType>::getName()), |
| 40 | DefineKeyValue(outType, dtype_traits<outType>::getName()), |
| 41 | DefineKeyValue(MATCH_T, static_cast<int>(mType)), |
| 42 | DefineKeyValue(NEEDMEAN, static_cast<int>(needMean)), |
| 43 | DefineKeyValue(AF_SAD, static_cast<int>(AF_SAD)), |
| 44 | DefineKeyValue(AF_ZSAD, static_cast<int>(AF_ZSAD)), |
| 45 | DefineKeyValue(AF_LSAD, static_cast<int>(AF_LSAD)), |
| 46 | DefineKeyValue(AF_SSD, static_cast<int>(AF_SSD)), |
| 47 | DefineKeyValue(AF_ZSSD, static_cast<int>(AF_ZSSD)), |
| 48 | DefineKeyValue(AF_LSSD, static_cast<int>(AF_LSSD)), |
| 49 | DefineKeyValue(AF_NCC, static_cast<int>(AF_NCC)), |
| 50 | DefineKeyValue(AF_ZNCC, static_cast<int>(AF_ZNCC)), |
| 51 | DefineKeyValue(AF_SHD, static_cast<int>(AF_SHD)), |
| 52 | getTypeBuildDefinition<outType>()}; |
| 53 | |
| 54 | auto matchImgOp = common::getKernel( |
| 55 | "matchTemplate", {{matchTemplate_cl_src}}, targs, options); |
| 56 | |
| 57 | cl::NDRange local(THREADS_X, THREADS_Y); |
| 58 | |
| 59 | int blk_x = divup(srch.info.dims[0], THREADS_X); |
| 60 | int blk_y = divup(srch.info.dims[1], THREADS_Y); |
| 61 | |
| 62 | cl::NDRange global(blk_x * srch.info.dims[2] * THREADS_X, |
| 63 | blk_y * srch.info.dims[3] * THREADS_Y); |
| 64 | |
| 65 | matchImgOp(cl::EnqueueArgs(getQueue(), global, local), *out.data, out.info, |
| 66 | *srch.data, srch.info, *tmplt.data, tmplt.info, blk_x, blk_y); |
| 67 | CL_DEBUG_FINISH(getQueue()); |
| 68 | } |
| 69 | } // namespace kernel |
| 70 | } // namespace opencl |
| 71 | } // namespace arrayfire |
nothing calls this directly
no test coverage detected