summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Rabaud <vrabaud@google.com>2019-01-22 10:04:51 +0100
committerVincent Rabaud <vrabaud@google.com>2019-01-23 11:49:08 +0100
commit7d05d6ca91f6453835e8dad3141517198d5acad7 (patch)
tree5012bf9b43f4d84d4f09f7721da5f1d65c553fae
parent6bcf8769809b17c4bef4d5b48b8095b629b5e4d3 (diff)
downloadlibwebp-7d05d6ca91f6453835e8dad3141517198d5acad7.tar.gz
Have the color cache computation be u32-bit only.
BUG=webp:412 Change-Id: I18a3acb1b7f5d64f538b5c27521bc9e8dd599f5e
-rw-r--r--src/enc/backward_references_enc.c8
-rw-r--r--src/utils/color_cache_utils.h4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/enc/backward_references_enc.c b/src/enc/backward_references_enc.c
index 3ab7b0ac..94911ffa 100644
--- a/src/enc/backward_references_enc.c
+++ b/src/enc/backward_references_enc.c
@@ -191,13 +191,13 @@ void VP8LHashChainClear(VP8LHashChain* const p) {
// -----------------------------------------------------------------------------
-#define HASH_MULTIPLIER_HI (0xc6a4a793ULL)
-#define HASH_MULTIPLIER_LO (0x5bd1e996ULL)
+static const uint32_t kHashMultiplierHi = 0xc6a4a793u;
+static const uint32_t kHashMultiplierLo = 0x5bd1e996u;
static WEBP_INLINE uint32_t GetPixPairHash64(const uint32_t* const argb) {
uint32_t key;
- key = (argb[1] * HASH_MULTIPLIER_HI) & 0xffffffffu;
- key += (argb[0] * HASH_MULTIPLIER_LO) & 0xffffffffu;
+ key = argb[1] * kHashMultiplierHi;
+ key += argb[0] * kHashMultiplierLo;
key = key >> (32 - HASH_BITS);
return key;
}
diff --git a/src/utils/color_cache_utils.h b/src/utils/color_cache_utils.h
index 20b7be11..ee3e58ea 100644
--- a/src/utils/color_cache_utils.h
+++ b/src/utils/color_cache_utils.h
@@ -30,10 +30,10 @@ typedef struct {
int hash_bits_;
} VP8LColorCache;
-static const uint64_t kHashMul = 0x1e35a7bdull;
+static const uint32_t kHashMul = 0x1e35a7bdu;
static WEBP_INLINE int VP8LHashPix(uint32_t argb, int shift) {
- return (int)(((argb * kHashMul) & 0xffffffffu) >> shift);
+ return (int)((argb * kHashMul) >> shift);
}
static WEBP_INLINE uint32_t VP8LColorCacheLookup(