mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
Speed up hash chain initialization using memset.
That gains 1% on lossy compression. Change-Id: Ib9aa210194ed2f17eaff85b499b55cc4eb99ff11
This commit is contained in:
parent
4c60f63c64
commit
6c702b81ac
@ -196,14 +196,11 @@ int VP8LBackwardRefsCopy(const VP8LBackwardRefs* const src,
|
|||||||
|
|
||||||
// initialize as empty
|
// initialize as empty
|
||||||
static void HashChainReset(VP8LHashChain* const p) {
|
static void HashChainReset(VP8LHashChain* const p) {
|
||||||
int i;
|
|
||||||
assert(p != NULL);
|
assert(p != NULL);
|
||||||
for (i = 0; i < p->size_; ++i) {
|
// Set the int32_t arrays to -1.
|
||||||
p->chain_[i] = -1;
|
memset(p->chain_, 0xff, p->size_ * sizeof(*p->chain_));
|
||||||
}
|
memset(p->hash_to_first_index_, 0xff,
|
||||||
for (i = 0; i < HASH_SIZE; ++i) {
|
HASH_SIZE * sizeof(*p->hash_to_first_index_));
|
||||||
p->hash_to_first_index_[i] = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int VP8LHashChainInit(VP8LHashChain* const p, int size) {
|
int VP8LHashChainInit(VP8LHashChain* const p, int size) {
|
||||||
|
Loading…
Reference in New Issue
Block a user