zstd/doc/educational_decoder
Nick Terrell ac58c8d720 Fix copyright and license lines
* All copyright lines now have -2020 instead of -present
* All copyright lines include "Facebook, Inc"
* All licenses are now standardized

The copyright in `threading.{h,c}` is not changed because it comes from
zstdmt.

The copyright and license of `divsufsort.{h,c}` is not changed.
2020-03-26 17:02:06 -07:00
..
.gitignore ignore build artifact from educational decoder test 2019-10-17 10:50:39 -07:00
Makefile Fix copyright and license lines 2020-03-26 17:02:06 -07:00
README.md added ability to remove error messages and dictionary support (#1975) 2020-01-27 11:39:29 -08:00
harness.c Fix copyright and license lines 2020-03-26 17:02:06 -07:00
zstd_decompress.c Fix copyright and license lines 2020-03-26 17:02:06 -07:00
zstd_decompress.h Fix copyright and license lines 2020-03-26 17:02:06 -07:00

README.md

Educational Decoder

zstd_decompress.c is a self-contained implementation in C99 of a decoder, according to the Zstandard format specification. While it does not implement as many features as the reference decoder, such as the streaming API or content checksums, it is written to be easy to follow and understand, to help understand how the Zstandard format works. It's laid out to match the format specification, so it can be used to understand how complex segments could be implemented. It also contains implementations of Huffman and FSE table decoding.

While the library's primary objective is code clarity, it also happens to compile into a small object file. The object file can be made even smaller by removing error messages, using the macro directive ZDEC_NO_MESSAGE at compilation time. This can be reduced even further by foregoing dictionary support, by defining ZDEC_NO_DICTIONARY.

harness.c provides a simple test harness around the decoder:

harness <input-file> <output-file> [dictionary]

As an additional resource to be used with this decoder, see the decodecorpus tool in the tests directory. It generates valid Zstandard frames that can be used to verify a Zstandard decoder implementation. Note that to use the tool to verify this decoder implementation, the --content-size flag should be set, as this decoder does not handle streaming decoding, and so it must know the decompressed size in advance.