Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
- Hopefully deals with Static webp sometimes laggy #1509
Pull Request Information
This PR improves how webp images are handled. Previously, every webp would go through the
NukeWebpBridgeDecoder
, which would both decode the image and, if the image was animated, populate theanimated
field. This had multiple problems:BridgeDecoder
was scanning the entire data to find theANMF
headerBridgeDecoder
was therefore very slow, even for static images, and because the check was so slow it couldn't defer to the standard Nuke decoder for static imagesBridgeDecoder
was poorly optimized for static images, since it was built to handle animated imagesBridgeDecoder
could throw a false positive ifANMF
happened to appear in the body of the image's dataThis PR implements a much more efficient method of checking whether a webp is animated; it now scans only the critical bytes, rather than the whole data. This allows the
NukeWebpBridgeDecoder
to check atinit
whether a webp is animated and defer to the more efficient Nuke default decoder for static images.Hopefully using Nuke for the static webps fixes the lagginess, which I believe may have been caused by the custom decoding. It may just be good luck, but I haven't encountered lag on this branch.