Skip to content

Commit 03c3e0e

Browse files
committed
core(stat): stat.cpp minor refactoring
- remove unused code - added: #if CV_ENABLE_UNROLLED in Hamming's functions
1 parent 4f558e8 commit 03c3e0e

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

modules/core/src/stat.cpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,6 @@
5353
namespace cv
5454
{
5555

56-
template<typename T> static inline Scalar rawToScalar(const T& v)
57-
{
58-
Scalar s;
59-
typedef typename DataType<T>::channel_type T1;
60-
int i, n = DataType<T>::channels;
61-
for( i = 0; i < n; i++ )
62-
s.val[i] = ((T1*)&v)[i];
63-
return s;
64-
}
65-
6656
/****************************************************************************************\
6757
* sum *
6858
\****************************************************************************************/
@@ -4344,12 +4334,13 @@ int normHamming(const uchar* a, int n)
43444334
result += v_reduce_sum(t);
43454335
}
43464336
#endif // CV_SIMD128
4347-
4337+
#if CV_ENABLE_UNROLLED
43484338
for(; i <= n - 4; i += 4)
43494339
{
43504340
result += popCountTable[a[i]] + popCountTable[a[i+1]] +
43514341
popCountTable[a[i+2]] + popCountTable[a[i+3]];
43524342
}
4343+
#endif
43534344
for(; i < n; i++)
43544345
{
43554346
result += popCountTable[a[i]];
@@ -4415,12 +4406,13 @@ int normHamming(const uchar* a, const uchar* b, int n)
44154406
result += v_reduce_sum(t);
44164407
}
44174408
#endif // CV_SIMD128
4418-
4409+
#if CV_ENABLE_UNROLLED
44194410
for(; i <= n - 4; i += 4)
44204411
{
44214412
result += popCountTable[a[i] ^ b[i]] + popCountTable[a[i+1] ^ b[i+1]] +
44224413
popCountTable[a[i+2] ^ b[i+2]] + popCountTable[a[i+3] ^ b[i+3]];
44234414
}
4415+
#endif
44244416
for(; i < n; i++)
44254417
{
44264418
result += popCountTable[a[i] ^ b[i]];
@@ -4463,11 +4455,11 @@ int normHamming(const uchar* a, const uchar* b, int n, int cellSize)
44634455
return -1;
44644456
int i = 0;
44654457
int result = 0;
4466-
#if CV_ENABLE_UNROLLED
4458+
#if CV_ENABLE_UNROLLED
44674459
for( ; i <= n - 4; i += 4 )
44684460
result += tab[a[i] ^ b[i]] + tab[a[i+1] ^ b[i+1]] +
44694461
tab[a[i+2] ^ b[i+2]] + tab[a[i+3] ^ b[i+3]];
4470-
#endif
4462+
#endif
44714463
for( ; i < n; i++ )
44724464
result += tab[a[i] ^ b[i]];
44734465
return result;

0 commit comments

Comments
 (0)