Skip to content
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

Error out on unsupported predictor instead of decoding incorrectly. #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kevinmehall
Copy link

Files using the floating-point predictor (GDAL's -co PREDICTOR=3) were silently decoding corrupt data because the algorithm implemented corresponds to predictor 2.

@constantinius
Copy link
Member

Hi @kevinmehall
Actually, PREDICTOR=3 is supported (AFAIK, the mechanism is the same as with PREDICTOR=2, just with floating point arithmetic instead of the integer one), thus the check predictor !== 1.
If you say that corrupted data is read there must be something else that is wrong, as far as I can tell.
Can you make your test file and a sample code available to reproduce the bug?

Thanks for your contribution anyways!

@kevinmehall
Copy link
Author

Predictors 2 and 3 are not the same. The floating point predictor 3 rearranges the bytes to take advantage of patterns in the IEEE754 floating point representation, and then performs byte-level differencing. See Technical Note 3, page 3 and the libtiff implementation.

However, I've also discovered different data corruption when decoding float32 data with predictor=2 with this library, so I've opened #28 with a test case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants