mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 06:24:27 +02:00
Pack code & extra_bits to Struct (VP8LPrefixCode).
Also created variant VP8LPrefixEncodeBits that returns the code & extra_bits only. There's no impact on compression density and compression speed. Change-Id: I2cafdd3438ac9270cd72ad9d57b383cdddfdfa4c
This commit is contained in:
@ -462,15 +462,15 @@ 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, extra_bits_val;
|
||||
VP8LPrefixEncode(length, &code, &extra_bits, &extra_bits_val);
|
||||
int code, extra_bits;
|
||||
VP8LPrefixEncodeBits(length, &code, &extra_bits);
|
||||
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, extra_bits_val;
|
||||
VP8LPrefixEncode(distance, &code, &extra_bits, &extra_bits_val);
|
||||
int code, extra_bits;
|
||||
VP8LPrefixEncodeBits(distance, &code, &extra_bits);
|
||||
return m->distance_[code] + extra_bits;
|
||||
}
|
||||
|
||||
|
@ -90,10 +90,10 @@ void VP8LHistogramAddSinglePixOrCopy(VP8LHistogram* const histo,
|
||||
int literal_ix = 256 + NUM_LENGTH_CODES + PixOrCopyCacheIdx(v);
|
||||
++histo->literal_[literal_ix];
|
||||
} else {
|
||||
int code, extra_bits, extra_bits_val;
|
||||
VP8LPrefixEncode(PixOrCopyLength(v), &code, &extra_bits, &extra_bits_val);
|
||||
int code, extra_bits;
|
||||
VP8LPrefixEncodeBits(PixOrCopyLength(v), &code, &extra_bits);
|
||||
++histo->literal_[256 + code];
|
||||
VP8LPrefixEncode(PixOrCopyDistance(v), &code, &extra_bits, &extra_bits_val);
|
||||
VP8LPrefixEncodeBits(PixOrCopyDistance(v), &code, &extra_bits);
|
||||
++histo->distance_[code];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user