Create LUT for PrefixEncode.

This speeds up lossless compression by 5%.
Change-Id: Ifd114b1d9850dc3aac74593809e7d48529d35e3d
This commit is contained in:
Vikas Arora
2013-08-05 10:19:24 -07:00
parent 988b70844e
commit 69257f70df
6 changed files with 191 additions and 80 deletions

View File

@ -462,16 +462,16 @@ static WEBP_INLINE double GetCacheCost(const CostModel* const m, uint32_t idx) {
static WEBP_INLINE double GetLengthCost(const CostModel* const m,
uint32_t length) {
int code, extra_bits_count, extra_bits_value;
PrefixEncode(length, &code, &extra_bits_count, &extra_bits_value);
return m->literal_[VALUES_IN_BYTE + code] + extra_bits_count;
int code, extra_bits, extra_bits_val;
VP8LPrefixEncode(length, &code, &extra_bits, &extra_bits_val);
return m->literal_[VALUES_IN_BYTE + code] + extra_bits;
}
static WEBP_INLINE double GetDistanceCost(const CostModel* const m,
uint32_t distance) {
int code, extra_bits_count, extra_bits_value;
PrefixEncode(distance, &code, &extra_bits_count, &extra_bits_value);
return m->distance_[code] + extra_bits_count;
int code, extra_bits, extra_bits_val;
VP8LPrefixEncode(distance, &code, &extra_bits, &extra_bits_val);
return m->distance_[code] + extra_bits;
}
static int BackwardReferencesHashChainDistanceOnly(