Gzip and Brotli Compression Level Estimator
tools.paulcalvano.com
tools.paulcalvano.com
I guess compression is something that would come under that?
[1] https://github.com/madler/zlib/blob/21767c6/deflate.c#L134-L...
[2] https://github.com/deus-libri/preflate/blob/master/preflate_...
Decoding the huffman codes is by far the most expensive operation, so you don't save much.
For decoding match lengths you also need to decode all symbols.
You can compare the output from each level and that will be your guess, assuming of course that zlib was used in the first place.
If you see a match that would not be visible from given compression level, or conversely if you don't see a match that should have been selected at given compression level, then it is clear that the level couldn't be used to make that compressed stream. I think preflate actually does this, maintaining multiple hash tables over the course.
That said, I see where my explanation was slightly off in hindsight (sorry!). A bitstream only composed of blocks with the static Huffman table can be produced in multiple ways. One such case is of course a very specific input that is more beneficial to not use dynamic Huffman tables (that said, zlib tallying is AFAIK greedy so this should be very rare). Another case is Z_FIXED, which was actually what I had in mind at that writing---I should have said compression parameters instead. But I stand by the claim that many parameter combinations can be excluded from partial or full decompression, and for the practical purpose this is enough to be classified as the "estimation".
Yes, but you'd need to reconstruct the hash table and the link table. For that you'd need to decompress fully. You could compare matches, but you are so far along at this point you might as well just decompress and recompress, comparing the output bit by bit.
Why, then, not just let me enter a file size that I'm curious about, if that's the only input it uses? Heck, why not just show a result graph with size on the X axis so you don't need to enter anything at all but just get the info the tool has to offer at a glance?
1. Compression time
2. De-compression time
3. Memory allocation during compression
4. Memory allocation during de-compression
Thank you, but I have enough nightmares with C.