Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: SixLabors/ImageSharp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: rickbrew/ImageSharp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Mar 30, 2021

  1. No need to use a lookup table for the mask

    Faster, simpler to just shift left
    rickbrew committed Mar 30, 2021
    Configuration menu
    Copy the full SHA
    8d60cac View commit details
    Browse the repository at this point in the history
  2. Fix shifting in GetColorIndex

    When shift is small, the result of (shift-1) and (shift-2) is negative. The intended result is to have a shift left instead of a shift right, but C# doesn't do it that way -- the expression results in 0.
    
    Without this fix, colors will get binned (via AddColor) into the wrong (but nearby) leaf nodes in the Octree. The algorithm still works but may not generate the right number of colors (e.g. 64 instead of 256 in some cases), and error will be higher.
    
    In particular, an image of a red->black gradient comprised of 256 colors will generate a palette of 64 colors because you only get 64 leaf nodes when binning those colors (without this fix).
    
    This can significantly increase the memory consumption of the Octree -- by up to 4x.
    rickbrew committed Mar 30, 2021
    Configuration menu
    Copy the full SHA
    599c806 View commit details
    Browse the repository at this point in the history
Loading