Compression provides a <Read>-struct to wrap a Brotli-compressed stream. A consumer is thus able to read a compressed stream with usual convenience.
Bug with multiple metablocks, reported and fixed by Daniel.
Worked around feature gate issue in nightly. (Thanks, Corey!)
Removed 64k big Pseudo-Code lookup table, because creating this trivial table probably took more time than making the calculcation on the fly. (Bench tests seem to suggest a 1% time savings without the lookup table)
Fixed case where a simple prefix code could have duplicate symbols.
Fixed case where a complex prefix code could have an incorrect checksum on its runlength code.
- Fixed incorrect calculation of alphabet size for distance code.
- Fixed evaluation where streams with excessive insert/copy lengths could be rejected early.
Fixed injection of invalid symbols in simple prefix code.
Fixed invalid block-type in switch command. (Thanks, Corey!).
Fixed uncaught non-positive distances. (Thanks, Corey!).
Fixed uncaught zero-byte in word transformation. (Thanks, Corey!).
Fixed possible arithmetic overflow in word transformation. (Thanks, Corey!).
Fixed incorrect type for runlength code. (Thanks, Corey!).
Fixed incorrect array index bound check in tree lookup. (Thanks, Corey!).
Fixed some value range checks on block types and ntree*. (Thanks, Corey!).
Went over "unreachable!()" statements, analyzed, and handled error condition properly, if they were reachable through invalid data.
Fixed a case where an invalid prefix code with all-zero codelengths could create an index-out-of-bounds panic. (Thanks, Corey!).
Fixed a case where an invalid insert-and-copy-length-code would produce a panic. (Thanks, Corey!).
Fair amount of internal small improvements, improving code quality. Fixed a couple of cases where invalid streams would lead to panics and/or infinite loops (Thanks, Corey!).
This is only a minor version bump, with no breakage in usage, but it's exciting nonetheless!
In Brotli, a lot of work is done with and by prefix codes. Through a change in the internal representation of prefix codes, it was possible to speed the reference benchmark time by a factor of ~7. The benchmark decompresses the contents of the file data/monkey.compressed.
-
With linked-list-based, recursive tree implementation:
test bench_monkey ... bench: 866,888 ns/iter (+/- 58,119) -
With array-based, iterative tree implementation, before max-depth constraint:
test bench_monkey ... bench: 704,282 ns/iter (+/- 220,068) -
With array-based, iterative tree implementation, with max-depth constraint:
test bench_monkey ... bench: 120,745 ns/iter (+/- 16,627)
- renamed crate compression -> brotli
- restructured modules to avoid redundant paths like brotli::brotli::Decompressor (now it's just brotli::Decompressor)
- Decompressor::new() now accepts a Read, as opposed to a BitReader.