mirror of
https://github.com/opencv/opencv.git
synced 2024-12-15 18:09:11 +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
63 lines
1.7 KiB
C
63 lines
1.7 KiB
C
/*
|
|
* SSE optimized hash slide
|
|
*
|
|
* Copyright (C) 2017 Intel Corporation
|
|
* Authors:
|
|
* Arjan van de Ven <arjan@linux.intel.com>
|
|
* Jim Kukunas <james.t.kukunas@linux.intel.com>
|
|
*
|
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
*/
|
|
#include "zbuild.h"
|
|
#include "deflate.h"
|
|
|
|
#include <immintrin.h>
|
|
#include <assert.h>
|
|
|
|
static inline void slide_hash_chain(Pos *table0, Pos *table1, uint32_t entries0,
|
|
uint32_t entries1, const __m128i wsize) {
|
|
uint32_t entries;
|
|
Pos *table;
|
|
__m128i value0, value1, result0, result1;
|
|
|
|
int on_chain = 0;
|
|
|
|
next_chain:
|
|
table = (on_chain) ? table1 : table0;
|
|
entries = (on_chain) ? entries1 : entries0;
|
|
|
|
table += entries;
|
|
table -= 16;
|
|
|
|
/* ZALLOC allocates this pointer unless the user chose a custom allocator.
|
|
* Our alloc function is aligned to 64 byte boundaries */
|
|
do {
|
|
value0 = _mm_load_si128((__m128i *)table);
|
|
value1 = _mm_load_si128((__m128i *)(table + 8));
|
|
result0 = _mm_subs_epu16(value0, wsize);
|
|
result1 = _mm_subs_epu16(value1, wsize);
|
|
_mm_store_si128((__m128i *)table, result0);
|
|
_mm_store_si128((__m128i *)(table + 8), result1);
|
|
|
|
table -= 16;
|
|
entries -= 16;
|
|
} while (entries > 0);
|
|
|
|
++on_chain;
|
|
if (on_chain > 1) {
|
|
return;
|
|
} else {
|
|
goto next_chain;
|
|
}
|
|
}
|
|
|
|
Z_INTERNAL void slide_hash_sse2(deflate_state *s) {
|
|
uint16_t wsize = (uint16_t)s->w_size;
|
|
const __m128i xmm_wsize = _mm_set1_epi16((short)wsize);
|
|
|
|
assert(((uintptr_t)s->head & 15) == 0);
|
|
assert(((uintptr_t)s->prev & 15) == 0);
|
|
|
|
slide_hash_chain(s->head, s->prev, HASH_SIZE, wsize, xmm_wsize);
|
|
}
|