Merge pull request #25491 from savuor:rv/hal_norm_hamming

HAL for Hamming norm added #25491

fixes #25474

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Rostislav Vasilikhin 2024-04-27 13:38:44 +02:00 committed by GitHub
parent 357b9abaef
commit 12e2cc9502
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 36 additions and 0 deletions

View File

@ -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

View File

@ -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;