use block-based allocation for backward refs storage, and free-lists

Non-photo source produce far less literal reference and their
buffer is usually much smaller than the picture size if its compresses
well. Hence, use a block-base allocation (and recycling) to avoid
pre-allocating a buffer with maximal size.

This can reduce memory consumption up to 50% for non-photographic
content. Encode speed is also a little better (1-2%)

Change-Id: Icbc229e1e5a08976348e600c8906beaa26954a11
This commit is contained in:
skal
2014-05-05 11:11:55 -07:00
parent 1ba61b09f9
commit ca3d746e39
5 changed files with 225 additions and 124 deletions

View File

@ -48,10 +48,10 @@ typedef struct {
uint32_t palette_[MAX_PALETTE_SIZE];
// Some 'scratch' (potentially large) objects.
struct VP8LBackwardRefs* refs_[2]; // Backward Refs array corresponding to
// LZ77 & RLE coding.
VP8LHashChain hash_chain_; // HashChain data for constructing
// backward references.
struct VP8LBackwardRefs refs_[2]; // Backward Refs array corresponding to
// LZ77 & RLE coding.
VP8LHashChain hash_chain_; // HashChain data for constructing
// backward references.
} VP8LEncoder;
//------------------------------------------------------------------------------