33 lines
765 B
C++
33 lines
765 B
C++
|
#include <iostream>
|
||
|
|
||
|
#include "Lz77Encoder.h"
|
||
|
#include "BufferBitStream.h"
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
std::vector<unsigned> values {0, 10, 11, 12, 10, 11, 12, 0, 13, 14, 15, 10, 11, 12};
|
||
|
|
||
|
//std::vector<unsigned> values {0, 1, 2, 3, 0, 1, 2, 3, 0,1};
|
||
|
|
||
|
BufferBitStream input_stream;
|
||
|
for (auto value : values)
|
||
|
{
|
||
|
input_stream.writeByte(value);
|
||
|
}
|
||
|
|
||
|
BufferBitStream output_stream;
|
||
|
|
||
|
Lz77Encoder encoder(&input_stream, &output_stream);
|
||
|
|
||
|
encoder.encode();
|
||
|
|
||
|
auto hit_buffer = encoder.getHitBuffer();
|
||
|
for(const auto& hit : hit_buffer)
|
||
|
{
|
||
|
const auto& [length, distance, next_char] = hit;
|
||
|
std::cout << "Got hit " << length << " | " << distance << " | " << static_cast<int>(next_char) << std::endl;
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|