mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 13:48:21 +01:00
split 64-mult hashing into two 32-bit multiplies
Speed-wise equivalent on x86 and ARM (maybe a tad faster, hard to tell). Note that the two 32-bit multiples are not strictly equivalent to the 64-bit one, since we're missing one carry propagation. In practice, no observable difference was seen because of this slightly different hashing result. Change-Id: I8f2381175eae1cb20dabf149e6b27e1768fba6ab
This commit is contained in:
parent
b69a6c35b2
commit
7fe357b8c0
@ -21,8 +21,6 @@
|
||||
|
||||
#define VALUES_IN_BYTE 256
|
||||
|
||||
#define HASH_MULTIPLIER (0xc6a4a7935bd1e995ULL)
|
||||
|
||||
#define MIN_BLOCK_SIZE 256 // minimum block size for backward references
|
||||
|
||||
#define MAX_ENTROPY (1e30f)
|
||||
@ -215,9 +213,14 @@ void VP8LHashChainClear(VP8LHashChain* const p) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#define HASH_MULTIPLIER_HI (0xc6a4a793U)
|
||||
#define HASH_MULTIPLIER_LO (0x5bd1e996U)
|
||||
|
||||
static WEBP_INLINE uint64_t GetPixPairHash64(const uint32_t* const argb) {
|
||||
uint64_t key = ((uint64_t)argb[1] << 32) | argb[0];
|
||||
key = (key * HASH_MULTIPLIER) >> (64 - HASH_BITS);
|
||||
uint32_t key;
|
||||
key = argb[1] * HASH_MULTIPLIER_HI;
|
||||
key += argb[0] * HASH_MULTIPLIER_LO;
|
||||
key = key >> (32 - HASH_BITS);
|
||||
return key;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user