speed-up lossless in BackwardTrace

we special-case code=2 (with a later TODO to adapt this on quality)

Change-Id: I93d43f5b3f8f1ef9f211cce253bb4b415918ee57
This commit is contained in:
skal 2013-02-05 19:42:23 +01:00
parent 7c732e59f4
commit 0fc1a3a072

View File

@ -486,6 +486,7 @@ static int BackwardReferencesHashChainDistanceOnly(
VP8LColorCache hashers;
const double mul0 = (recursive_cost_model != 0) ? 1.0 : 0.68;
const double mul1 = (recursive_cost_model != 0) ? 1.0 : 0.82;
const int min_distance_code = 2; // TODO(vikasa): tune as function of quality
int window_size = WINDOW_SIZE;
int iter_pos = 1;
int iter_limit = -1;
@ -543,7 +544,7 @@ static int BackwardReferencesHashChainDistanceOnly(
}
// This if is for speedup only. It roughly doubles the speed, and
// makes compression worse by .1 %.
if (len >= 128 && code < 2) {
if (len >= 128 && code <= min_distance_code) {
// Long copy for short distances, let's skip the middle
// lookups for better copies.
// 1) insert the hashes.