compressBound() functionality #107

Closed
opened 2026-01-29 20:34:58 +00:00 by claunia · 2 comments
Owner

Originally created by @richgel999 on GitHub (May 19, 2016).

Hi,
I'm using brotli::BrotliCompressBuffer() in my benchmark, but I need a way to compute the max size of the buffer to allocate to hold the encoded data. zlib has a function like this:

compressBound()

For now, I tried just allocating 10% more bytes than the source file's size, but I encountered 65 exceptions (out of 30,000+ files) so I guess I'll need to bump this up more.

Originally created by @richgel999 on GitHub (May 19, 2016). Hi, I'm using brotli::BrotliCompressBuffer() in my benchmark, but I need a way to compute the max size of the buffer to allocate to hold the encoded data. zlib has a function like this: [compressBound()](https://refspecs.linuxbase.org/LSB_2.1.0/LSB-generic/LSB-generic/zlib-compressbound-1.html) For now, I tried just allocating 10% more bytes than the source file's size, but I encountered 65 exceptions (out of 30,000+ files) so I guess I'll need to bump this up more.
Author
Owner

@nemequ commented on GitHub (May 25, 2016):

Dup of #274

Until that is fixed, I think the function in Squash is safe: 26aa037b61/plugins/brotli/squash-brotli.cpp (L265)

@nemequ commented on GitHub (May 25, 2016): Dup of #274 Until that is fixed, I think the function in Squash is safe: https://github.com/quixdb/squash/blob/26aa037b618c1a37d984099b8dd5a3e04d3058c3/plugins/brotli/squash-brotli.cpp#L265
Author
Owner

@nemequ commented on GitHub (Jun 16, 2016):

0.5 provides BrotliEncoderMaxCompressedSize, I think this can be closed.

@nemequ commented on GitHub (Jun 16, 2016): 0.5 provides `BrotliEncoderMaxCompressedSize`, I think this can be closed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#107