|
53 | 53 | namespace cv
|
54 | 54 | {
|
55 | 55 |
|
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 |
| - |
66 | 56 | /****************************************************************************************\
|
67 | 57 | * sum *
|
68 | 58 | \****************************************************************************************/
|
@@ -4344,12 +4334,13 @@ int normHamming(const uchar* a, int n)
|
4344 | 4334 | result += v_reduce_sum(t);
|
4345 | 4335 | }
|
4346 | 4336 | #endif // CV_SIMD128
|
4347 |
| - |
| 4337 | +#if CV_ENABLE_UNROLLED |
4348 | 4338 | for(; i <= n - 4; i += 4)
|
4349 | 4339 | {
|
4350 | 4340 | result += popCountTable[a[i]] + popCountTable[a[i+1]] +
|
4351 | 4341 | popCountTable[a[i+2]] + popCountTable[a[i+3]];
|
4352 | 4342 | }
|
| 4343 | +#endif |
4353 | 4344 | for(; i < n; i++)
|
4354 | 4345 | {
|
4355 | 4346 | result += popCountTable[a[i]];
|
@@ -4415,12 +4406,13 @@ int normHamming(const uchar* a, const uchar* b, int n)
|
4415 | 4406 | result += v_reduce_sum(t);
|
4416 | 4407 | }
|
4417 | 4408 | #endif // CV_SIMD128
|
4418 |
| - |
| 4409 | +#if CV_ENABLE_UNROLLED |
4419 | 4410 | for(; i <= n - 4; i += 4)
|
4420 | 4411 | {
|
4421 | 4412 | result += popCountTable[a[i] ^ b[i]] + popCountTable[a[i+1] ^ b[i+1]] +
|
4422 | 4413 | popCountTable[a[i+2] ^ b[i+2]] + popCountTable[a[i+3] ^ b[i+3]];
|
4423 | 4414 | }
|
| 4415 | +#endif |
4424 | 4416 | for(; i < n; i++)
|
4425 | 4417 | {
|
4426 | 4418 | result += popCountTable[a[i] ^ b[i]];
|
@@ -4463,11 +4455,11 @@ int normHamming(const uchar* a, const uchar* b, int n, int cellSize)
|
4463 | 4455 | return -1;
|
4464 | 4456 | int i = 0;
|
4465 | 4457 | int result = 0;
|
4466 |
| - #if CV_ENABLE_UNROLLED |
| 4458 | +#if CV_ENABLE_UNROLLED |
4467 | 4459 | for( ; i <= n - 4; i += 4 )
|
4468 | 4460 | result += tab[a[i] ^ b[i]] + tab[a[i+1] ^ b[i+1]] +
|
4469 | 4461 | tab[a[i+2] ^ b[i+2]] + tab[a[i+3] ^ b[i+3]];
|
4470 |
| - #endif |
| 4462 | +#endif |
4471 | 4463 | for( ; i < n; i++ )
|
4472 | 4464 | result += tab[a[i] ^ b[i]];
|
4473 | 4465 | return result;
|
|
0 commit comments