GithubHelp home page GithubHelp logo

3omar-mostafa / compressor Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 62 KB

A Fast C++ Lossless Compress/Decompress CLI Program with High Compression Ratio

License: GNU General Public License v3.0

CMake 2.64% C++ 97.36%
huffman lzw-compressor lzw burrows-wheeler-transform bwt move-to-front mtf compression lossless enwik

compressor's Introduction

Compressor

A Fast C++ Lossless Compress/Decompress CLI Program with High Compression Ratio

Algorithms Implemented

  • Huffman
  • LZW (Lempel – Ziv – Welch)
  • BWT (Burrows - Wheeler Transform) and MTF (Move To Front)

The Pipeline which produces best compression ratio is BWT -> MTF -> LZW

Compatibility

Tested on Linux (Ubuntu) with GNU GCC and Windows with Microsoft Visual Studio and Mingw-w64

Requires CMake and C++11 or above

How to Build

  • Clone this repo with its submodules git clone --recurse-submodules https://github.com/3omar-mostafa/Compressor.git
  • Use CMake to Build
mkdir cmake-build
cd ./cmake-build
cmake ..

You Can Create Visual Studio Project on Windows

mkdir cmake-build
cd ./cmake-build
cmake .. -G "Visual Studio 15 2017"

Download Binaries

Binaries for Windows and Ubuntu are available at Releases

How To Run

./Compressor OPTION input_file output_file
OPTION:
      -c  --compress     Compress the file
      -d  --decompress   Decompress the file

Tests and Results

Tested on enwik8 (Size of 100MB)

Tested on Github Action Servers with 2-core 64-Bit CPU, 7 GB of RAM memory and SSD. Learn more about environment

Executables are built in release mode with max compiler optimization

Compression Ratio on enwik8: 3.858, Lossless Integrity checked with SHA512

Platform Compress Time (Avg) Decompress Time (Avg)
Linux (Ubuntu) - GNU GCC 1m 25s 20s
Windows - Visual Studio 4m 30s 46s
Windows - Mingw-w64 4m 3s 36s

TODO

  • More Memory Optimization

Credits

Used this paper Linear Work Suffix Array Construction (2006) By Juha Kärkkäinen, Peter Sanders, Stefan Burkhardt to implement a faster Suffix Array O(n) instead of O(nlogn)

compressor's People

Contributors

3omar-mostafa avatar

Stargazers

 avatar  avatar

Watchers

 avatar

compressor's Issues

can not compress large file

hello,i just use it to compress a file that size of 3GB ,then i get :
terminate called after throwing an instance of 'std::length_error'
what(): basic_string::_M_replace_aux
Aborted
I would appreciate it if you could give me some advice

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.