Skip to content

Commit 85923c8

Browse files
authored
Merge pull request opencv#26113 from FantasqueX:zlib-ng-2-2-1
Update zlib-ng to 2.2.1 opencv#26113 Release: https://github.com/zlib-ng/zlib-ng/releases/tag/2.2.1 ARM diagnostics patch: zlib-ng/zlib-ng#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
1 parent 7de3a8e commit 85923c8

File tree

132 files changed

+7213
-1750
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+7213
-1750
lines changed

3rdparty/zlib-ng/CMakeLists.txt

Lines changed: 1163 additions & 549 deletions
Large diffs are not rendered by default.

3rdparty/zlib-ng/LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(C) 1995-2013 Jean-loup Gailly and Mark Adler
1+
(C) 1995-2024 Jean-loup Gailly and Mark Adler
22

33
This software is provided 'as-is', without any express or implied
44
warranty. In no event will the authors be held liable for any damages

3rdparty/zlib-ng/README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ Features
2121
* Support for CPU intrinsics when available
2222
* Adler32 implementation using SSSE3, AVX2, AVX512, AVX512-VNNI, Neon, VMX & VSX
2323
* CRC32-B implementation using PCLMULQDQ, VPCLMULQDQ, ACLE, & IBM Z
24-
* Hash table implementation using CRC32-C intrinsics on x86 and ARM
2524
* Slide hash implementations using SSE2, AVX2, ARMv6, Neon, VMX & VSX
2625
* Compare256 implementations using SSE2, AVX2, Neon, POWER9 & RVV
2726
* Inflate chunk copying using SSE2, SSSE3, AVX, Neon & VSX
@@ -95,20 +94,21 @@ make test
9594
Build Options
9695
-------------
9796

98-
| CMake | configure | Description | Default |
99-
|:-------------------------|:-------------------------|:--------------------------------------------------------------------------------------|---------|
100-
| ZLIB_COMPAT | --zlib-compat | Compile with zlib compatible API | OFF |
101-
| ZLIB_ENABLE_TESTS | | Build test binaries | ON |
102-
| WITH_GZFILEOP | --without-gzfileops | Compile with support for gzFile related functions | ON |
103-
| WITH_OPTIM | --without-optimizations | Build with optimisations | ON |
104-
| WITH_NEW_STRATEGIES | --without-new-strategies | Use new strategies | ON |
105-
| WITH_NATIVE_INSTRUCTIONS | | Compiles with full instruction set supported on this host (gcc/clang -march=native) | OFF |
106-
| WITH_SANITIZER | | Build with sanitizer (memory, address, undefined) | OFF |
107-
| WITH_GTEST | | Build gtest_zlib | ON |
108-
| WITH_FUZZERS | | Build test/fuzz | OFF |
109-
| WITH_BENCHMARKS | | Build test/benchmarks | OFF |
110-
| WITH_MAINTAINER_WARNINGS | | Build with project maintainer warnings | OFF |
111-
| WITH_CODE_COVERAGE | | Enable code coverage reporting | OFF |
97+
| CMake | configure | Description | Default |
98+
|:---------------------------|:-------------------------|:------------------------------------------------------------------------------------|---------|
99+
| ZLIB_COMPAT | --zlib-compat | Compile with zlib compatible API | OFF |
100+
| ZLIB_ENABLE_TESTS | | Build test binaries | ON |
101+
| WITH_GZFILEOP | --without-gzfileops | Compile with support for gzFile related functions | ON |
102+
| WITH_OPTIM | --without-optimizations | Build with optimisations | ON |
103+
| WITH_NEW_STRATEGIES | --without-new-strategies | Use new strategies | ON |
104+
| WITH_NATIVE_INSTRUCTIONS | | Compiles with full instruction set supported on this host (gcc/clang -march=native) | OFF |
105+
| WITH_RUNTIME_CPU_DETECTION | | Compiles with runtime CPU detection | ON |
106+
| WITH_SANITIZER | | Build with sanitizer (memory, address, undefined) | OFF |
107+
| WITH_GTEST | | Build gtest_zlib | ON |
108+
| WITH_FUZZERS | | Build test/fuzz | OFF |
109+
| WITH_BENCHMARKS | | Build test/benchmarks | OFF |
110+
| WITH_MAINTAINER_WARNINGS | | Build with project maintainer warnings | OFF |
111+
| WITH_CODE_COVERAGE | | Enable code coverage reporting | OFF |
112112

