Header file for the RLE (Run-Length Encoding) compression and decompression module.
This module provides classes for compressing and decompressing data using RLE. The CRleEncoder class encodes data from an input pipe and writes the compressed data to an output pipe. The CRleDecoder class decodes compressed data from an input pipe and writes the decompressed data to an output pipe.
#include <iostream>
#include <memory>
#include <vector>
using namespace std;
using namespace Pipe;
int main() {
vector<u8> input_data = {0, 0, 0, 0, 1, 2, 3, 3, 3, 3, 3, 0, 0, 0};
auto pipe_mem_reader = make_shared<CMemBufferPipe>();
for (auto data : input_data) {
pipe_mem_reader->Push(data);
}
auto pipe_mem_packed = make_shared<CMemBufferPipe>();
encoder.
SetIn(pipe_mem_reader);
encoder.
SetOut(pipe_mem_packed);
cout << "RLE Encoded Data:" << endl;
pipe_mem_packed->Dump();
auto pipe_mem_unpacked = make_shared<CMemBufferPipe>();
decoder.
SetIn(pipe_mem_packed);
decoder.
SetOut(pipe_mem_unpacked);
cout << "RLE Decoded Data:" << endl;
pipe_mem_unpacked->Dump();
return 0;
}
Class for decoding data using run-length encoding (RLE).
Definition rle.h:142
void SetIn(std::shared_ptr< Pipe::CPipe > pipe_in_)
Sets the input pipe for the decoder.
Definition rle.cpp:115
CRleDecoder::DecodeResult Decode()
Performs the RLE decoding process.
Definition rle.cpp:128
void SetOut(std::shared_ptr< Pipe::CPipe > pipe_out_)
Sets the output pipe for the decoder.
Definition rle.cpp:119
Class for encoding data using run-length encoding (RLE).
Definition rle.h:105
void SetIn(std::shared_ptr< Pipe::CPipe > pipe_in_)
Sets the input pipe for the encoder.
Definition rle.cpp:104
void SetOut(std::shared_ptr< Pipe::CPipe > pipe_out_)
Sets the output pipe for the encoder.
Definition rle.cpp:108
CRleEncoder::EncodeResult Encode()
Performs the RLE encoding process.
Definition rle.cpp:36
The Rle namespace provides classes for run-length encoding (RLE) compression and decompression.
Module for data pipeline processing using pipes.
Header file for the RLE (Run-Length Encoding) compression and decompression module.