-
Notifications
You must be signed in to change notification settings - Fork 140
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
PIZ decompression error with tinyexr 1.0.2 #194
Comments
Good find! The issue was it falsely returns error when input pixels are all zeros. The reproducible 000.exr has a tile(Bitmap) with all zeros, whose are encoded as
Line 2971 in 2a4dd61
And for some reason I did a wrong fix to return false for Possible fixCheck if
when |
That was fast. The fix seems to work, changing the code to: minNonZero == BITMAP_SIZE - 1;
maxNonZero == 0;
bitmap[0] == 0xffffffff; // optional fixes the Godot .exr loading, at least for this and other generated .exr images. I don't have a huge amount of images to test against right now, but I would assume this fix works for other images as well. Any estimates for tinyexr 1.0.3 etc. release? Meanwhile, we'll probably patch our local tinyexr while waiting for the next release if this fix seems solid. |
Thanks for testing! > at least for this and other generated .exr images All other test passes so pushed the fix to @bitsawer Can we add 000.exr to tinyexr regression test files https://github.com/syoyo/tinyexr/tree/release/test/unit/regression ? |
Thanks for the quick fix! I tested the 1.0.3 with Godot and it fixes the issue. I generated the 000.exr file, so feel free to use it for whatever you need. |
Thanks! Add 000.exr to regression test case |
Describe the issue
When updating Godot's tinyexr to 1.0.2, we encountered an error when loading .exr files that use PIZ compression. These files are also created and saved using tinyexr. Changing the compression type from TINYEXR_COMPRESSIONTYPE_PIZ to TINYEXR_COMPRESSIONTYPE_ZIP makes the save / load sequence work again. Some extra info:
tinyexr 1.0.2 can write these PIZ files but it can't read them (at least in the form Godot saves them). However, it can read PIZ files created by an earlier version of tinyexr.
Older tinyexr than 1.0.2 can read PIZ files created using new 1.0.2. However, the new 1.0.2 can't read the files it itself created, so it looks like a regression?
See the Godot bug report for more info: godotengine/godot#77746
I did some debugging and seems like at least some kind of error is detected at this line in the
DecompressPiz
function:tinyexr/tinyexr.h
Line 3203 in 2a4dd61
After that,
LoadEXRImageFromMemory()
returns the error code -4 (TINYEXR_ERROR_INVALID_DATA) and this message:"Invalid/Corrupted data found when decoding pixels."
Of course, it could also be that Godot is doing something wrong when loading the file. Here is the Godot's .exr loading code: https://github.com/godotengine/godot/blob/master/modules/tinyexr/image_loader_tinyexr.cpp
To Reproduce
Build / run Godot and follow the steps in the bug report: godotengine/godot#77746
Alternatively, try to open the attached .exr using tinyexr:
000.zip
Expected behavior
The .exr file should load succesfully.
Environment
The text was updated successfully, but these errors were encountered: