MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / removeDuplicates

Function removeDuplicates

src/backend/cuda/kernel/sift.hpp:479–509  ·  view source on GitHub ↗

Remove duplicate keypoints

Source from the content-addressed store, hash-verified

477
478// Remove duplicate keypoints
479__global__ void removeDuplicates(float* x_out, float* y_out,
480 unsigned* layer_out, float* response_out,
481 float* size_out, unsigned* counter,
482 const float* x_in, const float* y_in,
483 const unsigned* layer_in,
484 const float* response_in, const float* size_in,
485 const unsigned total_feat) {
486 const unsigned f = blockIdx.x * blockDim.x + threadIdx.x;
487
488 if (f >= total_feat) return;
489
490 float prec_fctr = 1e4f;
491
492 if (f < total_feat - 1) {
493 if (round(x_in[f] * prec_fctr) == round(x_in[f + 1] * prec_fctr) &&
494 round(y_in[f] * prec_fctr) == round(y_in[f + 1] * prec_fctr) &&
495 layer_in[f] == layer_in[f + 1] &&
496 round(response_in[f] * prec_fctr) ==
497 round(response_in[f + 1] * prec_fctr) &&
498 round(size_in[f] * prec_fctr) == round(size_in[f + 1] * prec_fctr))
499 return;
500 }
501
502 unsigned idx = atomicAdd(counter, 1);
503
504 x_out[idx] = x_in[f];
505 y_out[idx] = y_in[f];
506 layer_out[idx] = layer_in[f];
507 response_out[idx] = response_in[f];
508 size_out[idx] = size_in[f];
509}
510
511#define IPTR(Y, X) (img_ptr[(Y)*dim0 + (X)])
512

Callers

nothing calls this directly

Calls 2

roundFunction · 0.85
atomicAddFunction · 0.85

Tested by

no test coverage detected