Index: third_party/libwebp/enc/backward_references.h |
diff --git a/third_party/libwebp/enc/backward_references.h b/third_party/libwebp/enc/backward_references.h |
index daa084d84681b54d022ae0d0dd59176683178a8a..0cadb11e11ef421d5099aa9037f98be8f936b28f 100644 |
--- a/third_party/libwebp/enc/backward_references.h |
+++ b/third_party/libwebp/enc/backward_references.h |
@@ -115,11 +115,12 @@ static WEBP_INLINE uint32_t PixOrCopyDistance(const PixOrCopy* const p) { |
typedef struct VP8LHashChain VP8LHashChain; |
struct VP8LHashChain { |
- // Stores the most recently added position with the given hash value. |
- int32_t hash_to_first_index_[HASH_SIZE]; |
- // chain_[pos] stores the previous position with the same hash value |
- // for every pixel in the image. |
- int32_t* chain_; |
+ // The 20 most significant bits contain the offset at which the best match |
+ // is found. These 20 bits are the limit defined by GetWindowSizeForHashChain |
+ // (through WINDOW_SIZE = 1<<20). |
+ // The lower 12 bits contain the length of the match. The 12 bit limit is |
+ // defined in MaxFindCopyLength with MAX_LENGTH=4096. |
+ uint32_t* offset_length_; |
// This is the maximum size of the hash_chain that can be constructed. |
// Typically this is the pixel count (width x height) for a given image. |
int size_; |
@@ -127,6 +128,9 @@ struct VP8LHashChain { |
// Must be called first, to set size. |
int VP8LHashChainInit(VP8LHashChain* const p, int size); |
+// Pre-compute the best matches for argb. |
+int VP8LHashChainFill(VP8LHashChain* const p, int quality, |
+ const uint32_t* const argb, int xsize, int ysize); |
void VP8LHashChainClear(VP8LHashChain* const p); // release memory |
// ----------------------------------------------------------------------------- |
@@ -192,8 +196,8 @@ static WEBP_INLINE void VP8LRefsCursorNext(VP8LRefsCursor* const c) { |
// refs[0] or refs[1]. |
VP8LBackwardRefs* VP8LGetBackwardReferences( |
int width, int height, const uint32_t* const argb, int quality, |
- int low_effort, int* const cache_bits, VP8LHashChain* const hash_chain, |
- VP8LBackwardRefs refs[2]); |
+ int low_effort, int* const cache_bits, |
+ const VP8LHashChain* const hash_chain, VP8LBackwardRefs refs[2]); |
#ifdef __cplusplus |
} |