MCPcopy Create free account
hub / github.com/creatale/node-dv / normHamming

Function normHamming

deps/opencv/modules/core/src/stat.cpp:1309–1332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1307};
1308
1309static int normHamming(const uchar* a, int n)
1310{
1311 int i = 0, result = 0;
1312#if CV_NEON
1313 uint32x4_t bits = vmovq_n_u32(0);
1314 for (; i <= n - 16; i += 16) {
1315 uint8x16_t A_vec = vld1q_u8 (a + i);
1316 uint8x16_t bitsSet = vcntq_u8 (A_vec);
1317 uint16x8_t bitSet8 = vpaddlq_u8 (bitsSet);
1318 uint32x4_t bitSet4 = vpaddlq_u16 (bitSet8);
1319 bits = vaddq_u32(bits, bitSet4);
1320 }
1321 uint64x2_t bitSet2 = vpaddlq_u32 (bits);
1322 result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0);
1323 result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2);
1324#else
1325 for( ; i <= n - 4; i += 4 )
1326 result += popCountTable[a[i]] + popCountTable[a[i+1]] +
1327 popCountTable[a[i+2]] + popCountTable[a[i+3]];
1328#endif
1329 for( ; i < n; i++ )
1330 result += popCountTable[a[i]];
1331 return result;
1332}
1333
1334int normHamming(const uchar* a, const uchar* b, int n)
1335{

Callers 4

stat.cppFile · 0.85
normMethod · 0.85
batchDistHammingFunction · 0.85
batchDistHamming2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected