1*3117ece4SchristosEducational Decoder 2*3117ece4Schristos=================== 3*3117ece4Schristos 4*3117ece4Schristos`zstd_decompress.c` is a self-contained implementation in C99 of a decoder, 5*3117ece4Schristosaccording to the [Zstandard format specification]. 6*3117ece4SchristosWhile it does not implement as many features as the reference decoder, 7*3117ece4Schristossuch as the streaming API or content checksums, it is written to be easy to 8*3117ece4Schristosfollow and understand, to help understand how the Zstandard format works. 9*3117ece4SchristosIt's laid out to match the [format specification], 10*3117ece4Schristosso it can be used to understand how complex segments could be implemented. 11*3117ece4SchristosIt also contains implementations of Huffman and FSE table decoding. 12*3117ece4Schristos 13*3117ece4Schristos[Zstandard format specification]: https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md 14*3117ece4Schristos[format specification]: https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md 15*3117ece4Schristos 16*3117ece4SchristosWhile the library's primary objective is code clarity, 17*3117ece4Schristosit also happens to compile into a small object file. 18*3117ece4SchristosThe object file can be made even smaller by removing error messages, 19*3117ece4Schristosusing the macro directive `ZDEC_NO_MESSAGE` at compilation time. 20*3117ece4SchristosThis can be reduced even further by foregoing dictionary support, 21*3117ece4Schristosby defining `ZDEC_NO_DICTIONARY`. 22*3117ece4Schristos 23*3117ece4Schristos`harness.c` provides a simple test harness around the decoder: 24*3117ece4Schristos 25*3117ece4Schristos harness <input-file> <output-file> [dictionary] 26*3117ece4Schristos 27*3117ece4SchristosAs an additional resource to be used with this decoder, 28*3117ece4Schristossee the `decodecorpus` tool in the [tests] directory. 29*3117ece4SchristosIt generates valid Zstandard frames that can be used to verify 30*3117ece4Schristosa Zstandard decoder implementation. 31*3117ece4SchristosNote that to use the tool to verify this decoder implementation, 32*3117ece4Schristosthe --content-size flag should be set, 33*3117ece4Schristosas this decoder does not handle streaming decoding, 34*3117ece4Schristosand so it must know the decompressed size in advance. 35*3117ece4Schristos 36*3117ece4Schristos[tests]: https://github.com/facebook/zstd/blob/dev/tests/ 37