mirror of
https://github.com/opencv/opencv.git
synced 2024-12-16 02:19:12 +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
94 lines
2.6 KiB
C
94 lines
2.6 KiB
C
/* chunkset_ssse3.c -- SSSE3 inline functions to copy small data chunks.
|
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
*/
|
|
|
|
#include "zbuild.h"
|
|
|
|
#if defined(X86_SSSE3)
|
|
#include <immintrin.h>
|
|
#include "../generic/chunk_permute_table.h"
|
|
|
|
typedef __m128i chunk_t;
|
|
|
|
#define CHUNK_SIZE 16
|
|
|
|
#define HAVE_CHUNKMEMSET_2
|
|
#define HAVE_CHUNKMEMSET_4
|
|
#define HAVE_CHUNKMEMSET_8
|
|
#define HAVE_CHUNK_MAG
|
|
|
|
static const lut_rem_pair perm_idx_lut[13] = {
|
|
{0, 1}, /* 3 */
|
|
{0, 0}, /* don't care */
|
|
{1 * 32, 1}, /* 5 */
|
|
{2 * 32, 4}, /* 6 */
|
|
{3 * 32, 2}, /* 7 */
|
|
{0 * 32, 0}, /* don't care */
|
|
{4 * 32, 7}, /* 9 */
|
|
{5 * 32, 6}, /* 10 */
|
|
{6 * 32, 5}, /* 11 */
|
|
{7 * 32, 4}, /* 12 */
|
|
{8 * 32, 3}, /* 13 */
|
|
{9 * 32, 2}, /* 14 */
|
|
{10 * 32, 1},/* 15 */
|
|
};
|
|
|
|
|
|
static inline void chunkmemset_2(uint8_t *from, chunk_t *chunk) {
|
|
int16_t tmp;
|
|
memcpy(&tmp, from, sizeof(tmp));
|
|
*chunk = _mm_set1_epi16(tmp);
|
|
}
|
|
|
|
static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) {
|
|
int32_t tmp;
|
|
memcpy(&tmp, from, sizeof(tmp));
|
|
*chunk = _mm_set1_epi32(tmp);
|
|
}
|
|
|
|
static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) {
|
|
int64_t tmp;
|
|
memcpy(&tmp, from, sizeof(tmp));
|
|
*chunk = _mm_set1_epi64x(tmp);
|
|
}
|
|
|
|
static inline void loadchunk(uint8_t const *s, chunk_t *chunk) {
|
|
*chunk = _mm_loadu_si128((__m128i *)s);
|
|
}
|
|
|
|
static inline void storechunk(uint8_t *out, chunk_t *chunk) {
|
|
_mm_storeu_si128((__m128i *)out, *chunk);
|
|
}
|
|
|
|
static inline chunk_t GET_CHUNK_MAG(uint8_t *buf, uint32_t *chunk_rem, uint32_t dist) {
|
|
lut_rem_pair lut_rem = perm_idx_lut[dist - 3];
|
|
__m128i perm_vec, ret_vec;
|
|
/* Important to note:
|
|
* This is _not_ to subvert the memory sanitizer but to instead unpoison some
|
|
* bytes we willingly and purposefully load uninitialized that we swizzle over
|
|
* in a vector register, anyway. If what we assume is wrong about what is used,
|
|
* the memory sanitizer will still usefully flag it */
|
|
__msan_unpoison(buf + dist, 16 - dist);
|
|
ret_vec = _mm_loadu_si128((__m128i*)buf);
|
|
*chunk_rem = lut_rem.remval;
|
|
|
|
perm_vec = _mm_load_si128((__m128i*)(permute_table + lut_rem.idx));
|
|
ret_vec = _mm_shuffle_epi8(ret_vec, perm_vec);
|
|
|
|
return ret_vec;
|
|
}
|
|
|
|
#define CHUNKSIZE chunksize_ssse3
|
|
#define CHUNKMEMSET chunkmemset_ssse3
|
|
#define CHUNKMEMSET_SAFE chunkmemset_safe_ssse3
|
|
#define CHUNKCOPY chunkcopy_ssse3
|
|
#define CHUNKUNROLL chunkunroll_ssse3
|
|
|
|
#include "chunkset_tpl.h"
|
|
|
|
#define INFLATE_FAST inflate_fast_ssse3
|
|
|
|
#include "inffast_tpl.h"
|
|
|
|
#endif
|