2

Inspired by this question, what is the maximum theoretical compression ratio of brotli?

I was able to find a lower-bound by experimenting with the brotli cli, but I'd like someone who understands the algorithm better to find a more formal answer.

1GB (1073741824 bytes) of null bytes, with no dictionary, at the best (11) (default) compression level, gets compressed to 841 bytes for a compression ratio of ~1276744x.

Analyzing the archive, there seems to be a head, a repeating segment and a tail. In the 1GB archive, this segment has been repeated 3 times.

Repeating it 1 and 2 times, gave the following valid archives:

Download Link Compressed Size Decompressed Size
repeat1 421 bytes 536870912 bytes
repeat2 631 bytes 805306368 bytes
repeat3 (original) 841 bytes 1073741824 bytes

These data points exhibit a linear dependency between the decompressed and compressed size where the slope is 1278264.076190476 (268435456 decompressed bytes for every 210 compressed bytes).

Dinhero21
  • 21
  • 2

0 Answers0