mirror of
https://github.com/opencv/opencv.git
synced 2024-12-26 02:28:04 +08:00
0de26fd78e
Zlib-ng is zlib replacement with optimizations for "next generation" systems. Its optimization may benifits image library decode and encode speed such as libpng. In our tests, if using zlib-ng and libpng combination on a x86_64 machine with AVX2, the time of `imdecode` amd `imencode` will drop 20% approximately. This patch enables zlib-ng's optimization if `CV_DISABLE_OPTIMIZATION` is OFF. Since Zlib-ng can dispatch intrinsics on the fly, port work is much easier. Related discussion: https://github.com/opencv/opencv/issues/22573
51 lines
980 B
C
51 lines
980 B
C
#ifndef CRC32_BRAID_P_H_
|
|
#define CRC32_BRAID_P_H_
|
|
|
|
#include "zbuild.h"
|
|
#include "zendian.h"
|
|
|
|
/* Define N */
|
|
#ifdef Z_TESTN
|
|
# define N Z_TESTN
|
|
#else
|
|
# define N 5
|
|
#endif
|
|
#if N < 1 || N > 6
|
|
# error N must be in 1..6
|
|
#endif
|
|
|
|
/*
|
|
Define W and the associated z_word_t type. If W is not defined, then a
|
|
braided calculation is not used, and the associated tables and code are not
|
|
compiled.
|
|
*/
|
|
#ifdef Z_TESTW
|
|
# if Z_TESTW-1 != -1
|
|
# define W Z_TESTW
|
|
# endif
|
|
#else
|
|
# ifndef W
|
|
# if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
|
|
# define W 8
|
|
# else
|
|
# define W 4
|
|
# endif
|
|
# endif
|
|
#endif
|
|
#ifdef W
|
|
# if W == 8
|
|
typedef uint64_t z_word_t;
|
|
# else
|
|
# undef W
|
|
# define W 4
|
|
typedef uint32_t z_word_t;
|
|
# endif
|
|
#endif
|
|
|
|
/* CRC polynomial. */
|
|
#define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */
|
|
|
|
extern uint32_t PREFIX(crc32_braid)(uint32_t crc, const uint8_t *buf, size_t len);
|
|
|
|
#endif /* CRC32_BRAID_P_H_ */
|