113113

114114
Install

3rdparty/zlib-ng/adler32.c

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,70 +7,24 @@
77
#include "functable.h"
88
#include "adler32_p.h"
99

10-
/* ========================================================================= */
11-
Z_INTERNAL uint32_t adler32_c(uint32_t adler, const uint8_t *buf, size_t len) {
12-
uint32_t sum2;
13-
unsigned n;
14-
15-
/* split Adler-32 into component sums */
16-
sum2 = (adler >> 16) & 0xffff;
17-
adler &= 0xffff;
18-
19-
/* in case user likes doing a byte at a time, keep it fast */
20-
if (UNLIKELY(len == 1))
21-
return adler32_len_1(adler, buf, sum2);
22-
23-
/* initial Adler-32 value (deferred check for len == 1 speed) */
24-
if (UNLIKELY(buf == NULL))
25-
return 1L;
26-
27-
/* in case short lengths are provided, keep it somewhat fast */
28-
if (UNLIKELY(len < 16))
29-
return adler32_len_16(adler, buf, len, sum2);
30-
31-
/* do length NMAX blocks -- requires just one modulo operation */
32-
while (len >= NMAX) {
33-
len -= NMAX;
34-
#ifdef UNROLL_MORE
35-
n = NMAX / 16; /* NMAX is divisible by 16 */
36-
#else
37-
n = NMAX / 8; /* NMAX is divisible by 8 */
38-
#endif
39-
do {
40-
#ifdef UNROLL_MORE
41-
DO16(adler, sum2, buf); /* 16 sums unrolled */
42-
buf += 16;
43-
#else
44-
DO8(adler, sum2, buf, 0); /* 8 sums unrolled */
45-
buf += 8;
46-
#endif
47-
} while (--n);
48-
adler %= BASE;
49-
sum2 %= BASE;
50-
}
51-
52-
/* do remaining bytes (less than NMAX, still just one modulo) */
53-
return adler32_len_64(adler, buf, len, sum2);
54-
}
55-
5610
#ifdef ZLIB_COMPAT
5711
unsigned long Z_EXPORT PREFIX(adler32_z)(unsigned long adler, const unsigned char *buf, size_t len) {
58-
return (unsigned long)functable.adler32((uint32_t)adler, buf, len);
12+
return (unsigned long)FUNCTABLE_CALL(adler32)((uint32_t)adler, buf, len);
5913
}
6014
#else
6115
uint32_t Z_EXPORT PREFIX(adler32_z)(uint32_t adler, const unsigned char *buf, size_t len) {
62-
return functable.adler32(adler, buf, len);
16+
return FUNCTABLE_CALL(adler32)(adler, buf, len);
6317
}
6418
#endif
6519

6620
/* ========================================================================= */
6721
#ifdef ZLIB_COMPAT
6822
unsigned long Z_EXPORT PREFIX(adler32)(unsigned long adler, const unsigned char *buf, unsigned int len) {
69-
return (unsigned long)functable.adler32((uint32_t)adler, buf, len);
23+
return (unsigned long)FUNCTABLE_CALL(adler32)((uint32_t)adler, buf, len);
7024
}
7125
#else
7226
uint32_t Z_EXPORT PREFIX(adler32)(uint32_t adler, const unsigned char *buf, uint32_t len) {
73-
return functable.adler32(adler, buf, len);
27+
return FUNCTABLE_CALL(adler32)(adler, buf, len);
7428
}
7529
#endif
7630

3rdparty/zlib-ng/adler32_fold.h

Lines changed: 0 additions & 11 deletions
This file was deleted.

3rdparty/zlib-ng/arch/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

