Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Added extra comparisons to not rely on ordering for duplicate removal
Browse files Browse the repository at this point in the history
  • Loading branch information
ariostas committed Apr 12, 2024
1 parent 64f247a commit f9c9aac
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions SDL/Kernels.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ namespace SDL {
if (nMatched >= 7) {
if (score_rphisum1 > score_rphisum2) {
rmQuintupletFromMemory(quintupletsInGPU, ix);
} else if ((score_rphisum1 == score_rphisum2) && (ix < jx)) {
} else if ((score_rphisum1 == score_rphisum2) && (quintupletsInGPU.pt[ix] < quintupletsInGPU.pt[jx])) {
rmQuintupletFromMemory(quintupletsInGPU, ix);
}
}
Expand Down Expand Up @@ -306,7 +306,7 @@ namespace SDL {
rmQuintupletFromMemory(quintupletsInGPU, ix);
continue;
}
if ((score_rphisum1 == score_rphisum2) && (ix < jx)) {
if ((score_rphisum1 == score_rphisum2) && (quintupletsInGPU.pt[ix] < quintupletsInGPU.pt[jx])) {
rmQuintupletFromMemory(quintupletsInGPU, ix);
continue;
}
Expand Down Expand Up @@ -341,7 +341,8 @@ namespace SDL {
rmPixelTripletFromMemory(pixelTripletsInGPU, ix);
break;
} else if (pixelTripletsInGPU.logicalLayers[5 * ix + 2] == pixelTripletsInGPU.logicalLayers[5 * jx + 2] &&
(__H2F(pixelTripletsInGPU.score[ix]) == __H2F(pixelTripletsInGPU.score[jx])) && (ix < jx)) {
(__H2F(pixelTripletsInGPU.score[ix]) == __H2F(pixelTripletsInGPU.score[jx])) &&
(pixelTripletsInGPU.pt[ix] < pixelTripletsInGPU.pt[jx])) {
rmPixelTripletFromMemory(pixelTripletsInGPU, ix);
break;
}
Expand All @@ -367,7 +368,8 @@ namespace SDL {
int nMatched = checkHitspT5(ix, jx, pixelQuintupletsInGPU);
float score2 = __H2F(pixelQuintupletsInGPU.score[jx]);
if (nMatched >= 7) {
if (score1 > score2 or ((score1 == score2) and (ix > jx))) {
if (score1 > score2 or ((score1 == score2) and (pixelQuintupletsInGPU.quintupletRadius[ix] <
pixelQuintupletsInGPU.quintupletRadius[jx]))) {
rmPixelQuintupletFromMemory(pixelQuintupletsInGPU, ix);
break;
}
Expand Down Expand Up @@ -417,7 +419,7 @@ namespace SDL {
char quad_diff = segmentsInGPU.isQuad[ix] - segmentsInGPU.isQuad[jx];
float score_diff = segmentsInGPU.score[ix] - segmentsInGPU.score[jx];
// Always keep quads over trips. If they are the same, we want the object with better score
int idxToRemove;
int idxToRemove = -1;
if (quad_diff > 0)
idxToRemove = jx;
else if (quad_diff < 0)
Expand All @@ -426,9 +428,12 @@ namespace SDL {
idxToRemove = jx;
else if (score_diff > 0)
idxToRemove = ix;
else
else if (segmentsInGPU.circleRadius[ix] < segmentsInGPU.circleRadius[jx])
idxToRemove = ix;

if (idxToRemove == -1)
continue;

unsigned int phits2[4];
phits2[0] = segmentsInGPU.pLSHitsIdxs[jx].x;
phits2[1] = segmentsInGPU.pLSHitsIdxs[jx].y;
Expand Down

0 comments on commit f9c9aac

Please sign in to comment.