From bd02cca0a3eb7fb8409007a64d44391ec36ed8b5 Mon Sep 17 00:00:00 2001 From: Patrick Stotko Date: Mon, 5 Nov 2018 16:25:45 +0100 Subject: [PATCH] Fix sorting in rare case when no swapping is performed in the initial run (every even pair is sorted) --- FriedLiver/Source/SiftGPU/SIFTImageManager.cu | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FriedLiver/Source/SiftGPU/SIFTImageManager.cu b/FriedLiver/Source/SiftGPU/SIFTImageManager.cu index 06a78299..9b46b7ce 100644 --- a/FriedLiver/Source/SiftGPU/SIFTImageManager.cu +++ b/FriedLiver/Source/SiftGPU/SIFTImageManager.cu @@ -104,7 +104,8 @@ void __global__ SortKeyPointMatchesCU_Kernel( __shared__ bool swapped; swapped = true; unsigned int run = 0; - while (swapped) { + //at least one odd phase is required + while (swapped || run < 2) { swapped = false; unsigned int idx0 = 2 * tidx + 0;