Speed up hash chain initialization using memset.

That gains 1% on lossy compression.

Change-Id: Ib9aa210194ed2f17eaff85b499b55cc4eb99ff11
This commit is contained in:
Vincent Rabaud 2015-12-07 11:54:50 +01:00
parent 4c60f63c64
commit 6c702b81ac

View File

@ -196,14 +196,11 @@ int VP8LBackwardRefsCopy(const VP8LBackwardRefs* const src,
// initialize as empty
static void HashChainReset(VP8LHashChain* const p) {
int i;
assert(p != NULL);
for (i = 0; i < p->size_; ++i) {
p->chain_[i] = -1;
}
for (i = 0; i < HASH_SIZE; ++i) {
p->hash_to_first_index_[i] = -1;
}
// Set the int32_t arrays to -1.
memset(p->chain_, 0xff, p->size_ * sizeof(*p->chain_));
memset(p->hash_to_first_index_, 0xff,
HASH_SIZE * sizeof(*p->hash_to_first_index_));
}
int VP8LHashChainInit(VP8LHashChain* const p, int size) {