| 321 | |
| 322 | template<typename T> |
| 323 | void fast(unsigned *out_feat, float **x_out, float **y_out, float **score_out, |
| 324 | const Array<T> &in, const float thr, const unsigned arc_length, |
| 325 | const unsigned nonmax, const float feature_ratio, const unsigned edge, |
| 326 | const LookupTable1D<unsigned char> &luTable) { |
| 327 | dim4 indims = in.dims(); |
| 328 | const unsigned max_feat = ceil(indims[0] * indims[1] * feature_ratio); |
| 329 | |
| 330 | dim3 threads(16, 16); |
| 331 | dim3 blocks(divup(indims[0] - edge * 2, threads.x), |
| 332 | divup(indims[1] - edge * 2, threads.y)); |
| 333 | |
| 334 | // Matrix containing scores for detected features, scores are stored in the |
| 335 | // same coordinates as features, dimensions should be equal to in. |
| 336 | auto d_score = memAlloc<float>(indims[0] * indims[1] + 1); |
| 337 | |
| 338 | float *d_flags = d_score.get(); |
| 339 | uptr<float> d_flags_alloc; |
| 340 | if (nonmax) { |
| 341 | d_flags_alloc = memAlloc<float>(indims[0] * indims[1]); |
| 342 | d_flags = d_flags_alloc.get(); |
| 343 | } |
| 344 | |
| 345 | // Shared memory size |
| 346 | size_t shared_size = (threads.x + 6) * (threads.y + 6) * sizeof(T); |
| 347 | |
| 348 | switch (arc_length) { |
| 349 | case 9: |
| 350 | CUDA_LAUNCH_SMEM((locate_features<T, 9>), blocks, threads, |
| 351 | shared_size, in, d_score.get(), thr, edge, |
| 352 | luTable.get()); |
| 353 | break; |
| 354 | case 10: |
| 355 | CUDA_LAUNCH_SMEM((locate_features<T, 10>), blocks, threads, |
| 356 | shared_size, in, d_score.get(), thr, edge, |
| 357 | luTable.get()); |
| 358 | break; |
| 359 | case 11: |
| 360 | CUDA_LAUNCH_SMEM((locate_features<T, 11>), blocks, threads, |
| 361 | shared_size, in, d_score.get(), thr, edge, |
| 362 | luTable.get()); |
| 363 | break; |
| 364 | case 12: |
| 365 | CUDA_LAUNCH_SMEM((locate_features<T, 12>), blocks, threads, |
| 366 | shared_size, in, d_score.get(), thr, edge, |
| 367 | luTable.get()); |
| 368 | break; |
| 369 | case 13: |
| 370 | CUDA_LAUNCH_SMEM((locate_features<T, 13>), blocks, threads, |
| 371 | shared_size, in, d_score.get(), thr, edge, |
| 372 | luTable.get()); |
| 373 | break; |
| 374 | case 14: |
| 375 | CUDA_LAUNCH_SMEM((locate_features<T, 14>), blocks, threads, |
| 376 | shared_size, in, d_score.get(), thr, edge, |
| 377 | luTable.get()); |
| 378 | break; |
| 379 | case 15: |
| 380 | CUDA_LAUNCH_SMEM((locate_features<T, 15>), blocks, threads, |
no test coverage detected