Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fytex/shafa-cd
File Compressor written in C using both Shannon Fano and RLE algorithms
https://github.com/fytex/shafa-cd
binary-code c clang compressor decompressor matrix rle rle-compression-algorithm shafa shannon-fano shannon-fano-algorithm shannonfano
Last synced: 8 days ago
JSON representation
File Compressor written in C using both Shannon Fano and RLE algorithms
- Host: GitHub
- URL: https://github.com/fytex/shafa-cd
- Owner: Fytex
- License: apache-2.0
- Created: 2020-11-25T10:58:57.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-12T15:15:41.000Z (almost 4 years ago)
- Last Synced: 2024-01-01T03:41:44.335Z (11 months ago)
- Topics: binary-code, c, clang, compressor, decompressor, matrix, rle, rle-compression-algorithm, shafa, shannon-fano, shannon-fano-algorithm, shannonfano
- Language: C
- Homepage:
- Size: 389 KB
- Stars: 23
- Watchers: 7
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![GitHub top language](https://img.shields.io/github/languages/top/fytex/Shafa-CD?style=for-the-badge)
# What is Shafa?
**Shafa** is a free and open-source program made for Lossless files' compression written in C (2020/21).
It is OS independent and some modules are multithread executed if running on Windows or POSIX-compliant (allowing pthreads).Uses two algorithms for compression:
- **RLE**
- **Shannon Fano** with blocks of length 1 (K=1).For RLE's decompression a .freq file is needed along with the .rle file.
For Shannon Fano's decompression a .cod file is needed along with .shaf.
(All these files are generated by the program)## Modules:
- F ( RLE compression and Frequencies calculation )
- T ( Codes calculation using Shannon-Fano's algorithm )
- C ( Shannon-Fano compression )
- D ( RLE and Shannon-Fano decompression )
#### SETUP - \*NIX
```
gcc -o shafa $(find ./src -name '*.c' -or -name '*.h') -O3 -Wno-format -pthread
```#### SETUP - WINDOWS
```
gcc -o shafa src/*.c src/*.h src/*/*.c src/*/*.h src/*/*/*.c src/*/*/*.h -O3 -Wno-format
```### How to execute?
Open terminal where the created executable `shafa` is located and type the following:**Windows**:
- shafa.exe \ \**\*NIX**:
- ./shafa \ \### CLI Options:
-m : Executes respective module (Can be executed more than one module if possible)
-b : Blocks size for compression (default: K)
-c : Forces execution (r -> RLE's compress | f -> Original file's frequencies)
-d : Only executes a specific decompression (s -> Shannon-Fano's algorithm | r -> RLE's algorithm)
--no-multithread : Disables multithread
### Blocks Size:
- K = 640 KiB
- m = 8 MiB
- M = 64 MiB**Note:** Multithread was only implemented in modules C and D (the ones that cost the most)