Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Use more accurate bit for alpha lookup. - #2473

#2473
Merged
JimBobSquarePants merged 2 commits into
mainSixLabors/ImageSharp:mainfrom
js/2469-color-LUT-memorySixLabors/ImageSharp:js/2469-color-LUT-memoryCopy head branch name to clipboard
Jun 13, 2023
Merged

Use more accurate bit for alpha lookup.#2473
JimBobSquarePants merged 2 commits into
mainSixLabors/ImageSharp:mainfrom
js/2469-color-LUT-memorySixLabors/ImageSharp:js/2469-color-LUT-memoryCopy head branch name to clipboard

Conversation

@JimBobSquarePants

Copy link
Copy Markdown
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Fixes #2469

Our pixel map accuracy wasn't good enough for alpha comparison, so we were leaving artifacts.

This increases memory from 2.26MB to 4.45MB but not only do we fix our issue, as a result of the increased accuracy, we're also getting less collisions in our RGB components.

{
private const int IndexBits = 5;
private const int IndexAlphaBits = 5;
private const int IndexAlphaBits = 6;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This could be zero when TPixel doesn't have an alpha. It might be worth to eventually implement some trick to have two versions of EuclideanPixelMap, so we save memory when working with RGB pngs and gifs.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point. We could easily preserve much more accurate matches in less space.

@JimBobSquarePants
JimBobSquarePants merged commit bf43044 into main Jun 13, 2023
@JimBobSquarePants
JimBobSquarePants deleted the js/2469-color-LUT-memory branch June 13, 2023 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected artefacts when quantizing images

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.