-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor unpack_bits for palette expanded images
Remove copy_from_slice in palette match arms of next_interlaced_row_impl Reuse the previous row in unpack_bits calculation instead of expanding the palette within the buffer Use chunks_exact and iterate from start to end of the buffer instead of back to front in-place
- Loading branch information
Showing
2 changed files
with
35 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4b2a01f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI I think this commit made a massive improvement on grayscale image decoding in wasm. Before, using image 0.24.7 as is (this is profiling a micro benchmark taking two 2560x3300 monochrome images stored as base64-encoded text representation of png files, and downscaling them):
and after, just adding
png = { git = "https://github.com/image-rs/image-png.git", rev = "ae5dee9" }
under[patch.crates-io]
and rebuilding my wasm:expand_gray_u8
was where the vast majority of time was spent in calls fromnext_interlaced_row_impl
.Almost a 100% improvement!