-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
54 lines (39 loc) · 1.8 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
FSC: Finite State Coder
An implementation of the compression technique described
in http://arxiv.org/pdf/1311.2540v2.pdf
To understand ANS, i extensively used the FSE project:
https://github.com/Cyan4973/FiniteStateEntropy
from Yann Collet, which is referenced by Jarek's paper.
See the blog entry:
http://fastcompression.blogspot.fr/2013/12/finite-state-entropy-new-breed-of.html
Fabian Giesen also has interesting implementations ideas. See his blog for pointers:
http://fgiesen.wordpress.com/
Code is located here: https://github.com/rygorous/ryg_rans
I re-implemented some his ideas (Alias method, interleaving, etc.) for
experimentation purpose.
Building:
=========
There is a primitive "Makefile" to help you build the library (libfsc.a)
and tests. Just type 'make'. This code has been developed and tested on
Linux/x86_64 mostly. Expect moderate surprises on other platforms.
Quick description of the source files:
======================================
* fsc.h: main header
* fsc_enc.c: encoder
* fsc_dec.c: decoder
* bits.c / bits.h: bit reading and writing function
* fsc_utils.[ch]: non-critical utility functions for testing
* test.c / bit_test.c: tests
* fsc.c: sample program to compress / decompress
API:
====
// Compresses input buffer (in / in_size) using FSC.
// log_tab_size must be in [log(alphabet_size)..14] range
// for method 0 to 3. For word-based method, the value doesn't matter.
// Compressed output (*out / out_size) must be deallocated using free().
int FSCEncode(const uint8_t* in, size_t in_size,
uint8_t** out, size_t* out_size,
int log_tab_size, FSCCodingMethod method);
// Decompresses compressed bytes.
// Decompressed output (*out / out_size) must be deallocated using free().
int FSCDecode(const uint8_t* in, size_t in_size, uint8_t* out, size_t out_size);