https://github.com/nir3x/compressor.cpp
Compressor - Simple Repeated Characters Compression Algorithm
https://github.com/nir3x/compressor.cpp
algorithm c-plus-plus compression compression-library compression-package cpp data-compression data-encoding data-size reduction-algorithm repeated-characters sequence symmetric-algorithm varsizedint
Last synced: 10 months ago
JSON representation
Compressor - Simple Repeated Characters Compression Algorithm
- Host: GitHub
- URL: https://github.com/nir3x/compressor.cpp
- Owner: NIR3X
- License: agpl-3.0
- Created: 2024-01-13T16:05:40.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-16T04:06:46.000Z (almost 2 years ago)
- Last Synced: 2024-02-16T05:22:09.846Z (almost 2 years ago)
- Topics: algorithm, c-plus-plus, compression, compression-library, compression-package, cpp, data-compression, data-encoding, data-size, reduction-algorithm, repeated-characters, sequence, symmetric-algorithm, varsizedint
- Language: C++
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Compressor - Simple Repeated Characters Compression Algorithm
This C++ package provides a basic implementation of a symmetric compression algorithm designed for sequences containing repeated characters. The algorithm aims to reduce the size of data by efficiently encoding repeated character chunks.
## Installation
To use this package, you can clone the repository and compile it using a C++ compiler:
```bash
git clone https://github.com/NIR3X/Compressor.cpp --recurse-submodules
cd Compressor.cpp
make
```
## Usage
Here is an example of how to use the Compressor package in your C++ application:
```cpp
#include "Compressor.h"
#include
#include
#include
int main() {
// Data to compress
std::string data = "Hellooooooooooo, World!";
// Compress the data
std::vector compressed(data.size() * 2); // Assume worst-case expansion for simplicity
uint64_t compressedSize = CCompressor::Compress((uint8_t*)data.data(), data.size(), compressed.data());
// Decompress the data
std::vector decompressed(data.size());
uint64_t decompressedSize = CCompressor::Decompress(compressed.data(), compressedSize, decompressed.data());
// Print original, compressed, and decompressed sizes
std::cout << "Original Size: " << data.size() << " bytes" << std::endl;
std::cout << "Compressed Size: " << compressedSize << " bytes" << std::endl;
std::cout << "Decompressed Size: " << decompressedSize << " bytes" << std::endl;
// Print original and decompressed data
std::cout << "Original Data: " << data << std::endl;
std::cout << "Decompressed Data: " << std::string(decompressed.begin(), decompressed.end()) << std::endl;
return 0;
}
```
In this example, the Compressor package compresses the input data, and then decompresses it, demonstrating the basic usage of the compression and decompression functionalities. Adjust the package integration as needed for your specific use case.
## License
[](https://www.gnu.org/licenses/agpl-3.0.html)
This program is Free Software: You can use, study share and improve it at your
will. Specifically you can redistribute and/or modify it under the terms of the
[GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html) as
published by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.