| 100 | } |
| 101 | |
| 102 | bool compareHamming(int data_size, unsigned* cpu, unsigned* gpu, |
| 103 | unsigned thr = 1) { |
| 104 | bool ret = true; |
| 105 | for (int i = 0; i < data_size; i++) { |
| 106 | unsigned x = (cpu[i] ^ gpu[i]); |
| 107 | if (popcount(x) > thr) { |
| 108 | ret = false; |
| 109 | cout << endl << "@compareHamming: first mismatch." << endl; |
| 110 | cout << "(cpu,gpu,cpu-gpu)[" << i << "] : {" << cpu[i] << "," |
| 111 | << gpu[i] << "," << cpu[i] - gpu[i] << "}" << endl; |
| 112 | cout << endl; |
| 113 | break; |
| 114 | } |
| 115 | } |
| 116 | return ret; |
| 117 | } |
| 118 | |
| 119 | template<typename T> |
| 120 | class ORB : public ::testing::Test { |