-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZopfliStream not working? #4
Comments
When I debug tests, the freeze comes from |
I experienced freezes when I used an "output sink" to disable verbose output, because the options didn't work. It turns out there's some critical error either in the way libzopfli-sharp passes ZopfliOptions to the native lib, or in the current build of the zopfli library itself - somehow it was passing a pointer to memory that was changing, and producing invalid data (like turning a 300 kB stream into 12 bytes). I built my own version from source to work around it: void ZopfliCompress(ZopfliOptions* options_unused, ZopfliFormat output_type,
const unsigned char* in, size_t insize,
unsigned char** out, size_t* outsize) {
ZopfliOptions options;
options.verbose = 0;
options.verbose_more = 0;
options.numiterations = 15;
options.blocksplitting = 1;
options.blocksplittinglast = 0;
options.blocksplittingmax = 15;
if (output_type == ZOPFLI_FORMAT_GZIP) {
ZopfliGzipCompress(&options, in, insize, out, outsize);
} else if (output_type == ZOPFLI_FORMAT_ZLIB) {
ZopfliZlibCompress(&options, in, insize, out, outsize);
} else if (output_type == ZOPFLI_FORMAT_DEFLATE) {
unsigned char bp = 0;
ZopfliDeflate(&options, 2 /* Dynamic block */, 1,
in, insize, &bp, out, outsize);
} else {
assert(0);
}
} |
To fix issue #2 myself, I cloned this repositiory and executed unit tests.
By upgrading NUint to 3 and installing NUnit3Adapter nuget I was able to run
IntegrationTests.cs
, but the tests just stuck and never end. It is strange because tests reside onPNGCompressTests.cs
works without a problem. It happens regardless of my patch (PR #3) to ZopfliStream.The text was updated successfully, but these errors were encountered: