Skip to content

Conversation

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

/// </para>
/// </remarks>
private unsafe struct ColorDistanceCache : IDisposable
{
private const int IndexBits = 5;
private const int IndexAlphaBits = 5;
private const int IndexAlphaBits = 6;
Copy link
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
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.

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