Convert lz77 to use fixed buffer sizes.

This commit is contained in:
James Grogan 2022-11-29 12:05:08 +00:00
parent a6e31c8d39
commit af6fad72eb
9 changed files with 362 additions and 110 deletions

View file

@ -28,6 +28,7 @@ void testCompressedPng()
PngWriter writer;
writer.setPath("test_compressed.png");
writer.setCompressionMethod(Deflate::CompressionMethod::NONE);
writer.write(image);
return;
@ -72,9 +73,40 @@ void testFixedPng()
}
void testDynamicCompressedPng()
{
unsigned width = 10;
unsigned height = 10;
unsigned numChannels = 1;
auto image = Image<unsigned char>::Create(width, height);
image->setNumChannels(numChannels);
image->setBitDepth(8);
std::vector<unsigned char> data(width*height, 0);
for (unsigned idx=0; idx<width*height; idx++)
{
//unsigned char val = 100 * idx /(width*height);
unsigned char val = 10;
data[idx] = val;
}
image->setData(data);
PngWriter writer;
writer.setPath("test_dynamic.png");
writer.write(image);
//return;
File test_file("test_dynamic.png");
std::cout << test_file.dumpBinary();
}
int main()
{
//testCompressedPng();
testFixedPng();
//testFixedPng();
testDynamicCompressedPng();
return 0;
}