Convert lz77 to use fixed buffer sizes.
This commit is contained in:
parent
a6e31c8d39
commit
af6fad72eb
9 changed files with 362 additions and 110 deletions
32
test/compression/TestLz77Encoder.cpp
Normal file
32
test/compression/TestLz77Encoder.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue