mirror of
https://github.com/opencv/opencv.git
synced 2024-12-03 00:10:21 +08:00
85923c8f30
Update zlib-ng to 2.2.1 #26113 Release: https://github.com/zlib-ng/zlib-ng/releases/tag/2.2.1 ARM diagnostics patch: https://github.com/zlib-ng/zlib-ng/pull/1774 ### 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 - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
61 lines
1.5 KiB
C
61 lines
1.5 KiB
C
/* compare256_neon.c - NEON version of compare256
|
|
* Copyright (C) 2022 Nathan Moinvaziri
|
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
*/
|
|
|
|
#include "zbuild.h"
|
|
#include "zutil_p.h"
|
|
#include "deflate.h"
|
|
#include "fallback_builtins.h"
|
|
|
|
#if defined(ARM_NEON) && defined(HAVE_BUILTIN_CTZLL)
|
|
#include "neon_intrins.h"
|
|
|
|
static inline uint32_t compare256_neon_static(const uint8_t *src0, const uint8_t *src1) {
|
|
uint32_t len = 0;
|
|
|
|
do {
|
|
uint8x16_t a, b, cmp;
|
|
uint64_t lane;
|
|
|
|
a = vld1q_u8(src0);
|
|
b = vld1q_u8(src1);
|
|
|
|
cmp = veorq_u8(a, b);
|
|
|
|
lane = vgetq_lane_u64(vreinterpretq_u64_u8(cmp), 0);
|
|
if (lane) {
|
|
uint32_t match_byte = (uint32_t)__builtin_ctzll(lane) / 8;
|
|
return len + match_byte;
|
|
}
|
|
len += 8;
|
|
lane = vgetq_lane_u64(vreinterpretq_u64_u8(cmp), 1);
|
|
if (lane) {
|
|
uint32_t match_byte = (uint32_t)__builtin_ctzll(lane) / 8;
|
|
return len + match_byte;
|
|
}
|
|
len += 8;
|
|
|
|
src0 += 16, src1 += 16;
|
|
} while (len < 256);
|
|
|
|
return 256;
|
|
}
|
|
|
|
Z_INTERNAL uint32_t compare256_neon(const uint8_t *src0, const uint8_t *src1) {
|
|
return compare256_neon_static(src0, src1);
|
|
}
|
|
|
|
#define LONGEST_MATCH longest_match_neon
|
|
#define COMPARE256 compare256_neon_static
|
|
|
|
#include "match_tpl.h"
|
|
|
|
#define LONGEST_MATCH_SLOW
|
|
#define LONGEST_MATCH longest_match_slow_neon
|
|
#define COMPARE256 compare256_neon_static
|
|
|
|
#include "match_tpl.h"
|
|
|
|
#endif
|