Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

235 Commits
235 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GitHub top language

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 <file> <options>

*NIX:

  • ./shafa <file> <options>

CLI Options:

-m <module>      :  Executes respective module (Can be executed more than one module if possible)
-b <K/m/M>       :  Blocks size for compression (default: K)
-c <r/f>         :  Forces execution (r -> RLE's compress | f -> Original file's frequencies)
-d <s/r>         :  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)

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.