-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zlib #396
Comments
FWIW, I started working on this format. It is commonly called zlib compression, but this is quite unfortunate designation (it leads to false impressions). zlib is mainly a library for Deflate compression and decompression (see https://zlib.net/). See this good summary on Stack Overflow by Mark Adler (https://stackoverflow.com/a/20765054):
It's important to understand that the method of data compression, which is called zlib, "raw" deflate and gzip, is one and the same - the only difference is in the wrapping (envelope).
(Note: gzip and zlib headers might have some optional fields after the mandatory part, but that's out of scope of this basic intro.) Kaitai Struct supports only the And to the references that you linked - RFC 1950 really just describes the zlib header and footer (from which you can't read anything useful about the compressed data), the actual compression method is documented in RFC 1951 ("DEFLATE Compressed Data Format Specification version 1.3"). Also, the Wikidata item Q207240 refers to the zlib library, not to the compression format - DEFLATE - data decompression algorithm (Q2712) would be more appropriate. I can think of a terminological thing to mention, in case someone isn't aware - deflating means "letting air or gas out of a baloon" and DEFLATE means the compression (reducing the size), and inflating is the opposite - it means "filling a balloon with air or gas" and it refers to the decompression. It's a quite funny analogy I think 😃 My WIP .ksy spec for the deflate stream is here: https://gist.github.com/generalmimon/0f202457ebe8f1556293d611a949c358 I consider the RFCs and docs pretty much incomprehensible and not practical (i.e. you are often left to devise your own specific algorithms by yourself) and I don't fancy C code at all (zlib library), but Go language has a pretty good and legible DEFLATE implementation. The parsing of the deflated stream starts here: golang/go > So most of the The beginning is pretty simple, but it becomes ugly fast. You often need to implement various counters and collector variables, the Go implementation uses various mutable byte arrays for example, so this needs to be converted to the immutable paradigm for KSY usage, etc. I'm not sure if the KSY spec can be even finished. I don't think I'm going to actively work on the spec in the near future, so if anyone feels like that, please let me know. |
Fixed, thanks. |
Thanks, I wasn't aware of it. I will look into. |
The text was updated successfully, but these errors were encountered: