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

4× faster RGB/A to palette conversion #148

Merged
merged 1 commit into from
Nov 23, 2018

Conversation

kornelski
Copy link
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.

Copy link
Owner

@shssoichiro shssoichiro left a comment

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 shssoichiro: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