Thanks to visit codestin.com
Credit goes to github.com

Skip to content

4× faster RGB/A to palette conversion - #148

Merged
shssoichiro merged 1 commit into
oxipng:masterfrom
kornelski:pals
Nov 23, 2018
Merged

4× faster RGB/A to palette conversion#148
shssoichiro merged 1 commit into
oxipng:masterfrom
kornelski:pals

Conversation

@kornelski

Copy link
Copy Markdown
Contributor

Manipulation of palette as separate vec of RGB bytes and tRNS to match was cumbersome. I've changed the internal representation of palette to a vec RGBA colors. Actual chunks are auto-generated on file write.

Fixed-size 4-byte RGBA pixels are much cheaper to use than 128-bit fat pointers of variable-length slices.

With colors being structs I was able to replace duplicate RGB and RGBA reduction functions with one function using generics.

The end result is that RGBA to palette reduction is 4-4.5 times faster.

@shssoichiro shssoichiro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks awesome. Thanks!

@shssoichiro
shssoichiro merged commit 686adcd into oxipng:master Nov 23, 2018
@kornelski
kornelski deleted the pals branch November 23, 2018 03:34
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