-
Notifications
You must be signed in to change notification settings - Fork 88
Seeking multiple times #279
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
Conversation
The previous strategy could not keep track of all cycles such as reflexive ones at the very start. Additionally, it would fail to be able to iterate after seeking since it was overly cautious and verified the next IFD position before allowing the read of a current IFD. The new implementation is furthermore proof against having multiple independent chains of IFD which may occur when iterating SubIFDs for thumbnails. (Note that we do not verify the tree-structure, only a freedom from cycles).
ac575fe
to
97e2305
Compare
There's another motivation here: This new cycle tracking implementation will allow the decoder to switch the image chain to another one, that is not in the original IFD chain. This is required for tags such as SubIFD (thumbnails etc.) that refer one image to a separate chain of child images. |
I think letting the |
I'll sketch this out in the PR for it but my impression is the decoder could also have a non-image iteration mode without that becoming overly complex. For instance, when we first switch to another chain we may set a flag in the decoder to no longer read images ahead-of-time and then only deactivate that flag when explicitly asked. Or, offer a Also, he current behavior has downsides. We should per specification be able to handle color channels beyond the rgba and simply skip bytes that do not belong to them according to the
|
Ok, I think that makes sense. I could also see adding methods like |
This fixes an issue with cycle tracking that got introduced when we allowed seeking to previous images. Since the
next
offset of an IFD had to be unique, seeking back would not allow iterating forwards again and bring the decoder into a rather unfortunate state that was not consistent with actually rewinding as intended.