Crates.io | rscompress |
lib.rs | rscompress |
version | 0.1.3 |
source | src |
created_at | 2021-01-30 18:34:18.151302 |
updated_at | 2021-05-15 11:18:47.573982 |
description | Library for compression of data. |
homepage | https://github.com/ucyo/rscompress |
repository | https://github.com/ucyo/rscompress/ |
max_upload_size | |
id | 348553 |
size | 7,214 |
A compression library in Rust with focus on scientific data.
This is a rewrite and merge of several compression algorithms developed during my time as a phd student:
The dissertation can be downloaded from https://doi.org/10.5445/IR/1000105055
The library is split into one base and four supporting libraries. The base library orchestrates the supporting libraries. All compression algorithms follow the same basic structure:
Additionally, check if each step executed as expected.
+----------------+ lossless +----------+
| | | |
Start +------> | Transformation | +------------> | Coding | +------> End
| | | |
+----------------+ +----------+
+ ^
| |
| lossy |
| |
v |
|
+---------------+ |
| | |
| Approximation | +------------------------+
| |
+---------------+
This library will follow the same principles.
Transformations are algorithms which represent the same information using a different alphabet.
Good transformation algorithms eliminate redundant information in the data.
A mathematical function can be seen as a transformation of a series of data.
The series 1 1 2 3 5 8 13 21 ..
can expressed as f(x) = f(x-1) + f(x-2)
.
We mapped the information represented in alphabet A (integers) to an alphabet B (letters + integers) which is more compact.
It is important to note that all transformations must have two properties:
Approximations are algorithms which loose information for the sake of better compression.
Given a threshold theta
(this can be absolute or relative), the algorithm maps the data from alphabet A to B with an information lose within the expected threshold.
An example for an approximation is the ~=
operator known from primary school e.g. 1/3 ~= 0.3
.
Approximations have the following properties:
theta
Codings are algorithms where the actual compression happens. The information is being saved on disk as compact as possible. Examples are Huffman or Arithmetic coding.
Checksums are algorithms to check the integrity of the data at each step e.g. Adler-32.