3rdparty/zlib-ng/arch/arm/Makefile.in

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ all: \
2525
crc32_acle.o crc32_acle.lo \
2626
slide_hash_neon.o slide_hash_neon.lo \
2727
slide_hash_armv6.o slide_hash_armv6.lo \
28-
insert_string_acle.o insert_string_acle.lo
2928

3029
adler32_neon.o:
3130
$(CC) $(CFLAGS) $(NEONFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_neon.c
@@ -69,12 +68,6 @@ slide_hash_armv6.o:
6968
slide_hash_armv6.lo:
7069
$(CC) $(SFLAGS) $(ARMV6FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_armv6.c
7170

72-
insert_string_acle.o:
73-
$(CC) $(CFLAGS) $(ACLEFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_acle.c
74-
75-
insert_string_acle.lo:
76-
$(CC) $(SFLAGS) $(ACLEFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_acle.c
77-
7871
mostlyclean: clean
7972
clean:
8073
rm -f *.o *.lo *~

3rdparty/zlib-ng/arch/arm/adler32_neon.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*/
88
#ifdef ARM_NEON
99
#include "neon_intrins.h"
10-
#include "../../zbuild.h"
11-
#include "../../adler32_p.h"
10+
#include "zbuild.h"
11+
#include "adler32_p.h"
1212

1313
static void NEON_accum32(uint32_t *s, const uint8_t *buf, size_t len) {
1414
static const uint16_t ALIGNED_(16) taps[64] = {

3rdparty/zlib-ng/arch/arm/arm_features.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "../../zbuild.h"
1+
#include "zbuild.h"
22
#include "arm_features.h"
33

44
#if defined(__linux__) && defined(HAVE_SYS_AUXV_H)
@@ -11,6 +11,11 @@
1111
# ifndef ID_AA64ISAR0_CRC32_VAL
1212
# define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32
1313
# endif
14+
#elif defined(__OpenBSD__) && defined(__aarch64__)
15+
# include <machine/armreg.h>
16+
# include <machine/cpu.h>
17+
# include <sys/sysctl.h>
18+
# include <sys/types.h>
1419
#elif defined(__APPLE__)
1520
# if !defined(_DARWIN_C_SOURCE)
1621
# define _DARWIN_C_SOURCE /* enable types aliases (eg u_int) */
@@ -30,6 +35,16 @@ static int arm_has_crc32() {
3035
#elif defined(__FreeBSD__) && defined(__aarch64__)
3136
return getenv("QEMU_EMULATING") == NULL
3237
&& ID_AA64ISAR0_CRC32_VAL(READ_SPECIALREG(id_aa64isar0_el1)) >= ID_AA64ISAR0_CRC32_BASE;
38+
#elif defined(__OpenBSD__) && defined(__aarch64__)
39+
int hascrc32 = 0;
40+
int isar0_mib[] = { CTL_MACHDEP, CPU_ID_AA64ISAR0 };
41+
uint64_t isar0 = 0;
42+
size_t len = sizeof(isar0);
43+
if (sysctl(isar0_mib, 2, &isar0, &len, NULL, 0) != -1) {
44+
if (ID_AA64ISAR0_CRC32(isar0) >= ID_AA64ISAR0_CRC32_BASE)
45+
hascrc32 = 1;
46+
}
47+
return hascrc32;
3348
#elif defined(__APPLE__)
3449
int hascrc32;
3550
size_t size = sizeof(hascrc32);

3rdparty/zlib-ng/arch/arm/arm_features.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* For conditions of distribution and use, see copyright notice in zlib.h
33
*/
44

5-
#ifndef ARM_H_
6-
#define ARM_H_
5+
#ifndef ARM_FEATURES_H_
6+
#define ARM_FEATURES_H_
77

88
struct arm_cpu_features {
99
int has_simd;
@@ -13,4 +13,4 @@ struct arm_cpu_features {
1313

1414
void Z_INTERNAL arm_check_features(struct arm_cpu_features *features);
1515

16-
#endif /* ARM_H_ */
16+
#endif /* ARM_FEATURES_H_ */

0 commit comments

Comments
 (0)