diff --git a/modules/core/src/hal_replacement.hpp b/modules/core/src/hal_replacement.hpp index 046b0678a4..15149453c7 100644 --- a/modules/core/src/hal_replacement.hpp +++ b/modules/core/src/hal_replacement.hpp @@ -214,6 +214,36 @@ inline int hal_ni_not8u(const uchar *src_data, size_t src_step, uchar *dst_data, #define cv_hal_not8u hal_ni_not8u //! @endcond +/** +Hamming norm of a vector +@param a pointer to vector data +@param n length of a vector +@param cellSize how many bits of the vector will be added and treated as a single bit, can be 1 (standard Hamming distance), 2 or 4 +@param result pointer to result output +*/ +//! @addtogroup core_hal_interface_hamming Hamming distance +//! @{ +inline int hal_ni_normHamming8u(const uchar* a, int n, int cellSize, int* result) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } +//! @} + +/** +Hamming distance between two vectors +@param a pointer to first vector data +@param b pointer to second vector data +@param n length of vectors +@param cellSize how many bits of the vectors will be added and treated as a single bit, can be 1 (standard Hamming distance), 2 or 4 +@param result pointer to result output +*/ +//! @addtogroup core_hal_interface_hamming Hamming distance +//! @{ +inline int hal_ni_normHammingDiff8u(const uchar* a, const uchar* b, int n, int cellSize, int* result) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } +//! @} + +//! @cond IGNORED +#define cv_hal_normHamming8u hal_ni_normHamming8u +#define cv_hal_normHammingDiff8u hal_ni_normHammingDiff8u +//! @endcond + /** Compare: _dst[i] = src1[i] op src2[i]_ @param src1_data first source image data diff --git a/modules/core/src/norm.cpp b/modules/core/src/norm.cpp index 49d781fcb0..f2f84c35b8 100644 --- a/modules/core/src/norm.cpp +++ b/modules/core/src/norm.cpp @@ -52,6 +52,9 @@ static const uchar popCountTable4[] = int normHamming(const uchar* a, int n, int cellSize) { + int output; + CALL_HAL_RET(normHamming8u, cv_hal_normHamming8u, output, a, n, cellSize); + if( cellSize == 1 ) return normHamming(a, n); const uchar* tab = 0; @@ -98,6 +101,9 @@ int normHamming(const uchar* a, int n, int cellSize) int normHamming(const uchar* a, const uchar* b, int n, int cellSize) { + int output; + CALL_HAL_RET(normHammingDiff8u, cv_hal_normHammingDiff8u, output, a, b, n, cellSize); + if( cellSize == 1 ) return normHamming(a, b, n); const uchar* tab = 0;