package decompress
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=51983d4497ccb27c253e7464b03d38544aad51e0e7d537e405f4df6954c27ab0
sha512=17c7e3dc79b7cedaf649c208874a50a810002c71d061c133239b9813a9dfe424ba303a968ba68c728862bb20ceaa23465097334bc16b819317390d01c2f91f89
doc/decompress.de/De/index.html
Module De
Source
RFC1951/DEFLATE codec.
RFC1951/DEFLATE is a IETF standard. Module provides non-blocking streaming codec to decode and encode DEFLATE encoding. It can efficiently work payload by payload without blocking IO.
Module provides LZ77 compression algorithm but let the client to define his algorithm as long as he uses shared queue provided in this module.
Prelude.
de
wants to be self-contained. By this constraint, it provides convenience values to be used by others (like zz
). The client should not use these functions even if they are available. Others libraries like Bigstringaf
serve the same purpose of a much better way.
MirageOS compatibility.
The type for bigstring
.
Type type for optimal integer.
bigstring_create len
returns a uninitialized bigstring of length len
.
bigstring_length t
is the length of the bigstring t
, in bytes.
Window.
The type for windows.
make_window
allocates a new buffer which represents a window. It used by decoder and LZ77 compressor to keep tracking older inputs and:
- process a copy from a distance by the decoder.
- generate a copy from the compression algorithm.
DEFLATE Decoder.
Decoder of RFC1951 DEFLATE codec. de
provides a Inf.decoder
to decode DEFLATE input and inflate it.
Queue.
DEFLATE encoder needs a compressed input which can be transmited by a shared queue filled by compression algorithm. B
is used between N
and a compression algorithm like L
. It provides a small representation of commands (see Queue.cmd
) emitted by compression algorithm.
N
encoder interprets Queue.cmd
as fast as it can. Shared queue can be a bottleneck about the whole compression process. Indeed, it limits encoder on how many bytes it can produce. We recommend to make a queue as large as output buffer.
Frequencies.
DYNAMIC DEFLATE block needs frequencies of code emitted by compression algorithm. literals
and distances
exist to keep frequencies while compression process.
The type of frequencies of literals (including lengths).
The type of frequencies of distances.
make_literals
allocates a new literals
where frequencies of symbols (expect End Of Block) are set to 0.
make_distances
allocates a new distances
where frequencies of distance symboles are set to 0.
succ_literals literals chr
increases frequency of chr
.
succ_length literals l
increases frequency of l
code. l
must be upper than 2 and lower than 259 according DEFLATE codec. Otherwise, it raises an Invalid_argument
.
succ_distance distance d
increases frequency of d
code. d
must be upper than 0 and lower than 32769 according DEFLATE codec. Otherwise, it raises an Invalid_argument
.
DEFLATE Encoder.
LZ77 compression algorithm.
Distribution provides LZ77 compression algorithm which can be used with N
. However, the client must know others algorithms exist. This algorithm is used by zz
to implement ZLIB layer.
Higher API.
de
provides useful but complex API. This sub-module provides an easier way to compress/uncompress DEFLATE codec. Even if the client still can give some details, we recommend to use M
and N
if you want a precise control about memory consumption.
/ *