mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
add a VP8LColorCacheSet() method for color cache
Change-Id: Iebdc0383474fc3b8fbb0d7da4a35a0a7061bb9b5
This commit is contained in:
parent
17eb609916
commit
1ceecdc871
@ -32,10 +32,16 @@ static const uint32_t kHashMul = 0x1e35a7bd;
|
||||
|
||||
static WEBP_INLINE uint32_t VP8LColorCacheLookup(
|
||||
const VP8LColorCache* const cc, uint32_t key) {
|
||||
assert(key <= (~0U >> cc->hash_shift_));
|
||||
assert((key >> cc->hash_bits_) == 0u);
|
||||
return cc->colors_[key];
|
||||
}
|
||||
|
||||
static WEBP_INLINE void VP8LColorCacheSet(const VP8LColorCache* const cc,
|
||||
uint32_t key, uint32_t argb) {
|
||||
assert((key >> cc->hash_bits_) == 0u);
|
||||
cc->colors_[key] = argb;
|
||||
}
|
||||
|
||||
static WEBP_INLINE void VP8LColorCacheInsert(const VP8LColorCache* const cc,
|
||||
uint32_t argb) {
|
||||
const uint32_t key = (kHashMul * argb) >> cc->hash_shift_;
|
||||
@ -50,7 +56,7 @@ static WEBP_INLINE int VP8LColorCacheGetIndex(const VP8LColorCache* const cc,
|
||||
static WEBP_INLINE int VP8LColorCacheContains(const VP8LColorCache* const cc,
|
||||
uint32_t argb) {
|
||||
const uint32_t key = (kHashMul * argb) >> cc->hash_shift_;
|
||||
return cc->colors_[key] == argb;
|
||||
return (cc->colors_[key] == argb);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user