Commit a381b95e authored by Andrey Kamaev's avatar Andrey Kamaev

Fixed buggy NEON check inside flann

parent cc54226e
...@@ -416,9 +416,9 @@ struct Hamming ...@@ -416,9 +416,9 @@ struct Hamming
ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const
{ {
ResultType result = 0; ResultType result = 0;
#if __GNUC__ #ifdef __GNUC__
#if CV_NEON #ifdef __ARM_NEON__
if (CPU_HAS_NEON_FEATURE) { {
uint32x4_t bits = vmovq_n_u32(0); uint32x4_t bits = vmovq_n_u32(0);
for (size_t i = 0; i < size; i += 16) { for (size_t i = 0; i < size; i += 16) {
uint8x16_t A_vec = vld1q_u8 (a + i); uint8x16_t A_vec = vld1q_u8 (a + i);
...@@ -433,8 +433,7 @@ struct Hamming ...@@ -433,8 +433,7 @@ struct Hamming
result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0); result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0);
result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2); result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2);
} }
else #else
#endif
{ {
//for portability just use unsigned long -- and use the __builtin_popcountll (see docs for __builtin_popcountll) //for portability just use unsigned long -- and use the __builtin_popcountll (see docs for __builtin_popcountll)
typedef unsigned long long pop_t; typedef unsigned long long pop_t;
...@@ -454,6 +453,7 @@ struct Hamming ...@@ -454,6 +453,7 @@ struct Hamming
result += __builtin_popcountll(a_final ^ b_final); result += __builtin_popcountll(a_final ^ b_final);
} }
} }
#endif //NEON
#else #else
HammingLUT lut; HammingLUT lut;
result = lut(reinterpret_cast<const unsigned char*> (a), result = lut(reinterpret_cast<const unsigned char*> (a),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment