mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-16 13:59:51 +02:00
make the token page size be variable instead of fixed 8192
also changed the token-page layout a little bit to remove a not-needed field. This reduces the number of malloc()/free() calls substantially with minimal increase in memory consumption (~2%). For the tail of large sources, the number of malloc calls goes typically from ~10000 to ~100 (e.g.: bryce_big.jpg: 22711 -> 105) Change-Id: Ib847f41e618ed8c303d26b76da982fbc48de45b9
This commit is contained in:
@ -363,12 +363,14 @@ typedef struct {
|
||||
VP8Tokens* pages_; // first page
|
||||
VP8Tokens** last_page_; // last page
|
||||
uint16_t* tokens_; // set to (*last_page_)->tokens_
|
||||
int left_; // how many free tokens left before the page is full.
|
||||
int left_; // how many free tokens left before the page is full
|
||||
int page_size_; // number of tokens per page
|
||||
#endif
|
||||
int error_; // true in case of malloc error
|
||||
} VP8TBuffer;
|
||||
|
||||
void VP8TBufferInit(VP8TBuffer* const b); // initialize an empty buffer
|
||||
// initialize an empty buffer
|
||||
void VP8TBufferInit(VP8TBuffer* const b, int page_size);
|
||||
void VP8TBufferClear(VP8TBuffer* const b); // de-allocate pages memory
|
||||
|
||||
#if !defined(DISABLE_TOKEN_BUFFER)
|
||||
|
Reference in New Issue
Block a user